diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core')
530 files changed, 0 insertions, 97474 deletions
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java deleted file mode 100644 index b51915bb7b..0000000000 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ /dev/null @@ -1,162 +0,0 @@ -package gtPlusPlus.core.block; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.general.BlockCompressedObsidian; -import gtPlusPlus.core.block.general.BlockNet; -import gtPlusPlus.core.block.general.BlockTankXpConverter; -import gtPlusPlus.core.block.general.FirePit; -import gtPlusPlus.core.block.general.FluidTankInfinite; -import gtPlusPlus.core.block.general.HellFire; -import gtPlusPlus.core.block.general.LightGlass; -import gtPlusPlus.core.block.general.MiningExplosives; -import gtPlusPlus.core.block.general.PlayerDoors; -import gtPlusPlus.core.block.general.antigrief.BlockWitherProof; -import gtPlusPlus.core.block.general.redstone.BlockGenericRedstoneDetector; -import gtPlusPlus.core.block.general.redstone.BlockGenericRedstoneTest; -import gtPlusPlus.core.block.machine.*; -import gtPlusPlus.core.block.machine.bedrock.Mining_Head_Fake; -import gtPlusPlus.core.block.machine.bedrock.Mining_Pipe_Fake; -import gtPlusPlus.core.fluids.FluidRegistryHandler; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraftforge.fluids.Fluid; - -public final class ModBlocks { - - public static Block blockRoundRobinator; - public static Block blockCircuitProgrammer; - public static Block blockVolumetricFlaskSetter; - public static Block blockFakeMiningPipe; - public static Block blockFakeMiningHead; - - public static Block blockFishTrap; - public static Block blockWorkbench; - public static Block blockWorkbenchAdvanced; - public static Block blockDecayablesChest; - public static Block blockEggBox; - - //Blocks - //public static Block blockBloodSteel; - //public static Block blockStaballoy; - // WIP TODO public static Block blockToolBuilder; - public static Block blockGriefSaver; - - public static Block blockCasingsMisc; - public static Block blockCasings2Misc; - public static Block blockCasings3Misc; - public static Block blockCasings4Misc; - public static Block blockCasings5Misc; - public static Block blockCasingsTieredGTPP; - public static Block blockSpecialMultiCasings; - public static Block blockCustomMachineCasings; - - public static Block blockMetaTileEntity; - public static Block blockHeliumGenerator; - public static Block blockNHG; - public static Block blockCharger; - - public static Block MatterFabricatorEffectBlock; - - public static Fluid fluidSludge = new Fluid("fluid.sludge"); - public static Block blockFluidSludge; - - public static Block blockFirePit; - - public static Block blockOreFluorite; - - public static Block blockMiningExplosive; - - public static Block blockHellfire; - public static Block blockInfiniteFLuidTank; - public static Block blockProjectTable; - public static Block blockTradeTable; - public static Block blockModularTable; - - public static Block blockWitherGuard; - public static Block blockXpConverter; - public static Block blockCompressedObsidian; - public static Block blockNet; - - public static Block blockPlayerDoorWooden; - public static Block blockPlayerDoorIron; - public static Block blockPlayerDoorCustom_Glass; - public static Block blockPlayerDoorCustom_Ice; - public static Block blockPlayerDoorCustom_Cactus; - - public static Block blockCustomMobSpawner; - public static Block blockCustomSuperLight; - public static Block blockCustomJukebox; - - public static Block blockPooCollector; - - public static Block blockPestKiller; - - public static void init() { - Logger.INFO("Initializing Blocks."); - //blockGriefSaver = new TowerDevice().setBlockName("blockGriefSaver").setCreativeTab(AddToCreativeTab.tabBlock).setBlockTextureName("blockDefault"); - - registerBlocks(); - } - - public static void registerBlocks(){ - - Logger.INFO("Registering Blocks."); - MatterFabricatorEffectBlock = new LightGlass(false); - - //Fluids - FluidRegistryHandler.registerFluids(); - - //Workbench - blockWorkbench = new Machine_Workbench().setHardness(1.5F); - blockWorkbenchAdvanced = new Machine_WorkbenchAdvanced().setHardness(2.5F); - blockHeliumGenerator = new HeliumGenerator(); - blockFirePit = new FirePit(); - blockFishTrap = new FishTrap(); - blockInfiniteFLuidTank = new FluidTankInfinite(); - //blockOreFluorite = new BlockBaseOre.oldOreBlock("oreFluorite", "Fluorite", Material.rock, BlockTypes.ORE, Utils.rgbtoHexValue(120, 120, 30), 3); - blockMiningExplosive = new MiningExplosives(); - blockHellfire = new HellFire(); - blockProjectTable = new Machine_ProjectTable(); - blockTradeTable = new Machine_TradeTable(); - blockModularTable = new Machine_ModularityTable(); - blockWitherGuard = new BlockWitherProof(); - blockXpConverter = new BlockTankXpConverter(); - blockCompressedObsidian = new BlockCompressedObsidian(); - blockNet = new BlockNet(); - - blockFakeMiningPipe = new Mining_Pipe_Fake(); - blockFakeMiningHead = new Mining_Head_Fake(); - - blockCircuitProgrammer = new CircuitProgrammer(); - - blockDecayablesChest = new DecayablesChest(); - blockEggBox = new EggBox(); - - blockPlayerDoorWooden = new PlayerDoors(Material.wood, "door_wood", true); - blockPlayerDoorIron = new PlayerDoors(Material.iron, "door_iron", true); - blockPlayerDoorCustom_Glass = new PlayerDoors(Material.glass, "door_glass", false); - blockPlayerDoorCustom_Ice = new PlayerDoors(Material.ice, "door_ice", false); - blockPlayerDoorCustom_Cactus = new PlayerDoors(Material.cactus, "door_cactus", false, 0.6f, Block.soundTypeGrass, "Cactus"); - - //blockCustomSuperLight = new BlockSuperLight(); - blockCustomJukebox = new Machine_SuperJukebox(); - - blockPooCollector = new Machine_PooCollector(); - - blockPestKiller = new Machine_PestKiller(); - - blockRoundRobinator = new Machine_RoundRobinator(); - - if (Meta_GT_Proxy.sDoesVolumetricFlaskExist) { - blockVolumetricFlaskSetter = new VolumetricFlaskSetter(); - } - - new BlockGenericRedstoneDetector(); - new BlockGenericRedstoneTest(); - - } - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java b/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java deleted file mode 100644 index f63762a2d7..0000000000 --- a/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java +++ /dev/null @@ -1,39 +0,0 @@ -package gtPlusPlus.core.block.base; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import gtPlusPlus.core.lib.CORE; - -public class AdvancedBlock extends Block { - - protected AdvancedBlock(final String unlocalizedName, final Material material, final CreativeTabs x, final float blockHardness, final float blockResistance, final float blockLightLevel, - final String blockHarvestTool, final int blockHarvestLevel, final SoundType BlockSound) { - super(material); - this.setBlockName(unlocalizedName); - this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); - this.setCreativeTab(x); - this.setHardness(blockHardness); //block Hardness - this.setResistance(blockResistance); - this.setLightLevel(blockLightLevel); - this.setHarvestLevel(blockHarvestTool, blockHarvestLevel); - this.setStepSound(BlockSound); - } - - @Override - public boolean onBlockActivated(final World p_149727_1_, final int p_149727_2_, final int p_149727_3_, final int p_149727_4_, final EntityPlayer p_149727_5_, final int p_149727_6_, final float p_149727_7_, final float p_149727_8_, final float p_149727_9_) - { - return false; - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - -} diff --git a/src/Java/gtPlusPlus/core/block/base/BasicBlock.java b/src/Java/gtPlusPlus/core/block/base/BasicBlock.java deleted file mode 100644 index 6014388cda..0000000000 --- a/src/Java/gtPlusPlus/core/block/base/BasicBlock.java +++ /dev/null @@ -1,81 +0,0 @@ -package gtPlusPlus.core.block.base; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; - -public class BasicBlock extends BlockContainer { - - public BasicBlock(final String unlocalizedName, final Material material) { - this(BlockTypes.STANDARD, unlocalizedName, material, 2); - } - - public BasicBlock(final BlockTypes type, final String unlocalizedName, final Material material) { - this(type, unlocalizedName, material, 2); - } - - public BasicBlock(BlockTypes type, final String unlocalizedName, final Material material, final int harvestLevel) { - super(material); - this.setBlockName(Utils.sanitizeString(unlocalizedName)); - - if (type != BlockTypes.ORE && !unlocalizedName.toLowerCase().contains("ore")) { - this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); - } - - this.setCreativeTab(AddToCreativeTab.tabBlock); - this.setResistance(6.0F); - this.setLightLevel(0.0F); - this.setHardness(1.0f*harvestLevel); - this.setHarvestLevel("pickaxe", harvestLevel); - this.setStepSound(soundTypeMetal); - } - - - public static enum BlockTypes { - STANDARD("blockBlock", "pickaxe", soundTypeMetal), - FRAME("blockFrameGt", "wrench", soundTypeMetal), - ORE("blockStone", "pickaxe", soundTypeStone); - - private String TEXTURE_NAME; - private String HARVEST_TOOL; - private SoundType soundOfBlock; - private BlockTypes (final String textureName, final String harvestTool, final SoundType blockSound) - { - this.TEXTURE_NAME = textureName; - this.HARVEST_TOOL = harvestTool; - this.soundOfBlock = blockSound; - } - - public String getTexture() { - return this.TEXTURE_NAME; - } - - public String getHarvestTool(){ - return this.HARVEST_TOOL; - } - - public SoundType getBlockSoundType(){ - return this.soundOfBlock; - } - - } - - - @Override - public TileEntity createNewTileEntity(final World p_149915_1_, final int p_149915_2_) { - return null; - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - -} diff --git a/src/Java/gtPlusPlus/core/block/base/BasicTileBlockWithTooltip.java b/src/Java/gtPlusPlus/core/block/base/BasicTileBlockWithTooltip.java deleted file mode 100644 index 2bfd09d848..0000000000 --- a/src/Java/gtPlusPlus/core/block/base/BasicTileBlockWithTooltip.java +++ /dev/null @@ -1,328 +0,0 @@ -package gtPlusPlus.core.block.base; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.api.interfaces.ITileTooltip; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.CubicObject; -import gtPlusPlus.api.objects.minecraft.SafeTexture; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.InventoryUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -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.creativetab.CreativeTabs; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public abstract class BasicTileBlockWithTooltip extends BlockContainer implements ITileTooltip { - - /** - * Each mapped object holds the data for the six sides. - */ - @SideOnly(Side.CLIENT) - private AutoMap<CubicObject<SafeTexture>> mSidedTextureArray; - - /** - * Holds the data for the six sides, each side holds an array of data for each respective meta. - */ - @SideOnly(Side.CLIENT) - private AutoMap<CubicObject<String>> mSidedTexturePathArray; - - /** - * Does this block have any meta at all? - * @return - */ - public final boolean hasMeta() { - return getMetaCount() > 0; - } - - /** - * The amount of meta this block has. - * @return - */ - public abstract int getMetaCount(); - - /** - * Does this {@link Block} require special {@link ItemBlock} handling? - * @return The {@link Class} that will be used for this {@link Block}. - */ - public Class<? extends ItemBlock> getItemBlockClass() { - return ItemBlock.class; - } - - /** - * A lazy way to declare the unlocal name for the block, makes boilerplating easy. - * @return The internal name for this block. - */ - public abstract String getUnlocalBlockName(); - - /** - * Does this Block have {@link ITileTooltip} support? - * @return {@link boolean} that represents if this block supports {@link ITileTooltip} or not. - */ - public final boolean hasTooltip() { - return getTooltipID() >= -1; - } - - /** - * Lazy Boilerplating. - * @return Block Hardness. - */ - protected abstract float initBlockHardness(); - - /** - * Lazy Boilerplating. - * @return Block Resistance. - */ - protected abstract float initBlockResistance(); - - /** - * Lazy Boilerplating. - * @return The {@link CreativeTab} this Block is shown on. - */ - protected abstract CreativeTabs initCreativeTab(); - - /** - * The ID used by the {@link ITileTooltip} handler. Return -1 if you are not providing a custom {@link ItemBlock} in {@link #getItemBlockClass}(). - * @return - */ - @Override - public abstract int getTooltipID(); - - public BasicTileBlockWithTooltip(Material aBlockMat){ - super(aBlockMat); - //Use Abstract method values - this.setHardness(initBlockHardness()); - this.setResistance(initBlockResistance()); - this.setBlockName(getUnlocalBlockName()); - this.setCreativeTab(initCreativeTab()); - // Register the block last. - GameRegistry.registerBlock(this, getItemBlockClass(), getUnlocalBlockName()); - Logger.INFO("Registered "+getTileEntityName()+"."); - if (Utils.isClient()) { - // Handle Textures - handleTextures(); - } - } - - /** - * The name of the Tile Entity. - * @return - */ - protected abstract String getTileEntityName(); - - /** - * The String used for texture pathing. - * @return Sanitized {@link String}, containing no spaces or illegal characters. - */ - private final String getTileEntityNameForTexturePathing() { - return Utils.sanitizeString(getTileEntityName().replace(" ", "")); - } - - /** - * An array of CubicObjects, one for each meta, else just a single cell array. - * Expected to be null regularly, as the default texture handling should suffice. - * Handy if re-using textures or using a non-standard structure for them. FULL texture path must be used, - * inclusive of the MODID and a colon. - * @return - */ - public CubicObject<String>[] getCustomTextureDirectoryObject(){ - return null; - } - - @Override - @SideOnly(Side.CLIENT) - public final IIcon getIcon(final int aSide, final int aMeta) { - return mSidedTextureArray.get(aMeta).get(aSide).getIcon(); - } - - @Override - public IIcon getIcon(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { - return super.getIcon(aWorld, aX, aY, aZ, aSide); - } - - @SideOnly(Side.CLIENT) - private final void handleTextures() { - - Logger.INFO("[TeTexture] Building Texture Maps for "+getTileEntityName()+"."); - - // Init on the Client side only, to prevent Field initialisers existing in the Server side bytecode. - mSidedTextureArray = new AutoMap<CubicObject<SafeTexture>>(); - mSidedTexturePathArray = new AutoMap<CubicObject<String>>(); - - - //Store them in forge order - //DOWN, UP, NORTH, SOUTH, WEST, EAST - - // Default Path Name, this will make us look inside 'miscutils\textures\blocks' - final String aPrefixTexPath = CORE.MODID + ":"; - // Default Path Name, this will make us look in the sub-directory for this Tile Entity. - final String aTexPathMid = "TileEntities"+CORE.SEPERATOR+getTileEntityNameForTexturePathing()+CORE.SEPERATOR; - // Construct a full path - String aTexPathBuilt = aPrefixTexPath + aTexPathMid; - // File Name Suffixes, without meta tags - String aStringBot; - String aStringTop; - String aStringBack; - String aStringFront; - String aStringLeft; - String aStringRight; - // Do we provide a matrix of custom data to be used for texture processing instead? - if (getCustomTextureDirectoryObject() != null) { - // Get custom provided texture data. - CubicObject<String>[] aDataMap = getCustomTextureDirectoryObject(); - Logger.INFO("[TeTexture] Found custom texture data, using this instead. Size: "+aDataMap.length); - // Map each meta string data to the main map. - for (int i=0;i<aDataMap.length;i++) { - mSidedTexturePathArray.put(aDataMap[i]); - Logger.INFO("Mapped value for meta "+i+"."); - } - } - else { - Logger.INFO("[TeTexture] Processing "+(1+getMetaCount())+" sets."); - // Iterate once for each meta - for (int i=0;i<(1+getMetaCount());i++) { - - // File Name Suffixes, without meta tags - aStringBot = "Bottom"; - aStringTop = "Top"; - aStringBack = "Back"; - aStringFront = "Front"; - aStringLeft = "Left"; - aStringRight = "Right"; - - // Add tails if we have meta - if (hasMeta()) { - aStringBot = aStringBot + "_"+i; - aStringTop = aStringTop + "_"+i; - aStringBack = aStringBack + "_"+i; - aStringFront = aStringFront + "_"+i; - aStringLeft = aStringLeft + "_"+i; - aStringRight = aStringRight + "_"+i; - } - // Append the full path - aStringBot = aTexPathBuilt + aStringBot; - aStringTop = aTexPathBuilt + aStringTop; - aStringBack = aTexPathBuilt + aStringBack; - aStringFront = aTexPathBuilt + aStringFront; - aStringLeft = aTexPathBuilt + aStringLeft; - aStringRight = aTexPathBuilt + aStringRight; - // Convenience Blob - CubicObject<String> aMetaBlob = new CubicObject<String>(aStringBot, aStringTop, aStringBack, aStringFront, aStringLeft, aStringRight); - mSidedTexturePathArray.put(aMetaBlob); - Logger.INFO("[TeTexture] Added Texture Path data to map for meta "+i); - } - } - Logger.INFO("[TeTexture] Map size for pathing: "+mSidedTexturePathArray.size()); - - // Iteration Index - int aIndex = 0; - - // Iterate each CubicObject, holding the six texture paths for each meta. - for (CubicObject<String> aMetaBlob : mSidedTexturePathArray) { - // Make a Safe Texture for each side - SafeTexture aBottom = SafeTexture.register(aMetaBlob.DOWN); - SafeTexture aTop = SafeTexture.register(aMetaBlob.UP); - SafeTexture aBack = SafeTexture.register(aMetaBlob.NORTH); - SafeTexture aFont = SafeTexture.register(aMetaBlob.SOUTH); - SafeTexture aWest = SafeTexture.register(aMetaBlob.WEST); - SafeTexture aEast = SafeTexture.register(aMetaBlob.EAST); - // Store them in an Array - SafeTexture[] aInjectBlob = new SafeTexture[] { - aBottom, - aTop, - aBack, - aFont, - aWest, - aEast - }; - // Convenience Blob - CubicObject<SafeTexture> aMetaBlob2 = new CubicObject<SafeTexture>(aInjectBlob); - // Store this Blob into - mSidedTextureArray.put(aMetaBlob2); - Logger.INFO("[TeTexture] Added SafeTexture data to map for meta "+(aIndex++)); - } - Logger.INFO("[TeTexture] Map size for registration: "+mSidedTextureArray.size()); - - - } - - @Override - @SideOnly(Side.CLIENT) - public final void registerBlockIcons(final IIconRegister aRegisterer){ - this.blockIcon = aRegisterer.registerIcon(CORE.MODID + ":" + "net"); - } - - @Override - public abstract TileEntity createNewTileEntity(final World world, final int p_149915_2_); - - /** - * Called when {@link #breakBlock}() is called, but before {@link InventoryUtils#dropInventoryItems} and the super call. - */ - public void onBlockBreak() { - - } - - @Override - public final void breakBlock(final World world, final int x, final int y, final int z, final Block block, final int number) { - onBlockBreak(); - InventoryUtils.dropInventoryItems(world, x, y, z, block); - super.breakBlock(world, x, y, z, block, number); - } - - @SuppressWarnings({"unchecked", "rawtypes"}) - @Override - public final void getSubBlocks(Item aItem, CreativeTabs p_149666_2_, List aList) { - if (hasMeta()) { - for (int i=0;i<getMetaCount();i++) { - aList.add(ItemUtils.simpleMetaStack(aItem, i, 1)); - } - } - else { - aList.add(ItemUtils.getSimpleStack(aItem)); - } - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - - - - /** - * Get the block's damage value (for use with pick block). - */ - @Override - public int getDamageValue(World aWorld, int aX, int aY, int aZ) { - int l = aWorld.getBlockMetadata(aX, aY, aZ); - return l; - } - - - public Item getItemDropped(int meta, Random rand, int p_149650_3_){ - return ItemUtils.getSimpleStack(this, 1).getItem(); - } - - public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune){ - ArrayList<ItemStack> drops = new ArrayList<ItemStack>(); - drops.add(ItemUtils.simpleMetaStack(this, metadata, 1)); - return drops; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseFluid.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseFluid.java deleted file mode 100644 index db37e18a32..0000000000 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseFluid.java +++ /dev/null @@ -1,103 +0,0 @@ -package gtPlusPlus.core.block.base; - -import java.util.Random; - -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import gtPlusPlus.core.client.renderer.particle.EntityDropParticleFX; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.itemblock.ItemBlockMeta; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.BlockFluidClassic; -import net.minecraftforge.fluids.Fluid; - -public class BlockBaseFluid extends BlockFluidClassic { - - private final String name; - private final IIcon textureArray[] = new IIcon[6]; - - protected float particleRed = 1.0F; - protected float particleGreen = 1.0F; - protected float particleBlue = 1.0F; - - public BlockBaseFluid(String materialName, Fluid fluid, Material material) { - super(fluid, material); - this.setLightOpacity(2); - this.name = Utils.sanitizeString(materialName); - this.setBlockName("fluid"+this.name); - this.setCreativeTab(AddToCreativeTab.tabBlock); - GameRegistry.registerBlock(this, ItemBlockMeta.class, "fluid"+this.name); - } - - public BlockFluidClassic setParticleColor(int arg0) { - return this.setParticleColor((arg0 >> 16 & 255) / 255.0F, (arg0 >> 8 & 255) / 255.0F, - (arg0 >> 0 & 255) / 255.0F); - } - - public BlockFluidClassic setParticleColor(float arg0, float arg1, float arg2) { - this.particleRed = arg0; - this.particleGreen = arg1; - this.particleBlue = arg2; - return this; - } - - @Override - public boolean canCreatureSpawn(EnumCreatureType arg0, IBlockAccess arg1, int arg2, int arg3, int arg4) { - return false; - } - - public boolean preInit() { - return true; - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) { - return side <= 1 ? this.textureArray[0] : this.textureArray[1]; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iicon) { - this.textureArray[0] = iicon.registerIcon(CORE.MODID + ":" + "fluid/" + "Fluid_" + this.name + "_Still"); - this.textureArray[1] = iicon.registerIcon(CORE.MODID + ":" + "fluid/" + "Fluid_" + this.name + "_Flow"); - //IconRegistry.addIcon("Fluid" + this.name, this.modName + ":fluid/Fluid_" + this.name + "_Still", arg0); - //IconRegistry.addIcon("Fluid" + this.name + "1", this.modName + ":fluid/Fluid_" + this.name + "_Flow", arg0); - } - - @Override - @Optional.Method(modid = "CoFHCore") - @SideOnly(Side.CLIENT) - public void randomDisplayTick(World arg0, int arg1, int arg2, int arg3, Random arg4) { - super.randomDisplayTick(arg0, arg1, arg2, arg3, arg4); - double arg5 = arg1 + arg4.nextFloat(); - double arg7 = arg2 - 1.05D; - double arg9 = arg3 + arg4.nextFloat(); - if (super.density < 0) { - arg7 = arg2 + 2.1D; - } - - if (arg4.nextInt(20) == 0 - && arg0.isSideSolid(arg1, arg2 + super.densityDir, arg3, - super.densityDir == -1 ? ForgeDirection.UP : ForgeDirection.DOWN) - && !arg0.getBlock(arg1, arg2 + 2 * super.densityDir, arg3).getMaterial().blocksMovement()) { - EntityDropParticleFX arg11 = new EntityDropParticleFX(arg0, arg5, arg7, arg9, this.particleRed, - this.particleGreen, this.particleBlue, super.densityDir); - FMLClientHandler.instance().getClient().effectRenderer.addEffect(arg11); - } - - } - -} diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java deleted file mode 100644 index c0113e869b..0000000000 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java +++ /dev/null @@ -1,211 +0,0 @@ -package gtPlusPlus.core.block.base; - -import java.util.HashMap; -import java.util.Map; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.world.IBlockAccess; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.TextureSet; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.item.base.itemblock.ItemBlockGtBlock; -import gtPlusPlus.core.item.base.itemblock.ItemBlockGtFrameBox; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class BlockBaseModular extends BasicBlock { - - protected Material blockMaterial; - - protected int blockColour; - protected BlockTypes thisBlock; - protected String thisBlockMaterial; - protected final String thisBlockType; - - public BlockBaseModular(final Material material, final BlockTypes blockType) { - this(material, blockType, material.getRgbAsHex()); - } - - public BlockBaseModular(final Material material, final BlockTypes blockType, final int colour) { - this(material.getUnlocalizedName(), material.getLocalizedName(), net.minecraft.block.material.Material.iron, - blockType, colour, Math.min(Math.max(material.vTier, 1), 6)); - blockMaterial = material; - registerComponent(); - } - - protected BlockBaseModular(final String unlocalizedName, final String blockMaterial, - final net.minecraft.block.material.Material vanillaMaterial, final BlockTypes blockType, final int colour, - final int miningLevel) { - super(blockType, unlocalizedName, vanillaMaterial, miningLevel); - this.setHarvestLevel(blockType.getHarvestTool(), miningLevel); - this.setBlockTextureName(CORE.MODID + ":" + blockType.getTexture()); - this.blockColour = colour; - this.thisBlock = blockType; - this.thisBlockMaterial = blockMaterial; - this.thisBlockType = blockType.name().toUpperCase(); - this.setBlockName(this.GetProperName()); - int fx = getBlockTypeMeta(); - if (fx == 0) { - GameRegistry.registerBlock(this, ItemBlockGtBlock.class, - Utils.sanitizeString(blockType.getTexture() + unlocalizedName)); - GT_OreDictUnificator.registerOre( - "block" + getUnlocalizedName().replace("tile.block", "").replace("tile.", "").replace("of", "") - .replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""), - ItemUtils.getSimpleStack(this)); - } - else if (fx == 1) { - GameRegistry.registerBlock(this, ItemBlockGtBlock.class, - Utils.sanitizeString(blockType.getTexture() + unlocalizedName)); - GT_OreDictUnificator.registerOre( - "frameGt" + getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "") - .replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), - ItemUtils.getSimpleStack(this)); - } - else if (fx == 2) { - GameRegistry.registerBlock(this, ItemBlockGtBlock.class, - Utils.sanitizeString(blockType.getTexture() + unlocalizedName)); - GT_OreDictUnificator.registerOre( - "block" + getUnlocalizedName().replace("tile.block", "").replace("tile.", "").replace("of", "") - .replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""), - ItemUtils.getSimpleStack(this)); - } - } - - public boolean registerComponent() { - Logger.MATERIALS("Attempting to register "+this.getUnlocalizedName()+"."); - if (this.blockMaterial == null) { - Logger.MATERIALS("Tried to register "+this.getUnlocalizedName()+" but the material was null."); - return false; - } - String aName = blockMaterial.getUnlocalizedName(); - //Register Component - Map<String, ItemStack> aMap = Material.mComponentMap.get(aName); - if (aMap == null) { - aMap = new HashMap<String, ItemStack>(); - } - int fx = getBlockTypeMeta(); - String aKey = (fx == 0 ? OrePrefixes.block.name() : ( fx == 1 ? OrePrefixes.frameGt.name() : OrePrefixes.ore.name())); - ItemStack x = aMap.get(aKey); - if (x == null) { - aMap.put(aKey, ItemUtils.getSimpleStack(this)); - Logger.MATERIALS("Registering a material component. Item: ["+aName+"] Map: ["+aKey+"]"); - Material.mComponentMap.put(aName, aMap); - return true; - } - else { - //Bad - Logger.MATERIALS("Tried to double register a material component."); - return false; - } - } - - public int getBlockTypeMeta() { - if (this.thisBlockType.equals(BlockTypes.STANDARD.name().toUpperCase())) { - return 0; - } - else if (this.thisBlockType.equals(BlockTypes.FRAME.name().toUpperCase())) { - return 1; - } - else if (this.thisBlockType.equals(BlockTypes.ORE.name().toUpperCase())) { - return 2; - } - return 0; - } - - /** - * Returns which pass should this block be rendered on. 0 for solids and 1 - * for alpha - */ - @Override - @SideOnly(Side.CLIENT) - public int getRenderBlockPass() { - if (this.thisBlock == BlockTypes.FRAME) { - return 1; - } - return 0; - } - - public String GetProperName() { - String tempIngot; - if (this.thisBlock == BlockTypes.STANDARD) { - tempIngot = "Block of " + this.thisBlockMaterial; - } - else if (this.thisBlock == BlockTypes.FRAME) { - tempIngot = this.thisBlockMaterial + " Frame Box"; - } - else if (this.thisBlock == BlockTypes.ORE) { - tempIngot = this.thisBlockMaterial + " Ore [Old]"; - } - else { - - tempIngot = this.getUnlocalizedName().replace("tile.blockGt", "ingot"); - } - return tempIngot; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - public Material getMaterialEx(){ - return this.blockMaterial; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister iIcon) { - if (!CORE.ConfigSwitches.useGregtechTextures || this.blockMaterial == null || this.thisBlock == BlockTypes.ORE){ - this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + this.thisBlock.getTexture()); - } - String metType = "9j4852jyo3rjmh3owlhw9oe"; - if (this.blockMaterial != null) { - TextureSet u = this.blockMaterial.getTextureSet(); - if (u != null) { - metType = u.mSetName; - } - } - metType = (metType.equals("9j4852jyo3rjmh3owlhw9oe") ? "METALLIC" : metType); - int tier = blockMaterial != null ? this.blockMaterial.vTier : 0; - String aType = (this.thisBlock == BlockTypes.FRAME) ? "frameGt" : (tier <= 4 ? "block1" : "block5"); - this.blockIcon = iIcon.registerIcon("gregtech" + ":" + "materialicons/"+ metType +"/" + aType); - } - - @Override - public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4) { - - if (this.blockColour == 0) { - return MathUtils.generateSingularRandomHexValue(); - } - - return this.blockColour; - } - - @Override - public int getRenderColor(final int aMeta) { - if (this.blockColour == 0) { - return MathUtils.generateSingularRandomHexValue(); - } - - return this.blockColour; - } - - @Override - public int getBlockColor() { - if (this.blockColour == 0) { - return MathUtils.generateSingularRandomHexValue(); - } - - return this.blockColour; - } - -} diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseNBT.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseNBT.java deleted file mode 100644 index e4dff82ec4..0000000000 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseNBT.java +++ /dev/null @@ -1,81 +0,0 @@ -package gtPlusPlus.core.block.base; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.Explosion; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.itemblock.ItemBlockNBT; - -public abstract class BlockBaseNBT extends BlockContainer -{ - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - @SuppressWarnings("deprecation") - public BlockBaseNBT(final Material material, final String unlocalName, final String displayName){ - super(material); - this.setBlockName(unlocalName); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, ItemBlockNBT.class, unlocalName); - //LanguageRegistry.addName(this, displayName); - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_){ - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront)); - } - - @Override - public abstract TileEntity createNewTileEntity(final World world, final int p_149915_2_); - - @Override - public void breakBlock(final World world, final int x, final int y, final int z, final Block block, final int meta) { - super.breakBlock(world, x, y, z, block, meta); - } - - @Override - public void onBlockDestroyedByPlayer(final World world, final int x, final int y, final int z, final int meta) { - super.onBlockDestroyedByPlayer(world, x, y, z, meta); - } - - @Override - public void onBlockDestroyedByExplosion(final World world, final int x, final int y, final int z, final Explosion explosion) { - super.onBlockDestroyedByExplosion(world, x, y, z, explosion); - } - - @Override - public void onBlockHarvested(final World world, final int x, final int y, final int z, final int meta, final EntityPlayer player) { - super.onBlockHarvested(world, x, y, z, meta, player); - } - - @Override - public void onBlockExploded(final World world, final int x, final int y, final int z, final Explosion explosion) { - super.onBlockExploded(world, x, y, z, explosion); - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java deleted file mode 100644 index e1bc3462be..0000000000 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java +++ /dev/null @@ -1,229 +0,0 @@ -package gtPlusPlus.core.block.base; - -import java.lang.reflect.Field; - -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.ITexture; -import gregtech.api.objects.GT_CopiedBlockTexture; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.api.interfaces.ITexturedBlock; -import gtPlusPlus.core.client.renderer.CustomOreBlockRenderer; -import gtPlusPlus.core.item.base.itemblock.ItemBlockOre; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.init.Blocks; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; - -public class BlockBaseOre extends BasicBlock implements ITexturedBlock { - - private final Material blockMaterial; - - public BlockBaseOre(final Material material, final BlockTypes blockType, final int colour) { - super(blockType, Utils.sanitizeString(material.getUnlocalizedName()), net.minecraft.block.material.Material.rock, Math.min(Math.max(material.vTier, 1), 6)); - int aMaterialTierForMining = Math.min(Math.max(material.vTier, 1), 6); - this.blockMaterial = material; - this.setHardness(1.0f*aMaterialTierForMining); - this.setResistance(6.0F); - this.setLightLevel(0.0F); - this.setHarvestLevel("pickaxe", aMaterialTierForMining); - this.setStepSound(soundTypeStone); - this.setBlockName("Ore"+Utils.sanitizeString(Utils.sanitizeString(material.getUnlocalizedName()))); - this.setBlockTextureName("stone"); - try { - GameRegistry.registerBlock(this, ItemBlockOre.class, Utils.sanitizeString("ore"+Utils.sanitizeString(this.blockMaterial.getLocalizedName()))); - GT_OreDictUnificator.registerOre("ore"+Utils.sanitizeString(this.blockMaterial.getLocalizedName()), ItemUtils.getSimpleStack(this)); - } - catch (Throwable t){ - t.printStackTrace(); - } - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - - public Material getMaterialEx(){ - return this.blockMaterial; - } - - @Override - public int getRenderType() { - try { - if (CustomOreBlockRenderer.INSTANCE != null){ - return CustomOreBlockRenderer.INSTANCE.mRenderID; - } - return super.getRenderType(); - } - catch (NullPointerException n) { - return 0; - } - } - - @Override - public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int aSide) { - return Blocks.stone.getIcon(0, 0); - } - - @Override - public IIcon getIcon(int aSide, int aMeta) { - return Blocks.stone.getIcon(0, 0); - } - - /** - * GT Texture Handler - */ - - //.08 compat - public static IIconContainer[] hiddenTextureArray; - public ITexture[] getTexture(byte arg0) { - return getTexture(null, arg0); - } - - public ITexture[] getTexture(Block block, byte side) { - if (this.blockMaterial != null){ - GT_RenderedTexture aIconSet = new GT_RenderedTexture(blockMaterial.getTextureSet().mTextures[OrePrefixes.ore.mTextureIndex], this.blockMaterial.getRGBA()); - if (aIconSet != null){ - return new ITexture[]{new GT_CopiedBlockTexture(Blocks.stone, 0, 0), aIconSet}; - } - } - - if (hiddenTextureArray == null){ - if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - hiddenTextureArray = Textures.BlockIcons.GRANITES; - } - else { - try { - Field o = ReflectionUtils.getField(Textures.BlockIcons.class, "STONES"); - if (o != null){ - hiddenTextureArray = (IIconContainer[]) o.get(Textures.BlockIcons.class); - } - if (hiddenTextureArray == null){ - hiddenTextureArray = new IIconContainer[6]; - } - } - catch (IllegalArgumentException | IllegalAccessException e) { - hiddenTextureArray = new IIconContainer[6]; - } - } - } - return new ITexture[]{new GT_RenderedTexture(hiddenTextureArray[0], new short[]{240, 240, 240, 0})}; - } - - @Override - public void registerBlockIcons(IIconRegister p_149651_1_) { - - } - - public static class oldOreBlock extends BlockBaseModular implements ITexturedBlock{ - - public oldOreBlock(final String unlocalizedName, final String blockMaterial, final BlockTypes blockType, final int colour) { - this(unlocalizedName, blockMaterial, net.minecraft.block.material.Material.iron, blockType, colour, 2); - } - - public oldOreBlock(final String unlocalizedName, final String blockMaterial, final net.minecraft.block.material.Material vanillaMaterial, final BlockTypes blockType, final int colour, final int miningLevel) { - super(unlocalizedName, blockMaterial, vanillaMaterial, blockType, colour, miningLevel); - } - - /*@Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister iIcon) - { - this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + this.thisBlock.getTexture()); - //this.base = iIcon.registerIcon(CORE.MODID + ":" + "blockStone"); - //this.overlay = iIcon.registerIcon(CORE.MODID + ":" + "blockOre_Overlay"); - } - - @Override - public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4){ - if (this.blockColour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return this.blockColour; - } - - @Override - public int getRenderColor(final int aMeta) { - if (this.blockColour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return this.blockColour; - }*/ - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - - @Override - public int getRenderType() { - if (CustomOreBlockRenderer.INSTANCE != null){ - return CustomOreBlockRenderer.INSTANCE.mRenderID; - } - return super.getRenderType(); - } - - @Override - public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int aSide) { - return Blocks.stone.getIcon(0, 0); - } - - @Override - public IIcon getIcon(int aSide, int aMeta) { - return Blocks.stone.getIcon(0, 0); - } - - /** - * GT Texture Handler - */ - - //.08 compat - IIconContainer[] hiddenTextureArray; - public ITexture[] getTexture(byte arg0) { - return getTexture(null, arg0); - } - - public ITexture[] getTexture(Block block, byte side) { - if (this.blockMaterial != null){ - GT_RenderedTexture aIconSet = new GT_RenderedTexture(blockMaterial.getTextureSet().mTextures[OrePrefixes.ore.mTextureIndex], this.blockMaterial.getRGBA()); - if (aIconSet != null){ - return new ITexture[]{new GT_CopiedBlockTexture(Blocks.stone, 0, 0), aIconSet}; - } - } - - if (hiddenTextureArray == null){ - if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - hiddenTextureArray = Textures.BlockIcons.GRANITES; - } - else { - try { - Field o = ReflectionUtils.getField(Textures.BlockIcons.class, "STONES"); - if (o != null){ - hiddenTextureArray = (IIconContainer[]) o.get(Textures.BlockIcons.class); - } - if (hiddenTextureArray == null){ - hiddenTextureArray = new IIconContainer[6]; - } - } - catch (IllegalArgumentException | IllegalAccessException e) { - hiddenTextureArray = new IIconContainer[6]; - } - } - } - return new ITexture[]{new GT_RenderedTexture(hiddenTextureArray[0], new short[]{240, 240, 240, 0})}; - } - - } - -} diff --git a/src/Java/gtPlusPlus/core/block/base/MetaBlock.java b/src/Java/gtPlusPlus/core/block/base/MetaBlock.java deleted file mode 100644 index 880bb3a597..0000000000 --- a/src/Java/gtPlusPlus/core/block/base/MetaBlock.java +++ /dev/null @@ -1,35 +0,0 @@ -package gtPlusPlus.core.block.base; - -import java.util.List; - -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.IBlockAccess; - -public class MetaBlock extends MultiTextureBlock { - - protected MetaBlock(final String unlocalizedName, final Material material, final SoundType soundType) { - super(unlocalizedName, material, soundType); - } - - @Override - public int damageDropped(final int meta) { - return meta; - } - - @Override - public void getSubBlocks(final Item item, final CreativeTabs tab, final List list) { - for (int i = 0; i < 6; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java b/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java deleted file mode 100644 index a04bf841ba..0000000000 --- a/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java +++ /dev/null @@ -1,37 +0,0 @@ -package gtPlusPlus.core.block.base; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.util.IIcon; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; - -public class MultiTextureBlock extends Block { - - public IIcon[] icons = new IIcon[6]; - - protected MultiTextureBlock(final String unlocalizedName, final Material material, final SoundType blockSound) - { - super(material); - this.setBlockName(unlocalizedName); - this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabBlock); - this.setHardness(2.0F); - this.setResistance(6.0F); - this.setStepSound(blockSound); - } - - @Override - public void registerBlockIcons(final IIconRegister reg) { - for (int i = 0; i < 6; i ++) { - this.icons[i] = reg.registerIcon(this.textureName + "_" + i); - } - } - - @Override - public IIcon getIcon(final int side, final int meta) { - return this.icons[side]; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/general/BlockCompressedObsidian.java b/src/Java/gtPlusPlus/core/block/general/BlockCompressedObsidian.java deleted file mode 100644 index 03ca846b7d..0000000000 --- a/src/Java/gtPlusPlus/core/block/general/BlockCompressedObsidian.java +++ /dev/null @@ -1,94 +0,0 @@ -package gtPlusPlus.core.block.general; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.BlockObsidian; -import net.minecraft.block.material.MapColor; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.itemblock.ItemBlockMeta; -import gtPlusPlus.core.lib.CORE; - -public class BlockCompressedObsidian extends BlockObsidian { - - private final IIcon textureArray[] = new IIcon[6]; - - public BlockCompressedObsidian() { - this.setBlockName("blockCompressedObsidian"); - this.setHardness(50.0F); - this.setResistance(2000.0F); - this.setStepSound(soundTypePiston); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, ItemBlockMeta.class, "blockCompressedObsidian"); - } - - @Override - public MapColor getMapColor(final int meta) { - if (meta != 5) { - return MapColor.obsidianColor; - } - else { - return MapColor.sandColor; - } - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister iicon) { - this.textureArray[0] = iicon.registerIcon(CORE.MODID + ":" + "compressed/" + "obsidian1"); - this.textureArray[1] = iicon.registerIcon(CORE.MODID + ":" + "compressed/" + "obsidian2"); - this.textureArray[2] = iicon.registerIcon(CORE.MODID + ":" + "compressed/" + "obsidian3"); - this.textureArray[3] = iicon.registerIcon(CORE.MODID + ":" + "compressed/" + "obsidian4"); - this.textureArray[4] = iicon.registerIcon(CORE.MODID + ":" + "compressed/" + "obsidian5"); - this.textureArray[5] = iicon.registerIcon(CORE.MODID + ":" + "compressed/" + "obsidian_invert"); - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int side, final int meta) { - return this.textureArray[meta]; - } - - @Override - public int damageDropped(final int damage) { - return damage; - } - - @Override - public void getSubBlocks(final Item item, final CreativeTabs tab, final List list) { - for (int i = 0; i < 6; i++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public Item getItemDropped(final int meta, final Random rand, final int fortune) { - return Item.getItemFromBlock(this); - } - - @Override - public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int metadata, - final int fortune) { - int m = metadata; - if (m == 5) { - m = 1; - } - return super.getDrops(world, x, y, z, m, fortune); - } - -} diff --git a/src/Java/gtPlusPlus/core/block/general/BlockNet.java b/src/Java/gtPlusPlus/core/block/general/BlockNet.java deleted file mode 100644 index 1f0f145392..0000000000 --- a/src/Java/gtPlusPlus/core/block/general/BlockNet.java +++ /dev/null @@ -1,37 +0,0 @@ -package gtPlusPlus.core.block.general; -import java.util.Random; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.BlockWeb; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.Item; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.CORE; - -public class BlockNet extends BlockWeb{ - - public BlockNet(){ - this.setCreativeTab(AddToCreativeTab.tabBlock); - this.setLightOpacity(1); - this.setHardness(4.0F); - this.setBlockName("blockNet"); - GameRegistry.registerBlock(this, "blockNet"); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister iIcon){ - this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + "net"); - } - - @Override - public Item getItemDropped(final int p_149650_1_, final Random p_149650_2_, final int p_149650_3_){ - return ModItems.itemRope; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/general/BlockSuperLight.java b/src/Java/gtPlusPlus/core/block/general/BlockSuperLight.java deleted file mode 100644 index a1ba3be487..0000000000 --- a/src/Java/gtPlusPlus/core/block/general/BlockSuperLight.java +++ /dev/null @@ -1,220 +0,0 @@ -package gtPlusPlus.core.block.general; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.block.Block; -import net.minecraft.block.BlockAir; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Blocks; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -public class BlockSuperLight extends BlockContainer { - - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - //propecia (Inhibit DHD - recover hair get depression) - - public BlockSuperLight() { - super(Material.circuits); - this.setBlockName("blockSuperLight"); - this.setCreativeTab(CreativeTabs.tabRedstone); - GameRegistry.registerBlock(this, "blockSuperLight"); - LanguageRegistry.addName(this, "Shining Star"); - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) { - return this.blockIcon; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_) { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "SwirlBigBlue"); - } - - /** - * Returns a new instance of a block's tile entity class. Called on placing the - * block. - */ - public TileEntity createNewTileEntity(World aWorld, int p_149915_2_) { - return new TileEntitySuperLight(); - } - - public static class TileEntitySuperLight extends TileEntity { - - private long mCreated; - - private long mLastUpdateTick = 0; - - private int mLitBlockCount = 0; - - private int[][][][] aLitBlocks = new int[50][10][50][1]; - - private boolean mPowered = false; - - public TileEntitySuperLight() { - mCreated = System.currentTimeMillis(); - Logger.INFO("Created Super-Lamp"); - } - - public void readFromNBT(NBTTagCompound aNBT) { - super.readFromNBT(aNBT); - mCreated = aNBT.getLong("mCreated"); - mPowered = aNBT.getBoolean("mPowered"); - NBTTagCompound aLightingData = aNBT.getCompoundTag("lighting"); - for (int x = 0; x < 50; x++) { - for (int y = 0; y < 10; y++) { - for (int z = 0; z < 50; z++) { - int aData = aLightingData.getInteger("["+x+"]["+y+"]["+z+"]"); - aLitBlocks[x][y][z][0] = aData; - } - } - } - } - - public void writeToNBT(NBTTagCompound aNBT) { - super.writeToNBT(aNBT); - aNBT.setLong("mCreated", mCreated); - aNBT.setBoolean("mPowered", mPowered); - NBTTagCompound aLightingData = new NBTTagCompound(); - for (int x = 0; x < 50; x++) { - for (int y = 0; y < 10; y++) { - for (int z = 0; z < 50; z++) { - int aFlag = aLitBlocks[x][y][z][0]; - aLightingData.setInteger("["+x+"]["+y+"]["+z+"]", aFlag); - } - } - } - aNBT.setTag("lighting", aLightingData); - } - - @Override - public void updateEntity() { - super.updateEntity(); - - if (this.worldObj.isRemote) { - return; - } - - try { - if (mLastUpdateTick == 0 || (System.currentTimeMillis() - mLastUpdateTick) >= 30000) { - boolean powered = (this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord)); - boolean aLastState = mPowered; - //Logger.INFO("Powered: "+powered); - mPowered = powered; - if (mPowered != aLastState) { - updateLighting(powered); - } - } - } catch (Throwable t) { - } - } - - @Override - public void markDirty() { - super.markDirty(); - } - - @Override - public boolean canUpdate() { - return super.canUpdate(); - } - - public void updateLighting(boolean enable) { - - - mLastUpdateTick = System.currentTimeMillis(); - - if (false) { - return; - } - - aLitBlocks = new int[50][10][50][1]; - int aLitCounter = 0; - AutoMap<BlockPos> aBlocksToUpdate = new AutoMap<BlockPos>(); - Logger.INFO("Trying to relight area."); - - BlockPos aStartIterationPoint = new BlockPos(this.xCoord-24, this.yCoord-4, this.zCoord-24, this.worldObj); - for (int x = 0; x < 50; x++) { - for (int y = 0; y < 10; y++) { - for (int z = 0; z < 50; z++) { - int xOff = aStartIterationPoint.xPos + x; - int yOff = aStartIterationPoint.yPos + y; - int zOff = aStartIterationPoint.zPos + z; - Block aBlockGet = this.worldObj.getBlock(xOff, yOff, zOff); - if (aBlockGet != null) { - if (aBlockGet instanceof BlockAir || aBlockGet instanceof LightGlass) { - - int aLight = aBlockGet.getLightValue(); - - //Don't Need to relight anything. - if ((enable && aLight > 0) || (!enable && aLight == 0)) { - continue; - } - //Turning Lights on - else if (enable && aLight == 0) { - aBlocksToUpdate.put(new BlockPos(xOff, yOff, zOff, this.worldObj)); - if (aBlockGet instanceof BlockAir) { - Logger.INFO("Lit air."); - this.worldObj.setBlock(xOff, yOff, zOff, ModBlocks.MatterFabricatorEffectBlock, 0, 3); - } - //aBlockGet.setLightLevel(15); - aLitCounter++; - } - //Turning Lights off - else if (!enable && aLight > 0) { - aBlocksToUpdate.put(new BlockPos(xOff, yOff, zOff, this.worldObj)); - if (aBlockGet instanceof LightGlass) { - Logger.INFO("Dimmed air."); - this.worldObj.setBlock(xOff, yOff, zOff, Blocks.air, 0, 3); - } - //aBlockGet.setLightLevel(0); - } - aLitBlocks[x][y][z][0] = enable ? 15 : 0; - } - else { - aLitBlocks[x][y][z][0] = -1; - } - } - else { - aLitBlocks[x][y][z][0] = -1; - } - } - } - } - mLitBlockCount = aLitCounter; - doLargeBlockUpdate(aBlocksToUpdate); - } - - public void doLargeBlockUpdate(AutoMap<BlockPos> aUpdateMap) { - if (aUpdateMap.isEmpty()) { - return; - } - for (BlockPos p : aUpdateMap) { - //this.worldObj.markBlockForUpdate(p.xPos, p.yPos, p.zPos); - //this.worldObj.markBlocksDirtyVertical(p_72975_1_, p_72975_2_, p_72975_3_, p_72975_4_); - } - } - - } - -} diff --git a/src/Java/gtPlusPlus/core/block/general/BlockTankXpConverter.java b/src/Java/gtPlusPlus/core/block/general/BlockTankXpConverter.java deleted file mode 100644 index f7f0b446ce..0000000000 --- a/src/Java/gtPlusPlus/core/block/general/BlockTankXpConverter.java +++ /dev/null @@ -1,192 +0,0 @@ -package gtPlusPlus.core.block.general; - -import java.util.Random; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.itemblock.ItemBlockEntityBase; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public class BlockTankXpConverter extends BlockContainer { - - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - @SuppressWarnings("deprecation") - public BlockTankXpConverter() { - super(Material.iron); - this.setBlockName("blockTankXpConverter"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, ItemBlockEntityBase.class, "blockTankXpConverter"); - LanguageRegistry.addName(this, "Xp Converter"); - this.generateRainbowMap(); - if (!this.getTickRandomly()) { - this.setTickRandomly(true); - } - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) { - return p_149691_1_ == 1 ? this.textureTop - : (p_149691_1_ == 0 ? this.textureBottom - : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront)); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_) { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "SwirlGray"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "SwirlGray"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "SwirlGray"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "SwirlGray"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, - final int side, final float lx, final float ly, final float lz) { - - return true; - - /* - if (world.isRemote) { - return true; - } - else { - boolean mDidScrewDriver = false; - // Check For Screwdriver - try { - final ItemStack mHandStack = PlayerUtils.getItemStackInPlayersHand(world, player.getDisplayName()); - final Item mHandItem = mHandStack.getItem(); - if (((mHandItem instanceof GT_MetaGenerated_Tool_01) - && ((mHandItem.getDamage(mHandStack) == 22) || (mHandItem.getDamage(mHandStack) == 150)))) { - final TileEntityXpConverter tile = (TileEntityXpConverter) world.getTileEntity(x, y, z); - if (tile != null) { - mDidScrewDriver = true; - tile.onScrewdriverRightClick((byte) side, player, x, y, z); - } - - } - } - catch (final Throwable t) { - mDidScrewDriver = false; - } - - if (!mDidScrewDriver) { - - try { - final TileEntityXpConverter tile = (TileEntityXpConverter) world.getTileEntity(x, y, z); - if (tile != null) { - tile.onRightClick((byte) side, player, x, y, z); - } - } - catch (final Throwable t) { - } - - final TileEntityXpConverter tank = (TileEntityXpConverter) world.getTileEntity(x, y, z); - if (tank != null) { - if (tank.tankEssence.getFluid() != null) { - PlayerUtils.messagePlayer(player, "This tank contains " + tank.tankEssence.getFluidAmount() - + "L of " + tank.tankEssence.getFluid().getLocalizedName()); - } - if (tank.tankLiquidXp.getFluid() != null) { - PlayerUtils.messagePlayer(player, "This tank contains " + tank.tankLiquidXp.getFluidAmount() - + "L of " + tank.tankLiquidXp.getFluid().getLocalizedName()); - } - if ((tank.tankEssence.getFluid() != null) && (tank.tankLiquidXp.getFluid() != null)) { - PlayerUtils.messagePlayer(player, "This is worth " - + EnchantingUtils.getLevelForLiquid(tank.tankLiquidXp.getFluidAmount()) + " levels."); - } - } - } - } - return true; - */} - - @Override - public int getRenderBlockPass() { - return 1; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - //return new TileEntityXpConverter(); - return null; - } - - @Override - public void onBlockAdded(final World world, final int x, final int y, final int z) { - super.onBlockAdded(world, x, y, z); - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, - final int z) { - return false; - } - - private final boolean generateRainbowMap() { - return true; - } - - @Override - public int getBlockColor() { - return super.getBlockColor(); - } - - @Override - public int colorMultiplier(final IBlockAccess p_149720_1_, final int p_149720_2_, final int p_149720_3_, - final int p_149720_4_) { - return super.colorMultiplier(p_149720_1_, p_149720_2_, p_149720_3_, p_149720_4_); - } - - @Override - public void updateTick(final World world, final int x, final int y, final int z, final Random rand) { - // this.mRainbowTick++; - super.updateTick(world, x, y, z, rand); - } - - @Override - public void randomDisplayTick(final World world, final int x, final int y, final int z, final Random rand) { - //this.mRainbowTick++; - super.randomDisplayTick(world, x, y, z, rand); - } - - @Override - public int tickRate(final World p_149738_1_) { - return 20; - } - - @Override - public int getLightValue() { - return 6; - } - -} diff --git a/src/Java/gtPlusPlus/core/block/general/FirePit.java b/src/Java/gtPlusPlus/core/block/general/FirePit.java deleted file mode 100644 index 6f35715c48..0000000000 --- a/src/Java/gtPlusPlus/core/block/general/FirePit.java +++ /dev/null @@ -1,230 +0,0 @@ -package gtPlusPlus.core.block.general; - -import static net.minecraftforge.common.util.ForgeDirection.*; - -import java.util.List; -import java.util.Random; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import 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.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -import gtPlusPlus.core.block.base.BasicBlock; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.tileentities.general.TileEntityFirepit; -import net.minecraftforge.common.util.ForgeDirection; - -public class FirePit extends BasicBlock{ - private static IIcon[] TEXTURE; - public static final int META_ANTIBUILDER = 2; - private int meta; - - @SuppressWarnings("deprecation") - public FirePit() { - super("blockFirePit", Material.wood); - this.setBlockName("blockFirePit"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - this.setHardness(10.0F); - this.setResistance(35.0F); - this.setStepSound(Block.soundTypeWood); - GameRegistry.registerBlock(this, "blockFirePit"); - LanguageRegistry.addName(this, "Fire Pit"); - } - - @Override - public int tickRate(final World aParWorld) { - return 30; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int i) { - return new TileEntityFirepit(); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister par1IconRegister){ - TEXTURE = new IIcon[] {par1IconRegister.registerIcon(this.getTextureName() + "_layer_0"), par1IconRegister.registerIcon(this.getTextureName() + "_layer_1")}; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List){ - par3List.add(new ItemStack(par1, 1, 2)); - } - - @Override - public void updateTick(final World par1World, final int x, final int y, final int z, final Random par5Random){ - if (!par1World.isRemote){ - //Sets meta. - this.meta = par1World.getBlockMetadata(x, y, z); - //If Raining, Put out. - if (par1World.isRaining() - && (par1World.canLightningStrikeAt(x, y, z) - || par1World.canLightningStrikeAt(x - 1, y, z) - || par1World.canLightningStrikeAt(x + 1, y, z) - || par1World.canLightningStrikeAt(x, y, z - 1) - || par1World.canLightningStrikeAt(x, y, z + 1))){ - //Fire goes out - par1World.setBlockMetadataWithNotify(x, y, z, 1, 4); - } - if (isNeighborBurning(par1World, x, y, z)){ - //Fire can ignite from a nearby flame source. - par1World.setBlockMetadataWithNotify(x, y, z, 2, 4); - } - } - } - - @Override - public Item getItemDropped(final int meta, final Random par2Random, final int par3){ - switch (meta){ - case 0: - return null; - default: - break; - } - return Item.getItemFromBlock(this); - } - - @Override - public int damageDropped(final int meta){ - return meta; - } - - @Override - public boolean isOpaqueCube(){ - return false; - } - - @Override - public int getRenderType(){ - return -1; - } - - @Override - @SideOnly(Side.CLIENT) - public int getRenderBlockPass(){ - return 1; - } - - @Override - public boolean renderAsNormalBlock(){ - return false; - } - - /*@Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World aParWorld, int x, int y, int z){ - return null; - }*/ - - @Override - protected boolean canSilkHarvest(){ - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(final World p_149734_1_, final int p_149734_2_, final int p_149734_3_, final int p_149734_4_, final Random p_149734_5_){ - int l; - float f; - float f1; - float f2; - if (this.meta == 2) { - if (p_149734_5_.nextInt(24) == 0){ - p_149734_1_.playSound(p_149734_2_ + 0.5F, p_149734_3_ + 0.5F, p_149734_4_ + 0.5F, "fire.fire", 1.0F + p_149734_5_.nextFloat(), (p_149734_5_.nextFloat() * 0.7F) + 0.3F, false); - } - } - if (this.meta == 2) { - if (!World.doesBlockHaveSolidTopSurface(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_) && !Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_, UP)){ - if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_ - 1, p_149734_3_, p_149734_4_, EAST)){ - for (l = 0; l < 2; ++l){ - f = p_149734_2_ + (p_149734_5_.nextFloat() * 0.1F); - f1 = p_149734_3_ + p_149734_5_.nextFloat(); - f2 = p_149734_4_ + p_149734_5_.nextFloat(); - p_149734_1_.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); - } - } - if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_ + 1, p_149734_3_, p_149734_4_, WEST)){ - for (l = 0; l < 2; ++l){ - f = p_149734_2_ + 1 - (p_149734_5_.nextFloat() * 0.1F); - f1 = p_149734_3_ + p_149734_5_.nextFloat(); - f2 = p_149734_4_ + p_149734_5_.nextFloat(); - p_149734_1_.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); - } - } - if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ - 1, SOUTH)){ - for (l = 0; l < 2; ++l){ - f = p_149734_2_ + p_149734_5_.nextFloat(); - f1 = p_149734_3_ + p_149734_5_.nextFloat(); - f2 = p_149734_4_ + (p_149734_5_.nextFloat() * 0.1F); - p_149734_1_.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); - } - } - if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ + 1, NORTH)){ - for (l = 0; l < 2; ++l){ - f = p_149734_2_ + p_149734_5_.nextFloat(); - f1 = p_149734_3_ + p_149734_5_.nextFloat(); - f2 = p_149734_4_ + 1 - (p_149734_5_.nextFloat() * 0.1F); - p_149734_1_.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); - } - } - if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ + 1, p_149734_4_, DOWN)){ - for (l = 0; l < 2; ++l){ - f = p_149734_2_ + p_149734_5_.nextFloat(); - f1 = p_149734_3_ + 1 - (p_149734_5_.nextFloat() * 0.1F); - f2 = p_149734_4_ + p_149734_5_.nextFloat(); - p_149734_1_.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); - } - } - } - else{ - if (this.meta == 2) { - for (l = 0; l < 3; ++l){ - f = p_149734_2_ + p_149734_5_.nextFloat(); - f1 = p_149734_3_ + (p_149734_5_.nextFloat() * 0.5F) + 0.5F; - f2 = p_149734_4_ + p_149734_5_.nextFloat(); - p_149734_1_.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); - } - } - } - } - } - - @SideOnly(Side.CLIENT) - public static IIcon getFireIcon(final int p_149840_1_){ - return FirePit.TEXTURE[p_149840_1_]; - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_){ - return FirePit.TEXTURE[0]; - } - - private static boolean isNeighborBurning(final World world, final int x, final int y, final int z){ - return canCatchFire(world, x + 1, y, z, WEST ) || - canCatchFire(world, x - 1, y, z, EAST ) || - canCatchFire(world, x, y - 1, z, UP ) || - canCatchFire(world, x, y + 1, z, DOWN ) || - canCatchFire(world, x, y, z - 1, SOUTH) || - canCatchFire(world, x, y, z + 1, NORTH); - } - - public static boolean canCatchFire(final World world, final int x, final int y, final int z, final ForgeDirection face) - { - return world.getBlock(x, y, z).isFireSource(world, x, y, z, face); - } - -} diff --git a/src/Java/gtPlusPlus/core/block/general/FluidTankInfinite.java b/src/Java/gtPlusPlus/core/block/general/FluidTankInfinite.java deleted file mode 100644 index b979f7864b..0000000000 --- a/src/Java/gtPlusPlus/core/block/general/FluidTankInfinite.java +++ /dev/null @@ -1,136 +0,0 @@ -package gtPlusPlus.core.block.general; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.TileEntityInfiniteFluid; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidContainerItem; -import net.minecraftforge.fluids.ItemFluidContainer; - -public class FluidTankInfinite extends BlockContainer { - - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - @SuppressWarnings("deprecation") - public FluidTankInfinite() { - super(Material.iron); - this.setBlockName("blockInfiniteFluidTank"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, "blockInfiniteFluidTank"); - LanguageRegistry.addName(this, "Infinite Fluid Tank"); - - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) { - return p_149691_1_ == 1 ? this.textureTop - : (p_149691_1_ == 0 ? this.textureBottom - : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront)); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_) { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "Generic_Creative_Texture"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "Generic_Creative_Texture"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "Generic_Creative_Texture"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "Generic_Creative_Texture"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, - final int side, final float lx, final float ly, final float lz) { - if (world.isRemote) { - return true; - } else { - TileEntityInfiniteFluid tank = (TileEntityInfiniteFluid) world.getTileEntity(x, y, z); - if (tank != null) { - Item handItem; - try { - handItem = player.getHeldItem().getItem(); - } catch (Throwable t) { - handItem = null; - } - if (handItem != null - && (handItem instanceof IFluidContainerItem || handItem instanceof ItemFluidContainer - || FluidContainerRegistry.isFilledContainer(player.getHeldItem()))) { - if (tank.tank.getFluid() == null) { - try { - if (!FluidContainerRegistry.isFilledContainer(player.getHeldItem())) { - ItemStack handItemStack = player.getHeldItem(); - IFluidContainerItem container = (IFluidContainerItem) handItem; - FluidStack containerFluid = container.getFluid(handItemStack); - container.drain(handItemStack, container.getFluid(handItemStack).amount, true); - tank.tank.setFluid(containerFluid); - } else { - ItemStack handItemStack = player.getHeldItem(); - FluidContainerRegistry.drainFluidContainer(handItemStack); - FluidStack containerFluid = FluidContainerRegistry.getFluidForFilledItem(handItemStack); - ItemStack emptyContainer = FluidContainerRegistry.drainFluidContainer(handItemStack); - player.setItemInUse(emptyContainer, 0); - - tank.tank.setFluid(containerFluid); - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - - } - if (tank.tank.getFluid() != null) { - PlayerUtils.messagePlayer(player, "This tank contains " + tank.tank.getFluidAmount() + "L of " - + tank.tank.getFluid().getLocalizedName()); - } - } - } - return true; - } - - @Override - public int getRenderBlockPass() { - return 1; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - return new TileEntityInfiniteFluid(); - } - - @Override - public void onBlockAdded(World world, int x, int y, int z) { - super.onBlockAdded(world, x, y, z); - } - -} diff --git a/src/Java/gtPlusPlus/core/block/general/HellFire.java b/src/Java/gtPlusPlus/core/block/general/HellFire.java deleted file mode 100644 index 233f200815..0000000000 --- a/src/Java/gtPlusPlus/core/block/general/HellFire.java +++ /dev/null @@ -1,557 +0,0 @@ -package gtPlusPlus.core.block.general; - -import static net.minecraftforge.common.util.ForgeDirection.*; - -import java.util.IdentityHashMap; -import java.util.Map.Entry; -import java.util.Random; - -import com.google.common.collect.Maps; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockFire; -import net.minecraft.block.material.MapColor; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.init.Blocks; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.random.XSTR; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import net.minecraftforge.common.util.ForgeDirection; - -public class HellFire extends BlockFire { - @Deprecated - private final int[] field_149849_a = new int[Short.MAX_VALUE]; - @Deprecated - private final int[] field_149848_b = new int[Short.MAX_VALUE]; - @SideOnly(Side.CLIENT) - private IIcon[] IIconArray; - - public HellFire() { - this.setTickRandomly(true); - this.setLightLevel(1F); - this.setLightOpacity(0); - //this.setBlockTextureName(CORE.MODID + "hellfire/blockHellFire"); - this.setBlockName("blockHellFire"); - this.setCreativeTab(AddToCreativeTab.tabBlock); - GameRegistry.registerBlock(this, "blockHellFire"); - LanguageRegistry.addName(this, "Hellish Fire"); - this.enableBrutalFire(); - } - - private void enableBrutalFire() { - for (final Object o : Block.blockRegistry.getKeys()) - { - - try { - - final String name = (String)o; - final Block b = Block.getBlockFromName(name); - if (b != Blocks.air) - { - final int spread = Blocks.fire.getEncouragement(b); - final int flamm = Blocks.fire.getFlammability(b); - if (flamm > 0 && spread > 0) { - this.setFireInfo(b, spread * 4, flamm * 4); - } - } - - } - catch (Throwable t) { - t.printStackTrace(); - } - } - - //Special Case madness - this.setFireInfo(Blocks.brown_mushroom_block, 20, 100); - this.setFireInfo(Blocks.red_mushroom_block, 20, 100); - this.setFireInfo(Blocks.grass, 20, 100); - this.setFireInfo(Blocks.mycelium, 20, 100); - - } - - /** - * How many world ticks before ticking - */ - @Override - public int tickRate(final World world) { - return 5; - } - - /** - * Ticks the block if it's been scheduled - */ - @Override - public void updateTick(final World world, final int x, final int y, final int z, Random random) { - - random = new XSTR(); - - if (world.getGameRules().getGameRuleBooleanValue("doFireTick")) { - final boolean flag = world.getBlock(x, y - 1, z).isFireSource(world, x, y - 1, z, UP); - - if (!this.canPlaceBlockAt(world, x, y, z)) { - world.setBlockToAir(x, y, z); - } - - if (!flag && world.isRaining() - && (world.canLightningStrikeAt(x, y, z) || world.canLightningStrikeAt(x - 1, y, z) - || world.canLightningStrikeAt(x + 1, y, z) || world.canLightningStrikeAt(x, y, z - 1) - || world.canLightningStrikeAt(x, y, z + 1))) { - - if (MathUtils.randInt(0, 100) >= 90){ - world.setBlockToAir(x, y, z); - } - } - else { - final int blockMeta = world.getBlockMetadata(x, y, z); - - if (blockMeta < 15) { - world.setBlockMetadataWithNotify(x, y, z, blockMeta + (random.nextInt(3) / 2), 4); - } - - world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world) + random.nextInt(10)); - - if (!flag && !this.canNeighborBurn(world, x, y, z)) { - if (!World.doesBlockHaveSolidTopSurface(world, x, y - 1, z) || (blockMeta > 3)) { - world.setBlockToAir(x, y, z); - } - } - else if (!flag && !this.canCatchFire(world, x, y - 1, z, UP) && (blockMeta == 15) && (random.nextInt(4) == 0)) { - world.setBlockToAir(x, y, z); - } - else { - final boolean flag1 = world.isBlockHighHumidity(x, y, z); - byte b0 = 0; - - if (flag1) { - b0 = -50; - } - - this.tryCatchFire(world, x + 1, y, z, 300 + b0, random, blockMeta, WEST); - this.tryCatchFire(world, x - 1, y, z, 300 + b0, random, blockMeta, EAST); - this.tryCatchFire(world, x, y - 1, z, 250 + b0, random, blockMeta, UP); - this.tryCatchFire(world, x, y + 1, z, 250 + b0, random, blockMeta, DOWN); - this.tryCatchFire(world, x, y, z - 1, 300 + b0, random, blockMeta, SOUTH); - this.tryCatchFire(world, x, y, z + 1, 300 + b0, random, blockMeta, NORTH); - - for (int i1 = x - 1; i1 <= (x + 1); ++i1) { - for (int j1 = z - 1; j1 <= (z + 1); ++j1) { - for (int k1 = y - 1; k1 <= (y + 4); ++k1) { - if ((i1 != x) || (k1 != y) || (j1 != z)) { - int l1 = 100; - - if (k1 > (y + 1)) { - l1 += (k1 - (y + 1)) * 100; - } - - final int neighbourFireChance = this.getChanceOfNeighborsEncouragingFire(world, i1, k1, j1); - - if (neighbourFireChance > 0) { - int j2 = (neighbourFireChance + 40 + (world.difficultySetting.getDifficultyId() * 14)) / (blockMeta + 30); - - if (flag1) { - j2 /= 2; - } - - if ((j2 > 0) && (random.nextInt(l1) <= j2) - && (!world.isRaining() || !world.canLightningStrikeAt(i1, k1, j1)) - && !world.canLightningStrikeAt(i1 - 1, k1, z) - && !world.canLightningStrikeAt(i1 + 1, k1, j1) - && !world.canLightningStrikeAt(i1, k1, j1 - 1) - && !world.canLightningStrikeAt(i1, k1, j1 + 1)) { - int k2 = blockMeta + (random.nextInt(5) / 4); - - if (k2 > 15) { - k2 = 15; - } - - world.setBlock(i1, k1, j1, this, k2, 3); - } - } - } - } - } - } - } - } - } - } - - private void tryCatchFire(final World world, final int p_149841_2_, final int p_149841_3_, final int p_149841_4_, final int p_149841_5_, final Random p_149841_6_, final int p_149841_7_, final ForgeDirection face) { - final int j1 = world.getBlock(p_149841_2_, p_149841_3_, p_149841_4_).getFlammability(world, p_149841_2_, - p_149841_3_, p_149841_4_, face); - - if (p_149841_6_.nextInt(p_149841_5_) < j1) { - final boolean flag = world.getBlock(p_149841_2_, p_149841_3_, p_149841_4_) == Blocks.tnt; - - if ((p_149841_6_.nextInt(p_149841_7_ + 10) < 5) - && !world.canLightningStrikeAt(p_149841_2_, p_149841_3_, p_149841_4_)) { - int k1 = p_149841_7_ + (p_149841_6_.nextInt(5) / 4); - - if (k1 > 15) { - k1 = 15; - } - - world.setBlock(p_149841_2_, p_149841_3_, p_149841_4_, this, k1, 3); - } - else { - world.setBlockToAir(p_149841_2_, p_149841_3_, p_149841_4_); - } - - if (flag) { - Blocks.tnt.onBlockDestroyedByPlayer(world, p_149841_2_, p_149841_3_, p_149841_4_, 1); - } - } - } - - /** - * Returns true if at least one block next to this one can burn. - */ - private boolean canNeighborBurn(final World world, final int x, final int y, final int z) { - return this.canCatchFire(world, x + 1, y, z, WEST) - || this.canCatchFire(world, x - 1, y, z, EAST) - || this.canCatchFire(world, x, y - 1, z, UP) - || this.canCatchFire(world, x, y + 1, z, DOWN) - || this.canCatchFire(world, x, y, z - 1, SOUTH) - || this.canCatchFire(world, x, y, z + 1, NORTH); - } - - /** - * Gets the highest chance of a neighbor block encouraging this block to - * catch fire - */ - private int getChanceOfNeighborsEncouragingFire(final World world, final int x, final int y, final int z) { - final byte b0 = 0; - - if (!world.isAirBlock(x, y, z)) { - return 0; - } - else { - int l = b0; - l = this.getChanceToEncourageFire(world, x + 1, y, z, l, WEST); - l = this.getChanceToEncourageFire(world, x - 1, y, z, l, EAST); - l = this.getChanceToEncourageFire(world, x, y - 1, z, l, UP); - l = this.getChanceToEncourageFire(world, x, y + 1, z, l, DOWN); - l = this.getChanceToEncourageFire(world, x, y, z - 1, l, SOUTH); - l = this.getChanceToEncourageFire(world, x, y, z + 1, l, NORTH); - return l; - } - } - - /** - * Checks the specified block coordinate to see if it can catch fire. Args: - * blockAccess, x, y, z - */ - @Override - @Deprecated - public boolean canBlockCatchFire(final IBlockAccess p_149844_1_, final int p_149844_2_, final int p_149844_3_, final int p_149844_4_) { - return this.canCatchFire(p_149844_1_, p_149844_2_, p_149844_3_, p_149844_4_, UP); - } - - /** - * Checks to see if its valid to put this block at the specified - * coordinates. Args: world, x, y, z - */ - @Override - public boolean canPlaceBlockAt(final World worldObj, final int x, final int y, final int z) { - return World.doesBlockHaveSolidTopSurface(worldObj, x, y - 1, z) - || this.canNeighborBurn(worldObj, x, y, z); - } - - /** - * Lets the block know when one of its neighbor changes. Doesn't know which - * neighbor changed (coordinates passed are their own) Args: x, y, z, - * neighbor Block - */ - @Override - public void onNeighborBlockChange(final World worldObj, final int x, final int y, final int z, final Block blockObj) { - if (!World.doesBlockHaveSolidTopSurface(worldObj, x, y - 1, z) - && !this.canNeighborBurn(worldObj, x, y, z)) { - worldObj.setBlockToAir(x, y, z); - } - } - - /** - * Called whenever the block is added into the world. Args: world, x, y, z - */ - @Override - public void onBlockAdded(final World world, final int x, final int y, final int z) { - if ((world.provider.dimensionId > 0) - || !Blocks.portal.func_150000_e(world, x, y, z)) { - if (!World.doesBlockHaveSolidTopSurface(world, x, y - 1, z) - && !this.canNeighborBurn(world, x, y, z)) { - world.setBlockToAir(x, y, z); - } - else { - world.scheduleBlockUpdate(x, y, z, this, - this.tickRate(world) + world.rand.nextInt(10)); - } - } - } - - //Burn - @Override - public void onEntityWalking(final World world, final int i, final int j, final int k, final Entity entity) { - entity.setFire(10); - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - - //Burn - @Override - public void onEntityCollidedWithBlock(final World world, final int i, final int j, final int k, final Entity entity) { - entity.setFire(10); - } - - /** - * A randomly called display update to be able to add particles or other - * items for display - */ - @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(final World world, final int x, final int y, final int z, Random randomObj) { - - randomObj = new XSTR(); - - if (randomObj.nextInt(24) == 0) { - world.playSound(x + 0.5F, y + 0.5F, z + 0.5F, "fire.fire", - 1.0F + randomObj.nextFloat(), (randomObj.nextFloat() * 0.7F) + 0.3F, false); - } - - int l; - float f; - float f1; - float f2; - - if (!World.doesBlockHaveSolidTopSurface(world, x, y - 1, z) - && !Blocks.fire.canCatchFire(world, x, y - 1, z, UP)) { - if (Blocks.fire.canCatchFire(world, x - 1, y, z, EAST)) { - for (l = 0; l < 2; ++l) { - f = x + (randomObj.nextFloat() * 0.1F); - f1 = y + randomObj.nextFloat(); - f2 = z + randomObj.nextFloat(); - world.spawnParticle("witchMagic", f, f1, f2, 0.0D, 0.0D, 0.0D); - world.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); - world.spawnParticle("largesmoke", f, f1+0.5F, f2, 0.0D, 0.0D, 0.0D); - - } - } - - if (Blocks.fire.canCatchFire(world, x + 1, y, z, WEST)) { - for (l = 0; l < 2; ++l) { - f = (x + 1) - (randomObj.nextFloat() * 0.1F); - f1 = y + randomObj.nextFloat(); - f2 = z + randomObj.nextFloat(); - world.spawnParticle("witchMagic", f, f1, f2, 0.0D, 0.0D, 0.0D); - world.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); - world.spawnParticle("largesmoke", f, f1+0.5F, f2, 0.0D, 0.0D, 0.0D); - } - } - - if (Blocks.fire.canCatchFire(world, x, y, z - 1, SOUTH)) { - for (l = 0; l < 2; ++l) { - f = x + randomObj.nextFloat(); - f1 = y + randomObj.nextFloat(); - f2 = z + (randomObj.nextFloat() * 0.1F); - world.spawnParticle("witchMagic", f, f1, f2, 0.0D, 0.0D, 0.0D); - world.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); - world.spawnParticle("largesmoke", f, f1+0.5F, f2, 0.0D, 0.0D, 0.0D); - } - } - - if (Blocks.fire.canCatchFire(world, x, y, z + 1, NORTH)) { - for (l = 0; l < 2; ++l) { - f = x + randomObj.nextFloat(); - f1 = y + randomObj.nextFloat(); - f2 = (z + 1) - (randomObj.nextFloat() * 0.1F); - world.spawnParticle("witchMagic", f, f1, f2, 0.0D, 0.0D, 0.0D); - world.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); - world.spawnParticle("largesmoke", f, f1+0.5F, f2, 0.0D, 0.0D, 0.0D); - } - } - - if (Blocks.fire.canCatchFire(world, x, y + 1, z, DOWN)) { - for (l = 0; l < 2; ++l) { - f = x + randomObj.nextFloat(); - f1 = (y + 1) - (randomObj.nextFloat() * 0.1F); - f2 = z + randomObj.nextFloat(); - world.spawnParticle("witchMagic", f, f1, f2, 0.0D, 0.0D, 0.0D); - world.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); - world.spawnParticle("largesmoke", f, f1+0.5F, f2, 0.0D, 0.0D, 0.0D); - } - } - } - else { - for (l = 0; l < 5; ++l) { - f = x + randomObj.nextFloat(); - f1 = y + (randomObj.nextFloat() * 0.5F) + 0.5F; - f2 = z + randomObj.nextFloat(); - world.spawnParticle("witchMagic", f, f1, f2, 0.0D, 0.0D, 0.0D); - world.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); - world.spawnParticle("largesmoke", f, f1+0.5F, f2, 0.0D, 0.0D, 0.0D); - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister IIconRegister) { - this.IIconArray = new IIcon[] { - IIconRegister.registerIcon(CORE.MODID + ":" + "hellfire/" + "blockHellFire" + "_layer_0"), - IIconRegister.registerIcon(CORE.MODID + ":" + "hellfire/" + "blockHellFire" + "_layer_1") }; - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getFireIcon(final int p_149840_1_) { - return this.IIconArray[p_149840_1_]; - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) { - return this.IIconArray[0]; - } - - @Override - public MapColor getMapColor(final int p_149728_1_) { - return MapColor.snowColor; - } - - /* - * ================================= Forge Start - * ====================================== - */ - private static class FireInfo { - private int encouragement = 0; - private int flammibility = 0; - } - - private final IdentityHashMap<Block, FireInfo> blockInfo = Maps.newIdentityHashMap(); - - @Override - public void setFireInfo(final Block block, final int encouragement, final int flammibility) { - try { - if (block == Blocks.air) { - throw new IllegalArgumentException("Tried to set air on fire... This is bad."); - } - final int id = Block.getIdFromBlock(block); - if (id >= 4096 || id >= field_149849_a.length || id >= field_149848_b.length) { - return; - } - this.field_149849_a[id] = encouragement; - this.field_149848_b[id] = flammibility; - - final FireInfo info = this.getInfo(block, true); - info.encouragement = encouragement; - info.flammibility = flammibility; - } - catch (Throwable t) {} - } - - private FireInfo getInfo(final Block block, final boolean garentee) { - FireInfo ret = this.blockInfo.get(block); - if ((ret == null) && garentee) { - ret = new FireInfo(); - this.blockInfo.put(block, ret); - } - return ret; - } - - @Override - public void rebuildFireInfo() { - for (int x = 0; x < 4096; x++) { - // If we care.. we could detect changes in here and make sure we - // keep them, however - // it's my thinking that anyone who hacks into the private variables - // should DIAF and we don't care about them. - this.field_149849_a[x] = 0; - this.field_149848_b[x] = 0; - } - - for (final Entry<Block, FireInfo> e : this.blockInfo.entrySet()) { - final int id = Block.getIdFromBlock(e.getKey()); - if ((id >= 0) && (id < 4096)) { - this.field_149849_a[id] = e.getValue().encouragement; - this.field_149848_b[id] = e.getValue().flammibility; - } - } - } - - @Override - public int getFlammability(final Block block) { - final int id = Block.getIdFromBlock(block); - return (id >= 0) && (id < 4096) ? this.field_149848_b[id] : 0; - } - - @Override - public int getEncouragement(final Block block) { - final int id = Block.getIdFromBlock(block); - return (id >= 0) && (id < 4096) ? this.field_149849_a[id] : 0; - } - - /** - * Side sensitive version that calls the block function. - * - * @param world - * The current world - * @param x - * X Position - * @param y - * Y Position - * @param z - * Z Position - * @param face - * The side the fire is coming from - * @return True if the face can catch fire. - */ - @Override - public boolean canCatchFire(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) { - return world.getBlock(x, y, z).isFlammable(world, x, y, z, face); - } - - /** - * Side sensitive version that calls the block function. - * - * @param world - * The current world - * @param x - * X Position - * @param y - * Y Position - * @param z - * Z Position - * @param oldChance - * The previous maximum chance. - * @param face - * The side the fire is coming from - * @return The chance of the block catching fire, or oldChance if it is - * higher - */ - @Override - public int getChanceToEncourageFire(final IBlockAccess world, final int x, final int y, final int z, final int oldChance, final ForgeDirection face) { - final int newChance = world.getBlock(x, y, z).getFireSpreadSpeed(world, x, y, z, face); - return (newChance > oldChance ? newChance : oldChance); - } - /* - * ================================= Forge Start - * ====================================== - */ -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/general/LightGlass.java b/src/Java/gtPlusPlus/core/block/general/LightGlass.java deleted file mode 100644 index 30da7f1d56..0000000000 --- a/src/Java/gtPlusPlus/core/block/general/LightGlass.java +++ /dev/null @@ -1,144 +0,0 @@ -package gtPlusPlus.core.block.general; - -import java.util.Random; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.Block; -import net.minecraft.block.BlockAir; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; - -/*public class LightGlass extends BlockBreakable -{*/ -public class LightGlass extends BlockAir -{ - -private int state = 0; - private final int a = 255; - private int r = 255; - private int g = 0; - private int b = 0; - private int hex; - - public LightGlass(final boolean bool) - { - //super("blockMFEffect", Material.air, bool); - super(); - this.setCreativeTab(AddToCreativeTab.tabBlock); - this.setBlockName("blockMFEffect"); - this.setLightLevel(12F); - setHardness(0.1F); - setBlockTextureName(CORE.MODID + ":" + "blockMFEffect"); - setStepSound(Block.soundTypeGlass); - GameRegistry.registerBlock(this, "blockMFEffect"); - - /* - this.setLightOpacity(0); - this.setTickRandomly(true); - this.setResistance(1);*/ - } - - /** - * Returns the quantity of items to drop on block destruction. - */ - @Override - public int quantityDropped(final Random rand) - { - return 0; - } - - /** - * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha - */ - @Override - @SideOnly(Side.CLIENT) - public int getRenderBlockPass() - { - return 0; - } - - /** - * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) - */ - @Override - public boolean renderAsNormalBlock() - { - return false; - } - - /** - * Return true if a player with Silk Touch can harvest this block directly, and not its normal drops. - */ - @Override - protected boolean canSilkHarvest() - { - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister iIcon) - { - this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + "blockMFEffect"); - } - - @Override - //http://stackoverflow.com/questions/31784658/how-can-i-loop-through-all-rgb-combinations-in-rainbow-order-in-java - public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4) - { - if(this.state == 0){ - this.g++; - if(this.g == 255) { - this.state = 1; - } - } - if(this.state == 1){ - this.r--; - if(this.r == 0) { - this.state = 2; - } - } - if(this.state == 2){ - this.b++; - if(this.b == 255) { - this.state = 3; - } - } - if(this.state == 3){ - this.g--; - if(this.g == 0) { - this.state = 4; - } - } - if(this.state == 4){ - this.r++; - if(this.r == 255) { - this.state = 5; - } - } - if(this.state == 5){ - this.b--; - if(this.b == 0) { - this.state = 0; - } - } - this.hex = (this.a << 24) + (this.r << 16) + (this.g << 8) + (this.b); - return this.hex; - } - - /** - * A randomly called display update to be able to add particles or other items for display - */ - @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(final World world, final int posX, final int posY, final int posZ, final Random random){ - //Utils.spawnFX(world, posX, posY, posZ, "smoke", "cloud"); - - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/general/MiningExplosives.java b/src/Java/gtPlusPlus/core/block/general/MiningExplosives.java deleted file mode 100644 index 8925962e4e..0000000000 --- a/src/Java/gtPlusPlus/core/block/general/MiningExplosives.java +++ /dev/null @@ -1,172 +0,0 @@ -package gtPlusPlus.core.block.general; - -import java.util.Random; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockTNT; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.init.Items; -import net.minecraft.util.IIcon; -import net.minecraft.world.Explosion; -import net.minecraft.world.World; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.entity.EntityPrimedMiningExplosive; -import gtPlusPlus.core.lib.CORE; - -public class MiningExplosives extends BlockTNT { - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - - public MiningExplosives(){ - this.setBlockName("blockMiningExplosives"); - GameRegistry.registerBlock(this, "blockMiningExplosives"); - LanguageRegistry.addName(this, "Earth Blasting Explosives"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_){ - return p_149691_1_ == 0 ? this.textureBottom : (p_149691_1_ == 1 ? this.textureTop : this.blockIcon); - } - - /** - * Called whenever the block is added into the world. Args: world, x, y, z - */ - @Override - public void onBlockAdded(final World world, final int x, final int y, final int z){ - super.onBlockAdded(world, x, y, z); - - if (world.isBlockIndirectlyGettingPowered(x, y, z)) - { - this.onBlockDestroyedByPlayer(world, x, y, z, 1); - world.setBlockToAir(x, y, z); - } - } - - /** - * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are - * their own) Args: x, y, z, neighbor Block - */ - @Override - public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block neighbourblock){ - if (world.isBlockIndirectlyGettingPowered(x, y, z)) - { - this.onBlockDestroyedByPlayer(world, x, y, z, 1); - world.setBlockToAir(x, y, z); - } - } - - /** - * Returns the quantity of items to drop on block destruction. - */ - @Override - public int quantityDropped(final Random random){ - return 1; - } - - /** - * Called upon the block being destroyed by an explosion - */ - @Override - public void onBlockDestroyedByExplosion(final World world, final int x, final int y, final int z, final Explosion bang){ - if (!world.isRemote) - { - final EntityPrimedMiningExplosive EntityPrimedMiningExplosive = new EntityPrimedMiningExplosive(world, x + 0.5F, y + 0.5F, z + 0.5F, bang.getExplosivePlacedBy()); - EntityPrimedMiningExplosive.fuse = world.rand.nextInt(EntityPrimedMiningExplosive.fuse / 4) + (EntityPrimedMiningExplosive.fuse / 8); - world.spawnEntityInWorld(EntityPrimedMiningExplosive); - } - } - - /** - * Called right before the block is destroyed by a player. Args: world, x, y, z, metaData - */ - @Override - public void onBlockDestroyedByPlayer(final World world, final int x, final int y, final int z, final int meta){ - this.func_150114_a(world, x, y, z, meta, (EntityLivingBase)null); - } - - //TODO Spawns Primed TNT? - @Override - public void func_150114_a(final World world, final int p_150114_2_, final int p_150114_3_, final int p_150114_4_, final int p_150114_5_, final EntityLivingBase entityLiving){ - if (!world.isRemote) - { - if ((p_150114_5_ & 1) == 1) - { - final EntityPrimedMiningExplosive EntityPrimedMiningExplosive = new EntityPrimedMiningExplosive(world, p_150114_2_ + 0.5F, p_150114_3_ + 0.5F, p_150114_4_ + 0.5F, entityLiving); - world.spawnEntityInWorld(EntityPrimedMiningExplosive); - world.playSoundAtEntity(EntityPrimedMiningExplosive, "game.tnt.primed", 1.0F, 1.0F); - } - } - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer clickingPlayer, final int p_149727_6_, final float p_149727_7_, final float p_149727_8_, final float p_149727_9_){ - if ((clickingPlayer.getCurrentEquippedItem() != null) && (clickingPlayer.getCurrentEquippedItem().getItem() == Items.flint_and_steel)) - { - this.func_150114_a(world, x, y, z, 1, clickingPlayer); - world.setBlockToAir(x, y, z); - clickingPlayer.getCurrentEquippedItem().damageItem(1, clickingPlayer); - return true; - } - else - { - return super.onBlockActivated(world, x, y, z, clickingPlayer, p_149727_6_, p_149727_7_, p_149727_8_, p_149727_9_); - } - } - - /** - * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity - */ - @Override - public void onEntityCollidedWithBlock(final World world, final int x, final int y, final int z, final Entity entityTriggering){ - if ((entityTriggering instanceof EntityArrow) && !world.isRemote) - { - final EntityArrow entityarrow = (EntityArrow)entityTriggering; - - if (entityarrow.isBurning()) - { - this.func_150114_a(world, x, y, z, 1, entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase)entityarrow.shootingEntity : null); - world.setBlockToAir(x, y, z); - } - } - } - - /** - * Return whether this block can drop from an explosion. - */ - @Override - public boolean canDropFromExplosion(final Explosion bang){ - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister iconRegister){ - // - /*this.blockIcon = iconRegister.registerIcon(this.getTextureName() + "_side"); - this.textureTop = iconRegister.registerIcon(this.getTextureName() + "_top"); - this.textureBottom = iconRegister.registerIcon(this.getTextureName() + "_bottom");*/ - this.blockIcon = iconRegister.registerIcon(CORE.MODID + ":" + "chrono/" + "MetalSheet2"); - this.textureTop = iconRegister.registerIcon(CORE.MODID + ":" + "chrono/" + "MetalFunnel"); - this.textureBottom = iconRegister.registerIcon(CORE.MODID + ":" + "chrono/" + "MetalPanel"); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/general/PlayerDoors.java b/src/Java/gtPlusPlus/core/block/general/PlayerDoors.java deleted file mode 100644 index a4c0c1a0a5..0000000000 --- a/src/Java/gtPlusPlus/core/block/general/PlayerDoors.java +++ /dev/null @@ -1,467 +0,0 @@ -package gtPlusPlus.core.block.general; - -import java.util.HashMap; -import java.util.Random; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.item.base.itemblock.ItemBlockDoor; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.TileEntityPlayerDoorBase; -import gtPlusPlus.core.util.Utils; -import net.minecraft.block.Block; -import net.minecraft.block.BlockDoor; -import net.minecraft.block.ITileEntityProvider; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.IconFlipped; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.IIcon; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public class PlayerDoors extends BlockDoor implements ITileEntityProvider { - - @SideOnly(Side.CLIENT) - private IIcon[] aTextureUpper; - @SideOnly(Side.CLIENT) - private IIcon[] aTextureLower; - - private final static HashMap<Material, BlockDoor> mDoorMap = new HashMap<Material, BlockDoor>(); - - public PlayerDoors(Material aMaterial, String aTextureName, boolean vanillaType) { - this(aMaterial, aTextureName, vanillaType, 0f, null, null); - } - - public PlayerDoors(Material aMaterial, String aTextureName, boolean vanillaType, float aHardness, - SoundType aStepSound, String aBlockExtensionName) { - super(aMaterial); - this.disableStats(); - this.isBlockContainer = true; - if (mDoorMap.get(aMaterial) == null) { - mDoorMap.put(aMaterial, this); - } - float f = 0.5F; - float f1 = 1.0F; - this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); - - this.setBlockName("playerDoor_" + aTextureName); - if (aMaterial == Material.wood) { - setHardness(3.0F); - setStepSound(soundTypeWood); - setBlockName("playerDoor" + "Wood"); - this.setHarvestLevel("axe", 1); - } else if (aMaterial == Material.iron) { - setHardness(5.0F); - setStepSound(Block.soundTypeMetal); - setBlockName("playerDoor" + "Iron"); - this.setHarvestLevel("pickaxe", 1); - - } else if (aMaterial == Material.glass) { - setHardness(0.1F); - setStepSound(Block.soundTypeGlass); - setBlockName("playerDoor" + "Glass"); - this.setHarvestLevel("pickaxe", 1); - - } else if (aMaterial == Material.ice) { - setHardness(0.5F); - setStepSound(Block.soundTypeSnow); - setBlockName("playerDoor" + "Ice"); - this.setHarvestLevel("pickaxe", 1); - } else { - setHardness(aHardness); - setStepSound(aStepSound); - setBlockName("playerDoor" + aBlockExtensionName); - this.setHarvestLevel("axe", 1); - - } - this.setBlockTextureName(vanillaType ? aTextureName : CORE.MODID + ":" + aTextureName); - GameRegistry.registerBlock(this, ItemBlockDoor.class, Utils.sanitizeString(this.getUnlocalizedName())); - } - - /** - * Gets the block's texture. Args: side, meta - */ - @SideOnly(Side.CLIENT) - public IIcon getIcon(int p_149691_1_, int p_149691_2_) { - return this.aTextureLower[0]; - } - - @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess aAccess, int p_149673_2_, int p_149673_3_, int p_149673_4_, int p_149673_5_) { - if (p_149673_5_ != 1 && p_149673_5_ != 0) { - int i1 = this.getState(aAccess, p_149673_2_, p_149673_3_, p_149673_4_); - int j1 = i1 & 3; - boolean flag = (i1 & 4) != 0; - boolean flag1 = false; - boolean flag2 = (i1 & 8) != 0; - - if (flag) { - if (j1 == 0 && p_149673_5_ == 2) { - flag1 = !flag1; - } else if (j1 == 1 && p_149673_5_ == 5) { - flag1 = !flag1; - } else if (j1 == 2 && p_149673_5_ == 3) { - flag1 = !flag1; - } else if (j1 == 3 && p_149673_5_ == 4) { - flag1 = !flag1; - } - } else { - if (j1 == 0 && p_149673_5_ == 5) { - flag1 = !flag1; - } else if (j1 == 1 && p_149673_5_ == 3) { - flag1 = !flag1; - } else if (j1 == 2 && p_149673_5_ == 4) { - flag1 = !flag1; - } else if (j1 == 3 && p_149673_5_ == 2) { - flag1 = !flag1; - } - - if ((i1 & 16) != 0) { - flag1 = !flag1; - } - } - - return flag2 ? this.aTextureUpper[flag1 ? 1 : 0] : this.aTextureLower[flag1 ? 1 : 0]; - } else { - return this.aTextureLower[0]; - } - } - - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister p_149651_1_) { - this.aTextureUpper = new IIcon[2]; - this.aTextureLower = new IIcon[2]; - this.aTextureUpper[0] = p_149651_1_.registerIcon(this.getTextureName() + "_upper"); - this.aTextureLower[0] = p_149651_1_.registerIcon(this.getTextureName() + "_lower"); - this.aTextureUpper[1] = new IconFlipped(this.aTextureUpper[0], true, false); - this.aTextureLower[1] = new IconFlipped(this.aTextureLower[0], true, false); - } - - public boolean getBlocksMovement(IBlockAccess aAccess, int aX, int aY, int aZ) { - int l = this.getState(aAccess, aX, aY, aZ); - return (l & 4) != 0; - } - - /** - * If this block doesn't render as an ordinary block it will return False - * (examples: signs, buttons, stairs, etc) - */ - public boolean renderAsNormalBlock() { - return false; - } - - /** - * The type of render function that is called for this block - */ - public int getRenderType() { - return 7; - } - - /** - * Returns the bounding box of the wired rectangular prism to render. - */ - @SideOnly(Side.CLIENT) - public AxisAlignedBB getSelectedBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - this.setBlockBoundsBasedOnState(aWorld, aX, aY, aZ); - return super.getSelectedBoundingBoxFromPool(aWorld, aX, aY, aZ); - } - - /** - * Returns a bounding box from the pool of bounding boxes (this means this box - * can change after the pool has been cleared to be reused) - */ - public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - this.setBlockBoundsBasedOnState(aWorld, aX, aY, aZ); - return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); - } - - /** - * Updates the blocks bounds based on its current state. Args: world, x, y, z - */ - public void setBlockBoundsBasedOnState(IBlockAccess aAccess, int aX, int aY, int aZ) { - this.setBounds(this.getState(aAccess, aX, aY, aZ)); - } - - public int func_150013_e(IBlockAccess p_150013_1_, int p_150013_2_, int p_150013_3_, int p_150013_4_) { - return this.getState(p_150013_1_, p_150013_2_, p_150013_3_, p_150013_4_) & 3; - } - - public boolean func_150015_f(IBlockAccess p_150015_1_, int p_150015_2_, int p_150015_3_, int p_150015_4_) { - return (this.getState(p_150015_1_, p_150015_2_, p_150015_3_, p_150015_4_) & 4) != 0; - } - - private void setBounds(int aState) { - float f = 0.1875F; - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F); - int j = aState & 3; - boolean flag = (aState & 4) != 0; - boolean flag1 = (aState & 16) != 0; - - if (j == 0) { - if (flag) { - if (!flag1) { - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); - } else { - this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); - } - } else { - this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); - } - } else if (j == 1) { - if (flag) { - if (!flag1) { - this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } else { - this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); - } - } else { - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); - } - } else if (j == 2) { - if (flag) { - if (!flag1) { - this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); - } else { - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); - } - } else { - this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } - } else if (j == 3) { - if (flag) { - if (!flag1) { - this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); - } else { - this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } - } else { - this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); - } - } - } - - /** - * Called upon block activation (right click on the block.) - */ - public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int p_149727_6_, - float p_149727_7_, float p_149727_8_, float p_149727_9_) { - if (this.blockMaterial == Material.iron) { - return false; // Allow items to interact with the door - } else { - int i1 = this.getState(aWorld, aX, aY, aZ); - int j1 = i1 & 7; - j1 ^= 4; - - if ((i1 & 8) == 0) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, j1, 2); - aWorld.markBlockRangeForRenderUpdate(aX, aY, aZ, aX, aY, aZ); - } else { - aWorld.setBlockMetadataWithNotify(aX, aY - 1, aZ, j1, 2); - aWorld.markBlockRangeForRenderUpdate(aX, aY - 1, aZ, aX, aY, aZ); - } - - aWorld.playAuxSFXAtEntity(aPlayer, 1003, aX, aY, aZ, 0); - return true; - } - } - - public void func_150014_a(World aWorld, int aX, int aY, int aZ, boolean aFlag) { - int l = this.getState(aWorld, aX, aY, aZ); - boolean flag1 = (l & 4) != 0; - - if (flag1 != aFlag) { - int i1 = l & 7; - i1 ^= 4; - - if ((l & 8) == 0) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, i1, 2); - aWorld.markBlockRangeForRenderUpdate(aX, aY, aZ, aX, aY, aZ); - } else { - aWorld.setBlockMetadataWithNotify(aX, aY - 1, aZ, i1, 2); - aWorld.markBlockRangeForRenderUpdate(aX, aY - 1, aZ, aX, aY, aZ); - } - - aWorld.playAuxSFXAtEntity((EntityPlayer) null, 1003, aX, aY, aZ, 0); - } - } - - /** - * Lets the block know when one of its neighbor changes. Doesn't know which - * neighbor changed (coordinates passed are their own) Args: x, y, z, neighbor - * Block - */ - public void onNeighborBlockChange(World aWorld, int aX, int aY, int aZ, Block aNeighbour) { - int l = aWorld.getBlockMetadata(aX, aY, aZ); - - if ((l & 8) == 0) { - boolean flag = false; - - if (aWorld.getBlock(aX, aY + 1, aZ) != this) { - aWorld.setBlockToAir(aX, aY, aZ); - flag = true; - } - - if (!World.doesBlockHaveSolidTopSurface(aWorld, aX, aY - 1, aZ)) { - aWorld.setBlockToAir(aX, aY, aZ); - flag = true; - - if (aWorld.getBlock(aX, aY + 1, aZ) == this) { - aWorld.setBlockToAir(aX, aY + 1, aZ); - } - } - - if (flag) { - if (!aWorld.isRemote) { - this.dropBlockAsItem(aWorld, aX, aY, aZ, l, 0); - } - } else { - boolean flag1 = aWorld.isBlockIndirectlyGettingPowered(aX, aY, aZ) - || aWorld.isBlockIndirectlyGettingPowered(aX, aY + 1, aZ); - - if ((flag1 || aNeighbour.canProvidePower()) && aNeighbour != this) { - this.func_150014_a(aWorld, aX, aY, aZ, flag1); - } - } - } else { - if (aWorld.getBlock(aX, aY - 1, aZ) != this) { - aWorld.setBlockToAir(aX, aY, aZ); - } - - if (aNeighbour != this) { - this.onNeighborBlockChange(aWorld, aX, aY - 1, aZ, aNeighbour); - } - } - } - - public Item getItemDropped(int p_149650_1_, Random aRand, int p_149650_3_) { - if ((p_149650_1_ & 8) != 0) { - return null; - } else { - Block b = mDoorMap.get(this.blockMaterial); - if (b != null) { - return Item.getItemFromBlock(b); - } - } - return null; - } - - /** - * Ray traces through the blocks collision from start vector to end vector - * returning a ray trace hit. Args: world, x, y, z, startVec, endVec - */ - public MovingObjectPosition collisionRayTrace(World p_149731_1_, int p_149731_2_, int p_149731_3_, int p_149731_4_, - Vec3 p_149731_5_, Vec3 p_149731_6_) { - this.setBlockBoundsBasedOnState(p_149731_1_, p_149731_2_, p_149731_3_, p_149731_4_); - return super.collisionRayTrace(p_149731_1_, p_149731_2_, p_149731_3_, p_149731_4_, p_149731_5_, p_149731_6_); - } - - /** - * Checks to see if its valid to put this block at the specified coordinates. - * Args: world, x, y, z - */ - public boolean canPlaceBlockAt(World aWorld, int aX, int aY, int aZ) { - boolean aHeight = (aY < aWorld.getHeight() - 1); - boolean aSolidTopSurface = World.doesBlockHaveSolidTopSurface(aWorld, aX, aY - 1, aZ); - - boolean aCanPlace = aWorld.getBlock(aX, aY, aZ).isReplaceable(aWorld, aX, aY, aZ); - boolean aCanPlace2 = aWorld.getBlock(aX, aY, aZ).isReplaceable(aWorld, aX, aY + 1, aZ); - - // Logger.INFO(""+aY+"/"+aWorld.getHeight()+" | Trying to place door. Good - // height? "+aHeight+" | Solid top surface? "+aSolidTopSurface+" | Can Place? - // "+aCanPlace+"|"+aCanPlace2); - - return aHeight && aSolidTopSurface && aCanPlace && aCanPlace2; - } - - /** - * Returns the mobility information of the block, 0 = free, 1 = can't push but - * can move over, 2 = total immobility and stop pistons - */ - public int getMobilityFlag() { - return 1; - } - - public int getState(IBlockAccess aAccess, int aX, int aY, int aZ) { - int l = aAccess.getBlockMetadata(aX, aY, aZ); - boolean flag = (l & 8) != 0; - int i1; - int j1; - - if (flag) { - i1 = aAccess.getBlockMetadata(aX, aY - 1, aZ); - j1 = l; - } else { - i1 = l; - j1 = aAccess.getBlockMetadata(aX, aY + 1, aZ); - } - - boolean flag1 = (j1 & 1) != 0; - return i1 & 7 | (flag ? 8 : 0) | (flag1 ? 16 : 0); - } - - /** - * Gets an item for the block being called on. Args: world, x, y, z - */ - @SideOnly(Side.CLIENT) - public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { - Block b = mDoorMap.get(this.blockMaterial); - if (b != null) { - return Item.getItemFromBlock(b); - } - // return this.blockMaterial == Material.iron ? Items.iron_door : - // Items.wooden_door; - return null; - } - - /** - * Called when the block is attempted to be harvested - */ - public void onBlockHarvested(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, - EntityPlayer p_149681_6_) { - if (p_149681_6_.capabilities.isCreativeMode && (p_149681_5_ & 8) != 0 - && p_149681_1_.getBlock(p_149681_2_, p_149681_3_ - 1, p_149681_4_) == this) { - p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ - 1, p_149681_4_); - } - } - - /** - * Called whenever the block is added into the world. Args: world, x, y, z - */ - @Override - public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) { - super.onBlockAdded(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_); - } - - @Override - public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, - int p_149749_6_) { - super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); - p_149749_1_.removeTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); - } - - @Override - public boolean onBlockEventReceived(World p_149696_1_, int p_149696_2_, int p_149696_3_, int p_149696_4_, - int p_149696_5_, int p_149696_6_) { - super.onBlockEventReceived(p_149696_1_, p_149696_2_, p_149696_3_, p_149696_4_, p_149696_5_, p_149696_6_); - TileEntity tileentity = p_149696_1_.getTileEntity(p_149696_2_, p_149696_3_, p_149696_4_); - return tileentity != null ? tileentity.receiveClientEvent(p_149696_5_, p_149696_6_) : false; - } - - @Override - public TileEntity createNewTileEntity(World world, int metadata) { - return new TileEntityPlayerDoorBase(this, metadata); - } - - @Override - public TileEntity createTileEntity(World world, int metadata) { - return new TileEntityPlayerDoorBase(this, metadata); - } -} diff --git a/src/Java/gtPlusPlus/core/block/general/antigrief/BlockWitherProof.java b/src/Java/gtPlusPlus/core/block/general/antigrief/BlockWitherProof.java deleted file mode 100644 index 2210e68e8a..0000000000 --- a/src/Java/gtPlusPlus/core/block/general/antigrief/BlockWitherProof.java +++ /dev/null @@ -1,166 +0,0 @@ -package gtPlusPlus.core.block.general.antigrief; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.boss.EntityDragon; -import net.minecraft.entity.boss.EntityWither; -import net.minecraft.entity.boss.IBossDisplayData; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.world.Explosion; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; - -public class BlockWitherProof extends Block{ - - public BlockWitherProof(){ - super(Material.redstoneLight); - this.setBlockName(Utils.sanitizeString("blockBlackGate")); - this.setBlockTextureName(CORE.MODID + ":" + "blockFrameGt"); - this.setCreativeTab(AddToCreativeTab.tabBlock); - this.setHardness(-1F); - this.setResistance(5000.0F); - this.setHarvestLevel("pickaxe", 3); - this.setStepSound(soundTypeMetal); - //LanguageRegistry.addName(this, "Wither Cage"); - GameRegistry.registerBlock(this, Utils.sanitizeString("blockBlackGate")); - } - - public String GetProperName(){ - return "Wither Cage"; - } - - @Override - @SideOnly(Side.CLIENT) - public int getRenderBlockPass(){ - return 1; - } - - @Override - public boolean isOpaqueCube(){ - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister iIcon){ - this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + "blockFrameGt"); - } - - @Override - public void onBlockExploded(final World world, final int x, final int y, final int z, final Explosion explosion){ - //prevent from being destroyed by wither and nukes. - } - - @Override - public void onBlockDestroyedByExplosion(final World p_149723_1_, final int p_149723_2_, - final int p_149723_3_, final int p_149723_4_, final Explosion p_149723_5_) { - - } - - @Override - public boolean canDropFromExplosion(final Explosion p_149659_1_) { - return false; - } - - @Override - public boolean canEntityDestroy(final IBlockAccess world, final int x, final int y, final int z, - final Entity entity) { - if ((entity == null) || !entity.isEntityAlive()){ - return false; - } - if ((entity instanceof EntityWither) || (entity instanceof EntityDragon) || (entity instanceof IBossDisplayData)){ - return false; - } - else { - return super.canEntityDestroy(world, x, y, z, entity); - } - } - - - //Colour Handling - private static final int mWitherColour = Utils.rgbtoHexValue(32, 32, 32); - - @Override - public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4){ - return mWitherColour; - } - - @Override - public int getRenderColor(final int aMeta) { - return mWitherColour; - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - - @Override - public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { - super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); - } - - @Override - public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World p_149737_2_, int p_149737_3_, int p_149737_4_, int p_149737_5_) { - if (aPlayer != null && aPlayer instanceof EntityPlayerMP) { - return 1f; - } - return -1f; - } - - @Override - public float getExplosionResistance(Entity p_149638_1_) { - return Float.MAX_VALUE; - } - - @Override - public void onBlockClicked(World p_149699_1_, int p_149699_2_, int p_149699_3_, int p_149699_4_, EntityPlayer p_149699_5_) { - super.onBlockClicked(p_149699_1_, p_149699_2_, p_149699_3_, p_149699_4_, p_149699_5_); - } - - @Override - public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { - if ((entity == null) || !entity.isEntityAlive()){ - return; - } - if ((entity instanceof EntityWither) || (entity instanceof EntityDragon) || (entity instanceof IBossDisplayData)){ - return; - } - else { - super.onEntityCollidedWithBlock(world, x, y, z, entity); - } - } - - @Override - public void harvestBlock(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_) { - super.harvestBlock( p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_); - } - - @Override - public boolean canHarvestBlock(EntityPlayer player, int meta) { - if (player != null && player instanceof EntityPlayerMP) { - return true; - } - return super.canHarvestBlock(player, meta); - } - - @Override - public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) { - return Float.MAX_VALUE; - } - - - -} diff --git a/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java b/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java deleted file mode 100644 index 01a2116a0b..0000000000 --- a/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java +++ /dev/null @@ -1,293 +0,0 @@ -package gtPlusPlus.core.block.general.antigrief; - -import static gtPlusPlus.core.block.ModBlocks.blockGriefSaver; - -import java.util.List; -import java.util.Random; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -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 gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.TileEntityReverter; - -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); - this.setHardness(10.0F); - this.setResistance(35.0F); - this.setStepSound(Block.soundTypeWood); - this.setCreativeTab(AddToCreativeTab.tabMachines); - } - - public int tickRate() - { - return 15; - } - - public void saveNBTData(final NBTTagCompound aNBT) { - aNBT.setBoolean("bUnbreakable", this.bUnbreakable); - } - - public void loadNBTData(final NBTTagCompound aNBT) { - this.bUnbreakable = aNBT.getBoolean("bUnbreakable"); - } - - @Override - public IIcon getIcon(final int side, final int meta) - { - return TEX_ANTIBUILDER; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister par1IconRegister) - { - TEX_ANTIBUILDER = par1IconRegister.registerIcon(CORE.MODID + ":" + "blockAntiGrief"); - } - - @Override - public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) - { - par3List.add(new ItemStack(par1, 1, 9)); - } - - @Override - public boolean onBlockActivated(final World par1World, final int x, final int y, final int z, final EntityPlayer par5EntityPlayer, final int par6, final float par7, final float par8, final float par9) - { - final int meta = par1World.getBlockMetadata(x, y, z); - return false; - } - - @Override - public float getExplosionResistance(final Entity par1Entity, final World world, final int x, final int y, final int z, final double explosionX, final double explosionY, final double explosionZ) - { - final int meta = world.getBlockMetadata(x, y, z); - return super.getExplosionResistance(par1Entity, world, x, y, z, explosionX, explosionY, explosionZ); - } - - @Override - public float getBlockHardness(final World world, final int x, final int y, final int z) - { - final int meta = world.getBlockMetadata(x, y, z); - return super.getBlockHardness(world, x, y, z); - } - - public static boolean areNearbyLockBlocks(final World world, final int x, final int y, final 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(final World par1World, final int x, final int y, final int z) - { - final Block thereBlockID = par1World.getBlock(x, y, z); - final 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(final World par1World, final int x, final int y, final int z, final int meta) - { - final 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); - } - } - - @Override - public void onBlockAdded(final World par1World, final int x, final int y, final int z) - { - final int meta = par1World.getBlockMetadata(x, y, z); - if (!par1World.isRemote) { - - } - } - - @Override - public void onNeighborBlockChange(final World par1World, final int x, final int y, final int z, final Block myBlockID) - { - final int meta = par1World.getBlockMetadata(x, y, z); - if (!par1World.isRemote) - { - - } - } - - @Override - public void updateTick(final World par1World, final int x, final int y, final int z, final Random par5Random) - { - if (!par1World.isRemote) - { - final int meta = par1World.getBlockMetadata(x, y, z); - } - } - - private void letsBuild(final World par1World, final int x, final int y, final int z) - { - - } - - private boolean isInactiveTrapCharged(final World par1World, final int x, final int y, final int z) - { - return false; - } - - private boolean isReactorReady(final World world, final int x, final int y, final 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; - } - - @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(final World par1World, final int x, final int y, final int z, final Random par5Random) - { - final int meta = par1World.getBlockMetadata(x, y, z); - if ((meta == 3) || (meta == 1) || (meta == 9)) { - for (int i = 0; i < 1; i++) { - this.sparkle(par1World, x, y, z, par5Random); - } - } - } - - public void sparkle(final World world, final int x, final int y, final int z, final Random rand) - { - final 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(final World world, final int x, final int y, final int z) - { - final Block thereID = world.getBlock(x, y, z); - final int thereMeta = world.getBlockMetadata(x, y, z); - } - - public static void changeToActiveVanishBlock(final World par1World, final int x, final int y, final int z, final 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); - - final Block thereBlockID = par1World.getBlock(x, y, z); - par1World.scheduleBlockUpdate(x, y, z, thereBlockID, getTickRateFor(thereBlockID, meta, par1World.rand)); - } - - private static int getTickRateFor(final Block thereBlockID, final int meta, final Random rand) - { - return 15; - } - - @Override - public int getLightValue(final IBlockAccess world, final int x, final int y, final int z) - { - final Block blockID = world.getBlock(x, y, z); - final int meta = world.getBlockMetadata(x, y, z); - if (blockID != this) { - return 0; - } - return 10; - } - - @Override - public boolean hasTileEntity(final int metadata) - { - return (metadata == 0); - } - - @Override - public TileEntity createTileEntity(final World world, final int metadata) - { - if (metadata == 0) { - Logger.INFO("I have been created. [Antigriefer]"+this.getLocalizedName()); - return new TileEntityReverter(); - } - return null; - } - - @Override - public Item getItemDropped(final int meta, final Random par2Random, final int par3) - { - switch (meta) - { - case 0: - return null; - } - return Item.getItemFromBlock(this); - } - - @Override - public int damageDropped(final int meta) - { - return meta; - } -} diff --git a/src/Java/gtPlusPlus/core/block/general/fluids/BlockFluidSludge.java b/src/Java/gtPlusPlus/core/block/general/fluids/BlockFluidSludge.java deleted file mode 100644 index 6af27639ae..0000000000 --- a/src/Java/gtPlusPlus/core/block/general/fluids/BlockFluidSludge.java +++ /dev/null @@ -1,63 +0,0 @@ -package gtPlusPlus.core.block.general.fluids; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import net.minecraftforge.fluids.BlockFluidClassic; -import net.minecraftforge.fluids.Fluid; - -public class BlockFluidSludge extends BlockFluidClassic { - - @SideOnly(Side.CLIENT) - protected IIcon stillIcon; - @SideOnly(Side.CLIENT) - protected IIcon flowingIcon; - - public BlockFluidSludge(final Fluid fluid, final Material material) { - super(fluid, material); - this.setCreativeTab(AddToCreativeTab.tabMisc); - } - - @Override - public IIcon getIcon(final int side, final int meta) { - return ((side == 0) || (side == 1))? this.stillIcon : this.flowingIcon; - } - - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(final IIconRegister register) { - this.stillIcon = register.registerIcon(CORE.MODID+":fluids/fluid.jackdaniels"); - this.flowingIcon = register.registerIcon(CORE.MODID+":fluids/fluid.jackdaniels"); - } - - @Override - public boolean canDisplace(final IBlockAccess world, final int x, final int y, final int z) { - if (world.getBlock(x, y, z).getMaterial().isLiquid()) { - return false; - } - return super.canDisplace(world, x, y, z); - } - - @Override - public boolean displaceIfPossible(final World world, final int x, final int y, final int z) { - if (world.getBlock(x, y, z).getMaterial().isLiquid()) { - return false; - } - return super.displaceIfPossible(world, x, y, z); - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - -} diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java deleted file mode 100644 index b84c96be99..0000000000 --- a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java +++ /dev/null @@ -1,370 +0,0 @@ -package gtPlusPlus.core.block.general.redstone; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Random; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.common.items.GT_MetaGenerated_Tool_01; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.itemblock.ItemBlockMeta; -import gtPlusPlus.core.tileentities.general.redstone.TileEntityRedstoneHandler; -import gtPlusPlus.core.util.minecraft.InventoryUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -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.creativetab.CreativeTabs; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -public abstract class BlockGenericRedstone extends BlockContainer { - - - @SuppressWarnings("deprecation") - public BlockGenericRedstone(String aUnlocalizedSuffix, String aDisplayName) { - super(Material.redstoneLight); - this.setBlockName("blockGenericRedstone." + aUnlocalizedSuffix); - this.setHardness(3f); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, ItemBlockMeta.class, "blockGenericRedstone." + aUnlocalizedSuffix); - LanguageRegistry.addName(this, aDisplayName); - - } - - - private final HashMap<Integer, HashMap<ForgeDirection, IIcon>> mTextures = new HashMap<Integer, HashMap<ForgeDirection, IIcon>>(); - - /** - * A map of the textures used for this blocks. The key is the meta, then each internal map holds textures tied to each forge direction. Do not use unknown direction. - * @return - */ - public HashMap<Integer, HashMap<ForgeDirection, IIcon>> getTextureArray() { - return mTextures; - } - - public abstract void generateTextureArray(final IIconRegister iicon); - - - @Override - @SideOnly(Side.CLIENT) - public final void registerBlockIcons(final IIconRegister iicon) { - generateTextureArray(iicon); - this.blockIcon = iicon.registerIcon("redstone_block"); - } - - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, - final int side, final float lx, final float ly, final float lz) { - - if (world.isRemote) { - return true; - } - - boolean mDidTool = false; - // Check For Tools - try { - final ItemStack mHandStack = PlayerUtils.getItemStackInPlayersHand(world, player.getDisplayName()); - final Item mHandItem = mHandStack.getItem(); - if (ItemUtils.isItemGregtechTool(mHandStack)) { - - Logger.INFO("Found Tool in players hand!"); - - final TileEntityRedstoneHandler tile = (TileEntityRedstoneHandler) world.getTileEntity(x, y, z); - if (tile != null) { - if (tile.isScrewdriverable()) { - if (ItemUtils.isToolScrewdriver(mHandStack)){ - mDidTool = tile.onScrewdriverRMB(); - PlayerUtils.messagePlayer(player, "Adjusted Light level by 0.0625f. "+tile.getLightBrightness()); - } - } - if (tile.isMalletable()) { - if (ItemUtils.isToolMallet(mHandStack)){ - mDidTool = tile.onMalletRMB(); - PlayerUtils.messagePlayer(player, "Light Mode active: "+mDidTool); - } - } - if (tile.isWrenchable()) { - if (ItemUtils.isToolWrench(mHandStack)){ - mDidTool = tile.onWrenchRMB(); - } - } - } - } - } - catch (final Throwable t) {} - if (mDidTool) { - return true; - } - - return false; - } - - - - @Override - public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) { - - boolean mDidTool = false; - // Check For Tools - try { - final ItemStack mHandStack = PlayerUtils.getItemStackInPlayersHand(aWorld, aPlayer.getDisplayName()); - final Item mHandItem = mHandStack.getItem(); - if (mHandItem instanceof GT_MetaGenerated_Tool_01) { - - final TileEntityRedstoneHandler tile = (TileEntityRedstoneHandler) aWorld.getTileEntity(aX, aY, aZ); - if (tile != null) { - if (tile.isScrewdriverable()) { - if (ItemUtils.isToolScrewdriver(mHandStack)){ - mDidTool = tile.onScrewdriverLMB(); - } - } - if (tile.isMalletable()) { - if (ItemUtils.isToolMallet(mHandStack)){ - mDidTool = tile.onMalletLMB(); - } - } - if (tile.isWrenchable()) { - if (ItemUtils.isToolWrench(mHandStack)){ - mDidTool = tile.onWrenchLMB(); - } - } - } - } - } - catch (Throwable t) {} - - if (!mDidTool && !aPlayer.capabilities.isCreativeMode) { - super.onBlockClicked(aWorld, aX, aY, aZ, aPlayer); - } - else { - return; - } - } - - @Override - public abstract TileEntity createNewTileEntity(final World world, final int p_149915_2_); - - @Override - public void breakBlock(final World world, final int x, final int y, final int z, final Block block, - final int number) { - InventoryUtils.dropInventoryItems(world, x, y, z, block); - super.breakBlock(world, x, y, z, block, number); - } - - @Override - public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase entity, - final ItemStack stack) { - if (stack.hasDisplayName()) { - ((TileEntityRedstoneHandler) world.getTileEntity(x, y, z)).setCustomName(stack.getDisplayName()); - } - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, - final int z) { - return false; - } - - @Override - public int getLightValue() { - return super.getLightValue(); - } - - @Override - public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, - float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) { - // TODO Auto-generated method stub - return super.onBlockPlaced(p_149660_1_, p_149660_2_, p_149660_3_, p_149660_4_, p_149660_5_, p_149660_6_, - p_149660_7_, p_149660_8_, p_149660_9_); - } - - @Override - public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) { - TileEntityRedstoneHandler aThis = getTileEntity(world, x, y, z); - if (aThis != null) { - return aThis.isProvidingWeakPower(world, x, y, z, side); - } - return 0; - } - - @Override - public boolean canProvidePower() { - return false; - } - - @Override - public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) { - TileEntityRedstoneHandler aThis = getTileEntity(world, x, y, z); - if (aThis != null) { - return aThis.isProvidingStrongPower(world, x, y, z, side); - } - return 0; - } - - @Override - public boolean hasComparatorInputOverride() { - // TODO Auto-generated method stub - return super.hasComparatorInputOverride(); - } - - @Override - public int getComparatorInputOverride(World p_149736_1_, int p_149736_2_, int p_149736_3_, int p_149736_4_, - int p_149736_5_) { - // TODO Auto-generated method stub - return super.getComparatorInputOverride(p_149736_1_, p_149736_2_, p_149736_3_, p_149736_4_, p_149736_5_); - } - - @Override - public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) { - TileEntityRedstoneHandler aThis = getTileEntity(world, x, y, z); - if (aThis != null) { - return aThis.canConnectRedstone(world, x, y, z, side); - } - return false; - } - - @Override - public boolean shouldCheckWeakPower(IBlockAccess world, int x, int y, int z, int side) { - TileEntityRedstoneHandler aThis = getTileEntity(world, x, y, z); - if (aThis != null) { - return aThis.shouldCheckWeakPower(world, x, y, z, side); - } - return isNormalCube(); - } - - @Override - public boolean getWeakChanges(IBlockAccess world, int x, int y, int z) { - TileEntityRedstoneHandler aThis = getTileEntity(world, x, y, z); - if (aThis != null) { - return aThis.getWeakChanges(world, x, y, z); - } - return false; - } - - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public abstract IIcon getIcon(final int side, final int meta); - - @Override - public int damageDropped(final int damage) { - return damage; - } - - @Override - public abstract void getSubBlocks(final Item item, final CreativeTabs tab, final List list); - - - /** - * Called whenever the block is added into the world. Args: world, x, y, z - */ - public void onBlockAdded(World aWorld, int aX, int aY, int aZ) { - TileEntityRedstoneHandler aThis = getTileEntity(aWorld, aX, aY, aZ); - - if (!aWorld.isRemote) { - if (aThis.hasUpdatedRecently() && !aWorld.isBlockIndirectlyGettingPowered(aX, aY, aZ)) { - aWorld.scheduleBlockUpdate(aX, aY, aZ, this, 4); - } else if (!aThis.hasUpdatedRecently() && aWorld.isBlockIndirectlyGettingPowered(aX, aY, aZ)) { - aWorld.setBlock(aX, aY, aZ, Blocks.lit_redstone_lamp, 0, 2); - } - } - } - - /** - * Lets the block know when one of its neighbor changes. Doesn't know which - * neighbor changed (coordinates passed are their own) Args: x, y, z, neighbor - * Block - */ - public void onNeighborBlockChange(World aWorld, int aX, int aY, int aZ, Block p_149695_5_) { - - TileEntityRedstoneHandler aThis = getTileEntity(aWorld, aX, aY, aZ); - - if (!aWorld.isRemote) { - if (aThis.hasUpdatedRecently() && !aWorld.isBlockIndirectlyGettingPowered(aX, aY, aZ)) { - aWorld.scheduleBlockUpdate(aX, aY, aZ, this, 4); - } else if (!aThis.hasUpdatedRecently() && aWorld.isBlockIndirectlyGettingPowered(aX, aY, aZ)) { - aWorld.setBlock(aX, aY, aZ, Blocks.lit_redstone_lamp, 0, 2); - } - } - } - - /** - * Ticks the block if it's been scheduled - */ - public void updateTick(World aWorld, int aX, int aY, int aZ, Random p_149674_5_) { - TileEntityRedstoneHandler aTile = getTileEntity(aWorld, aX, aY, aZ); - // Client side handling - if (aTile != null) { - this.setLightLevel(aTile.getLightBrightness()); - } - // Only continue on server - if (aWorld.isRemote) { - return; - } - if (aTile != null) { - if (aTile.isGettingIndirectlyPowered()) { - } - } - } - - public TileEntityRedstoneHandler getTileEntity(IBlockAccess world, int aX, int aY, int aZ) { - TileEntity aTemp = world.getTileEntity(aX, aY, aZ); - if (aTemp != null) { - if (aTemp instanceof TileEntityRedstoneHandler) { - TileEntityRedstoneHandler g = (TileEntityRedstoneHandler) aTemp; - if (g != null) { - return g; - } - } - } - return null; - } - - - /** - * Gets an item for the block being called on. Args: world, x, y, z - */ - @SideOnly(Side.CLIENT) - @Override - public abstract Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_); - - /** - * Returns an item stack containing a single instance of the current block type. - * 'i' is the block's subtype/damage and is ignored for blocks which do not - * support subtypes. Blocks which cannot be harvested should return null. - */ - @Override - protected abstract ItemStack createStackedBlock(int p_149644_1_); - - @Override - public abstract ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int metadata, final int fortune); - - @Override - public abstract Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_); - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java deleted file mode 100644 index 43247110f1..0000000000 --- a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java +++ /dev/null @@ -1,131 +0,0 @@ -package gtPlusPlus.core.block.general.redstone; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Random; - -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.redstone.TileEntityRedstoneHandler; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -public class BlockGenericRedstoneDetector extends BlockGenericRedstone { - - public BlockGenericRedstoneDetector() { - super("detector", "Redstone Detector"); - setTickRandomly(true); - } - - @Override - public TileEntity createNewTileEntity(World world, int p_149915_2_) { - return new TileEntityRedstoneDetector(); - } - - public class TileEntityRedstoneDetector extends TileEntityRedstoneHandler { - public TileEntityRedstoneDetector() { - super(0); - } - - @Override - protected Class<? extends TileEntity> getTileEntityClass() { - return this.getClass(); - } - - @Override - protected String getTileEntityNameForRegistration() { - return "TileEntityRedstoneDetector"; - } - } - - @Override - public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List aList) { - aList.add(ItemUtils.getSimpleStack(this)); - } - - - @Override - public void updateTick(World aWorld, int aX, int aY, int aZ, Random aRand) { - super.updateTick(aWorld, aX, aY, aZ, aRand); - } - - @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { - // TODO Auto-generated method stub - return ItemUtils.getSimpleStack(this).getItem(); - } - - @Override - public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { - // TODO Auto-generated method stub - return ItemUtils.getSimpleStack(this).getItem(); - } - - @Override - protected ItemStack createStackedBlock(int p_149644_1_) { - return ItemUtils.simpleMetaStack(this, p_149644_1_, 1); - } - - public void generateTextureArray(final IIconRegister iicon) { - HashMap<Integer, HashMap<ForgeDirection, IIcon>> aTextures = new HashMap<Integer, HashMap<ForgeDirection, IIcon>>(); - - - //New Block for Each Meta - int aMeta = 0; - { - HashMap<ForgeDirection, IIcon> aTempMap = new HashMap<ForgeDirection, IIcon>(); - aTempMap.put(ForgeDirection.UP, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); - aTempMap.put(ForgeDirection.DOWN, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); - aTempMap.put(ForgeDirection.NORTH, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); - aTempMap.put(ForgeDirection.SOUTH, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); - aTempMap.put(ForgeDirection.EAST, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); - aTempMap.put(ForgeDirection.WEST, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); - aTextures.put(aMeta++, aTempMap); - } - - } - - @Override - public IIcon getIcon(int side, int meta) { - HashMap<ForgeDirection, IIcon> aTemp = getTextureArray().get(meta); - if (aTemp != null) { - IIcon aSide = aTemp.get(ForgeDirection.getOrientation(side)); - if (aSide != null) { - return aSide; - } - else { - //Smart calculate missing sides - if (side <= 1) { - for (int ss = 0; ss < 2; ss++) { - aSide = aTemp.get(ForgeDirection.getOrientation(side)); - if (aSide != null) { - return aSide; - } - } - } - for (int ss = 2; ss < 6; ss++) { - aSide = aTemp.get(ForgeDirection.getOrientation(side)); - if (aSide != null) { - return aSide; - } - } - } - } - return blockIcon; - } - - @Override - public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) { - ArrayList<ItemStack> aDrops = new ArrayList<ItemStack>(); - aDrops.add(ItemUtils.getSimpleStack(this)); - return aDrops; - } - -} diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneEmitter.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneEmitter.java deleted file mode 100644 index df8a929302..0000000000 --- a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneEmitter.java +++ /dev/null @@ -1,5 +0,0 @@ -package gtPlusPlus.core.block.general.redstone; - -public class BlockGenericRedstoneEmitter { - -} diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java deleted file mode 100644 index 0f1f983cd0..0000000000 --- a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java +++ /dev/null @@ -1,201 +0,0 @@ -package gtPlusPlus.core.block.general.redstone; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Random; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.redstone.TileEntityRedstoneHandler; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.world.explosions.ExplosionHandler; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -public class BlockGenericRedstoneTest extends BlockGenericRedstone { - - public BlockGenericRedstoneTest() { - super("test", "Redstone Test"); - setTickRandomly(true); - } - - @Override - public TileEntity createNewTileEntity(World world, int p_149915_2_) { - return new TileEntityRedstoneTest(); - } - - public class TileEntityRedstoneTest extends TileEntityRedstoneHandler { - public TileEntityRedstoneTest() { - super(2); - } - - @Override - public boolean isScrewdriverable() { - return true; - } - - @Override - public boolean onScrewdriverLMB() { - return super.onScrewdriverLMB(); - } - - @Override - public boolean onScrewdriverRMB() { - if (this.mLightValue + 0.0625f <= 1) { - this.mLightValue += 0.0625f; - } - else { - this.mLightValue = 0; - } - this.markForUpdate(); - return true; - } - - @Override - public boolean isMalletable() { - return true; - } - - @Override - public boolean onMalletLMB() { - return super.onMalletLMB(); - } - - @Override - public boolean onMalletRMB() { - this.mLightMode = Utils.invertBoolean(mLightMode); - this.markForUpdate(); - return mLightMode; - } - - @Override - public boolean isWrenchable() { - return true; - } - - @Override - public boolean onWrenchLMB() { - return super.onWrenchLMB(); - } - - @Override - public boolean onWrenchRMB() { - Logger.INFO("Found Wrench"); - ExplosionHandler explode = new ExplosionHandler(); - explode.createExplosion(this.worldObj, null, this.xCoord, this.yCoord, this.zCoord, 1f, false, true); - return true; - } - - @Override - protected Class<? extends TileEntity> getTileEntityClass() { - return this.getClass(); - } - - @Override - protected String getTileEntityNameForRegistration() { - return "TileEntityRedstoneTest"; - } - - @Override - public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) { - return super.isProvidingWeakPower(world, x, y, z, side); - } - - @Override - public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) { - return super.isProvidingStrongPower(world, x, y, z, side); - } - } - - @SuppressWarnings("unchecked") - @Override - public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List aList) { - aList.add(ItemUtils.getSimpleStack(this)); - } - - - @Override - public void updateTick(World aWorld, int aX, int aY, int aZ, Random aRand) { - super.updateTick(aWorld, aX, aY, aZ, aRand); - } - - @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { - return ItemUtils.getSimpleStack(this).getItem(); - } - - @Override - public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { - return ItemUtils.getSimpleStack(this).getItem(); - } - - @Override - protected ItemStack createStackedBlock(int p_149644_1_) { - return ItemUtils.simpleMetaStack(this, p_149644_1_, 1); - } - - public void generateTextureArray(final IIconRegister iicon) { - HashMap<Integer, HashMap<ForgeDirection, IIcon>> aTextures = new HashMap<Integer, HashMap<ForgeDirection, IIcon>>(); - - - //New Block for Each Meta - int aMeta = 0; - { - HashMap<ForgeDirection, IIcon> aTempMap = new HashMap<ForgeDirection, IIcon>(); - aTempMap.put(ForgeDirection.UP, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); - aTempMap.put(ForgeDirection.DOWN, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); - aTempMap.put(ForgeDirection.NORTH, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); - aTempMap.put(ForgeDirection.SOUTH, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); - aTempMap.put(ForgeDirection.EAST, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); - aTempMap.put(ForgeDirection.WEST, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); - aTextures.put(aMeta++, aTempMap); - } - - } - - @Override - public IIcon getIcon(int side, int meta) { - HashMap<ForgeDirection, IIcon> aTemp = getTextureArray().get(meta); - if (aTemp != null) { - IIcon aSide = aTemp.get(ForgeDirection.getOrientation(side)); - if (aSide != null) { - return aSide; - } - else { - //Smart calculate missing sides - if (side <= 1) { - for (int ss = 0; ss < 2; ss++) { - aSide = aTemp.get(ForgeDirection.getOrientation(side)); - if (aSide != null) { - return aSide; - } - } - } - for (int ss = 2; ss < 6; ss++) { - aSide = aTemp.get(ForgeDirection.getOrientation(side)); - if (aSide != null) { - return aSide; - } - } - } - } - return blockIcon; - } - - @Override - public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) { - ArrayList<ItemStack> aDrops = new ArrayList<ItemStack>(); - aDrops.add(ItemUtils.getSimpleStack(this)); - return aDrops; - } - -} diff --git a/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java b/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java deleted file mode 100644 index a4ed895b13..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java +++ /dev/null @@ -1,42 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import net.minecraft.block.material.Material; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.world.IBlockAccess; - -import gtPlusPlus.core.block.base.BasicBlock.BlockTypes; -import gtPlusPlus.core.block.base.MetaBlock; -import gtPlusPlus.core.lib.CORE; - -public class BlockGtFrameBox extends MetaBlock { - - private int[] colours; - private int totalColours; - - public BlockGtFrameBox( - final String unlocalizedName, final Material material, - final BlockTypes blockTypeENUM, final boolean recolour, final int... colour) { - super(unlocalizedName, material, blockTypeENUM.getBlockSoundType()); - this.setBlockTextureName(CORE.MODID + ":" + "blockGtFrame"); - this.setHarvestLevel(blockTypeENUM.getHarvestTool(), 2); - if (recolour && ((colour != null) && (colour.length > 0))){ - this.colours = colour; - this.totalColours = this.colours.length; - } - } - - @Override - public int colorMultiplier(final IBlockAccess p_149720_1_, final int p_149720_2_, - final int p_149720_3_, final int p_149720_4_) { - for (final int i : this.colours){ - - } - return super.colorMultiplier(p_149720_1_, p_149720_2_, p_149720_3_, p_149720_4_); - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - -} diff --git a/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java b/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java deleted file mode 100644 index 7d8b3eb708..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java +++ /dev/null @@ -1,159 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import cpw.mods.fml.common.registry.LanguageRegistry; -import gregtech.common.items.GT_MetaGenerated_Tool_01; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.objects.minecraft.CubicObject; -import gtPlusPlus.core.block.base.BasicTileBlockWithTooltip; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.handler.GuiHandler; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public class CircuitProgrammer extends BasicTileBlockWithTooltip { - - /** - * Determines which tooltip is displayed within the itemblock. - */ - private final int mTooltipID = 4; - - @Override - public int getTooltipID() { - return this.mTooltipID; - } - - @SuppressWarnings("deprecation") - public CircuitProgrammer(){ - super(Material.iron); - LanguageRegistry.addName(this, "Circuit Programmer"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) - { - if (world.isRemote) { - return true; - } - else { - - boolean mDidScrewDriver = false; - // Check For Screwdriver - try { - final ItemStack mHandStack = PlayerUtils.getItemStackInPlayersHand(world, player.getDisplayName()); - final Item mHandItem = mHandStack.getItem(); - if (((mHandItem instanceof GT_MetaGenerated_Tool_01) - && ((mHandItem.getDamage(mHandStack) == 22) || (mHandItem.getDamage(mHandStack) == 150)))) { - final TileEntityCircuitProgrammer tile = (TileEntityCircuitProgrammer) world.getTileEntity(x, y, z); - if (tile != null) { - mDidScrewDriver = tile.onScrewdriverRightClick((byte) side, player, x, y, z); - } - } - } - catch (final Throwable t) {} - - if (!mDidScrewDriver) { - final TileEntity te = world.getTileEntity(x, y, z); - if ((te != null) && (te instanceof TileEntityCircuitProgrammer)){ - player.openGui(GTplusplus.instance, GuiHandler.GUI8, world, x, y, z); - return true; - } - } - else { - return true; - } - - } - return false; - } - - @Override - public int getRenderBlockPass() { - return 1; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - return new TileEntityCircuitProgrammer(); - } - - @Override - public void onBlockAdded(final World world, final int x, final int y, final int z) { - super.onBlockAdded(world, x, y, z); - } - - @Override - public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase entity, final ItemStack stack) { - if (stack.hasDisplayName()) { - ((TileEntityCircuitProgrammer) world.getTileEntity(x,y,z)).setCustomName(stack.getDisplayName()); - } - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - - @Override - public int getMetaCount() { - return 0; - } - - @Override - public String getUnlocalBlockName() { - return "blockCircuitProgrammer"; - } - - @Override - protected float initBlockHardness() { - return 5f; - } - - @Override - protected float initBlockResistance() { - return 1f; - } - - @Override - protected CreativeTabs initCreativeTab() { - return AddToCreativeTab.tabMachines; - } - - @Override - protected String getTileEntityName() { - return "Circuit Programmer"; - } - - @Override - public CubicObject<String>[] getCustomTextureDirectoryObject() { - String[] aTexData = new String[] { - CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_G", - CORE.MODID + ":" + "metro/" + "TEXTURE_TECH_PANEL_B", - CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_I", - CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_I", - CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_I", - CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_I" - }; - CubicObject<String>[] aTextureData = new CubicObject[] {new CubicObject<String>(aTexData)}; - return aTextureData; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/DecayablesChest.java b/src/Java/gtPlusPlus/core/block/machine/DecayablesChest.java deleted file mode 100644 index 15d330defc..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/DecayablesChest.java +++ /dev/null @@ -1,223 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.interfaces.ITileTooltip; -import gtPlusPlus.core.client.renderer.RenderDecayChest; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.handler.GuiHandler; -import gtPlusPlus.core.item.base.itemblock.ItemBlockBasicTile; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; -import gtPlusPlus.core.util.minecraft.InventoryUtils; -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.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public class DecayablesChest extends BlockContainer implements ITileTooltip -{ - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - /** - * Determines which tooltip is displayed within the itemblock. - */ - private final int mTooltipID = 5; - public final int field_149956_a = 0; - - @Override - public int getTooltipID() { - return this.mTooltipID; - } - - @SuppressWarnings("deprecation") - public DecayablesChest() - { - super(Material.iron); - this.setBlockName("blockDecayablesChest"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - this.setHardness(5f); - this.setResistance(1f); - GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockDecayablesChest"); - LanguageRegistry.addName(this, "Lead Lined Box"); - this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); - - } - - /** - * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two - * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. - */ - public boolean isOpaqueCube() - { - return false; - } - - /** - * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) - */ - public boolean renderAsNormalBlock() - { - return false; - } - - /** - * The type of render function that is called for this block - */ - @SideOnly(Side.CLIENT) - public int getRenderType(){ - try { - if (RenderDecayChest.INSTANCE != null){ - return RenderDecayChest.INSTANCE.mRenderID; - } - return super.getRenderType(); - } - catch (NullPointerException n) { - return 0; - } - } - - /** - * Updates the blocks bounds based on its current state. Args: world, x, y, z - */ - public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) - { - if (p_149719_1_.getBlock(p_149719_2_, p_149719_3_, p_149719_4_ - 1) == this) - { - this.setBlockBounds(0.0625F, 0.0F, 0.0F, 0.9375F, 0.875F, 0.9375F); - } - else if (p_149719_1_.getBlock(p_149719_2_, p_149719_3_, p_149719_4_ + 1) == this) - { - this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 1.0F); - } - else if (p_149719_1_.getBlock(p_149719_2_ - 1, p_149719_3_, p_149719_4_) == this) - { - this.setBlockBounds(0.0F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); - } - else if (p_149719_1_.getBlock(p_149719_2_ + 1, p_149719_3_, p_149719_4_) == this) - { - this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 1.0F, 0.875F, 0.9375F); - } - else - { - this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); - } - } - - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) - { - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : this.textureFront); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "DecayablesChest_top"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "DecayablesChest_top"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "DecayablesChest_side"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "DecayablesChest_bottom"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) - { - if (world.isRemote) { - return true; - } - - final TileEntity te = world.getTileEntity(x, y, z); - if ((te != null) && (te instanceof TileEntityDecayablesChest)){ - player.openGui(GTplusplus.instance, GuiHandler.GUI13, world, x, y, z); - return true; - } - return false; - } - - @Override - public int getRenderBlockPass() { - return 1; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - return new TileEntityDecayablesChest(); - } - - @Override - public void onBlockAdded(final World world, final int x, final int y, final int z) { - super.onBlockAdded(world, x, y, z); - } - - @Override - public void breakBlock(final World world, final int x, final int y, final int z, final Block block, final int number) { - InventoryUtils.dropInventoryItems(world, x, y, z, block); - super.breakBlock(world, x, y, z, block, number); - } - - @Override - public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase entity, final ItemStack stack) { - if (stack.hasDisplayName()) { - ((TileEntityDecayablesChest) world.getTileEntity(x,y,z)).setCustomName(stack.getDisplayName()); - } - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - - /*@Override - public void breakBlock(World world, BlockPos pos, IBlockState blockstate) { - TileEntityFishTrap te = (TileEntityFishTrap) world.getTileEntity(pos); - InventoryHelper.dropInventoryItems(world, pos, te); - super.breakBlock(world, pos, blockstate); - } - - - @Override - public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { - if (stack.hasDisplayName()) { - ((TileEntityFishTrap) worldIn.getTileEntity(pos)).setCustomName(stack.getDisplayName()); - } - }*/ - - /** - * Update Chest Meta - Stub - * @param aWorld - * @param xPos - * @param yPos - * @param zPos - */ - @Deprecated - public void func_149954_e(World aWorld, int xPos, int yPos, int zPos) - { - - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/EggBox.java b/src/Java/gtPlusPlus/core/block/machine/EggBox.java deleted file mode 100644 index 630c4b5bc2..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/EggBox.java +++ /dev/null @@ -1,175 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.interfaces.ITileTooltip; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.handler.GuiHandler; -import gtPlusPlus.core.item.base.itemblock.ItemBlockBasicTile; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.TileEntityEggBox; -import gtPlusPlus.core.util.minecraft.InventoryUtils; -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.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public class EggBox extends BlockContainer implements ITileTooltip -{ - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - /** - * Determines which tooltip is displayed within the itemblock. - */ - private final int mTooltipID = 7; - public final int field_149956_a = 0; - - @Override - public int getTooltipID() { - return this.mTooltipID; - } - - @SuppressWarnings("deprecation") - public EggBox(){ - super(Material.wood); - this.setBlockName("blockEggBox"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - this.setHardness(5f); - this.setResistance(1f); - GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockEggBox"); - LanguageRegistry.addName(this, "Egg Box"); - - } - - /** - * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) - */ - public boolean renderAsNormalBlock() - { - return true; - } - - /** - * The type of render function that is called for this block - */ - @SideOnly(Side.CLIENT) - public int getRenderType(){ - return super.getRenderType(); - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) - { - return p_149691_1_ == 1 ? this.textureTop : this.textureFront; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "EggBox_top"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "EggBox_top"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "EggBox_side"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "EggBox_side"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) - { - if (world.isRemote) { - return true; - } - - final TileEntity te = world.getTileEntity(x, y, z); - if ((te != null) && (te instanceof TileEntityEggBox)){ - player.openGui(GTplusplus.instance, GuiHandler.GUI17, world, x, y, z); - return true; - } - return false; - } - - @Override - public int getRenderBlockPass() { - return 0; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - return new TileEntityEggBox(); - } - - @Override - public void onBlockAdded(final World world, final int x, final int y, final int z) { - super.onBlockAdded(world, x, y, z); - } - - @Override - public void breakBlock(final World world, final int x, final int y, final int z, final Block block, final int number) { - InventoryUtils.dropInventoryItems(world, x, y, z, block); - super.breakBlock(world, x, y, z, block, number); - } - - @Override - public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase entity, final ItemStack stack) { - if (stack.hasDisplayName()) { - ((TileEntityEggBox) world.getTileEntity(x,y,z)).setCustomName(stack.getDisplayName()); - } - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - - /*@Override - public void breakBlock(World world, BlockPos pos, IBlockState blockstate) { - TileEntityFishTrap te = (TileEntityFishTrap) world.getTileEntity(pos); - InventoryHelper.dropInventoryItems(world, pos, te); - super.breakBlock(world, pos, blockstate); - } - - - @Override - public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { - if (stack.hasDisplayName()) { - ((TileEntityFishTrap) worldIn.getTileEntity(pos)).setCustomName(stack.getDisplayName()); - } - }*/ - - /** - * Update Chest Meta - Stub - * @param aWorld - * @param xPos - * @param yPos - * @param zPos - */ - @Deprecated - public void func_149954_e(World aWorld, int xPos, int yPos, int zPos) - { - - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/FishTrap.java b/src/Java/gtPlusPlus/core/block/machine/FishTrap.java deleted file mode 100644 index 037ec61ced..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/FishTrap.java +++ /dev/null @@ -1,152 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import 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.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.interfaces.ITileTooltip; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.itemblock.ItemBlockBasicTile; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; -import gtPlusPlus.core.util.minecraft.InventoryUtils; - -public class FishTrap extends BlockContainer implements ITileTooltip -{ - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - /** - * Determines which tooltip is displayed within the itemblock. - */ - private final int mTooltipID = 0; - - @Override - public int getTooltipID() { - return this.mTooltipID; - } - - @SuppressWarnings("deprecation") - public FishTrap() - { - super(Material.iron); - this.setBlockName("blockFishTrap"); - this.setHardness(5f); - this.setResistance(1f); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockFishTrap"); - LanguageRegistry.addName(this, "Fish Catcher"); - - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) - { - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront)); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) - { - if (world.isRemote) { - return true; - } - - final TileEntity te = world.getTileEntity(x, y, z); - if ((te != null) && (te instanceof TileEntityFishTrap)){ - player.openGui(GTplusplus.instance, 5, world, x, y, z); - return true; - } - return false; - } - - @Override - public int getRenderBlockPass() { - return 1; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - return new TileEntityFishTrap(); - } - - @Override - public void onBlockAdded(final World world, final int x, final int y, final int z) { - super.onBlockAdded(world, x, y, z); - } - - @Override - public void breakBlock(final World world, final int x, final int y, final int z, final Block block, final int number) { - InventoryUtils.dropInventoryItems(world, x, y, z, block); - super.breakBlock(world, x, y, z, block, number); - } - - @Override - public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase entity, final ItemStack stack) { - if (stack.hasDisplayName()) { - ((TileEntityFishTrap) world.getTileEntity(x,y,z)).setCustomName(stack.getDisplayName()); - } - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - - /*@Override - public void breakBlock(World world, BlockPos pos, IBlockState blockstate) { - TileEntityFishTrap te = (TileEntityFishTrap) world.getTileEntity(pos); - InventoryHelper.dropInventoryItems(world, pos, te); - super.breakBlock(world, pos, blockstate); - } - - - @Override - public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { - if (stack.hasDisplayName()) { - ((TileEntityFishTrap) worldIn.getTileEntity(pos)).setCustomName(stack.getDisplayName()); - } - }*/ - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/HeliumGenerator.java b/src/Java/gtPlusPlus/core/block/machine/HeliumGenerator.java deleted file mode 100644 index 5dc8604a93..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/HeliumGenerator.java +++ /dev/null @@ -1,95 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -import gtPlusPlus.GTplusplus; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.TileEntityHeliumGenerator; - -public class HeliumGenerator extends BlockContainer -{ - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - - @SuppressWarnings("deprecation") - public HeliumGenerator() - { - super(Material.wood); - this.setBlockName("blockHeliumGenerator"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, "blockHeliumGenerator"); - LanguageRegistry.addName(this, "Helium Generator"); - - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) - { - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront)); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "Chrono/" + "CyberPanel"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "Chrono/" + "CyberPanel"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "Chrono/" + "CyberPanel"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "Chrono/" + "CyberPanel"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) - { - if (world.isRemote) { - return true; - } - - final TileEntity te = world.getTileEntity(x, y, z); - if ((te != null) && (te instanceof TileEntityHeliumGenerator)){ //TODO - player.openGui(GTplusplus.instance, 1, world, x, y, z); //TODO - return true; - } - return false; - } - - @Override - public int getRenderBlockPass() { - return 1; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - return new TileEntityHeliumGenerator(); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_ModularityTable.java b/src/Java/gtPlusPlus/core/block/machine/Machine_ModularityTable.java deleted file mode 100644 index 6f60d39ce7..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_ModularityTable.java +++ /dev/null @@ -1,103 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.interfaces.ITileTooltip; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.itemblock.ItemBlockBasicTile; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; - -public class Machine_ModularityTable extends BlockContainer implements ITileTooltip -{ - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - /** - * Determines which tooltip is displayed within the itemblock. - */ - private final int mTooltipID = 1; - - @Override - public int getTooltipID() { - return this.mTooltipID; - } - - @SuppressWarnings("deprecation") - public Machine_ModularityTable() - { - super(Material.iron); - this.setBlockName("blockModularity"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockModularity"); - LanguageRegistry.addName(this, "Modularity Configurator"); - - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) - { - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront)); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "ModularTable_side"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "ModularTable_top"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "ModularTable_output"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "ModularTable_side"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz){ - if (world.isRemote) { - return true; - } - final TileEntity te = world.getTileEntity(x, y, z); - if ((te != null) && (te instanceof TileEntityModularityTable)){ - player.openGui(GTplusplus.instance, 1, world, x, y, z); - Logger.INFO("Player opened GUI"); - return true; - } - return false; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - return new TileEntityModularityTable(); - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_PestKiller.java b/src/Java/gtPlusPlus/core/block/machine/Machine_PestKiller.java deleted file mode 100644 index 11fa80f439..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_PestKiller.java +++ /dev/null @@ -1,137 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.interfaces.ITileTooltip; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.handler.GuiHandler; -import gtPlusPlus.core.item.base.itemblock.ItemBlockBasicTile; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller; -import gtPlusPlus.core.util.minecraft.InventoryUtils; -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.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public class Machine_PestKiller extends BlockContainer implements ITileTooltip -{ - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - /** - * Determines which tooltip is displayed within the itemblock. - */ - private final int mTooltipID = 6; - - @Override - public int getTooltipID() { - return this.mTooltipID; - } - - @SuppressWarnings("deprecation") - public Machine_PestKiller() - { - super(Material.wood); - this.setBlockName("blockPestKiller"); - this.setHardness(5f); - this.setResistance(1f); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockPestKiller"); - LanguageRegistry.addName(this, "Pest Killer"); - - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int aSide, final int p_149691_2_) - { - return aSide == 1 ? this.textureTop : (aSide == 0 ? this.textureBottom : this.textureFront); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "MACHINE_CASING_FARM_MANAGER_STRUCTURAL"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "MACHINE_PESTKILLER_TOP"); - this.textureBottom = p_149651_1_.registerIcon("planks_acacia"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "MACHINE_CASING_FARM_MANAGER_STRUCTURAL"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) - { - if (world.isRemote) { - return true; - } - - final TileEntity te = world.getTileEntity(x, y, z); - if ((te != null) && (te instanceof TileEntityPestKiller)){ - player.openGui(GTplusplus.instance, GuiHandler.GUI15, world, x, y, z); - return true; - } - return false; - } - - @Override - public int getRenderBlockPass() { - return 0; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - return new TileEntityPestKiller(); - } - - @Override - public void onBlockAdded(final World world, final int x, final int y, final int z) { - super.onBlockAdded(world, x, y, z); - } - - @Override - public void breakBlock(final World world, final int x, final int y, final int z, final Block block, final int number) { - InventoryUtils.dropInventoryItems(world, x, y, z, block); - super.breakBlock(world, x, y, z, block, number); - } - - @Override - public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase entity, final ItemStack stack) { - if (stack.hasDisplayName()) { - ((TileEntityPestKiller) world.getTileEntity(x,y,z)).setCustomName(stack.getDisplayName()); - } - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_PooCollector.java b/src/Java/gtPlusPlus/core/block/machine/Machine_PooCollector.java deleted file mode 100644 index 945cf7b581..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_PooCollector.java +++ /dev/null @@ -1,182 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import java.util.List; -import java.util.Random; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.itemblock.ItemBlockMeta; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.machines.TileEntityAdvPooCollector; -import gtPlusPlus.core.tileentities.machines.TileEntityBaseFluidCollector; -import gtPlusPlus.core.tileentities.machines.TileEntityPooCollector; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -public class Machine_PooCollector extends BlockContainer { - - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureTop2; - @SideOnly(Side.CLIENT) - private IIcon textureSide; - @SideOnly(Side.CLIENT) - private IIcon textureSide2; - - public Machine_PooCollector() { - super(Material.iron); - this.setHardness(5f); - this.setResistance(1f); - this.setBlockName("blockPooCollector"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, ItemBlockMeta.class,"blockPooCollector"); - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int aSide, final int aMeta) { - if (aMeta <= 7) { - blockIcon = textureSide; - return aSide <= 1 ? this.textureTop : this.textureSide; - } - else { - blockIcon = textureSide2; - return aSide <= 1 ? this.textureTop2 : this.textureSide2; - } - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_) { - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "sewer_top"); - this.textureTop2 = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "sewer_adv_top"); - this.textureSide = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "sewer_sides"); - this.textureSide2 = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "sewer_adv_sides"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, - final int side, final float lx, final float ly, final float lz) { - if (world.isRemote) { - return true; - } else { - TileEntityBaseFluidCollector tank = (TileEntityBaseFluidCollector) world.getTileEntity(x, y, z); - if (tank != null) { - Item handItem; - try { - handItem = player.getHeldItem().getItem(); - } catch (Throwable t) { - handItem = null; - } - - //Fluid container code - /*if (handItem != null - && (handItem instanceof IFluidContainerItem || handItem instanceof ItemFluidContainer - || FluidContainerRegistry.isFilledContainer(player.getHeldItem()))) { - if (tank.tank.getFluid() == null) { - try { - if (!FluidContainerRegistry.isFilledContainer(player.getHeldItem())) { - ItemStack handItemStack = player.getHeldItem(); - IFluidContainerItem container = (IFluidContainerItem) handItem; - FluidStack containerFluid = container.getFluid(handItemStack); - container.drain(handItemStack, container.getFluid(handItemStack).amount, true); - tank.tank.setFluid(containerFluid); - } else { - ItemStack handItemStack = player.getHeldItem(); - FluidContainerRegistry.drainFluidContainer(handItemStack); - FluidStack containerFluid = FluidContainerRegistry.getFluidForFilledItem(handItemStack); - ItemStack emptyContainer = FluidContainerRegistry.drainFluidContainer(handItemStack); - player.setItemInUse(emptyContainer, 0); - - tank.tank.setFluid(containerFluid); - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - - }*/ - - if (!tank.mInventory.isEmpty()) { - PlayerUtils.messagePlayer(player, "Inventory contains:"); - PlayerUtils.messagePlayer(player, ItemUtils.getArrayStackNames(tank.mInventory.getRealInventory())); - } - else { - PlayerUtils.messagePlayer(player, "No solids collected yet."); - } - if (tank.tank.getFluid() != null) { - PlayerUtils.messagePlayer(player, "Tank contains " + tank.tank.getFluidAmount() + "L of " - + tank.tank.getFluid().getLocalizedName()); - } - } - } - return true; - } - - @Override - public int getRenderBlockPass() { - return 0; - } - - @Override - public boolean isOpaqueCube() { - return super.isOpaqueCube(); - } - - @Override - public TileEntity createNewTileEntity(final World world, final int aMeta) { - return aMeta <= 7 ? new TileEntityPooCollector() : new TileEntityAdvPooCollector(); - } - - @Override - public void onBlockAdded(World world, int x, int y, int z) { - super.onBlockAdded(world, x, y, z); - } - - @Override - public int getBlockColor() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int damageDropped(final int damage) { - return damage; - } - - @Override - public Item getItemDropped(final int meta, final Random rand, final int fortune) { - return Item.getItemFromBlock(this); - } - - @Override - public int getRenderColor(int aMeta) { - return super.getRenderColor(aMeta); - } - - @Override - public void getSubBlocks(Item aItem, CreativeTabs aTab, List aList) { - aList.add(new ItemStack(aItem, 1, 0)); - aList.add(new ItemStack(aItem, 1, 8)); - } - -} diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_ProjectTable.java b/src/Java/gtPlusPlus/core/block/machine/Machine_ProjectTable.java deleted file mode 100644 index fdb6b1a0a8..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_ProjectTable.java +++ /dev/null @@ -1,164 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.interfaces.ITileTooltip; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.itemblock.ItemBlockBasicTile; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import ic2.core.item.tool.ItemToolWrench; - -@Optional.Interface(iface = "crazypants.enderio.api.tool.ITool", modid = "EnderIO") -public class Machine_ProjectTable extends BlockContainer implements ITileTooltip -{ - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - /** - * Determines which tooltip is displayed within the itemblock. - */ - private final int mTooltipID = 3; - - @Override - public int getTooltipID() { - return this.mTooltipID; - } - - @SuppressWarnings("deprecation") - public Machine_ProjectTable() - { - super(Material.iron); - this.setBlockName("blockProjectBench"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockProjectBench"); - LanguageRegistry.addName(this, "Project Workbench"); - - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) - { - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront)); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "cover_crafting"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) - { - - ItemStack heldItem = null; - if (world.isRemote){ - heldItem = PlayerUtils.getItemStackInPlayersHand(); - } - - boolean holdingWrench = false; - - if (heldItem != null){ - holdingWrench = isWrench(heldItem); - } - - if (world.isRemote) { - return true; - } - - final TileEntity te = world.getTileEntity(x, y, z); - if ((te != null) && (te instanceof TileEntityProjectTable)) - { - if (!holdingWrench){ - player.openGui(GTplusplus.instance, 0, world, x, y, z); - return true; - } - Logger.INFO("Holding a Wrench, doing wrench things instead."); - } - return false; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - return new TileEntityProjectTable(); - } - - public static boolean isWrench(final ItemStack item){ - if (item.getItem() instanceof ItemToolWrench){ - return true; - } - if (LoadedMods.BuildCraft){ - return checkBuildcraftWrench(item); - } - if (LoadedMods.EnderIO){ - return checkEnderIOWrench(item); - } - return false; - } - - @Optional.Method(modid = "EnderIO") - private static boolean checkEnderIOWrench(final ItemStack item) { - if (ReflectionUtils.doesClassExist("crazypants.enderio.api.tool.ITool")) { - Class<?> wrenchClass; - wrenchClass = ReflectionUtils.getClass("crazypants.enderio.api.tool.ITool"); - if (wrenchClass.isInstance(item.getItem())) { - return true; - } - } - return false; - } - - @Optional.Method(modid = "Buildcraft") - private static boolean checkBuildcraftWrench(final ItemStack item) { - if (ReflectionUtils.doesClassExist("buildcraft.api.tools.IToolWrench")) { - Class<?> wrenchClass; - wrenchClass = ReflectionUtils.getClass("buildcraft.api.tools.IToolWrench"); - if (wrenchClass.isInstance(item.getItem())) { - return true; - } - } - return false; - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java b/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java deleted file mode 100644 index dc87b885b9..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java +++ /dev/null @@ -1,131 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.CubicObject; -import gtPlusPlus.core.block.base.BasicTileBlockWithTooltip; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.itemblock.ItemBlockRoundRobinator; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class Machine_RoundRobinator extends BasicTileBlockWithTooltip { - - - public Machine_RoundRobinator(){ - super(Material.iron); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) - { - if (world.isRemote) { - return true; - } - else { - - boolean mDidScrewDriver = false; - // Check For Screwdriver - try { - final ItemStack mHandStack = PlayerUtils.getItemStackInPlayersHand(world, player.getDisplayName()); - if (ItemUtils.isToolScrewdriver(mHandStack)) { - final TileEntityRoundRobinator tile = (TileEntityRoundRobinator) world.getTileEntity(x, y, z); - if (tile != null) { - mDidScrewDriver = tile.onScrewdriverRightClick((byte) side, player, x, y, z); - } - } - } - catch (final Throwable t) {} - - if (!mDidScrewDriver) { - final TileEntity te = world.getTileEntity(x, y, z); - if ((te != null) && (te instanceof TileEntityRoundRobinator)){ - return ((TileEntityRoundRobinator) te).onRightClick((byte) side, player, x, y, z); - } - return false; - } - else { - return true; - } - } - } - - @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - return new TileEntityRoundRobinator(); - } - - @Override - public int getMetaCount() { - return 5; - } - - @Override - public String getUnlocalBlockName() { - return "blockRoundRobinator"; - } - - @Override - protected float initBlockHardness() { - return 1; - } - - @Override - protected float initBlockResistance() { - return 1; - } - - @Override - protected CreativeTabs initCreativeTab() { - return AddToCreativeTab.tabMachines; - } - - @Override - public int getTooltipID() { - return -1; - } - - @Override - protected String getTileEntityName() { - return "Round Robinator"; - } - - @Override - public Class<? extends ItemBlock> getItemBlockClass() { - return ItemBlockRoundRobinator.class; - } - - @Override - public CubicObject<String>[] getCustomTextureDirectoryObject() { - AutoMap<String[]> aTemp = new AutoMap<String[]>(); - for (int i=0;i<5;i++) { - String[] aTexData = new String[] { - CORE.MODID + ":" + "TileEntities/RoundRobinator/Top_"+i, - CORE.MODID + ":" + "TileEntities/RoundRobinator/Top_"+i, - CORE.MODID + ":" + "TileEntities/RoundRobinator/Side_"+i, - CORE.MODID + ":" + "TileEntities/RoundRobinator/Side_"+i, - CORE.MODID + ":" + "TileEntities/RoundRobinator/Side_"+i, - CORE.MODID + ":" + "TileEntities/RoundRobinator/Side_"+i, - }; - aTemp.put(aTexData); - } - AutoMap<CubicObject<String>> aTemp2 = new AutoMap<CubicObject<String>>(); - for (String[] y : aTemp) { - aTemp2.put(new CubicObject<String>(y)); - } - CubicObject<String>[] aTextureData = new CubicObject[] {aTemp2.get(0), aTemp2.get(1), aTemp2.get(2), aTemp2.get(3), aTemp2.get(4)}; - return aTextureData; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_SuperJukebox.java b/src/Java/gtPlusPlus/core/block/machine/Machine_SuperJukebox.java deleted file mode 100644 index 021279f820..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_SuperJukebox.java +++ /dev/null @@ -1,579 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.handler.GuiHandler; -import gtPlusPlus.core.inventories.Inventory_SuperJukebox; -import gtPlusPlus.core.util.math.MathUtils; -import net.minecraft.block.Block; -import net.minecraft.block.BlockJukebox; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemRecord; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -public class Machine_SuperJukebox extends BlockJukebox -{ - @SideOnly(Side.CLIENT) - private IIcon mIcon; - - public Machine_SuperJukebox(){ - this.setBlockName("blockSuperJukebox"); - this.setCreativeTab(CreativeTabs.tabRedstone); - setHardness(2.0F); - setResistance(10.0F); - setStepSound(soundTypePiston); - setBlockTextureName("jukebox"); - GameRegistry.registerBlock(this, "blockSuperJukebox"); - LanguageRegistry.addName(this, "Sir Mixalot [Jukebox]"); - } - - /** - * Gets the block's texture. Args: side, meta - */ - @SideOnly(Side.CLIENT) - public IIcon getIcon(int aSide, int aMeta) - { - return aSide == 1 ? this.mIcon : this.blockIcon; - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) - { - if (world.isRemote) { - return true; - } - - final TileEntity te = world.getTileEntity(x, y, z); - if ((te != null) && (te instanceof TileEntitySuperJukebox)){ - player.openGui(GTplusplus.instance, GuiHandler.GUI14, world, x, y, z); - return true; - } - return false; - - - /* if (aWorld.getBlockMetadata(aX, aY, aZ) == 0) - { - return false; - } - else - { - this.func_149925_e(aWorld, aX, aY, aZ); - return true; - }*/ - } - - /** - * Set the record in the {@link SuperJukebox} {@link TileEntity}. - */ - @Override - public final void func_149926_b(World aWorld, int aX, int aY, int aZ, ItemStack aStackToSet) { - setRecordInJukeBox(aWorld, aX, aY, aZ, aStackToSet); - } - - public void setRecordInJukeBox(World aWorld, int aX, int aY, int aZ, ItemStack aStackToSet) { - if (!aWorld.isRemote) { - TileEntitySuperJukebox tileentityjukebox = (TileEntitySuperJukebox) aWorld.getTileEntity(aX, aY, aZ); - if (tileentityjukebox != null && aStackToSet.getItem() instanceof ItemRecord) { - tileentityjukebox.setCurrentRecord(aStackToSet.copy()); - //aWorld.setBlockMetadataWithNotify(aX, aY, aZ, 1, 2); - } - } - } - - /** - * Function to handle playing of records. - */ - @Override - public final void func_149925_e(World aWorld, int aX, int aY, int aZ) { - playJukeboxRecord(aWorld, aX, aY, aZ); - } - - public void playJukeboxRecord(World aWorld, int aX, int aY, int aZ) { - if (!aWorld.isRemote) { - TileEntitySuperJukebox tileentityjukebox = (TileEntitySuperJukebox) aWorld.getTileEntity(aX, - aY, aZ); - - if (tileentityjukebox != null) { - ItemStack itemstack = tileentityjukebox.func_145856_a(); - - if (itemstack != null) { - - - - aWorld.playAuxSFX(1005, aX, aY, aZ, Item.getIdFromItem(itemstack.getItem())); - //aWorld.playRecord((String) null, aX, aY, aZ); - //tileentityjukebox.func_145857_a((ItemStack) null); - //aWorld.setBlockMetadataWithNotify(aX, aY, aZ, 0, 2); - /*float f = 0.7F; - double d0 = (double) (aWorld.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; - double d1 = (double) (aWorld.rand.nextFloat() * f) + (double) (1.0F - f) * 0.2D + 0.6D; - double d2 = (double) (aWorld.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; - ItemStack itemstack1 = itemstack.copy(); - EntityItem entityitem = new EntityItem(aWorld, (double) aX + d0, - (double) aY + d1, (double) aZ + d2, itemstack1); - entityitem.delayBeforeCanPickup = 10; - aWorld.spawnEntityInWorld(entityitem);*/ - } - } - } - } - - @Override - public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) - { - this.func_149925_e(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_); - super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); - } - - /** - * Drops the block items with a specified chance of dropping the specified items - */ - @Override - public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) - { - if (!p_149690_1_.isRemote) - { - super.dropBlockAsItemWithChance(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, 0); - } - } - - /** - * Returns a new instance of a block's tile entity class. Called on placing the block. - */ - @Override - public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) - { - return new TileEntitySuperJukebox(); - } - - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(this.getTextureName() + "_side"); - this.mIcon = p_149651_1_.registerIcon(this.getTextureName() + "_top"); - } - - public static class TileEntitySuperJukebox extends TileEntityJukebox implements ISidedInventory { - - /** The number of players currently using this chest */ - public int numPlayersUsing; - private ItemStack mCurrentlyPlayingStack; - private final Inventory_SuperJukebox inventoryContents; - private String customName; - - - /* - * Important Data - */ - - public int a_TEST_INT_VAR_1; - public int a_TEST_INT_VAR_2; - public int a_TEST_INT_VAR_3; - public int a_TEST_INT_VAR_4; - - public boolean mIsPlaying = false; - public boolean mIsLooping = false; - public boolean a_TEST_BOOL_VAR_3; - public boolean a_TEST_BOOL_VAR_4; - - - - public TileEntitySuperJukebox() { - this.inventoryContents = new Inventory_SuperJukebox(); - } - - @Override - public void readFromNBT(NBTTagCompound aNBT) { - super.readFromNBT(aNBT); - - if (aNBT.hasKey("RecordItem", 10)) { - this.func_145857_a(ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag("RecordItem"))); - } else if (aNBT.getInteger("Record") > 0) { - this.func_145857_a(new ItemStack(Item.getItemById(aNBT.getInteger("Record")), 1, 0)); - } - - this.inventoryContents.readFromNBT(aNBT.getCompoundTag("ContentsChest")); - if (aNBT.hasKey("CustomName", 8)) { - this.setCustomName(aNBT.getString("CustomName")); - } - - mIsPlaying = aNBT.getBoolean("mIsPlaying"); - mIsLooping = aNBT.getBoolean("mIsLooping"); - - - } - - @Override - public void writeToNBT(NBTTagCompound aNBT) { - super.writeToNBT(aNBT); - - if (this.getCurrentRecord() != null) { - aNBT.setTag("RecordItem", this.func_145856_a().writeToNBT(new NBTTagCompound())); - aNBT.setInteger("Record", Item.getIdFromItem(this.func_145856_a().getItem())); - } - - final NBTTagCompound chestData = new NBTTagCompound(); - this.inventoryContents.writeToNBT(chestData); - aNBT.setTag("ContentsChest", chestData); - if (this.hasCustomInventoryName()) { - aNBT.setString("CustomName", this.getCustomName()); - } - - aNBT.setBoolean("mIsPlaying", mIsPlaying); - aNBT.setBoolean("mIsLooping", mIsLooping); - - } - - /** - * Called to get the internal stack - */ - @Override - public ItemStack func_145856_a() { - return this.mCurrentlyPlayingStack; - } - - /** - * Called to get the internal stack, wraps vanilla function - * {@link func_145856_a}. - */ - public ItemStack getCurrentRecord() { - return func_145856_a(); - } - - /** - * Called to set the internal stack - */ - @Override - public void func_145857_a(ItemStack p_145857_1_) { - this.mCurrentlyPlayingStack = p_145857_1_; - this.markDirty(); - } - - /** - * Called to set the internal stack, wraps vanilla function - * {@link func_145857_a}. - */ - public void setCurrentRecord(ItemStack aStack) { - func_145857_a(aStack); - this.markDirty(); - } - - public Inventory_SuperJukebox getInventory() { - return this.inventoryContents; - } - - - - - - public boolean playRecord(ItemStack aRecord) { - - - - return false; - } - - public boolean stopRecord() { - return openDiscDrive(); - } - - public void setLoopState(boolean isShufflingForever) { - - - - } - - - //Play button pressed - public boolean jukeboxLogicUpdate() { - - if (this.worldObj.isRemote) { - return true; - } - - Logger.INFO("a"); - if (this.mIsPlaying || this.mIsLooping) { - return selectRecordToPlayFromInventoryAndSetViaVanillaHandler(); - } - else { - return stopRecord(); - } - } - - - //Determine which record to play - public boolean selectRecordToPlayFromInventoryAndSetViaVanillaHandler() { - AutoMap<ItemStack> mValidRecords = new AutoMap<ItemStack>(); - for (ItemStack g : this.getInventory().getInventory()) { - if (g != null) { - if (g.getItem() instanceof ItemRecord) { - mValidRecords.put(g); - } - } - } - - Logger.INFO("b1"); - //Select First Record - ItemStack aRecordToPlay; - if (mValidRecords.size() == 0) { - Logger.INFO("bX"); - return false; - } - else { - aRecordToPlay = mValidRecords.get(!mIsLooping ? 0 : MathUtils.randInt(0, (mValidRecords.size()-1))); - } - Logger.INFO("b2 - "+aRecordToPlay.getDisplayName()); - - int aSlotCounter = 0; - for (ItemStack g : this.getInventory().getInventory()) { - if (g != null && aSlotCounter <= 17) { - Logger.INFO("b3 - "+g.getDisplayName()); - if (GT_Utility.areStacksEqual(g, aRecordToPlay, true)) { - IInventory aThisInv = this.getInventory(); - if (aThisInv.getStackInSlot(20) != null) { - openDiscDrive(); - } - - GT_Utility.moveStackFromSlotAToSlotB(aThisInv, aThisInv, aSlotCounter, 20, (byte) 1, (byte) 1, (byte) 1, (byte) 1); - setCurrentRecord(aThisInv.getStackInSlot(20)); - - World aWorld = this.worldObj; - int aX = this.xCoord; - int aY = this.yCoord; - int aZ = this.zCoord; - if (!aWorld.isRemote) { - aRecordToPlay = this.func_145856_a(); - if (aRecordToPlay != null) { - aWorld.playAuxSFX(1005, aX, aY, aZ, Item.getIdFromItem(aRecordToPlay.getItem())); - this.markDirty(); - return true; - } - } - - Logger.INFO("b++"); - this.markDirty(); - return false; - } - } - aSlotCounter++; - } - - - Logger.INFO("b4"); - this.markDirty(); - return false; - } - - - public boolean genericMethodThree(Object a1, Object a2, Object a3, Object a4) { - return false; - } - - - public void vanillaStopJukebox() { - World aWorld = this.worldObj; - int aX = this.xCoord; - int aY = this.yCoord; - int aZ = this.zCoord; - if (!aWorld.isRemote) { - TileEntitySuperJukebox tileentityjukebox = (TileEntitySuperJukebox) aWorld.getTileEntity(aX, aY, aZ); - if (tileentityjukebox != null) { - ItemStack aRecordToPlay = tileentityjukebox.func_145856_a(); - if (aRecordToPlay != null) { - aWorld.playAuxSFX(1005, aX, aY, aZ, 0); - aWorld.playRecord((String) null, aX, aY, aZ); - tileentityjukebox.func_145857_a((ItemStack) null); - this.markDirty(); - } - } - } - } - - public boolean openDiscDrive() { - int aSlotCounter = 17; - - ItemStack g; - - for (int i = 17; i >= 0; i--) { - g = this.getInventory().getInventory()[i]; - if (g == null && aSlotCounter >= 0) { - IInventory aThisInv = this.getInventory(); - GT_Utility.moveStackFromSlotAToSlotB(aThisInv, aThisInv, 20, i, (byte) 1, (byte) 1, (byte) 1, (byte) 1); - vanillaStopJukebox(); - Logger.INFO("b++"); - this.markDirty(); - return true; - - } - } - - - /*for (ItemStack g : this.getInventory().getInventory()) { - if (g == null && aSlotCounter >= 0) { - IInventory aThisInv = this.getInventory(); - GT_Utility.moveStackFromSlotAToSlotB(aThisInv, aThisInv, 20, aSlotCounter, (byte) 1, (byte) 1, (byte) 1, (byte) 1); - vanillaStopJukebox(); - Logger.INFO("b++"); - return true; - - } - aSlotCounter--; - } */ - this.markDirty(); - return false; - } - - - - - - - - - - - public boolean anyPlayerInRange() { - return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, - 32) != null; - } - - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { - if (!nbt.hasKey(tag)) { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public int getSizeInventory() { - return this.getInventory().getSizeInventory()-3; - } - - @Override - public ItemStack getStackInSlot(final int slot) { - return this.getInventory().getStackInSlot(slot); - } - - @Override - public ItemStack decrStackSize(final int slot, final int count) { - return this.getInventory().decrStackSize(slot, count); - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) { - return this.getInventory().getStackInSlotOnClosing(slot); - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) { - this.getInventory().setInventorySlotContents(slot, stack); - } - - @Override - public int getInventoryStackLimit() { - return 1; - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) { - return this.getInventory().isUseableByPlayer(entityplayer); - } - - @Override - public void openInventory() { - if (this.numPlayersUsing < 0) { - this.numPlayersUsing = 0; - } - if (!this.worldObj.isRemote) { - this.numPlayersUsing++; - } - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, - this.numPlayersUsing); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.getInventory().openInventory(); - } - - @Override - public void closeInventory() { - if (!this.worldObj.isRemote) { - this.numPlayersUsing--; - } - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, - this.numPlayersUsing); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.getInventory().closeInventory(); - } - - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - if (slot >= 18) { - return false; - } - return this.getInventory().isItemValidForSlot(slot, itemstack); - } - - private final static int[] SIDED_SLOTS = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}; - - @Override - public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { - return SIDED_SLOTS; - - } - - @Override - public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) { - if (p_102007_1_ >= 18) { - return false; - } - return this.getInventory().isItemValidForSlot(p_102007_1_, p_102007_2_); - } - - @Override - public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) { - if (p_102008_1_ >= 18) { - return false; - } - return this.getInventory().isItemValidForSlot(p_102008_1_, p_102008_2_); - } - - public String getCustomName() { - return this.customName; - } - - public void setCustomName(final String customName) { - this.customName = customName; - } - - @Override - public String getInventoryName() { - return this.hasCustomInventoryName() ? this.customName : "container.SuperJukebox"; - } - - @Override - public boolean hasCustomInventoryName() { - return (this.customName != null) && !this.customName.equals(""); - } - - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_TradeTable.java b/src/Java/gtPlusPlus/core/block/machine/Machine_TradeTable.java deleted file mode 100644 index 5195e0f18c..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_TradeTable.java +++ /dev/null @@ -1,86 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.interfaces.ITileTooltip; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.base.BlockBaseNBT; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; - -public class Machine_TradeTable extends BlockBaseNBT implements ITileTooltip -{ - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - /** - * Determines which tooltip is displayed within the itemblock. - */ - private final int mTooltipID = 2; - - @Override - public int getTooltipID() { - return this.mTooltipID; - } - - public Machine_TradeTable(){ - super(Material.leaves, "blockTradeBench", "Trade-o-Mat"); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_){ - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "SwirlYellow"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "workbench_top"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "SwirlYellow"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "SwirlYellow"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz){ - if (world.isRemote) { - return true; - } - - final TileEntity te = world.getTileEntity(x, y, z); - if ((te != null) && (te instanceof TileEntityTradeTable)) - { - //Utils.LOG_INFO("Clicked on TE - ok"); - player.openGui(GTplusplus.instance, 6, world, x, y, z); - return true; - } - else { - Logger.INFO("Bad TE"); - } - return false; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - return new TileEntityTradeTable(); - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_WireiusDeletus.java b/src/Java/gtPlusPlus/core/block/machine/Machine_WireiusDeletus.java deleted file mode 100644 index e964a9da01..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_WireiusDeletus.java +++ /dev/null @@ -1,5 +0,0 @@ -package gtPlusPlus.core.block.machine; - -public class Machine_WireiusDeletus { //A Block that removes GT Cable and Wire from it's inventory. - -} diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java deleted file mode 100644 index 5c08612042..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java +++ /dev/null @@ -1,152 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import ic2.core.item.tool.ItemToolWrench; - -@Optional.Interface(iface = "crazypants.enderio.api.tool.ITool", modid = "EnderIO") -public class Machine_Workbench extends BlockContainer -{ - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - @SuppressWarnings("deprecation") - public Machine_Workbench() - { - super(Material.iron); - this.setBlockName("blockWorkbenchGT"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, "blockWorkbenchGT"); - LanguageRegistry.addName(this, "Bronze Workbench"); - - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) - { - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront)); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side_cabinet"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_top_crafting"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side_cabinet"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) - { - - ItemStack heldItem = null; - if (world.isRemote){ - heldItem = PlayerUtils.getItemStackInPlayersHand(); - } - - boolean holdingWrench = false; - - if (heldItem != null){ - holdingWrench = isWrench(heldItem); - } - - if (world.isRemote) { - return true; - } - - final TileEntity te = world.getTileEntity(x, y, z); - if ((te != null) && (te instanceof TileEntityWorkbench)) - { - if (!holdingWrench){ - player.openGui(GTplusplus.instance, 3, world, x, y, z); - return true; - } - Logger.INFO("Holding a Wrench, doing wrench things instead."); - } - return false; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - return new TileEntityWorkbench(); - } - - public static boolean isWrench(final ItemStack item){ - if (item.getItem() instanceof ItemToolWrench){ - return true; - } - if (LoadedMods.BuildCraft){ - return checkBuildcraftWrench(item); - } - if (LoadedMods.EnderIO){ - return checkEnderIOWrench(item); - } - return false; - } - - @Optional.Method(modid = "EnderIO") - private static boolean checkEnderIOWrench(final ItemStack item) { - if (ReflectionUtils.doesClassExist("crazypants.enderio.api.tool.ITool")) { - Class<?> wrenchClass; - wrenchClass = ReflectionUtils.getClass("crazypants.enderio.api.tool.ITool"); - if (wrenchClass.isInstance(item.getItem())) { - return true; - } - } - return false; - } - - @Optional.Method(modid = "Buildcraft") - private static boolean checkBuildcraftWrench(final ItemStack item) { - if (ReflectionUtils.doesClassExist("buildcraft.api.tools.IToolWrench")) { - Class<?> wrenchClass; - wrenchClass = ReflectionUtils.getClass("buildcraft.api.tools.IToolWrench"); - if (wrenchClass.isInstance(item.getItem())) { - return true; - } - } - return false; - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java deleted file mode 100644 index af2f9f82e0..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java +++ /dev/null @@ -1,111 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; - -public class Machine_WorkbenchAdvanced extends BlockContainer -{ - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - @SuppressWarnings("deprecation") - public Machine_WorkbenchAdvanced() - { - super(Material.iron); - this.setBlockName("blockWorkbenchGTAdvanced"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, "blockWorkbenchGTAdvanced"); - LanguageRegistry.addName(this, "Advanced Workbench"); - - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) - { - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront)); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "cover_crafting"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) - { - - /*final ItemStack heldItem = PlayerUtils.getItemStackInPlayersHand(player); - if (world.isRemote) { - return true; - } - boolean holdingWrench = false; - - if (heldItem != null){ - if (heldItem.getItem() instanceof ItemToolWrench){ - holdingWrench = true; - } - else if (heldItem.getItem() instanceof IToolWrench){ - holdingWrench = true; - } - else if (heldItem.getItem() instanceof ITool){ - holdingWrench = true; - } - else if (heldItem.getItem() instanceof GT_MetaGenerated_Tool){ - GT_MetaGenerated_Tool testTool = (GT_MetaGenerated_Tool) heldItem.getItem(); - if (testTool.canWrench(player, x, y, z)){ - holdingWrench = true; - } - } - else { - holdingWrench = false; - } - } - - - final TileEntity te = world.getTileEntity(x, y, z); - if ((te != null) && (te instanceof TileEntityWorkbenchAdvanced)) - { - if (!holdingWrench){ - player.openGui(GTplusplus.instance, 4, world, x, y, z); - return true; - } - Utils.LOG_INFO("Holding a Wrench, doing wrench things instead."); - }*/ - return false; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - return new TileEntityWorkbenchAdvanced(128000, 2); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/VolumetricFlaskSetter.java b/src/Java/gtPlusPlus/core/block/machine/VolumetricFlaskSetter.java deleted file mode 100644 index 36ea2af7cc..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/VolumetricFlaskSetter.java +++ /dev/null @@ -1,169 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import cpw.mods.fml.common.registry.LanguageRegistry; -import gregtech.common.items.GT_MetaGenerated_Tool_01; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.objects.minecraft.CubicObject; -import gtPlusPlus.core.block.base.BasicTileBlockWithTooltip; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.handler.GuiHandler; -import gtPlusPlus.core.item.base.itemblock.ItemBlockBasicTile; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.network.packet.Packet_VolumetricFlaskGui2; -import gtPlusPlus.core.tileentities.general.TileEntityVolumetricFlaskSetter; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public class VolumetricFlaskSetter extends BasicTileBlockWithTooltip { - - /** - * Determines which tooltip is displayed within the itemblock. - */ - private final int mTooltipID = 8; - - @Override - public int getTooltipID() { - return this.mTooltipID; - } - - @Override - public Class<? extends ItemBlock> getItemBlockClass() { - return ItemBlockBasicTile.class; - } - - @SuppressWarnings("deprecation") - public VolumetricFlaskSetter(){ - super(Material.iron); - LanguageRegistry.addName(this, "Volumetric Flask Configurator"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) - { - if (world.isRemote) { - return true; - } - else { - - boolean mDidScrewDriver = false; - // Check For Screwdriver - try { - final ItemStack mHandStack = PlayerUtils.getItemStackInPlayersHand(world, player.getDisplayName()); - final Item mHandItem = mHandStack.getItem(); - if (((mHandItem instanceof GT_MetaGenerated_Tool_01) - && ((mHandItem.getDamage(mHandStack) == 22) || (mHandItem.getDamage(mHandStack) == 150)))) { - final TileEntityVolumetricFlaskSetter tile = (TileEntityVolumetricFlaskSetter) world.getTileEntity(x, y, z); - if (tile != null) { - mDidScrewDriver = tile.onScrewdriverRightClick((byte) side, player, x, y, z); - } - } - } - catch (final Throwable t) {} - - if (!mDidScrewDriver) { - final TileEntity te = world.getTileEntity(x, y, z); - if ((te != null) && (te instanceof TileEntityVolumetricFlaskSetter)){ - player.openGui(GTplusplus.instance, GuiHandler.GUI18, world, x, y, z); - TileEntityVolumetricFlaskSetter aTile = (TileEntityVolumetricFlaskSetter) te; - //new Packet_VolumetricFlaskGui2(aTile, aTile.getCustomValue()); - return true; - } - } - else { - return true; - } - - } - return false; - } - - @Override - public int getRenderBlockPass() { - return 1; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - return new TileEntityVolumetricFlaskSetter(); - } - - @Override - public void onBlockAdded(final World world, final int x, final int y, final int z) { - super.onBlockAdded(world, x, y, z); - } - - @Override - public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase entity, final ItemStack stack) { - if (stack.hasDisplayName()) { - ((TileEntityVolumetricFlaskSetter) world.getTileEntity(x,y,z)).setCustomName(stack.getDisplayName()); - } - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - - @Override - public int getMetaCount() { - return 0; - } - - @Override - public String getUnlocalBlockName() { - return "blockVolumetricFlaskSetter"; - } - - @Override - protected float initBlockHardness() { - return 5f; - } - - @Override - protected float initBlockResistance() { - return 1f; - } - - @Override - protected CreativeTabs initCreativeTab() { - return AddToCreativeTab.tabMachines; - } - - @Override - protected String getTileEntityName() { - return "Volumetric Flask Configurator"; - } - - @Override - public CubicObject<String>[] getCustomTextureDirectoryObject() { - String[] aTexData = new String[] { - CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_A", - CORE.MODID + ":" + "metro/" + "TEXTURE_TECH_PANEL_C", - CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_H", - CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_H", - CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_H", - CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_H" - }; - CubicObject<String>[] aTextureData = new CubicObject[] {new CubicObject<String>(aTexData)}; - return aTextureData; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/bedrock/Mining_Head_Fake.java b/src/Java/gtPlusPlus/core/block/machine/bedrock/Mining_Head_Fake.java deleted file mode 100644 index b8f9662ac7..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/bedrock/Mining_Head_Fake.java +++ /dev/null @@ -1,159 +0,0 @@ -package gtPlusPlus.core.block.machine.bedrock; - -import java.util.Random; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.DamageSource; -import net.minecraft.world.Explosion; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.api.objects.random.XSTR; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EntityUtils; - -public class Mining_Head_Fake extends Block{ - - public Mining_Head_Fake(){ - super(Material.lava); - this.setBlockName(Utils.sanitizeString("blockMiningHeadFake")); - this.setBlockTextureName(CORE.MODID + ":" + "blockFrameGt"); - this.setCreativeTab(AddToCreativeTab.tabBlock); - this.setHardness(-1F); - this.setResistance(50000.0F); - this.setHarvestLevel("pickaxe", 10); - this.setStepSound(soundTypeMetal); - //LanguageRegistry.addName(this, "Wither Cage"); - GameRegistry.registerBlock(this, Utils.sanitizeString("blockMiningHeadFake")); - } - - public String GetProperName(){ - return "Hardened Mining Head"; - } - - @Override - @SideOnly(Side.CLIENT) - public int getRenderBlockPass(){ - return 1; - } - - @Override - public boolean isOpaqueCube(){ - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister iIcon){ - this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + "blockFrameGt"); - } - - @Override - public void onBlockExploded(final World world, final int x, final int y, final int z, final Explosion explosion){ - //prevent from being destroyed by wither and nukes. - } - - @Override - public void onBlockDestroyedByExplosion(final World p_149723_1_, final int p_149723_2_, - final int p_149723_3_, final int p_149723_4_, final Explosion p_149723_5_) { - - } - - @Override - public boolean canDropFromExplosion(final Explosion p_149659_1_) { - return false; - } - - @Override - public boolean canEntityDestroy(final IBlockAccess world, final int x, final int y, final int z, - final Entity entity) { - return false; - } - - - //Colour Handling - private static final int mWitherColour = Utils.rgbtoHexValue(175, 64, 32); - - @Override - public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4){ - return mWitherColour; - } - - @Override - public int getRenderColor(final int aMeta) { - return mWitherColour; - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - - @Override - public boolean isCollidable() { - return true; - } - - @Override - public void randomDisplayTick(World world, int posX, int posY, int posZ, - Random rand) { - generateVoidParticlesAroundBlockPos(new BlockPos(posX, posY, posZ, world), 2); - super.randomDisplayTick(world, posX, posY, posZ, rand); - } - - @Override - public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, - Entity ent) { - EntityUtils.doDamage(ent, DamageSource.outOfWorld, 20); - EntityUtils.setEntityOnFire(ent, 100); - super.onEntityCollidedWithBlock(p_149670_1_, p_149670_2_, p_149670_3_, p_149670_4_, ent); - } - - @Override - protected boolean canSilkHarvest() { - return false; - } - - @Override - public boolean canHarvestBlock(EntityPlayer player, int meta) { - return false; - } - - public static void generateVoidParticlesAroundBlockPos(BlockPos Pos, int range){ - for (BlockPos G : Pos.getSurroundingBlocks()) { - int i1 = G.xPos + MathUtils.randInt(0, range) - MathUtils.randInt(0, range); - int j1 = G.yPos + MathUtils.randInt(0, range) - MathUtils.randInt(0, range); - int k1 = G.zPos + MathUtils.randInt(0, range) - MathUtils.randInt(0, range); - - Block block = Pos.world.getBlock(i1, j1, k1); - - if (block.getMaterial() == Material.air){ - - //lava - if (Pos.yPos <= 7) { - Pos.world.spawnParticle("portal", (double)((float)i1 + CORE.RANDOM.nextFloat()), (double)((float)j1 + CORE.RANDOM.nextFloat()), (double)((float)k1 + CORE.RANDOM.nextFloat()), 0.0D, 0.0D, 0.0D); - Pos.world.spawnParticle("lava", (double)((float)i1 + CORE.RANDOM.nextFloat()), (double)((float)j1 + CORE.RANDOM.nextFloat()), (double)((float)k1 + CORE.RANDOM.nextFloat()), 0.0D, 0.0D, 0.0D); - } - else { - Pos.world.spawnParticle("portal", (double)((float)i1 + CORE.RANDOM.nextFloat()), (double)((float)j1 + CORE.RANDOM.nextFloat()), (double)((float)k1 + CORE.RANDOM.nextFloat()), 0.0D, 0.0D, 0.0D); - } - - } - } - } - - -} diff --git a/src/Java/gtPlusPlus/core/block/machine/bedrock/Mining_Pipe_Fake.java b/src/Java/gtPlusPlus/core/block/machine/bedrock/Mining_Pipe_Fake.java deleted file mode 100644 index bba185a0c1..0000000000 --- a/src/Java/gtPlusPlus/core/block/machine/bedrock/Mining_Pipe_Fake.java +++ /dev/null @@ -1,136 +0,0 @@ -package gtPlusPlus.core.block.machine.bedrock; - -import java.util.Random; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.DamageSource; -import net.minecraft.world.Explosion; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EntityUtils; - -public class Mining_Pipe_Fake extends Block{ - - public Mining_Pipe_Fake(){ - super(Material.cactus); - this.setBlockName(Utils.sanitizeString("blockMiningPipeFake")); - this.setBlockTextureName(CORE.MODID + ":" + "blockFrameGt"); - this.setCreativeTab(AddToCreativeTab.tabBlock); - this.setHardness(-1F); - this.setResistance(50000.0F); - this.setHarvestLevel("pickaxe", 8); - this.setStepSound(soundTypeMetal); - //LanguageRegistry.addName(this, "Wither Cage"); - GameRegistry.registerBlock(this, Utils.sanitizeString("blockMiningPipeFake")); - } - - public String GetProperName(){ - return "Hardened Mining Pipe"; - } - - @Override - @SideOnly(Side.CLIENT) - public int getRenderBlockPass(){ - return 1; - } - - @Override - public boolean isOpaqueCube(){ - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister iIcon){ - this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + "blockFrameGt"); - } - - @Override - public void onBlockExploded(final World world, final int x, final int y, final int z, final Explosion explosion){ - //prevent from being destroyed by wither and nukes. - } - - @Override - public void onBlockDestroyedByExplosion(final World p_149723_1_, final int p_149723_2_, - final int p_149723_3_, final int p_149723_4_, final Explosion p_149723_5_) { - - } - - @Override - public boolean canDropFromExplosion(final Explosion p_149659_1_) { - return false; - } - - @Override - public boolean canEntityDestroy(final IBlockAccess world, final int x, final int y, final int z, - final Entity entity) { - return false; - } - - - //Colour Handling - private static final int mWitherColour = Utils.rgbtoHexValue(32, 32, 32); - - @Override - public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4){ - return mWitherColour; - } - - @Override - public int getRenderColor(final int aMeta) { - return mWitherColour; - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - - @Override - public boolean isCollidable() { - return true; - } - - @Override - public void randomDisplayTick(World world, int posX, int posY, int posZ, - Random rand) { - Mining_Head_Fake.generateVoidParticlesAroundBlockPos(new BlockPos(posX, posY, posZ, world), 2); - super.randomDisplayTick(world, posX, posY, posZ, rand); - } - - @Override - public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity ent) { - if (MathUtils.randInt(0, 100) < 5) { - EntityUtils.doDamage(ent, DamageSource.outOfWorld, 1); - } - super.onEntityCollidedWithBlock(p_149670_1_, p_149670_2_, p_149670_3_, p_149670_4_, ent); - } - - @Override - protected boolean canSilkHarvest() { - return false; - } - - @Override - public boolean canHarvestBlock(EntityPlayer player, int meta) { - return false; - } - - - -} diff --git a/src/Java/gtPlusPlus/core/chunkloading/GTPP_ChunkManager.java b/src/Java/gtPlusPlus/core/chunkloading/GTPP_ChunkManager.java deleted file mode 100644 index ddfe9b8227..0000000000 --- a/src/Java/gtPlusPlus/core/chunkloading/GTPP_ChunkManager.java +++ /dev/null @@ -1,217 +0,0 @@ -package gtPlusPlus.core.chunkloading; - -import com.google.common.collect.HashMultimap; -import cpw.mods.fml.common.eventhandler.EventPriority; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gregtech.GT_Mod; -import gregtech.api.enums.GT_Values; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Log; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.interfaces.IChunkLoader; -import gtPlusPlus.core.lib.CORE; - -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.ListMultimap; -import net.minecraft.command.CommandBase; -import net.minecraft.command.ICommandSender; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTUtil; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.ChunkCoordIntPair; -import net.minecraft.world.World; -import net.minecraftforge.common.ForgeChunkManager; -import net.minecraftforge.common.ForgeChunkManager.Ticket; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.world.WorldEvent; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * - * This class handles re-initializing chunks after a server restart - * Credits to Repo-Alt for the original implementation. - * @author Repo-Alt, Alkalus - * - */ -public class GTPP_ChunkManager implements ForgeChunkManager.OrderedLoadingCallback, ForgeChunkManager.PlayerOrderedLoadingCallback { - - - private Map<TileEntity, Ticket> registeredTickets = new HashMap<>(); - - private static GTPP_ChunkManager instance = new GTPP_ChunkManager(); - - public static boolean enableChunkloaders = true; - public static boolean alwaysReloadChunkloaders = false; - public static boolean debugChunkloaders = false; - - public static void init() { - if (enableChunkloaders) { - ForgeChunkManager.setForcedChunkLoadingCallback(GTplusplus.instance, instance); - } - } - - @Override - public void ticketsLoaded(List<Ticket> tickets, World world) {} - - // Determine if tickets should be kept. Based on if the ticket is a machine or working chunk ticket. - // Working chunk tickets are tossed and re-created when the machine re-activates. - // Machine tickets are kept only if the config alwaysReloadChunkloaders is true. Otherwise - // machine chunks are tossed and re-created only when the machine re-activates, similar to a Passive Anchor. - @Override - public List<Ticket> ticketsLoaded(List<Ticket> tickets, World world, int maxTicketCount) { - List<Ticket> validTickets = new ArrayList<>(); - if (alwaysReloadChunkloaders) { - for (Ticket ticket : tickets) { - int x = ticket.getModData().getInteger("OwnerX"); - int y = ticket.getModData().getInteger("OwnerY"); - int z = ticket.getModData().getInteger("OwnerZ"); - if (y > 0) { - TileEntity tile = world.getTileEntity(x, y, z); - if (tile != null && tile instanceof IGregTechTileEntity && ((IGregTechTileEntity)tile).isAllowedToWork()) { - ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(x >> 4, z >> 4)); - if (!registeredTickets.containsKey(tile)) { - registeredTickets.put(tile, ticket); - if (((IGregTechTileEntity)tile).getMetaTileEntity() instanceof IChunkLoader) { - ForgeChunkManager.forceChunk(ticket, ((IChunkLoader)((IGregTechTileEntity)tile).getMetaTileEntity()).getResidingChunk()); - } - validTickets.add(ticket); - } - } - } - } - } - return validTickets; - } - - // Determine if player tickets should be kept. This is where a ticket list per player would be created and maintained. When - // a player join event occurs, their name/UUID/whatevs is compared against tickets on this list and those tickets reactivated. - // Since that info would be maintained/dealt with on a per-player startup, the list returned back to Forge is empty. - @Override - public ListMultimap<String, Ticket> playerTicketsLoaded(ListMultimap<String, Ticket> tickets, World world) { - // Not currently used, so just return an empty list. - return ArrayListMultimap.create(); - } - - // Request a chunk to be loaded for this machine - // may pass null chunk to load just the machine itself, if "alwaysReloadChunkloaders" is enabled in config - static public boolean requestPlayerChunkLoad(TileEntity owner, ChunkCoordIntPair chunkXZ, String player) { - if (!enableChunkloaders) { - return false; - } - if (!alwaysReloadChunkloaders && chunkXZ == null) { - return false; - } - if (debugChunkloaders && chunkXZ != null) { - GT_Log.out.println("GT_ChunkManager: Chunk request: (" + chunkXZ.chunkXPos + ", " + chunkXZ.chunkZPos + ")"); - } - if (instance.registeredTickets.containsKey(owner)) { - ForgeChunkManager.forceChunk(instance.registeredTickets.get(owner), chunkXZ); - } - else { - Ticket ticket = null; - if (player != "") { - ticket = ForgeChunkManager.requestPlayerTicket(GT_Mod.instance, player, owner.getWorldObj(), ForgeChunkManager.Type.NORMAL); - } - else { - ticket = ForgeChunkManager.requestTicket(GT_Mod.instance, owner.getWorldObj(), ForgeChunkManager.Type.NORMAL); - } - if (ticket == null) { - if (debugChunkloaders) { - GT_Log.out.println("GT_ChunkManager: ForgeChunkManager.requestTicket failed"); - } - return false; - } - if (debugChunkloaders) { - GT_Log.out.println("GT_ChunkManager: ticket issued for machine at: (" + owner.xCoord + ", " + owner.yCoord + ", " + owner.zCoord + ")" ); - } - NBTTagCompound tag = ticket.getModData(); - tag.setInteger("OwnerX", owner.xCoord); - tag.setInteger("OwnerY", owner.yCoord); - tag.setInteger("OwnerZ", owner.zCoord); - ForgeChunkManager.forceChunk(ticket, chunkXZ); - if (alwaysReloadChunkloaders) { - ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(owner.xCoord << 4, owner.zCoord << 4)); - } - instance.registeredTickets.put(owner, ticket); - } - return true; - } - - static public boolean requestChunkLoad(TileEntity owner, ChunkCoordIntPair chunkXZ) { - return requestPlayerChunkLoad(owner, chunkXZ, ""); - } - - static public void releaseChunk(TileEntity owner, ChunkCoordIntPair chunkXZ) { - if (!enableChunkloaders) { - return; - } - Ticket ticket = instance.registeredTickets.get(owner); - if (ticket != null) { - if (debugChunkloaders) { - GT_Log.out.println("GT_ChunkManager: Chunk release: (" + chunkXZ.chunkXPos + ", " + chunkXZ.chunkZPos + ")"); - } - ForgeChunkManager.unforceChunk(ticket, chunkXZ); - } - } - - static public void releaseTicket(TileEntity owner) { - if (!enableChunkloaders) { - return; - } - Ticket ticket = instance.registeredTickets.get(owner); - if (ticket != null) { - if (debugChunkloaders) { - GT_Log.out.println("GT_ChunkManager: ticket released by machine at: (" + owner.xCoord + ", " + owner.yCoord + ", " + owner.zCoord + ")" ); - for (ChunkCoordIntPair chunk : ticket.getChunkList()) { - GT_Log.out.println("GT_ChunkManager: Chunk release: (" + chunk.chunkXPos + ", " + chunk.chunkZPos + ")"); - } - } - ForgeChunkManager.releaseTicket(ticket); - instance.registeredTickets.remove(owner); - } - } - - public static void printTickets() { - if (!debugChunkloaders) { - return; - } - GT_Log.out.println("GT_ChunkManager: Start forced chunks dump:"); - instance.registeredTickets.forEach((machine, ticket) -> { - GT_Log.out.print("GT_ChunkManager: Chunks forced by the machine at (" + machine.xCoord + ", " + machine.yCoord + ", " + machine.zCoord + ")"); - if (ticket.isPlayerTicket()) { - GT_Log.out.print(" Owner: " + ticket.getPlayerName()); - } - GT_Log.out.print(" :"); - for (ChunkCoordIntPair c : ticket.getChunkList()) { - GT_Log.out.print("("); - GT_Log.out.print(c.chunkXPos); - GT_Log.out.print(", "); - GT_Log.out.print(c.chunkZPos); - GT_Log.out.print("), "); - } - }); - GT_Log.out.println("GT_ChunkManager: End forced chunks dump:"); - } - public static class DebugCommand extends CommandBase { - @Override - public String getCommandName() { - return "gtpp:dump_chunks"; - } - @Override - public int getRequiredPermissionLevel() { - return 0; - } - @Override - public String getCommandUsage(ICommandSender sender) { - return "/" + getCommandName(); - } - @Override - public void processCommand(ICommandSender sender, String[] args) { - printTickets(); - } - } -} diff --git a/src/Java/gtPlusPlus/core/chunkloading/StaticChunkFunctions.java b/src/Java/gtPlusPlus/core/chunkloading/StaticChunkFunctions.java deleted file mode 100644 index 36d9fa670c..0000000000 --- a/src/Java/gtPlusPlus/core/chunkloading/StaticChunkFunctions.java +++ /dev/null @@ -1,63 +0,0 @@ -package gtPlusPlus.core.chunkloading; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.api.interfaces.IChunkLoader; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaTileEntityChunkLoader; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.ChunkCoordIntPair; - -public class StaticChunkFunctions { - - public static void saveNBTDataForTileEntity(IGregTechTileEntity aBaseMetaTileEntity, NBTTagCompound aNBT) { - IChunkLoader aTileEntity = getChunkLoader(aBaseMetaTileEntity); - aNBT.setBoolean("chunkLoadingEnabled", aTileEntity.getChunkLoadingActive()); - aNBT.setBoolean("isChunkloading", aTileEntity.getResidingChunk() != null); - if (aTileEntity.getResidingChunk() != null) { - aNBT.setInteger("loadedChunkXPos", aTileEntity.getResidingChunk().chunkXPos); - aNBT.setInteger("loadedChunkZPos", aTileEntity.getResidingChunk().chunkZPos); - } - } - - public static void loadNBTDataForTileEntity(IGregTechTileEntity aBaseMetaTileEntity, NBTTagCompound aNBT) { - IChunkLoader aTileEntity = getChunkLoader(aBaseMetaTileEntity); - if (aNBT.hasKey("chunkLoadingEnabled")) { - aTileEntity.setChunkLoadingActive(aNBT.getBoolean("chunkLoadingEnabled")); - } - if (aNBT.getBoolean("isChunkloading")) { - aTileEntity.setResidingChunk(new ChunkCoordIntPair(aNBT.getInteger("loadedChunkXPos"), aNBT.getInteger("loadedChunkZPos"))); - } - } - - public static void onRemoval(IGregTechTileEntity aBaseMetaTileEntity) { - IChunkLoader aTileEntity = getChunkLoader(aBaseMetaTileEntity); - if (aTileEntity.getChunkLoadingActive()) { - GTPP_ChunkManager.releaseTicket((TileEntity)aBaseMetaTileEntity); - } - } - - public static boolean onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - IChunkLoader aTileEntity = getChunkLoader(aBaseMetaTileEntity); - if (aBaseMetaTileEntity.isServerSide() && aTileEntity.getResidingChunk() != null && !aTileEntity.getDoesWorkChunkNeedReload() && !aBaseMetaTileEntity.isAllowedToWork()) { - // if machine has stopped, stop chunkloading - GTPP_ChunkManager.releaseTicket((TileEntity)aBaseMetaTileEntity); - aTileEntity.setDoesWorkChunkNeedReload(true); - return false; - } - return true; - } - - public static void createInitialWorkingChunk(IGregTechTileEntity aBaseMetaTileEntity, int aChunkX, int aDrillZ) { - final int centerX = aChunkX >> 4; - final int centerZ = aDrillZ >> 4; - IChunkLoader aTileEntity = getChunkLoader(aBaseMetaTileEntity); - aTileEntity.addChunkToLoadedList(new ChunkCoordIntPair(centerX, centerZ)); - GTPP_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity.getMetaTileEntity(), aTileEntity.getResidingChunk()); - aTileEntity.setDoesWorkChunkNeedReload(false); - } - - private static final IChunkLoader getChunkLoader(IGregTechTileEntity aTile) { - return (IChunkLoader) ((IGregTechTileEntity)aTile).getMetaTileEntity(); - } - -} diff --git a/src/Java/gtPlusPlus/core/client/CustomTextureSet.java b/src/Java/gtPlusPlus/core/client/CustomTextureSet.java deleted file mode 100644 index 400503b2fa..0000000000 --- a/src/Java/gtPlusPlus/core/client/CustomTextureSet.java +++ /dev/null @@ -1,28 +0,0 @@ -package gtPlusPlus.core.client; - -import gregtech.api.enums.TextureSet; - -public class CustomTextureSet extends TextureSet { - - public static enum TextureSets { - - REFINED(), - GEM_A(), - ENRICHED(), - NUCLEAR; - - private final CustomTextureSet A; - - private TextureSets (){ - A = new CustomTextureSet(this.name().toUpperCase()); - } - public CustomTextureSet get() { - return A; - } - } - - public CustomTextureSet(String aSetName) { - super(aSetName); - } - -} diff --git a/src/Java/gtPlusPlus/core/client/model/ModelBatKing.java b/src/Java/gtPlusPlus/core/client/model/ModelBatKing.java deleted file mode 100644 index ac64dee26a..0000000000 --- a/src/Java/gtPlusPlus/core/client/model/ModelBatKing.java +++ /dev/null @@ -1,120 +0,0 @@ -package gtPlusPlus.core.client.model; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.entity.monster.EntityBatKing; -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.passive.EntityBat; -import net.minecraft.util.MathHelper; - -@SideOnly(Side.CLIENT) -public class ModelBatKing extends ModelBase -{ - private ModelRenderer batHead; - /** The body box of the bat model. */ - private ModelRenderer batBody; - /** The inner right wing box of the bat model. */ - private ModelRenderer batRightWing; - /** The inner left wing box of the bat model. */ - private ModelRenderer batLeftWing; - /** The outer right wing box of the bat model. */ - private ModelRenderer batOuterRightWing; - /** The outer left wing box of the bat model. */ - private ModelRenderer batOuterLeftWing; - - public ModelBatKing() - { - this.textureWidth = 64; - this.textureHeight = 64; - - this.batHead = new ModelRenderer(this, 0, 0); - this.batHead.addBox(-3.0F, -3.0F, -3.0F, 6, 6, 6); - ModelRenderer modelrenderer = new ModelRenderer(this, 24, 0); - modelrenderer.addBox(-4.0F, -6.0F, -2.0F, 3, 4, 1); - this.batHead.addChild(modelrenderer); - ModelRenderer modelrenderer1 = new ModelRenderer(this, 24, 0); - modelrenderer1.mirror = true; - modelrenderer1.addBox(1.0F, -6.0F, -2.0F, 3, 4, 1); - this.batHead.addChild(modelrenderer1); - this.batBody = new ModelRenderer(this, 0, 16); - this.batBody.addBox(-3.0F, 4.0F, -3.0F, 6, 12, 6); - this.batBody.setTextureOffset(0, 34).addBox(-5.0F, 16.0F, 0.0F, 10, 6, 1); - this.batRightWing = new ModelRenderer(this, 42, 0); - this.batRightWing.addBox(-12.0F, 1.0F, 1.5F, 10, 16, 1); - this.batOuterRightWing = new ModelRenderer(this, 24, 16); - this.batOuterRightWing.setRotationPoint(-12.0F, 1.0F, 1.5F); - this.batOuterRightWing.addBox(-8.0F, 1.0F, 0.0F, 8, 12, 1); - this.batLeftWing = new ModelRenderer(this, 42, 0); - this.batLeftWing.mirror = true; - this.batLeftWing.addBox(2.0F, 1.0F, 1.5F, 10, 16, 1); - this.batOuterLeftWing = new ModelRenderer(this, 24, 16); - this.batOuterLeftWing.mirror = true; - this.batOuterLeftWing.setRotationPoint(12.0F, 1.0F, 1.5F); - this.batOuterLeftWing.addBox(0.0F, 1.0F, 0.0F, 8, 12, 1); - this.batBody.addChild(this.batRightWing); - this.batBody.addChild(this.batLeftWing); - this.batRightWing.addChild(this.batOuterRightWing); - this.batLeftWing.addChild(this.batOuterLeftWing); - } - - /** - * not actually sure this is size, is not used as of now, but the model would be recreated if the value changed and - * it seems a good match for a bats size - */ - public int getBatSize() - { - return 72; - } - - /** - * Sets the models various rotation angles then renders the model. - */ - public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_) - { - EntityBatKing entitybat = (EntityBatKing)p_78088_1_; - float f6; - - if (entitybat.getIsBatHanging()) - { - f6 = (180F / (float)Math.PI); - this.batHead.rotateAngleX = p_78088_6_ / (180F / (float)Math.PI); - this.batHead.rotateAngleY = (float)Math.PI - p_78088_5_ / (180F / (float)Math.PI); - this.batHead.rotateAngleZ = (float)Math.PI; - this.batHead.setRotationPoint(0.0F, -2.0F, 0.0F); - this.batRightWing.setRotationPoint(-3.0F, 0.0F, 3.0F); - this.batLeftWing.setRotationPoint(3.0F, 0.0F, 3.0F); - this.batBody.rotateAngleX = (float)Math.PI; - this.batRightWing.rotateAngleX = -0.15707964F; - this.batRightWing.rotateAngleY = -((float)Math.PI * 2F / 5F); - this.batOuterRightWing.rotateAngleY = -1.7278761F; - this.batLeftWing.rotateAngleX = this.batRightWing.rotateAngleX; - this.batLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY; - this.batOuterLeftWing.rotateAngleY = -this.batOuterRightWing.rotateAngleY; - } - else - { - f6 = (180F / (float)Math.PI); - this.batHead.rotateAngleX = p_78088_6_ / (180F / (float)Math.PI); - this.batHead.rotateAngleY = p_78088_5_ / (180F / (float)Math.PI); - this.batHead.rotateAngleZ = 0.0F; - this.batHead.setRotationPoint(0.0F, 0.0F, 0.0F); - this.batRightWing.setRotationPoint(0.0F, 0.0F, 0.0F); - this.batLeftWing.setRotationPoint(0.0F, 0.0F, 0.0F); - this.batBody.rotateAngleX = ((float)Math.PI / 4F) + MathHelper.cos(p_78088_4_ * 0.1F) * 0.15F; - this.batBody.rotateAngleY = 0.0F; - this.batRightWing.rotateAngleY = MathHelper.cos(p_78088_4_ * 1.3F) * (float)Math.PI * 0.25F; - this.batLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY; - this.batOuterRightWing.rotateAngleY = this.batRightWing.rotateAngleY * 0.5F; - this.batOuterLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY * 0.5F; - } - - - GL11.glScalef(4, 4, 4); - this.batHead.render(p_78088_7_); - this.batBody.render(p_78088_7_); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/model/ModelDecayChest.java b/src/Java/gtPlusPlus/core/client/model/ModelDecayChest.java deleted file mode 100644 index c116dcf115..0000000000 --- a/src/Java/gtPlusPlus/core/client/model/ModelDecayChest.java +++ /dev/null @@ -1,46 +0,0 @@ -package gtPlusPlus.core.client.model; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; - -@SideOnly(Side.CLIENT) -public class ModelDecayChest extends ModelBase -{ - /** The chest lid in the chest's model. */ - public ModelRenderer chestLid = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64); - /** The model of the bottom of the chest. */ - public ModelRenderer chestBelow; - /** The chest's knob in the chest model. */ - public ModelRenderer chestKnob; - - public ModelDecayChest() - { - this.chestLid.addBox(0.0F, -5.0F, -14.0F, 14, 5, 14, 0.0F); - this.chestLid.rotationPointX = 1.0F; - this.chestLid.rotationPointY = 7.0F; - this.chestLid.rotationPointZ = 15.0F; - this.chestKnob = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64); - this.chestKnob.addBox(-1.0F, -2.0F, -15.0F, 2, 4, 1, 0.0F); - this.chestKnob.rotationPointX = 8.0F; - this.chestKnob.rotationPointY = 7.0F; - this.chestKnob.rotationPointZ = 15.0F; - this.chestBelow = (new ModelRenderer(this, 0, 19)).setTextureSize(64, 64); - this.chestBelow.addBox(0.0F, 0.0F, 0.0F, 14, 10, 14, 0.0F); - this.chestBelow.rotationPointX = 1.0F; - this.chestBelow.rotationPointY = 6.0F; - this.chestBelow.rotationPointZ = 1.0F; - } - - /** - * This method renders out all parts of the chest model. - */ - public void renderAll() - { - this.chestKnob.rotateAngleX = this.chestLid.rotateAngleX; - this.chestLid.render(0.0625F); - this.chestKnob.render(0.0625F); - this.chestBelow.render(0.0625F); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/model/ModelEggBox.java b/src/Java/gtPlusPlus/core/client/model/ModelEggBox.java deleted file mode 100644 index 0aef4eb7b0..0000000000 --- a/src/Java/gtPlusPlus/core/client/model/ModelEggBox.java +++ /dev/null @@ -1,65 +0,0 @@ -package gtPlusPlus.core.client.model; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.client.model.tabula.ModelTabulaBase; -import gtPlusPlus.core.client.renderer.tabula.RenderTabulaBase; -import gtPlusPlus.core.tileentities.general.TileEntityEggBox; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; - -/** - * ModelEggBox - Alkalus - * Created using Tabula 4.1.1 - */ -public class ModelEggBox extends ModelTabulaBase { - - private final AutoMap<Pair<ModelRenderer, Float>> mParts = new AutoMap<Pair<ModelRenderer, Float>>(); - - private static RenderTabulaBase mRendererInstance; - - public ModelRenderer bottom; - //EggBox_full.png - - public ModelEggBox() { - super(64, 64); - this.textureWidth = 64; - this.textureHeight = 64; - - this.bottom = new ModelRenderer(this, 0, 19); - this.bottom.setRotationPoint(1.0F, 6.0F, 1.0F); - this.bottom.addBox(0.0F, 0.0F, 0.0F, 14, 10, 14, 0.0F); - mParts.add(new Pair<ModelRenderer, Float>(bottom, 0f)); - } - - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - //Logger.INFO("Rendering EggBox"); - this.bottom.render(f5); - } - - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } - - @Override - protected AutoMap<Pair<ModelRenderer, Float>> getModelParts() { - AutoMap<Pair<ModelRenderer, Float>> aParts = new AutoMap<Pair<ModelRenderer, Float>>(); - aParts.add(new Pair<ModelRenderer, Float>(bottom, 0.0625F)); - return aParts; - //return mParts; - } - - public static RenderTabulaBase getRenderer() { - if (mRendererInstance == null) { - mRendererInstance = new RenderTabulaBase(new ModelEggBox(), "textures/blocks/TileEntities/EggBox_full.png", TileEntityEggBox.class); - } - return mRendererInstance; - } -} diff --git a/src/Java/gtPlusPlus/core/client/model/ModelGiantChicken.java b/src/Java/gtPlusPlus/core/client/model/ModelGiantChicken.java deleted file mode 100644 index f7fb92f550..0000000000 --- a/src/Java/gtPlusPlus/core/client/model/ModelGiantChicken.java +++ /dev/null @@ -1,112 +0,0 @@ -package gtPlusPlus.core.client.model; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.model.ModelChicken; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.util.MathHelper; -import org.lwjgl.opengl.GL11; - -@SideOnly(Side.CLIENT) -public class ModelGiantChicken extends ModelChicken{ - - public ModelGiantChicken() - { - byte b0 = 16; - this.head = new ModelRenderer(this, 0, 0); - this.head.addBox(-2.0F, -6.0F, -2.0F, 4, 6, 3, 0.0F); - this.head.setRotationPoint(0.0F, (float)(-1 + b0), -4.0F); - this.bill = new ModelRenderer(this, 14, 0); - this.bill.addBox(-2.0F, -4.0F, -4.0F, 4, 2, 2, 0.0F); - this.bill.setRotationPoint(0.0F, (float)(-1 + b0), -4.0F); - this.chin = new ModelRenderer(this, 14, 4); - this.chin.addBox(-1.0F, -2.0F, -3.0F, 2, 2, 2, 0.0F); - this.chin.setRotationPoint(0.0F, (float)(-1 + b0), -4.0F); - this.body = new ModelRenderer(this, 0, 9); - this.body.addBox(-3.0F, -4.0F, -3.0F, 6, 8, 6, 0.0F); - this.body.setRotationPoint(0.0F, (float)b0, 0.0F); - this.rightLeg = new ModelRenderer(this, 26, 0); - this.rightLeg.addBox(-1.0F, 0.0F, -3.0F, 3, 5, 3); - this.rightLeg.setRotationPoint(-2.0F, (float)(3 + b0), 1.0F); - this.leftLeg = new ModelRenderer(this, 26, 0); - this.leftLeg.addBox(-1.0F, 0.0F, -3.0F, 3, 5, 3); - this.leftLeg.setRotationPoint(1.0F, (float)(3 + b0), 1.0F); - this.rightWing = new ModelRenderer(this, 24, 13); - this.rightWing.addBox(0.0F, 0.0F, -3.0F, 1, 4, 6); - this.rightWing.setRotationPoint(-4.0F, (float)(-3 + b0), 0.0F); - this.leftWing = new ModelRenderer(this, 24, 13); - this.leftWing.addBox(-1.0F, 0.0F, -3.0F, 1, 4, 6); - this.leftWing.setRotationPoint(4.0F, (float)(-3 + b0), 0.0F); - } - - /** - * Sets the models various rotation angles then renders the model. - */ - public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_) - { - this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_, p_78088_1_); - - if (this.isChild) - { - float f6 = 1.0F; - GL11.glPushMatrix(); - GL11.glTranslatef(0.0F, 0F, 0F); - this.head.render(p_78088_7_); - this.bill.render(p_78088_7_); - this.chin.render(p_78088_7_); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glScalef(1.0F * f6, 1.0F * f6, 1.0F * f6); - GL11.glTranslatef(0.0F, 0F, 0.0F); - this.body.render(p_78088_7_); - this.rightLeg.render(p_78088_7_); - this.leftLeg.render(p_78088_7_); - this.rightWing.render(p_78088_7_); - this.leftWing.render(p_78088_7_); - GL11.glPopMatrix(); - //super.render(p_78088_1_, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_); - } - else - { - float f6 = 2.0F; - GL11.glPushMatrix(); - GL11.glScalef(1.0F * f6, 1.0F * f6, 1.0F * f6); - GL11.glTranslatef(0.0F, -0.85F, 0F); - this.head.render(p_78088_7_); - this.bill.render(p_78088_7_); - this.chin.render(p_78088_7_); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glScalef(1.0F * f6, 1.0F * f6, 1.0F * f6); - GL11.glTranslatef(0.0F, -0.75F, 0.0F); - this.body.render(p_78088_7_); - this.rightLeg.render(p_78088_7_); - this.leftLeg.render(p_78088_7_); - this.rightWing.render(p_78088_7_); - this.leftWing.render(p_78088_7_); - GL11.glPopMatrix(); - } - } - - /** - * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms - * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how - * "far" arms and legs can swing at most. - */ - public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) - { - this.head.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); - this.head.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); - this.bill.rotateAngleX = this.head.rotateAngleX; - this.bill.rotateAngleY = this.head.rotateAngleY; - this.chin.rotateAngleX = this.head.rotateAngleX; - this.chin.rotateAngleY = this.head.rotateAngleY; - this.body.rotateAngleX = ((float)Math.PI / 2F); - this.rightLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_; - this.leftLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_; - this.rightWing.rotateAngleZ = p_78087_3_; - this.leftWing.rotateAngleZ = -p_78087_3_; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/model/ModelSickBlaze.java b/src/Java/gtPlusPlus/core/client/model/ModelSickBlaze.java deleted file mode 100644 index 455df761cb..0000000000 --- a/src/Java/gtPlusPlus/core/client/model/ModelSickBlaze.java +++ /dev/null @@ -1,93 +0,0 @@ -package gtPlusPlus.core.client.model; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.model.ModelBlaze; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.util.MathHelper; - -@SideOnly(Side.CLIENT) -public class ModelSickBlaze extends ModelBlaze -{ - /** The sticks that fly around the Blaze. */ - private ModelRenderer[] blazeSticks = new ModelRenderer[24]; - private ModelRenderer blazeHead; - - public ModelSickBlaze() - { - for (int i = 0; i < this.blazeSticks.length; ++i) - { - this.blazeSticks[i] = new ModelRenderer(this, 0, 16); - this.blazeSticks[i].addBox(0.0F, 0.0F, 0.0F, 2, 8, 2); - } - - this.blazeHead = new ModelRenderer(this, 0, 0); - this.blazeHead.addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8); - } - - @Override - public int func_78104_a() - { - return 8; - } - - /** - * Sets the models various rotation angles then renders the model. - */ - @Override - public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_) - { - this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_, p_78088_1_); - this.blazeHead.render(p_78088_7_); - - for (int i = 0; i < this.blazeSticks.length; ++i) - { - this.blazeSticks[i].render(p_78088_7_); - } - } - - /** - * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms - * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how - * "far" arms and legs can swing at most. - */ - @Override - public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) - { - float f6 = p_78087_3_ * (float)Math.PI * -0.1F; - int i; - - for (i = 0; i < 4; ++i) - { - this.blazeSticks[i].rotationPointY = -2.0F + MathHelper.cos((i * 2 + p_78087_3_) * 0.25F); - this.blazeSticks[i].rotationPointX = MathHelper.cos(f6) * 9.0F; - this.blazeSticks[i].rotationPointZ = MathHelper.sin(f6) * 9.0F; - ++f6; - } - - f6 = ((float)Math.PI / 4F) + p_78087_3_ * (float)Math.PI * 0.03F; - - for (i = 4; i < 8; ++i) - { - this.blazeSticks[i].rotationPointY = 2.0F + MathHelper.cos((i * 2 + p_78087_3_) * 0.25F); - this.blazeSticks[i].rotationPointX = MathHelper.cos(f6) * 7.0F; - this.blazeSticks[i].rotationPointZ = MathHelper.sin(f6) * 7.0F; - ++f6; - } - - f6 = 0.47123894F + p_78087_3_ * (float)Math.PI * -0.05F; - - for (i = 8; i < 12; ++i) - { - this.blazeSticks[i].rotationPointY = 11.0F + MathHelper.cos((i * 1.5F + p_78087_3_) * 0.5F); - this.blazeSticks[i].rotationPointX = MathHelper.cos(f6) * 5.0F; - this.blazeSticks[i].rotationPointZ = MathHelper.sin(f6) * 5.0F; - ++f6; - } - - this.blazeHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); - this.blazeHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/model/ModelStaballoyConstruct.java b/src/Java/gtPlusPlus/core/client/model/ModelStaballoyConstruct.java deleted file mode 100644 index aa23635b4d..0000000000 --- a/src/Java/gtPlusPlus/core/client/model/ModelStaballoyConstruct.java +++ /dev/null @@ -1,120 +0,0 @@ -package gtPlusPlus.core.client.model; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.model.ModelIronGolem; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.monster.EntityIronGolem; - -@SideOnly(Side.CLIENT) -public class ModelStaballoyConstruct extends ModelIronGolem -{ - - public ModelStaballoyConstruct() - { - this(0.0F); - } - - public ModelStaballoyConstruct(float p_i1161_1_) - { - this(p_i1161_1_, -7.0F); - } - - public ModelStaballoyConstruct(float p_i1162_1_, float p_i1162_2_) - { - short short1 = 128; - short short2 = 128; - this.ironGolemHead = (new ModelRenderer(this)).setTextureSize(short1, short2); - this.ironGolemHead.setRotationPoint(0.0F, 0.0F + p_i1162_2_, -2.0F); - this.ironGolemHead.setTextureOffset(0, 0).addBox(-4.0F, -12.0F, -5.5F, 8, 10, 8, p_i1162_1_); - this.ironGolemHead.setTextureOffset(24, 0).addBox(-1.0F, -5.0F, -7.5F, 2, 4, 2, p_i1162_1_); - this.ironGolemBody = (new ModelRenderer(this)).setTextureSize(short1, short2); - this.ironGolemBody.setRotationPoint(0.0F, 0.0F + p_i1162_2_, 0.0F); - this.ironGolemBody.setTextureOffset(0, 40).addBox(-9.0F, -2.0F, -6.0F, 18, 12, 11, p_i1162_1_); - this.ironGolemBody.setTextureOffset(0, 70).addBox(-4.5F, 10.0F, -3.0F, 9, 5, 6, p_i1162_1_ + 0.5F); - this.ironGolemRightArm = (new ModelRenderer(this)).setTextureSize(short1, short2); - this.ironGolemRightArm.setRotationPoint(0.0F, -7.0F, 0.0F); - this.ironGolemRightArm.setTextureOffset(60, 21).addBox(-13.0F, -2.5F, -3.0F, 4, 30, 6, p_i1162_1_); - this.ironGolemLeftArm = (new ModelRenderer(this)).setTextureSize(short1, short2); - this.ironGolemLeftArm.setRotationPoint(0.0F, -7.0F, 0.0F); - this.ironGolemLeftArm.setTextureOffset(60, 58).addBox(9.0F, -2.5F, -3.0F, 4, 30, 6, p_i1162_1_); - this.ironGolemLeftLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(short1, short2); - this.ironGolemLeftLeg.setRotationPoint(-4.0F, 18.0F + p_i1162_2_, 0.0F); - this.ironGolemLeftLeg.setTextureOffset(37, 0).addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, p_i1162_1_); - this.ironGolemRightLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(short1, short2); - this.ironGolemRightLeg.mirror = true; - this.ironGolemRightLeg.setTextureOffset(60, 0).setRotationPoint(5.0F, 18.0F + p_i1162_2_, 0.0F); - this.ironGolemRightLeg.addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, p_i1162_1_); - } - - /** - * Sets the models various rotation angles then renders the model. - */ - @Override - public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_) - { - this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_, p_78088_1_); - this.ironGolemHead.render(p_78088_7_); - this.ironGolemBody.render(p_78088_7_); - this.ironGolemLeftLeg.render(p_78088_7_); - this.ironGolemRightLeg.render(p_78088_7_); - this.ironGolemRightArm.render(p_78088_7_); - this.ironGolemLeftArm.render(p_78088_7_); - } - - /** - * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms - * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how - * "far" arms and legs can swing at most. - */ - @Override - public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) - { - this.ironGolemHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); - this.ironGolemHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); - this.ironGolemLeftLeg.rotateAngleX = -1.5F * this.func_78172_a(p_78087_1_, 13.0F) * p_78087_2_; - this.ironGolemRightLeg.rotateAngleX = 1.5F * this.func_78172_a(p_78087_1_, 13.0F) * p_78087_2_; - this.ironGolemLeftLeg.rotateAngleY = 0.0F; - this.ironGolemRightLeg.rotateAngleY = 0.0F; - } - - /** - * Used for easily adding entity-dependent animations. The second and third float params here are the same second - * and third as in the setRotationAngles method. - */ - @Override - public void setLivingAnimations(EntityLivingBase p_78086_1_, float p_78086_2_, float p_78086_3_, float p_78086_4_) - { - EntityIronGolem entityirongolem = (EntityIronGolem)p_78086_1_; - int i = entityirongolem.getAttackTimer(); - - if (i > 0) - { - this.ironGolemRightArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a(i - p_78086_4_, 10.0F); - this.ironGolemLeftArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a(i - p_78086_4_, 10.0F); - } - else - { - int j = entityirongolem.getHoldRoseTick(); - - if (j > 0) - { - this.ironGolemRightArm.rotateAngleX = -0.8F + 0.025F * this.func_78172_a(j, 70.0F); - this.ironGolemLeftArm.rotateAngleX = 0.0F; - } - else - { - this.ironGolemRightArm.rotateAngleX = (-0.2F + 1.5F * this.func_78172_a(p_78086_2_, 13.0F)) * p_78086_3_; - this.ironGolemLeftArm.rotateAngleX = (-0.2F - 1.5F * this.func_78172_a(p_78086_2_, 13.0F)) * p_78086_3_; - } - } - } - - private float func_78172_a(float p_78172_1_, float p_78172_2_) - { - return (Math.abs(p_78172_1_ % p_78172_2_ - p_78172_2_ * 0.5F) - p_78172_2_ * 0.25F) / (p_78172_2_ * 0.25F); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/model/tabula/ModelTabulaBase.java b/src/Java/gtPlusPlus/core/client/model/tabula/ModelTabulaBase.java deleted file mode 100644 index 3a0cbb636b..0000000000 --- a/src/Java/gtPlusPlus/core/client/model/tabula/ModelTabulaBase.java +++ /dev/null @@ -1,38 +0,0 @@ -package gtPlusPlus.core.client.model.tabula; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; - -/** - * ModelEggBox - Alkalus - * Created using Tabula 4.1.1 - */ -public abstract class ModelTabulaBase extends ModelBase { - - - public ModelTabulaBase(int aTexWidth, int aTexHeight) { - this.textureWidth = aTexWidth; - this.textureHeight = aTexHeight; - } - - protected abstract AutoMap<Pair<ModelRenderer, Float>> getModelParts(); - - public void renderAll() { - for (Pair<ModelRenderer, Float> part : getModelParts()) { - //Logger.INFO("Rendering EggBox"); - part.getKey().render(part.getValue()); - } - } - - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } -} diff --git a/src/Java/gtPlusPlus/core/client/renderer/CustomItemBlockRenderer.java b/src/Java/gtPlusPlus/core/client/renderer/CustomItemBlockRenderer.java deleted file mode 100644 index f40357495a..0000000000 --- a/src/Java/gtPlusPlus/core/client/renderer/CustomItemBlockRenderer.java +++ /dev/null @@ -1,85 +0,0 @@ -package gtPlusPlus.core.client.renderer; - -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraftforge.client.IItemRenderer; - -import org.lwjgl.opengl.GL11; - - -/** - * Easy way of rendering an item which should look like a block. - * Borrowed. - * - * @author King Lemming - * - */ -public class CustomItemBlockRenderer implements IItemRenderer { - - public static CustomItemBlockRenderer instance = new CustomItemBlockRenderer(); - - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return true; - } - - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - return true; - } - - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - - double offset = -0.5; - if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) { - offset = 0; - } else if (type == ItemRenderType.ENTITY) { - GL11.glScalef(0.5F, 0.5F, 0.5F); - } - renderItemAsBlock((RenderBlocks) data[0], item, offset, offset, offset); - } - - public static void renderItemAsBlock(RenderBlocks renderer, ItemStack item, double translateX, double translateY, double translateZ) { - - renderTextureAsBlock(renderer, item.getIconIndex(), translateX, translateY, translateZ); - } - - public static void renderTextureAsBlock(RenderBlocks renderer, IIcon texture, double translateX, double translateY, double translateZ) { - - Tessellator tessellator = Tessellator.instance; - Block block = Blocks.stone; - - if (texture == null) { - return; - } - renderer.setRenderBoundsFromBlock(block); - GL11.glTranslated(translateX, translateY, translateZ); - tessellator.startDrawingQuads(); - - tessellator.setNormal(0.0F, -1.0F, 0.0F); - renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, texture); - - tessellator.setNormal(0.0F, 1.0F, 0.0F); - renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, texture); - - tessellator.setNormal(0.0F, 0.0F, -1.0F); - renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, texture); - - tessellator.setNormal(0.0F, 0.0F, 1.0F); - renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, texture); - - tessellator.setNormal(-1.0F, 0.0F, 0.0F); - renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, texture); - - tessellator.setNormal(1.0F, 0.0F, 0.0F); - renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, texture); - - tessellator.draw(); - } - -} diff --git a/src/Java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java b/src/Java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java deleted file mode 100644 index a0b34d3b0b..0000000000 --- a/src/Java/gtPlusPlus/core/client/renderer/CustomOreBlockRenderer.java +++ /dev/null @@ -1,2083 +0,0 @@ -package gtPlusPlus.core.client.renderer; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; -import cpw.mods.fml.client.registry.RenderingRegistry; -import gregtech.api.interfaces.ITexture; -import gtPlusPlus.api.interfaces.ITexturedBlock; -import gtPlusPlus.api.objects.Logger; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; - -public class CustomOreBlockRenderer implements ISimpleBlockRenderingHandler { - - public static CustomOreBlockRenderer INSTANCE; - public final int mRenderID; - - public CustomOreBlockRenderer() { - INSTANCE = this; - this.mRenderID = RenderingRegistry.getNextAvailableRenderId(); - RenderingRegistry.registerBlockHandler(this); - Logger.INFO("Registered Custom Ore Block Renderer."); - } - - public boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer) { - Block tTileEntity = aBlock; - if ((tTileEntity instanceof ITexturedBlock)) { - return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer, new ITexture[][]{((ITexturedBlock) tTileEntity).getTexture((byte) 0), ((ITexturedBlock) tTileEntity).getTexture((byte) 1), ((ITexturedBlock) tTileEntity).getTexture((byte) 2), ((ITexturedBlock) tTileEntity).getTexture((byte) 3), ((ITexturedBlock) tTileEntity).getTexture((byte) 4), ((ITexturedBlock) tTileEntity).getTexture((byte) 5)}); - } - return false; - } - - public boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer, ITexture[][] aTextures) { - aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - aRenderer.setRenderBoundsFromBlock(aBlock); - int l = aBlock.colorMultiplier(aWorld, aX, aY, aZ); - float RED = (float)(l >> 16 & 255) / 255.0F; - float GREEN = (float)(l >> 8 & 255) / 255.0F; - float BLUE = (float)(l & 255) / 255.0F; - - if (Minecraft.isAmbientOcclusionEnabled() && aBlock.getLightValue() == 0){ - if (RenderBlocks.getInstance().partialRenderBounds){ - return INSTANCE.renderStandardBlockWithAmbientOcclusionPartial(aWorld, aRenderer, aTextures, aBlock, aX, aY, aZ, RED, GREEN, BLUE); - } - else { - return INSTANCE.renderStandardBlockWithAmbientOcclusion(aWorld, aRenderer, aTextures, aBlock, aX, aY, aZ, RED, GREEN, BLUE); - } - } - else { - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[0], true); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[1], true); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[2], true); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[3], true); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[4], true); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[5], true); - } - return true; - } - - public static void renderFaceYNeg(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[][] aIcon) { - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aIcon[0], true); - } - public static void renderFaceYPos(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[][] aIcon) { - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aIcon[1], true); - } - public static void renderFaceZNeg(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[][] aIcon) { - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aIcon[2], true); - } - public static void renderFaceZPos(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[][] aIcon) { - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aIcon[3], true); - } - public static void renderFaceXNeg(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[][] aIcon) { - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aIcon[4], true); - } - public static void renderFaceXPos(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[][] aIcon) { - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aIcon[5], true); - } - - public static void renderNegativeYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) { - if (aWorld != null) { - if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY - 1, aZ, 0))) { - return; - } - Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY - 1 : aY, aZ)); - } - if (aIcon != null) { - for (int i = 0; i < aIcon.length; i++) { - if (aIcon[i] != null) { - aIcon[i].renderYNeg(aRenderer, aBlock, aX, aY, aZ); - } - } - } - aRenderer.flipTexture = false; - } - - public static void renderPositiveYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) { - if (aWorld != null) { - if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY + 1, aZ, 1))) { - return; - } - Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY + 1 : aY, aZ)); - } - if (aIcon != null) { - for (int i = 0; i < aIcon.length; i++) { - if (aIcon[i] != null) { - aIcon[i].renderYPos(aRenderer, aBlock, aX, aY, aZ); - } - } - } - aRenderer.flipTexture = false; - } - - public static void renderNegativeZFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) { - if (aWorld != null) { - if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY, aZ - 1, 2))) { - return; - } - Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ - 1 : aZ)); - } - aRenderer.flipTexture = (!aFullBlock); - if (aIcon != null) { - for (int i = 0; i < aIcon.length; i++) { - if (aIcon[i] != null) { - aIcon[i].renderZNeg(aRenderer, aBlock, aX, aY, aZ); - } - } - } - aRenderer.flipTexture = false; - } - - public static void renderPositiveZFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) { - if (aWorld != null) { - if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY, aZ + 1, 3))) { - return; - } - Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ + 1 : aZ)); - } - if (aIcon != null) { - for (int i = 0; i < aIcon.length; i++) { - if (aIcon[i] != null) { - aIcon[i].renderZPos(aRenderer, aBlock, aX, aY, aZ); - } - } - } - aRenderer.flipTexture = false; - } - - public static void renderNegativeXFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) { - if (aWorld != null) { - if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX - 1, aY, aZ, 4))) { - return; - } - Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX - 1 : aX, aY, aZ)); - } - if (aIcon != null) { - for (int i = 0; i < aIcon.length; i++) { - if (aIcon[i] != null) { - aIcon[i].renderXNeg(aRenderer, aBlock, aX, aY, aZ); - } - } - } - aRenderer.flipTexture = false; - } - - public static void renderPositiveXFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) { - if (aWorld != null) { - if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX + 1, aY, aZ, 5))) { - return; - } - Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX + 1 : aX, aY, aZ)); - } - aRenderer.flipTexture = (!aFullBlock); - if (aIcon != null) { - for (int i = 0; i < aIcon.length; i++) { - if (aIcon[i] != null) { - aIcon[i].renderXPos(aRenderer, aBlock, aX, aY, aZ); - } - } - } - aRenderer.flipTexture = false; - } - - public void renderInventoryBlock(Block aBlock, int aMeta, int aModelID, RenderBlocks aRenderer) { - aBlock.setBlockBoundsForItemRender(); - aRenderer.setRenderBoundsFromBlock(aBlock); - GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F); - renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedBlock) aBlock).getTexture((byte) 0), true); - Tessellator.instance.draw(); - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F); - renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedBlock) aBlock).getTexture((byte) 1), true); - Tessellator.instance.draw(); - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F); - renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedBlock) aBlock).getTexture((byte) 2), true); - Tessellator.instance.draw(); - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F); - renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedBlock) aBlock).getTexture((byte) 3), true); - Tessellator.instance.draw(); - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F); - renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedBlock) aBlock).getTexture((byte) 4), true); - Tessellator.instance.draw(); - Tessellator.instance.startDrawingQuads(); - Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F); - renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, ((ITexturedBlock) aBlock).getTexture((byte) 5), true); - Tessellator.instance.draw(); - aBlock.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - aRenderer.setRenderBoundsFromBlock(aBlock); - GL11.glTranslatef(0.5F, 0.5F, 0.5F); - } - - public boolean renderWorldBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, int aModelID, RenderBlocks aRenderer) { - blockAccess = aWorld; - return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer); - } - - public boolean shouldRender3DInInventory(int aModel) { - return true; - } - - public int getRenderId() { - return this.mRenderID; - } - - public void setRenderBounds(double p_147782_1_, double p_147782_3_, double p_147782_5_, double p_147782_7_, double p_147782_9_, double p_147782_11_) - { - if (!this.lockBlockBounds) - { - this.renderMinX = p_147782_1_; - this.renderMaxX = p_147782_7_; - this.renderMinY = p_147782_3_; - this.renderMaxY = p_147782_9_; - this.renderMinZ = p_147782_5_; - this.renderMaxZ = p_147782_11_; - this.partialRenderBounds = this.minecraftRB.gameSettings.ambientOcclusion >= 2 && (this.renderMinX > 0.0D || this.renderMaxX < 1.0D || this.renderMinY > 0.0D || this.renderMaxY < 1.0D || this.renderMinZ > 0.0D || this.renderMaxZ < 1.0D); - } - } - - /** - * Like setRenderBounds, but automatically pulling the bounds from the given Block. - */ - public void setRenderBoundsFromBlock(Block block) - { - if (!this.lockBlockBounds) - { - this.renderMinX = block.getBlockBoundsMinX(); - this.renderMaxX = block.getBlockBoundsMaxX(); - this.renderMinY = block.getBlockBoundsMinY(); - this.renderMaxY = block.getBlockBoundsMaxY(); - this.renderMinZ = block.getBlockBoundsMinZ(); - this.renderMaxZ = block.getBlockBoundsMaxZ(); - this.partialRenderBounds = this.minecraftRB.gameSettings.ambientOcclusion >= 2 && (this.renderMinX > 0.0D || this.renderMaxX < 1.0D || this.renderMinY > 0.0D || this.renderMaxY < 1.0D || this.renderMinZ > 0.0D || this.renderMaxZ < 1.0D); - } - } - - /** - * Vanilla Variables - */ - - /** The minimum X value for rendering (default 0.0). */ - public double renderMinX; - /** The maximum X value for rendering (default 1.0). */ - public double renderMaxX; - /** The minimum Y value for rendering (default 0.0). */ - public double renderMinY; - /** The maximum Y value for rendering (default 1.0). */ - public double renderMaxY; - /** The minimum Z value for rendering (default 0.0). */ - public double renderMinZ; - /** The maximum Z value for rendering (default 1.0). */ - public double renderMaxZ; - public boolean lockBlockBounds; - public boolean partialRenderBounds; - public final Minecraft minecraftRB = RenderBlocks.getInstance().minecraftRB; - public int uvRotateEast; - public int uvRotateWest; - public int uvRotateSouth; - public int uvRotateNorth; - public int uvRotateTop; - public int uvRotateBottom; - /** Whether ambient occlusion is enabled or not */ - public boolean enableAO; - /** Used as a scratch variable for ambient occlusion on the north/bottom/east corner. */ - public float aoLightValueScratchXYZNNN; - /** Used as a scratch variable for ambient occlusion between the bottom face and the north face. */ - public float aoLightValueScratchXYNN; - /** Used as a scratch variable for ambient occlusion on the north/bottom/west corner. */ - public float aoLightValueScratchXYZNNP; - /** Used as a scratch variable for ambient occlusion between the bottom face and the east face. */ - public float aoLightValueScratchYZNN; - /** Used as a scratch variable for ambient occlusion between the bottom face and the west face. */ - public float aoLightValueScratchYZNP; - /** Used as a scratch variable for ambient occlusion on the south/bottom/east corner. */ - public float aoLightValueScratchXYZPNN; - /** Used as a scratch variable for ambient occlusion between the bottom face and the south face. */ - public float aoLightValueScratchXYPN; - /** Used as a scratch variable for ambient occlusion on the south/bottom/west corner. */ - public float aoLightValueScratchXYZPNP; - /** Used as a scratch variable for ambient occlusion on the north/top/east corner. */ - public float aoLightValueScratchXYZNPN; - /** Used as a scratch variable for ambient occlusion between the top face and the north face. */ - public float aoLightValueScratchXYNP; - /** Used as a scratch variable for ambient occlusion on the north/top/west corner. */ - public float aoLightValueScratchXYZNPP; - /** Used as a scratch variable for ambient occlusion between the top face and the east face. */ - public float aoLightValueScratchYZPN; - /** Used as a scratch variable for ambient occlusion on the south/top/east corner. */ - public float aoLightValueScratchXYZPPN; - /** Used as a scratch variable for ambient occlusion between the top face and the south face. */ - public float aoLightValueScratchXYPP; - /** Used as a scratch variable for ambient occlusion between the top face and the west face. */ - public float aoLightValueScratchYZPP; - /** Used as a scratch variable for ambient occlusion on the south/top/west corner. */ - public float aoLightValueScratchXYZPPP; - /** Used as a scratch variable for ambient occlusion between the north face and the east face. */ - public float aoLightValueScratchXZNN; - /** Used as a scratch variable for ambient occlusion between the south face and the east face. */ - public float aoLightValueScratchXZPN; - /** Used as a scratch variable for ambient occlusion between the north face and the west face. */ - public float aoLightValueScratchXZNP; - /** Used as a scratch variable for ambient occlusion between the south face and the west face. */ - public float aoLightValueScratchXZPP; - /** Ambient occlusion brightness XYZNNN */ - public int aoBrightnessXYZNNN; - /** Ambient occlusion brightness XYNN */ - public int aoBrightnessXYNN; - /** Ambient occlusion brightness XYZNNP */ - public int aoBrightnessXYZNNP; - /** Ambient occlusion brightness YZNN */ - public int aoBrightnessYZNN; - /** Ambient occlusion brightness YZNP */ - public int aoBrightnessYZNP; - /** Ambient occlusion brightness XYZPNN */ - public int aoBrightnessXYZPNN; - /** Ambient occlusion brightness XYPN */ - public int aoBrightnessXYPN; - /** Ambient occlusion brightness XYZPNP */ - public int aoBrightnessXYZPNP; - /** Ambient occlusion brightness XYZNPN */ - public int aoBrightnessXYZNPN; - /** Ambient occlusion brightness XYNP */ - public int aoBrightnessXYNP; - /** Ambient occlusion brightness XYZNPP */ - public int aoBrightnessXYZNPP; - /** Ambient occlusion brightness YZPN */ - public int aoBrightnessYZPN; - /** Ambient occlusion brightness XYZPPN */ - public int aoBrightnessXYZPPN; - /** Ambient occlusion brightness XYPP */ - public int aoBrightnessXYPP; - /** Ambient occlusion brightness YZPP */ - public int aoBrightnessYZPP; - /** Ambient occlusion brightness XYZPPP */ - public int aoBrightnessXYZPPP; - /** Ambient occlusion brightness XZNN */ - public int aoBrightnessXZNN; - /** Ambient occlusion brightness XZPN */ - public int aoBrightnessXZPN; - /** Ambient occlusion brightness XZNP */ - public int aoBrightnessXZNP; - /** Ambient occlusion brightness XZPP */ - public int aoBrightnessXZPP; - /** Brightness top left */ - public int brightnessTopLeft; - /** Brightness bottom left */ - public int brightnessBottomLeft; - /** Brightness bottom right */ - public int brightnessBottomRight; - /** Brightness top right */ - public int brightnessTopRight; - /** Red color value for the top left corner */ - public float colorRedTopLeft; - /** Red color value for the bottom left corner */ - public float colorRedBottomLeft; - /** Red color value for the bottom right corner */ - public float colorRedBottomRight; - /** Red color value for the top right corner */ - public float colorRedTopRight; - /** Green color value for the top left corner */ - public float colorGreenTopLeft; - /** Green color value for the bottom left corner */ - public float colorGreenBottomLeft; - /** Green color value for the bottom right corner */ - public float colorGreenBottomRight; - /** Green color value for the top right corner */ - public float colorGreenTopRight; - /** Blue color value for the top left corner */ - public float colorBlueTopLeft; - /** Blue color value for the bottom left corner */ - public float colorBlueBottomLeft; - /** Blue color value for the bottom right corner */ - public float colorBlueBottomRight; - /** Blue color value for the top right corner */ - public float colorBlueTopRight; - /** If set to >=0, all block faces will be rendered using this texture index */ - public IIcon overrideBlockTexture; - /** - * Clear override block texture - */ - public void clearOverrideBlockTexture() - { - this.overrideBlockTexture = null; - } - - public boolean hasOverrideBlockTexture() - { - return this.overrideBlockTexture != null; - } - - public IIcon getBlockIcon(Block block, IBlockAccess access, int x, int y, int z, int side) - { - return this.getIconSafe(block.getIcon(access, x, y, z, side)); - } - - public IIcon getBlockIconFromSideAndMetadata(Block block, int side, int meta) - { - return this.getIconSafe(block.getIcon(side, meta)); - } - - public IIcon getBlockIconFromSide(Block block, int side) - { - return this.getIconSafe(block.getBlockTextureFromSide(side)); - } - - public IIcon getBlockIcon(Block block) - { - return this.getIconSafe(block.getBlockTextureFromSide(1)); - } - - public IIcon getIconSafe(IIcon iicon) - { - if (iicon == null) - { - iicon = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno"); - } - - return (IIcon)iicon; - } - - IBlockAccess blockAccess = RenderBlocks.getInstance().blockAccess; - - public boolean renderStandardBlockWithAmbientOcclusion(IBlockAccess aWorld, RenderBlocks aRenderer, ITexture[][] aTextures, Block block, int xPos, int yPos, int zPos, float R, float G, float B) - { - this.enableAO = true; - boolean flag = false; - float f3 = 0.0F; - float f4 = 0.0F; - float f5 = 0.0F; - float f6 = 0.0F; - boolean flag1 = true; - int l = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos); - Tessellator tessellator = Tessellator.instance; - tessellator.setBrightness(983055); - - if (this.getBlockIcon(block).getIconName().equals("grass_top")) - { - flag1 = false; - } - else if (this.hasOverrideBlockTexture()) - { - flag1 = false; - } - - boolean flag2; - boolean flag3; - boolean flag4; - boolean flag5; - int i1; - float f7; - - if (RenderBlocks.getInstance().renderAllFaces || block.shouldSideBeRendered(blockAccess, xPos, yPos - 1, zPos, 0)) - { - if (this.renderMinY <= 0.0D) - { - --yPos; - } - - this.aoBrightnessXYNN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos); - this.aoBrightnessYZNN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos - 1); - this.aoBrightnessYZNP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos + 1); - this.aoBrightnessXYPN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos); - this.aoLightValueScratchXYNN = blockAccess.getBlock(xPos - 1, yPos, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchYZNN = blockAccess.getBlock(xPos, yPos, zPos - 1).getAmbientOcclusionLightValue(); - this.aoLightValueScratchYZNP = blockAccess.getBlock(xPos, yPos, zPos + 1).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXYPN = blockAccess.getBlock(xPos + 1, yPos, zPos).getAmbientOcclusionLightValue(); - flag2 = blockAccess.getBlock(xPos + 1, yPos - 1, zPos).getCanBlockGrass(); - flag3 = blockAccess.getBlock(xPos - 1, yPos - 1, zPos).getCanBlockGrass(); - flag4 = blockAccess.getBlock(xPos, yPos - 1, zPos + 1).getCanBlockGrass(); - flag5 = blockAccess.getBlock(xPos, yPos - 1, zPos - 1).getCanBlockGrass(); - - if (!flag5 && !flag3) - { - this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXYNN; - this.aoBrightnessXYZNNN = this.aoBrightnessXYNN; - } - else - { - this.aoLightValueScratchXYZNNN = blockAccess.getBlock(xPos - 1, yPos, zPos - 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos - 1); - } - - if (!flag4 && !flag3) - { - this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXYNN; - this.aoBrightnessXYZNNP = this.aoBrightnessXYNN; - } - else - { - this.aoLightValueScratchXYZNNP = blockAccess.getBlock(xPos - 1, yPos, zPos + 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos + 1); - } - - if (!flag5 && !flag2) - { - this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXYPN; - this.aoBrightnessXYZPNN = this.aoBrightnessXYPN; - } - else - { - this.aoLightValueScratchXYZPNN = blockAccess.getBlock(xPos + 1, yPos, zPos - 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos - 1); - } - - if (!flag4 && !flag2) - { - this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXYPN; - this.aoBrightnessXYZPNP = this.aoBrightnessXYPN; - } - else - { - this.aoLightValueScratchXYZPNP = blockAccess.getBlock(xPos + 1, yPos, zPos + 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos + 1); - } - - if (this.renderMinY <= 0.0D) - { - ++yPos; - } - - i1 = l; - - if (this.renderMinY <= 0.0D || !blockAccess.getBlock(xPos, yPos - 1, zPos).isOpaqueCube()) - { - i1 = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos); - } - - f7 = blockAccess.getBlock(xPos, yPos - 1, zPos).getAmbientOcclusionLightValue(); - f3 = (this.aoLightValueScratchXYZNNP + this.aoLightValueScratchXYNN + this.aoLightValueScratchYZNP + f7) / 4.0F; - f6 = (this.aoLightValueScratchYZNP + f7 + this.aoLightValueScratchXYZPNP + this.aoLightValueScratchXYPN) / 4.0F; - f5 = (f7 + this.aoLightValueScratchYZNN + this.aoLightValueScratchXYPN + this.aoLightValueScratchXYZPNN) / 4.0F; - f4 = (this.aoLightValueScratchXYNN + this.aoLightValueScratchXYZNNN + f7 + this.aoLightValueScratchYZNN) / 4.0F; - this.brightnessTopLeft = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYZNNP, this.aoBrightnessXYNN, this.aoBrightnessYZNP, i1); - this.brightnessTopRight = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessYZNP, this.aoBrightnessXYZPNP, this.aoBrightnessXYPN, i1); - this.brightnessBottomRight = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessYZNN, this.aoBrightnessXYPN, this.aoBrightnessXYZPNN, i1); - this.brightnessBottomLeft = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYNN, this.aoBrightnessXYZNNN, this.aoBrightnessYZNN, i1); - - if (flag1) - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = R * 0.5F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = G * 0.5F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = B * 0.5F; - } - else - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.5F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.5F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.5F; - } - - this.colorRedTopLeft *= f3; - this.colorGreenTopLeft *= f3; - this.colorBlueTopLeft *= f3; - this.colorRedBottomLeft *= f4; - this.colorGreenBottomLeft *= f4; - this.colorBlueBottomLeft *= f4; - this.colorRedBottomRight *= f5; - this.colorGreenBottomRight *= f5; - this.colorBlueBottomRight *= f5; - this.colorRedTopRight *= f6; - this.colorGreenTopRight *= f6; - this.colorBlueTopRight *= f6; - CustomOreBlockRenderer.renderFaceYNeg(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - flag = true; - } - - if (RenderBlocks.getInstance().renderAllFaces || block.shouldSideBeRendered(blockAccess, xPos, yPos + 1, zPos, 1)) - { - if (this.renderMaxY >= 1.0D) - { - ++yPos; - } - - this.aoBrightnessXYNP = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos); - this.aoBrightnessXYPP = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos); - this.aoBrightnessYZPN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos - 1); - this.aoBrightnessYZPP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos + 1); - this.aoLightValueScratchXYNP = blockAccess.getBlock(xPos - 1, yPos, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXYPP = blockAccess.getBlock(xPos + 1, yPos, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchYZPN = blockAccess.getBlock(xPos, yPos, zPos - 1).getAmbientOcclusionLightValue(); - this.aoLightValueScratchYZPP = blockAccess.getBlock(xPos, yPos, zPos + 1).getAmbientOcclusionLightValue(); - flag2 = blockAccess.getBlock(xPos + 1, yPos + 1, zPos).getCanBlockGrass(); - flag3 = blockAccess.getBlock(xPos - 1, yPos + 1, zPos).getCanBlockGrass(); - flag4 = blockAccess.getBlock(xPos, yPos + 1, zPos + 1).getCanBlockGrass(); - flag5 = blockAccess.getBlock(xPos, yPos + 1, zPos - 1).getCanBlockGrass(); - - if (!flag5 && !flag3) - { - this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXYNP; - this.aoBrightnessXYZNPN = this.aoBrightnessXYNP; - } - else - { - this.aoLightValueScratchXYZNPN = blockAccess.getBlock(xPos - 1, yPos, zPos - 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos - 1); - } - - if (!flag5 && !flag2) - { - this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXYPP; - this.aoBrightnessXYZPPN = this.aoBrightnessXYPP; - } - else - { - this.aoLightValueScratchXYZPPN = blockAccess.getBlock(xPos + 1, yPos, zPos - 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos - 1); - } - - if (!flag4 && !flag3) - { - this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXYNP; - this.aoBrightnessXYZNPP = this.aoBrightnessXYNP; - } - else - { - this.aoLightValueScratchXYZNPP = blockAccess.getBlock(xPos - 1, yPos, zPos + 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos + 1); - } - - if (!flag4 && !flag2) - { - this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXYPP; - this.aoBrightnessXYZPPP = this.aoBrightnessXYPP; - } - else - { - this.aoLightValueScratchXYZPPP = blockAccess.getBlock(xPos + 1, yPos, zPos + 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos + 1); - } - - if (this.renderMaxY >= 1.0D) - { - --yPos; - } - - i1 = l; - - if (this.renderMaxY >= 1.0D || !blockAccess.getBlock(xPos, yPos + 1, zPos).isOpaqueCube()) - { - i1 = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos); - } - - f7 = blockAccess.getBlock(xPos, yPos + 1, zPos).getAmbientOcclusionLightValue(); - f6 = (this.aoLightValueScratchXYZNPP + this.aoLightValueScratchXYNP + this.aoLightValueScratchYZPP + f7) / 4.0F; - f3 = (this.aoLightValueScratchYZPP + f7 + this.aoLightValueScratchXYZPPP + this.aoLightValueScratchXYPP) / 4.0F; - f4 = (f7 + this.aoLightValueScratchYZPN + this.aoLightValueScratchXYPP + this.aoLightValueScratchXYZPPN) / 4.0F; - f5 = (this.aoLightValueScratchXYNP + this.aoLightValueScratchXYZNPN + f7 + this.aoLightValueScratchYZPN) / 4.0F; - this.brightnessTopRight = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYZNPP, this.aoBrightnessXYNP, this.aoBrightnessYZPP, i1); - this.brightnessTopLeft = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessYZPP, this.aoBrightnessXYZPPP, this.aoBrightnessXYPP, i1); - this.brightnessBottomLeft = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessYZPN, this.aoBrightnessXYPP, this.aoBrightnessXYZPPN, i1); - this.brightnessBottomRight = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYNP, this.aoBrightnessXYZNPN, this.aoBrightnessYZPN, i1); - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = R; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = G; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = B; - this.colorRedTopLeft *= f3; - this.colorGreenTopLeft *= f3; - this.colorBlueTopLeft *= f3; - this.colorRedBottomLeft *= f4; - this.colorGreenBottomLeft *= f4; - this.colorBlueBottomLeft *= f4; - this.colorRedBottomRight *= f5; - this.colorGreenBottomRight *= f5; - this.colorBlueBottomRight *= f5; - this.colorRedTopRight *= f6; - this.colorGreenTopRight *= f6; - this.colorBlueTopRight *= f6; - CustomOreBlockRenderer.renderFaceYPos(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - flag = true; - } - - IIcon iicon; - - if (RenderBlocks.getInstance().renderAllFaces || block.shouldSideBeRendered(blockAccess, xPos, yPos, zPos - 1, 2)) - { - if (this.renderMinZ <= 0.0D) - { - --zPos; - } - - this.aoLightValueScratchXZNN = blockAccess.getBlock(xPos - 1, yPos, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchYZNN = blockAccess.getBlock(xPos, yPos - 1, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchYZPN = blockAccess.getBlock(xPos, yPos + 1, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXZPN = blockAccess.getBlock(xPos + 1, yPos, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXZNN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos); - this.aoBrightnessYZNN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos); - this.aoBrightnessYZPN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos); - this.aoBrightnessXZPN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos); - flag2 = blockAccess.getBlock(xPos + 1, yPos, zPos - 1).getCanBlockGrass(); - flag3 = blockAccess.getBlock(xPos - 1, yPos, zPos - 1).getCanBlockGrass(); - flag4 = blockAccess.getBlock(xPos, yPos + 1, zPos - 1).getCanBlockGrass(); - flag5 = blockAccess.getBlock(xPos, yPos - 1, zPos - 1).getCanBlockGrass(); - - if (!flag3 && !flag5) - { - this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXZNN; - this.aoBrightnessXYZNNN = this.aoBrightnessXZNN; - } - else - { - this.aoLightValueScratchXYZNNN = blockAccess.getBlock(xPos - 1, yPos - 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos - 1, zPos); - } - - if (!flag3 && !flag4) - { - this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXZNN; - this.aoBrightnessXYZNPN = this.aoBrightnessXZNN; - } - else - { - this.aoLightValueScratchXYZNPN = blockAccess.getBlock(xPos - 1, yPos + 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos + 1, zPos); - } - - if (!flag2 && !flag5) - { - this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXZPN; - this.aoBrightnessXYZPNN = this.aoBrightnessXZPN; - } - else - { - this.aoLightValueScratchXYZPNN = blockAccess.getBlock(xPos + 1, yPos - 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos - 1, zPos); - } - - if (!flag2 && !flag4) - { - this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXZPN; - this.aoBrightnessXYZPPN = this.aoBrightnessXZPN; - } - else - { - this.aoLightValueScratchXYZPPN = blockAccess.getBlock(xPos + 1, yPos + 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos + 1, zPos); - } - - if (this.renderMinZ <= 0.0D) - { - ++zPos; - } - - i1 = l; - - if (this.renderMinZ <= 0.0D || !blockAccess.getBlock(xPos, yPos, zPos - 1).isOpaqueCube()) - { - i1 = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos - 1); - } - - f7 = blockAccess.getBlock(xPos, yPos, zPos - 1).getAmbientOcclusionLightValue(); - f3 = (this.aoLightValueScratchXZNN + this.aoLightValueScratchXYZNPN + f7 + this.aoLightValueScratchYZPN) / 4.0F; - f4 = (f7 + this.aoLightValueScratchYZPN + this.aoLightValueScratchXZPN + this.aoLightValueScratchXYZPPN) / 4.0F; - f5 = (this.aoLightValueScratchYZNN + f7 + this.aoLightValueScratchXYZPNN + this.aoLightValueScratchXZPN) / 4.0F; - f6 = (this.aoLightValueScratchXYZNNN + this.aoLightValueScratchXZNN + this.aoLightValueScratchYZNN + f7) / 4.0F; - this.brightnessTopLeft = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXZNN, this.aoBrightnessXYZNPN, this.aoBrightnessYZPN, i1); - this.brightnessBottomLeft = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessYZPN, this.aoBrightnessXZPN, this.aoBrightnessXYZPPN, i1); - this.brightnessBottomRight = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessYZNN, this.aoBrightnessXYZPNN, this.aoBrightnessXZPN, i1); - this.brightnessTopRight = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYZNNN, this.aoBrightnessXZNN, this.aoBrightnessYZNN, i1); - - if (flag1) - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = R * 0.8F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = G * 0.8F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = B * 0.8F; - } - else - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.8F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.8F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.8F; - } - - this.colorRedTopLeft *= f3; - this.colorGreenTopLeft *= f3; - this.colorBlueTopLeft *= f3; - this.colorRedBottomLeft *= f4; - this.colorGreenBottomLeft *= f4; - this.colorBlueBottomLeft *= f4; - this.colorRedBottomRight *= f5; - this.colorGreenBottomRight *= f5; - this.colorBlueBottomRight *= f5; - this.colorRedTopRight *= f6; - this.colorGreenTopRight *= f6; - this.colorBlueTopRight *= f6; - iicon = this.getBlockIcon(block, blockAccess, xPos, yPos, zPos, 2); - CustomOreBlockRenderer.renderFaceZNeg(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - - RenderBlocks.getInstance(); - if (RenderBlocks.fancyGrass && iicon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) - { - this.colorRedTopLeft *= R; - this.colorRedBottomLeft *= R; - this.colorRedBottomRight *= R; - this.colorRedTopRight *= R; - this.colorGreenTopLeft *= G; - this.colorGreenBottomLeft *= G; - this.colorGreenBottomRight *= G; - this.colorGreenTopRight *= G; - this.colorBlueTopLeft *= B; - this.colorBlueBottomLeft *= B; - this.colorBlueBottomRight *= B; - this.colorBlueTopRight *= B; - CustomOreBlockRenderer.renderFaceZNeg(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - } - - flag = true; - } - - if (RenderBlocks.getInstance().renderAllFaces || block.shouldSideBeRendered(blockAccess, xPos, yPos, zPos + 1, 3)) - { - if (this.renderMaxZ >= 1.0D) - { - ++zPos; - } - - this.aoLightValueScratchXZNP = blockAccess.getBlock(xPos - 1, yPos, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXZPP = blockAccess.getBlock(xPos + 1, yPos, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchYZNP = blockAccess.getBlock(xPos, yPos - 1, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchYZPP = blockAccess.getBlock(xPos, yPos + 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXZNP = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos); - this.aoBrightnessXZPP = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos); - this.aoBrightnessYZNP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos); - this.aoBrightnessYZPP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos); - flag2 = blockAccess.getBlock(xPos + 1, yPos, zPos + 1).getCanBlockGrass(); - flag3 = blockAccess.getBlock(xPos - 1, yPos, zPos + 1).getCanBlockGrass(); - flag4 = blockAccess.getBlock(xPos, yPos + 1, zPos + 1).getCanBlockGrass(); - flag5 = blockAccess.getBlock(xPos, yPos - 1, zPos + 1).getCanBlockGrass(); - - if (!flag3 && !flag5) - { - this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXZNP; - this.aoBrightnessXYZNNP = this.aoBrightnessXZNP; - } - else - { - this.aoLightValueScratchXYZNNP = blockAccess.getBlock(xPos - 1, yPos - 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos - 1, zPos); - } - - if (!flag3 && !flag4) - { - this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXZNP; - this.aoBrightnessXYZNPP = this.aoBrightnessXZNP; - } - else - { - this.aoLightValueScratchXYZNPP = blockAccess.getBlock(xPos - 1, yPos + 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos + 1, zPos); - } - - if (!flag2 && !flag5) - { - this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXZPP; - this.aoBrightnessXYZPNP = this.aoBrightnessXZPP; - } - else - { - this.aoLightValueScratchXYZPNP = blockAccess.getBlock(xPos + 1, yPos - 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos - 1, zPos); - } - - if (!flag2 && !flag4) - { - this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXZPP; - this.aoBrightnessXYZPPP = this.aoBrightnessXZPP; - } - else - { - this.aoLightValueScratchXYZPPP = blockAccess.getBlock(xPos + 1, yPos + 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos + 1, zPos); - } - - if (this.renderMaxZ >= 1.0D) - { - --zPos; - } - - i1 = l; - - if (this.renderMaxZ >= 1.0D || !blockAccess.getBlock(xPos, yPos, zPos + 1).isOpaqueCube()) - { - i1 = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos + 1); - } - - f7 = blockAccess.getBlock(xPos, yPos, zPos + 1).getAmbientOcclusionLightValue(); - f3 = (this.aoLightValueScratchXZNP + this.aoLightValueScratchXYZNPP + f7 + this.aoLightValueScratchYZPP) / 4.0F; - f6 = (f7 + this.aoLightValueScratchYZPP + this.aoLightValueScratchXZPP + this.aoLightValueScratchXYZPPP) / 4.0F; - f5 = (this.aoLightValueScratchYZNP + f7 + this.aoLightValueScratchXYZPNP + this.aoLightValueScratchXZPP) / 4.0F; - f4 = (this.aoLightValueScratchXYZNNP + this.aoLightValueScratchXZNP + this.aoLightValueScratchYZNP + f7) / 4.0F; - this.brightnessTopLeft = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXZNP, this.aoBrightnessXYZNPP, this.aoBrightnessYZPP, i1); - this.brightnessTopRight = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessYZPP, this.aoBrightnessXZPP, this.aoBrightnessXYZPPP, i1); - this.brightnessBottomRight = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessYZNP, this.aoBrightnessXYZPNP, this.aoBrightnessXZPP, i1); - this.brightnessBottomLeft = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYZNNP, this.aoBrightnessXZNP, this.aoBrightnessYZNP, i1); - - if (flag1) - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = R * 0.8F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = G * 0.8F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = B * 0.8F; - } - else - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.8F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.8F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.8F; - } - - this.colorRedTopLeft *= f3; - this.colorGreenTopLeft *= f3; - this.colorBlueTopLeft *= f3; - this.colorRedBottomLeft *= f4; - this.colorGreenBottomLeft *= f4; - this.colorBlueBottomLeft *= f4; - this.colorRedBottomRight *= f5; - this.colorGreenBottomRight *= f5; - this.colorBlueBottomRight *= f5; - this.colorRedTopRight *= f6; - this.colorGreenTopRight *= f6; - this.colorBlueTopRight *= f6; - iicon = this.getBlockIcon(block, blockAccess, xPos, yPos, zPos, 3); - CustomOreBlockRenderer.renderFaceZPos(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - - RenderBlocks.getInstance(); - if (RenderBlocks.fancyGrass && iicon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) - { - this.colorRedTopLeft *= R; - this.colorRedBottomLeft *= R; - this.colorRedBottomRight *= R; - this.colorRedTopRight *= R; - this.colorGreenTopLeft *= G; - this.colorGreenBottomLeft *= G; - this.colorGreenBottomRight *= G; - this.colorGreenTopRight *= G; - this.colorBlueTopLeft *= B; - this.colorBlueBottomLeft *= B; - this.colorBlueBottomRight *= B; - this.colorBlueTopRight *= B; - CustomOreBlockRenderer.renderFaceZPos(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - } - - flag = true; - } - - if (RenderBlocks.getInstance().renderAllFaces || block.shouldSideBeRendered(blockAccess, xPos - 1, yPos, zPos, 4)) - { - if (this.renderMinX <= 0.0D) - { - --xPos; - } - - this.aoLightValueScratchXYNN = blockAccess.getBlock(xPos, yPos - 1, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXZNN = blockAccess.getBlock(xPos, yPos, zPos - 1).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXZNP = blockAccess.getBlock(xPos, yPos, zPos + 1).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXYNP = blockAccess.getBlock(xPos, yPos + 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYNN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos); - this.aoBrightnessXZNN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos - 1); - this.aoBrightnessXZNP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos + 1); - this.aoBrightnessXYNP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos); - flag2 = blockAccess.getBlock(xPos - 1, yPos + 1, zPos).getCanBlockGrass(); - flag3 = blockAccess.getBlock(xPos - 1, yPos - 1, zPos).getCanBlockGrass(); - flag4 = blockAccess.getBlock(xPos - 1, yPos, zPos - 1).getCanBlockGrass(); - flag5 = blockAccess.getBlock(xPos - 1, yPos, zPos + 1).getCanBlockGrass(); - - if (!flag4 && !flag3) - { - this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXZNN; - this.aoBrightnessXYZNNN = this.aoBrightnessXZNN; - } - else - { - this.aoLightValueScratchXYZNNN = blockAccess.getBlock(xPos, yPos - 1, zPos - 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos - 1); - } - - if (!flag5 && !flag3) - { - this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXZNP; - this.aoBrightnessXYZNNP = this.aoBrightnessXZNP; - } - else - { - this.aoLightValueScratchXYZNNP = blockAccess.getBlock(xPos, yPos - 1, zPos + 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos + 1); - } - - if (!flag4 && !flag2) - { - this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXZNN; - this.aoBrightnessXYZNPN = this.aoBrightnessXZNN; - } - else - { - this.aoLightValueScratchXYZNPN = blockAccess.getBlock(xPos, yPos + 1, zPos - 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos - 1); - } - - if (!flag5 && !flag2) - { - this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXZNP; - this.aoBrightnessXYZNPP = this.aoBrightnessXZNP; - } - else - { - this.aoLightValueScratchXYZNPP = blockAccess.getBlock(xPos, yPos + 1, zPos + 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos + 1); - } - - if (this.renderMinX <= 0.0D) - { - ++xPos; - } - - i1 = l; - - if (this.renderMinX <= 0.0D || !blockAccess.getBlock(xPos - 1, yPos, zPos).isOpaqueCube()) - { - i1 = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos); - } - - f7 = blockAccess.getBlock(xPos - 1, yPos, zPos).getAmbientOcclusionLightValue(); - f6 = (this.aoLightValueScratchXYNN + this.aoLightValueScratchXYZNNP + f7 + this.aoLightValueScratchXZNP) / 4.0F; - f3 = (f7 + this.aoLightValueScratchXZNP + this.aoLightValueScratchXYNP + this.aoLightValueScratchXYZNPP) / 4.0F; - f4 = (this.aoLightValueScratchXZNN + f7 + this.aoLightValueScratchXYZNPN + this.aoLightValueScratchXYNP) / 4.0F; - f5 = (this.aoLightValueScratchXYZNNN + this.aoLightValueScratchXYNN + this.aoLightValueScratchXZNN + f7) / 4.0F; - this.brightnessTopRight = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYNN, this.aoBrightnessXYZNNP, this.aoBrightnessXZNP, i1); - this.brightnessTopLeft = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXZNP, this.aoBrightnessXYNP, this.aoBrightnessXYZNPP, i1); - this.brightnessBottomLeft = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXZNN, this.aoBrightnessXYZNPN, this.aoBrightnessXYNP, i1); - this.brightnessBottomRight = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYZNNN, this.aoBrightnessXYNN, this.aoBrightnessXZNN, i1); - - if (flag1) - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = R * 0.6F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = G * 0.6F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = B * 0.6F; - } - else - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.6F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.6F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.6F; - } - - this.colorRedTopLeft *= f3; - this.colorGreenTopLeft *= f3; - this.colorBlueTopLeft *= f3; - this.colorRedBottomLeft *= f4; - this.colorGreenBottomLeft *= f4; - this.colorBlueBottomLeft *= f4; - this.colorRedBottomRight *= f5; - this.colorGreenBottomRight *= f5; - this.colorBlueBottomRight *= f5; - this.colorRedTopRight *= f6; - this.colorGreenTopRight *= f6; - this.colorBlueTopRight *= f6; - iicon = this.getBlockIcon(block, blockAccess, xPos, yPos, zPos, 4); - CustomOreBlockRenderer.renderFaceXNeg(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - - RenderBlocks.getInstance(); - if (RenderBlocks.fancyGrass && iicon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) - { - this.colorRedTopLeft *= R; - this.colorRedBottomLeft *= R; - this.colorRedBottomRight *= R; - this.colorRedTopRight *= R; - this.colorGreenTopLeft *= G; - this.colorGreenBottomLeft *= G; - this.colorGreenBottomRight *= G; - this.colorGreenTopRight *= G; - this.colorBlueTopLeft *= B; - this.colorBlueBottomLeft *= B; - this.colorBlueBottomRight *= B; - this.colorBlueTopRight *= B; - CustomOreBlockRenderer.renderFaceXNeg(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - } - - flag = true; - } - - if (RenderBlocks.getInstance().renderAllFaces || block.shouldSideBeRendered(blockAccess, xPos + 1, yPos, zPos, 5)) - { - if (this.renderMaxX >= 1.0D) - { - ++xPos; - } - - this.aoLightValueScratchXYPN = blockAccess.getBlock(xPos, yPos - 1, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXZPN = blockAccess.getBlock(xPos, yPos, zPos - 1).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXZPP = blockAccess.getBlock(xPos, yPos, zPos + 1).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXYPP = blockAccess.getBlock(xPos, yPos + 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYPN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos); - this.aoBrightnessXZPN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos - 1); - this.aoBrightnessXZPP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos + 1); - this.aoBrightnessXYPP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos); - flag2 = blockAccess.getBlock(xPos + 1, yPos + 1, zPos).getCanBlockGrass(); - flag3 = blockAccess.getBlock(xPos + 1, yPos - 1, zPos).getCanBlockGrass(); - flag4 = blockAccess.getBlock(xPos + 1, yPos, zPos + 1).getCanBlockGrass(); - flag5 = blockAccess.getBlock(xPos + 1, yPos, zPos - 1).getCanBlockGrass(); - - if (!flag3 && !flag5) - { - this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXZPN; - this.aoBrightnessXYZPNN = this.aoBrightnessXZPN; - } - else - { - this.aoLightValueScratchXYZPNN = blockAccess.getBlock(xPos, yPos - 1, zPos - 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos - 1); - } - - if (!flag3 && !flag4) - { - this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXZPP; - this.aoBrightnessXYZPNP = this.aoBrightnessXZPP; - } - else - { - this.aoLightValueScratchXYZPNP = blockAccess.getBlock(xPos, yPos - 1, zPos + 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos + 1); - } - - if (!flag2 && !flag5) - { - this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXZPN; - this.aoBrightnessXYZPPN = this.aoBrightnessXZPN; - } - else - { - this.aoLightValueScratchXYZPPN = blockAccess.getBlock(xPos, yPos + 1, zPos - 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos - 1); - } - - if (!flag2 && !flag4) - { - this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXZPP; - this.aoBrightnessXYZPPP = this.aoBrightnessXZPP; - } - else - { - this.aoLightValueScratchXYZPPP = blockAccess.getBlock(xPos, yPos + 1, zPos + 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos + 1); - } - - if (this.renderMaxX >= 1.0D) - { - --xPos; - } - - i1 = l; - - if (this.renderMaxX >= 1.0D || !blockAccess.getBlock(xPos + 1, yPos, zPos).isOpaqueCube()) - { - i1 = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos); - } - - f7 = blockAccess.getBlock(xPos + 1, yPos, zPos).getAmbientOcclusionLightValue(); - f3 = (this.aoLightValueScratchXYPN + this.aoLightValueScratchXYZPNP + f7 + this.aoLightValueScratchXZPP) / 4.0F; - f4 = (this.aoLightValueScratchXYZPNN + this.aoLightValueScratchXYPN + this.aoLightValueScratchXZPN + f7) / 4.0F; - f5 = (this.aoLightValueScratchXZPN + f7 + this.aoLightValueScratchXYZPPN + this.aoLightValueScratchXYPP) / 4.0F; - f6 = (f7 + this.aoLightValueScratchXZPP + this.aoLightValueScratchXYPP + this.aoLightValueScratchXYZPPP) / 4.0F; - this.brightnessTopLeft = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYPN, this.aoBrightnessXYZPNP, this.aoBrightnessXZPP, i1); - this.brightnessTopRight = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXZPP, this.aoBrightnessXYPP, this.aoBrightnessXYZPPP, i1); - this.brightnessBottomRight = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXZPN, this.aoBrightnessXYZPPN, this.aoBrightnessXYPP, i1); - this.brightnessBottomLeft = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYZPNN, this.aoBrightnessXYPN, this.aoBrightnessXZPN, i1); - - if (flag1) - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = R * 0.6F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = G * 0.6F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = B * 0.6F; - } - else - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.6F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.6F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.6F; - } - - this.colorRedTopLeft *= f3; - this.colorGreenTopLeft *= f3; - this.colorBlueTopLeft *= f3; - this.colorRedBottomLeft *= f4; - this.colorGreenBottomLeft *= f4; - this.colorBlueBottomLeft *= f4; - this.colorRedBottomRight *= f5; - this.colorGreenBottomRight *= f5; - this.colorBlueBottomRight *= f5; - this.colorRedTopRight *= f6; - this.colorGreenTopRight *= f6; - this.colorBlueTopRight *= f6; - iicon = this.getBlockIcon(block, blockAccess, xPos, yPos, zPos, 5); - CustomOreBlockRenderer.renderFaceXPos(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - - RenderBlocks.getInstance(); - if (RenderBlocks.fancyGrass && iicon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) - { - this.colorRedTopLeft *= R; - this.colorRedBottomLeft *= R; - this.colorRedBottomRight *= R; - this.colorRedTopRight *= R; - this.colorGreenTopLeft *= G; - this.colorGreenBottomLeft *= G; - this.colorGreenBottomRight *= G; - this.colorGreenTopRight *= G; - this.colorBlueTopLeft *= B; - this.colorBlueBottomLeft *= B; - this.colorBlueBottomRight *= B; - this.colorBlueTopRight *= B; - CustomOreBlockRenderer.renderFaceXPos(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - } - - flag = true; - } - - this.enableAO = false; - return flag; - } - - /** - * Renders non-full-cube block with ambient occusion. Args: block, x, y, z, red, green, blue (lighting) - */ - public boolean renderStandardBlockWithAmbientOcclusionPartial(IBlockAccess aWorld, RenderBlocks aRenderer, ITexture[][] aTextures, Block block, int xPos, int yPos, int zPos, float R, float G, float B) - { - this.enableAO = true; - boolean flag = false; - float f3 = 0.0F; - float f4 = 0.0F; - float f5 = 0.0F; - float f6 = 0.0F; - boolean flag1 = true; - int l = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos); - Tessellator tessellator = Tessellator.instance; - tessellator.setBrightness(983055); - - if (this.getBlockIcon(block).getIconName().equals("grass_top")) - { - flag1 = false; - } - else if (this.hasOverrideBlockTexture()) - { - flag1 = false; - } - - boolean flag2; - boolean flag3; - boolean flag4; - boolean flag5; - int i1; - float f7; - - if (RenderBlocks.getInstance().renderAllFaces || block.shouldSideBeRendered(blockAccess, xPos, yPos - 1, zPos, 0)) - { - if (this.renderMinY <= 0.0D) - { - --yPos; - } - - this.aoBrightnessXYNN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos); - this.aoBrightnessYZNN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos - 1); - this.aoBrightnessYZNP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos + 1); - this.aoBrightnessXYPN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos); - this.aoLightValueScratchXYNN = blockAccess.getBlock(xPos - 1, yPos, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchYZNN = blockAccess.getBlock(xPos, yPos, zPos - 1).getAmbientOcclusionLightValue(); - this.aoLightValueScratchYZNP = blockAccess.getBlock(xPos, yPos, zPos + 1).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXYPN = blockAccess.getBlock(xPos + 1, yPos, zPos).getAmbientOcclusionLightValue(); - flag2 = blockAccess.getBlock(xPos + 1, yPos - 1, zPos).getCanBlockGrass(); - flag3 = blockAccess.getBlock(xPos - 1, yPos - 1, zPos).getCanBlockGrass(); - flag4 = blockAccess.getBlock(xPos, yPos - 1, zPos + 1).getCanBlockGrass(); - flag5 = blockAccess.getBlock(xPos, yPos - 1, zPos - 1).getCanBlockGrass(); - - if (!flag5 && !flag3) - { - this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXYNN; - this.aoBrightnessXYZNNN = this.aoBrightnessXYNN; - } - else - { - this.aoLightValueScratchXYZNNN = blockAccess.getBlock(xPos - 1, yPos, zPos - 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos - 1); - } - - if (!flag4 && !flag3) - { - this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXYNN; - this.aoBrightnessXYZNNP = this.aoBrightnessXYNN; - } - else - { - this.aoLightValueScratchXYZNNP = blockAccess.getBlock(xPos - 1, yPos, zPos + 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos + 1); - } - - if (!flag5 && !flag2) - { - this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXYPN; - this.aoBrightnessXYZPNN = this.aoBrightnessXYPN; - } - else - { - this.aoLightValueScratchXYZPNN = blockAccess.getBlock(xPos + 1, yPos, zPos - 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos - 1); - } - - if (!flag4 && !flag2) - { - this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXYPN; - this.aoBrightnessXYZPNP = this.aoBrightnessXYPN; - } - else - { - this.aoLightValueScratchXYZPNP = blockAccess.getBlock(xPos + 1, yPos, zPos + 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos + 1); - } - - if (this.renderMinY <= 0.0D) - { - ++yPos; - } - - i1 = l; - - if (this.renderMinY <= 0.0D || !blockAccess.getBlock(xPos, yPos - 1, zPos).isOpaqueCube()) - { - i1 = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos); - } - - f7 = blockAccess.getBlock(xPos, yPos - 1, zPos).getAmbientOcclusionLightValue(); - f3 = (this.aoLightValueScratchXYZNNP + this.aoLightValueScratchXYNN + this.aoLightValueScratchYZNP + f7) / 4.0F; - f6 = (this.aoLightValueScratchYZNP + f7 + this.aoLightValueScratchXYZPNP + this.aoLightValueScratchXYPN) / 4.0F; - f5 = (f7 + this.aoLightValueScratchYZNN + this.aoLightValueScratchXYPN + this.aoLightValueScratchXYZPNN) / 4.0F; - f4 = (this.aoLightValueScratchXYNN + this.aoLightValueScratchXYZNNN + f7 + this.aoLightValueScratchYZNN) / 4.0F; - this.brightnessTopLeft = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYZNNP, this.aoBrightnessXYNN, this.aoBrightnessYZNP, i1); - this.brightnessTopRight = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessYZNP, this.aoBrightnessXYZPNP, this.aoBrightnessXYPN, i1); - this.brightnessBottomRight = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessYZNN, this.aoBrightnessXYPN, this.aoBrightnessXYZPNN, i1); - this.brightnessBottomLeft = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYNN, this.aoBrightnessXYZNNN, this.aoBrightnessYZNN, i1); - - if (flag1) - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = R * 0.5F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = G * 0.5F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = B * 0.5F; - } - else - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.5F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.5F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.5F; - } - - this.colorRedTopLeft *= f3; - this.colorGreenTopLeft *= f3; - this.colorBlueTopLeft *= f3; - this.colorRedBottomLeft *= f4; - this.colorGreenBottomLeft *= f4; - this.colorBlueBottomLeft *= f4; - this.colorRedBottomRight *= f5; - this.colorGreenBottomRight *= f5; - this.colorBlueBottomRight *= f5; - this.colorRedTopRight *= f6; - this.colorGreenTopRight *= f6; - this.colorBlueTopRight *= f6; - CustomOreBlockRenderer.renderFaceYNeg(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - flag = true; - } - - if (RenderBlocks.getInstance().renderAllFaces || block.shouldSideBeRendered(blockAccess, xPos, yPos + 1, zPos, 1)) - { - if (this.renderMaxY >= 1.0D) - { - ++yPos; - } - - this.aoBrightnessXYNP = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos); - this.aoBrightnessXYPP = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos); - this.aoBrightnessYZPN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos - 1); - this.aoBrightnessYZPP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos + 1); - this.aoLightValueScratchXYNP = blockAccess.getBlock(xPos - 1, yPos, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXYPP = blockAccess.getBlock(xPos + 1, yPos, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchYZPN = blockAccess.getBlock(xPos, yPos, zPos - 1).getAmbientOcclusionLightValue(); - this.aoLightValueScratchYZPP = blockAccess.getBlock(xPos, yPos, zPos + 1).getAmbientOcclusionLightValue(); - flag2 = blockAccess.getBlock(xPos + 1, yPos + 1, zPos).getCanBlockGrass(); - flag3 = blockAccess.getBlock(xPos - 1, yPos + 1, zPos).getCanBlockGrass(); - flag4 = blockAccess.getBlock(xPos, yPos + 1, zPos + 1).getCanBlockGrass(); - flag5 = blockAccess.getBlock(xPos, yPos + 1, zPos - 1).getCanBlockGrass(); - - if (!flag5 && !flag3) - { - this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXYNP; - this.aoBrightnessXYZNPN = this.aoBrightnessXYNP; - } - else - { - this.aoLightValueScratchXYZNPN = blockAccess.getBlock(xPos - 1, yPos, zPos - 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos - 1); - } - - if (!flag5 && !flag2) - { - this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXYPP; - this.aoBrightnessXYZPPN = this.aoBrightnessXYPP; - } - else - { - this.aoLightValueScratchXYZPPN = blockAccess.getBlock(xPos + 1, yPos, zPos - 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos - 1); - } - - if (!flag4 && !flag3) - { - this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXYNP; - this.aoBrightnessXYZNPP = this.aoBrightnessXYNP; - } - else - { - this.aoLightValueScratchXYZNPP = blockAccess.getBlock(xPos - 1, yPos, zPos + 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos + 1); - } - - if (!flag4 && !flag2) - { - this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXYPP; - this.aoBrightnessXYZPPP = this.aoBrightnessXYPP; - } - else - { - this.aoLightValueScratchXYZPPP = blockAccess.getBlock(xPos + 1, yPos, zPos + 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos + 1); - } - - if (this.renderMaxY >= 1.0D) - { - --yPos; - } - - i1 = l; - - if (this.renderMaxY >= 1.0D || !blockAccess.getBlock(xPos, yPos + 1, zPos).isOpaqueCube()) - { - i1 = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos); - } - - f7 = blockAccess.getBlock(xPos, yPos + 1, zPos).getAmbientOcclusionLightValue(); - f6 = (this.aoLightValueScratchXYZNPP + this.aoLightValueScratchXYNP + this.aoLightValueScratchYZPP + f7) / 4.0F; - f3 = (this.aoLightValueScratchYZPP + f7 + this.aoLightValueScratchXYZPPP + this.aoLightValueScratchXYPP) / 4.0F; - f4 = (f7 + this.aoLightValueScratchYZPN + this.aoLightValueScratchXYPP + this.aoLightValueScratchXYZPPN) / 4.0F; - f5 = (this.aoLightValueScratchXYNP + this.aoLightValueScratchXYZNPN + f7 + this.aoLightValueScratchYZPN) / 4.0F; - this.brightnessTopRight = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYZNPP, this.aoBrightnessXYNP, this.aoBrightnessYZPP, i1); - this.brightnessTopLeft = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessYZPP, this.aoBrightnessXYZPPP, this.aoBrightnessXYPP, i1); - this.brightnessBottomLeft = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessYZPN, this.aoBrightnessXYPP, this.aoBrightnessXYZPPN, i1); - this.brightnessBottomRight = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYNP, this.aoBrightnessXYZNPN, this.aoBrightnessYZPN, i1); - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = R; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = G; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = B; - this.colorRedTopLeft *= f3; - this.colorGreenTopLeft *= f3; - this.colorBlueTopLeft *= f3; - this.colorRedBottomLeft *= f4; - this.colorGreenBottomLeft *= f4; - this.colorBlueBottomLeft *= f4; - this.colorRedBottomRight *= f5; - this.colorGreenBottomRight *= f5; - this.colorBlueBottomRight *= f5; - this.colorRedTopRight *= f6; - this.colorGreenTopRight *= f6; - this.colorBlueTopRight *= f6; - CustomOreBlockRenderer.renderFaceYPos(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - flag = true; - } - - float f8; - float f9; - float f10; - float f11; - int j1; - int k1; - int l1; - int i2; - IIcon iicon; - - if (RenderBlocks.getInstance().renderAllFaces || block.shouldSideBeRendered(blockAccess, xPos, yPos, zPos - 1, 2)) - { - if (this.renderMinZ <= 0.0D) - { - --zPos; - } - - this.aoLightValueScratchXZNN = blockAccess.getBlock(xPos - 1, yPos, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchYZNN = blockAccess.getBlock(xPos, yPos - 1, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchYZPN = blockAccess.getBlock(xPos, yPos + 1, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXZPN = blockAccess.getBlock(xPos + 1, yPos, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXZNN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos); - this.aoBrightnessYZNN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos); - this.aoBrightnessYZPN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos); - this.aoBrightnessXZPN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos); - flag2 = blockAccess.getBlock(xPos + 1, yPos, zPos - 1).getCanBlockGrass(); - flag3 = blockAccess.getBlock(xPos - 1, yPos, zPos - 1).getCanBlockGrass(); - flag4 = blockAccess.getBlock(xPos, yPos + 1, zPos - 1).getCanBlockGrass(); - flag5 = blockAccess.getBlock(xPos, yPos - 1, zPos - 1).getCanBlockGrass(); - - if (!flag3 && !flag5) - { - this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXZNN; - this.aoBrightnessXYZNNN = this.aoBrightnessXZNN; - } - else - { - this.aoLightValueScratchXYZNNN = blockAccess.getBlock(xPos - 1, yPos - 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos - 1, zPos); - } - - if (!flag3 && !flag4) - { - this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXZNN; - this.aoBrightnessXYZNPN = this.aoBrightnessXZNN; - } - else - { - this.aoLightValueScratchXYZNPN = blockAccess.getBlock(xPos - 1, yPos + 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos + 1, zPos); - } - - if (!flag2 && !flag5) - { - this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXZPN; - this.aoBrightnessXYZPNN = this.aoBrightnessXZPN; - } - else - { - this.aoLightValueScratchXYZPNN = blockAccess.getBlock(xPos + 1, yPos - 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos - 1, zPos); - } - - if (!flag2 && !flag4) - { - this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXZPN; - this.aoBrightnessXYZPPN = this.aoBrightnessXZPN; - } - else - { - this.aoLightValueScratchXYZPPN = blockAccess.getBlock(xPos + 1, yPos + 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos + 1, zPos); - } - - if (this.renderMinZ <= 0.0D) - { - ++zPos; - } - - i1 = l; - - if (this.renderMinZ <= 0.0D || !blockAccess.getBlock(xPos, yPos, zPos - 1).isOpaqueCube()) - { - i1 = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos - 1); - } - - f7 = blockAccess.getBlock(xPos, yPos, zPos - 1).getAmbientOcclusionLightValue(); - f8 = (this.aoLightValueScratchXZNN + this.aoLightValueScratchXYZNPN + f7 + this.aoLightValueScratchYZPN) / 4.0F; - f9 = (f7 + this.aoLightValueScratchYZPN + this.aoLightValueScratchXZPN + this.aoLightValueScratchXYZPPN) / 4.0F; - f10 = (this.aoLightValueScratchYZNN + f7 + this.aoLightValueScratchXYZPNN + this.aoLightValueScratchXZPN) / 4.0F; - f11 = (this.aoLightValueScratchXYZNNN + this.aoLightValueScratchXZNN + this.aoLightValueScratchYZNN + f7) / 4.0F; - f3 = (float)((double)f8 * this.renderMaxY * (1.0D - this.renderMinX) + (double)f9 * this.renderMaxY * this.renderMinX + (double)f10 * (1.0D - this.renderMaxY) * this.renderMinX + (double)f11 * (1.0D - this.renderMaxY) * (1.0D - this.renderMinX)); - f4 = (float)((double)f8 * this.renderMaxY * (1.0D - this.renderMaxX) + (double)f9 * this.renderMaxY * this.renderMaxX + (double)f10 * (1.0D - this.renderMaxY) * this.renderMaxX + (double)f11 * (1.0D - this.renderMaxY) * (1.0D - this.renderMaxX)); - f5 = (float)((double)f8 * this.renderMinY * (1.0D - this.renderMaxX) + (double)f9 * this.renderMinY * this.renderMaxX + (double)f10 * (1.0D - this.renderMinY) * this.renderMaxX + (double)f11 * (1.0D - this.renderMinY) * (1.0D - this.renderMaxX)); - f6 = (float)((double)f8 * this.renderMinY * (1.0D - this.renderMinX) + (double)f9 * this.renderMinY * this.renderMinX + (double)f10 * (1.0D - this.renderMinY) * this.renderMinX + (double)f11 * (1.0D - this.renderMinY) * (1.0D - this.renderMinX)); - j1 = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXZNN, this.aoBrightnessXYZNPN, this.aoBrightnessYZPN, i1); - k1 = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessYZPN, this.aoBrightnessXZPN, this.aoBrightnessXYZPPN, i1); - l1 = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessYZNN, this.aoBrightnessXYZPNN, this.aoBrightnessXZPN, i1); - i2 = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYZNNN, this.aoBrightnessXZNN, this.aoBrightnessYZNN, i1); - this.brightnessTopLeft = RenderBlocks.getInstance().mixAoBrightness(j1, k1, l1, i2, this.renderMaxY * (1.0D - this.renderMinX), this.renderMaxY * this.renderMinX, (1.0D - this.renderMaxY) * this.renderMinX, (1.0D - this.renderMaxY) * (1.0D - this.renderMinX)); - this.brightnessBottomLeft = RenderBlocks.getInstance().mixAoBrightness(j1, k1, l1, i2, this.renderMaxY * (1.0D - this.renderMaxX), this.renderMaxY * this.renderMaxX, (1.0D - this.renderMaxY) * this.renderMaxX, (1.0D - this.renderMaxY) * (1.0D - this.renderMaxX)); - this.brightnessBottomRight = RenderBlocks.getInstance().mixAoBrightness(j1, k1, l1, i2, this.renderMinY * (1.0D - this.renderMaxX), this.renderMinY * this.renderMaxX, (1.0D - this.renderMinY) * this.renderMaxX, (1.0D - this.renderMinY) * (1.0D - this.renderMaxX)); - this.brightnessTopRight = RenderBlocks.getInstance().mixAoBrightness(j1, k1, l1, i2, this.renderMinY * (1.0D - this.renderMinX), this.renderMinY * this.renderMinX, (1.0D - this.renderMinY) * this.renderMinX, (1.0D - this.renderMinY) * (1.0D - this.renderMinX)); - - if (flag1) - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = R * 0.8F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = G * 0.8F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = B * 0.8F; - } - else - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.8F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.8F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.8F; - } - - this.colorRedTopLeft *= f3; - this.colorGreenTopLeft *= f3; - this.colorBlueTopLeft *= f3; - this.colorRedBottomLeft *= f4; - this.colorGreenBottomLeft *= f4; - this.colorBlueBottomLeft *= f4; - this.colorRedBottomRight *= f5; - this.colorGreenBottomRight *= f5; - this.colorBlueBottomRight *= f5; - this.colorRedTopRight *= f6; - this.colorGreenTopRight *= f6; - this.colorBlueTopRight *= f6; - iicon = this.getBlockIcon(block, blockAccess, xPos, yPos, zPos, 2); - CustomOreBlockRenderer.renderFaceZNeg(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - - RenderBlocks.getInstance(); - if (RenderBlocks.fancyGrass && iicon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) - { - this.colorRedTopLeft *= R; - this.colorRedBottomLeft *= R; - this.colorRedBottomRight *= R; - this.colorRedTopRight *= R; - this.colorGreenTopLeft *= G; - this.colorGreenBottomLeft *= G; - this.colorGreenBottomRight *= G; - this.colorGreenTopRight *= G; - this.colorBlueTopLeft *= B; - this.colorBlueBottomLeft *= B; - this.colorBlueBottomRight *= B; - this.colorBlueTopRight *= B; - CustomOreBlockRenderer.renderFaceZNeg(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - } - - flag = true; - } - - if (RenderBlocks.getInstance().renderAllFaces || block.shouldSideBeRendered(blockAccess, xPos, yPos, zPos + 1, 3)) - { - if (this.renderMaxZ >= 1.0D) - { - ++zPos; - } - - this.aoLightValueScratchXZNP = blockAccess.getBlock(xPos - 1, yPos, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXZPP = blockAccess.getBlock(xPos + 1, yPos, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchYZNP = blockAccess.getBlock(xPos, yPos - 1, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchYZPP = blockAccess.getBlock(xPos, yPos + 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXZNP = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos); - this.aoBrightnessXZPP = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos); - this.aoBrightnessYZNP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos); - this.aoBrightnessYZPP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos); - flag2 = blockAccess.getBlock(xPos + 1, yPos, zPos + 1).getCanBlockGrass(); - flag3 = blockAccess.getBlock(xPos - 1, yPos, zPos + 1).getCanBlockGrass(); - flag4 = blockAccess.getBlock(xPos, yPos + 1, zPos + 1).getCanBlockGrass(); - flag5 = blockAccess.getBlock(xPos, yPos - 1, zPos + 1).getCanBlockGrass(); - - if (!flag3 && !flag5) - { - this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXZNP; - this.aoBrightnessXYZNNP = this.aoBrightnessXZNP; - } - else - { - this.aoLightValueScratchXYZNNP = blockAccess.getBlock(xPos - 1, yPos - 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos - 1, zPos); - } - - if (!flag3 && !flag4) - { - this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXZNP; - this.aoBrightnessXYZNPP = this.aoBrightnessXZNP; - } - else - { - this.aoLightValueScratchXYZNPP = blockAccess.getBlock(xPos - 1, yPos + 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos + 1, zPos); - } - - if (!flag2 && !flag5) - { - this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXZPP; - this.aoBrightnessXYZPNP = this.aoBrightnessXZPP; - } - else - { - this.aoLightValueScratchXYZPNP = blockAccess.getBlock(xPos + 1, yPos - 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos - 1, zPos); - } - - if (!flag2 && !flag4) - { - this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXZPP; - this.aoBrightnessXYZPPP = this.aoBrightnessXZPP; - } - else - { - this.aoLightValueScratchXYZPPP = blockAccess.getBlock(xPos + 1, yPos + 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos + 1, zPos); - } - - if (this.renderMaxZ >= 1.0D) - { - --zPos; - } - - i1 = l; - - if (this.renderMaxZ >= 1.0D || !blockAccess.getBlock(xPos, yPos, zPos + 1).isOpaqueCube()) - { - i1 = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos + 1); - } - - f7 = blockAccess.getBlock(xPos, yPos, zPos + 1).getAmbientOcclusionLightValue(); - f8 = (this.aoLightValueScratchXZNP + this.aoLightValueScratchXYZNPP + f7 + this.aoLightValueScratchYZPP) / 4.0F; - f9 = (f7 + this.aoLightValueScratchYZPP + this.aoLightValueScratchXZPP + this.aoLightValueScratchXYZPPP) / 4.0F; - f10 = (this.aoLightValueScratchYZNP + f7 + this.aoLightValueScratchXYZPNP + this.aoLightValueScratchXZPP) / 4.0F; - f11 = (this.aoLightValueScratchXYZNNP + this.aoLightValueScratchXZNP + this.aoLightValueScratchYZNP + f7) / 4.0F; - f3 = (float)((double)f8 * this.renderMaxY * (1.0D - this.renderMinX) + (double)f9 * this.renderMaxY * this.renderMinX + (double)f10 * (1.0D - this.renderMaxY) * this.renderMinX + (double)f11 * (1.0D - this.renderMaxY) * (1.0D - this.renderMinX)); - f4 = (float)((double)f8 * this.renderMinY * (1.0D - this.renderMinX) + (double)f9 * this.renderMinY * this.renderMinX + (double)f10 * (1.0D - this.renderMinY) * this.renderMinX + (double)f11 * (1.0D - this.renderMinY) * (1.0D - this.renderMinX)); - f5 = (float)((double)f8 * this.renderMinY * (1.0D - this.renderMaxX) + (double)f9 * this.renderMinY * this.renderMaxX + (double)f10 * (1.0D - this.renderMinY) * this.renderMaxX + (double)f11 * (1.0D - this.renderMinY) * (1.0D - this.renderMaxX)); - f6 = (float)((double)f8 * this.renderMaxY * (1.0D - this.renderMaxX) + (double)f9 * this.renderMaxY * this.renderMaxX + (double)f10 * (1.0D - this.renderMaxY) * this.renderMaxX + (double)f11 * (1.0D - this.renderMaxY) * (1.0D - this.renderMaxX)); - j1 = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXZNP, this.aoBrightnessXYZNPP, this.aoBrightnessYZPP, i1); - k1 = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessYZPP, this.aoBrightnessXZPP, this.aoBrightnessXYZPPP, i1); - l1 = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessYZNP, this.aoBrightnessXYZPNP, this.aoBrightnessXZPP, i1); - i2 = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYZNNP, this.aoBrightnessXZNP, this.aoBrightnessYZNP, i1); - this.brightnessTopLeft = RenderBlocks.getInstance().mixAoBrightness(j1, i2, l1, k1, this.renderMaxY * (1.0D - this.renderMinX), (1.0D - this.renderMaxY) * (1.0D - this.renderMinX), (1.0D - this.renderMaxY) * this.renderMinX, this.renderMaxY * this.renderMinX); - this.brightnessBottomLeft = RenderBlocks.getInstance().mixAoBrightness(j1, i2, l1, k1, this.renderMinY * (1.0D - this.renderMinX), (1.0D - this.renderMinY) * (1.0D - this.renderMinX), (1.0D - this.renderMinY) * this.renderMinX, this.renderMinY * this.renderMinX); - this.brightnessBottomRight = RenderBlocks.getInstance().mixAoBrightness(j1, i2, l1, k1, this.renderMinY * (1.0D - this.renderMaxX), (1.0D - this.renderMinY) * (1.0D - this.renderMaxX), (1.0D - this.renderMinY) * this.renderMaxX, this.renderMinY * this.renderMaxX); - this.brightnessTopRight = RenderBlocks.getInstance().mixAoBrightness(j1, i2, l1, k1, this.renderMaxY * (1.0D - this.renderMaxX), (1.0D - this.renderMaxY) * (1.0D - this.renderMaxX), (1.0D - this.renderMaxY) * this.renderMaxX, this.renderMaxY * this.renderMaxX); - - if (flag1) - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = R * 0.8F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = G * 0.8F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = B * 0.8F; - } - else - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.8F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.8F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.8F; - } - - this.colorRedTopLeft *= f3; - this.colorGreenTopLeft *= f3; - this.colorBlueTopLeft *= f3; - this.colorRedBottomLeft *= f4; - this.colorGreenBottomLeft *= f4; - this.colorBlueBottomLeft *= f4; - this.colorRedBottomRight *= f5; - this.colorGreenBottomRight *= f5; - this.colorBlueBottomRight *= f5; - this.colorRedTopRight *= f6; - this.colorGreenTopRight *= f6; - this.colorBlueTopRight *= f6; - iicon = this.getBlockIcon(block, blockAccess, xPos, yPos, zPos, 3); - CustomOreBlockRenderer.renderFaceZPos(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - - RenderBlocks.getInstance(); - if (RenderBlocks.fancyGrass && iicon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) - { - this.colorRedTopLeft *= R; - this.colorRedBottomLeft *= R; - this.colorRedBottomRight *= R; - this.colorRedTopRight *= R; - this.colorGreenTopLeft *= G; - this.colorGreenBottomLeft *= G; - this.colorGreenBottomRight *= G; - this.colorGreenTopRight *= G; - this.colorBlueTopLeft *= B; - this.colorBlueBottomLeft *= B; - this.colorBlueBottomRight *= B; - this.colorBlueTopRight *= B; - CustomOreBlockRenderer.renderFaceZPos(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - } - - flag = true; - } - - if (RenderBlocks.getInstance().renderAllFaces || block.shouldSideBeRendered(blockAccess, xPos - 1, yPos, zPos, 4)) - { - if (this.renderMinX <= 0.0D) - { - --xPos; - } - - this.aoLightValueScratchXYNN = blockAccess.getBlock(xPos, yPos - 1, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXZNN = blockAccess.getBlock(xPos, yPos, zPos - 1).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXZNP = blockAccess.getBlock(xPos, yPos, zPos + 1).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXYNP = blockAccess.getBlock(xPos, yPos + 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYNN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos); - this.aoBrightnessXZNN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos - 1); - this.aoBrightnessXZNP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos + 1); - this.aoBrightnessXYNP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos); - flag2 = blockAccess.getBlock(xPos - 1, yPos + 1, zPos).getCanBlockGrass(); - flag3 = blockAccess.getBlock(xPos - 1, yPos - 1, zPos).getCanBlockGrass(); - flag4 = blockAccess.getBlock(xPos - 1, yPos, zPos - 1).getCanBlockGrass(); - flag5 = blockAccess.getBlock(xPos - 1, yPos, zPos + 1).getCanBlockGrass(); - - if (!flag4 && !flag3) - { - this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXZNN; - this.aoBrightnessXYZNNN = this.aoBrightnessXZNN; - } - else - { - this.aoLightValueScratchXYZNNN = blockAccess.getBlock(xPos, yPos - 1, zPos - 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos - 1); - } - - if (!flag5 && !flag3) - { - this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXZNP; - this.aoBrightnessXYZNNP = this.aoBrightnessXZNP; - } - else - { - this.aoLightValueScratchXYZNNP = blockAccess.getBlock(xPos, yPos - 1, zPos + 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos + 1); - } - - if (!flag4 && !flag2) - { - this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXZNN; - this.aoBrightnessXYZNPN = this.aoBrightnessXZNN; - } - else - { - this.aoLightValueScratchXYZNPN = blockAccess.getBlock(xPos, yPos + 1, zPos - 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos - 1); - } - - if (!flag5 && !flag2) - { - this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXZNP; - this.aoBrightnessXYZNPP = this.aoBrightnessXZNP; - } - else - { - this.aoLightValueScratchXYZNPP = blockAccess.getBlock(xPos, yPos + 1, zPos + 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos + 1); - } - - if (this.renderMinX <= 0.0D) - { - ++xPos; - } - - i1 = l; - - if (this.renderMinX <= 0.0D || !blockAccess.getBlock(xPos - 1, yPos, zPos).isOpaqueCube()) - { - i1 = block.getMixedBrightnessForBlock(blockAccess, xPos - 1, yPos, zPos); - } - - f7 = blockAccess.getBlock(xPos - 1, yPos, zPos).getAmbientOcclusionLightValue(); - f8 = (this.aoLightValueScratchXYNN + this.aoLightValueScratchXYZNNP + f7 + this.aoLightValueScratchXZNP) / 4.0F; - f9 = (f7 + this.aoLightValueScratchXZNP + this.aoLightValueScratchXYNP + this.aoLightValueScratchXYZNPP) / 4.0F; - f10 = (this.aoLightValueScratchXZNN + f7 + this.aoLightValueScratchXYZNPN + this.aoLightValueScratchXYNP) / 4.0F; - f11 = (this.aoLightValueScratchXYZNNN + this.aoLightValueScratchXYNN + this.aoLightValueScratchXZNN + f7) / 4.0F; - f3 = (float)((double)f9 * this.renderMaxY * this.renderMaxZ + (double)f10 * this.renderMaxY * (1.0D - this.renderMaxZ) + (double)f11 * (1.0D - this.renderMaxY) * (1.0D - this.renderMaxZ) + (double)f8 * (1.0D - this.renderMaxY) * this.renderMaxZ); - f4 = (float)((double)f9 * this.renderMaxY * this.renderMinZ + (double)f10 * this.renderMaxY * (1.0D - this.renderMinZ) + (double)f11 * (1.0D - this.renderMaxY) * (1.0D - this.renderMinZ) + (double)f8 * (1.0D - this.renderMaxY) * this.renderMinZ); - f5 = (float)((double)f9 * this.renderMinY * this.renderMinZ + (double)f10 * this.renderMinY * (1.0D - this.renderMinZ) + (double)f11 * (1.0D - this.renderMinY) * (1.0D - this.renderMinZ) + (double)f8 * (1.0D - this.renderMinY) * this.renderMinZ); - f6 = (float)((double)f9 * this.renderMinY * this.renderMaxZ + (double)f10 * this.renderMinY * (1.0D - this.renderMaxZ) + (double)f11 * (1.0D - this.renderMinY) * (1.0D - this.renderMaxZ) + (double)f8 * (1.0D - this.renderMinY) * this.renderMaxZ); - j1 = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYNN, this.aoBrightnessXYZNNP, this.aoBrightnessXZNP, i1); - k1 = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXZNP, this.aoBrightnessXYNP, this.aoBrightnessXYZNPP, i1); - l1 = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXZNN, this.aoBrightnessXYZNPN, this.aoBrightnessXYNP, i1); - i2 = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYZNNN, this.aoBrightnessXYNN, this.aoBrightnessXZNN, i1); - this.brightnessTopLeft = RenderBlocks.getInstance().mixAoBrightness(k1, l1, i2, j1, this.renderMaxY * this.renderMaxZ, this.renderMaxY * (1.0D - this.renderMaxZ), (1.0D - this.renderMaxY) * (1.0D - this.renderMaxZ), (1.0D - this.renderMaxY) * this.renderMaxZ); - this.brightnessBottomLeft = RenderBlocks.getInstance().mixAoBrightness(k1, l1, i2, j1, this.renderMaxY * this.renderMinZ, this.renderMaxY * (1.0D - this.renderMinZ), (1.0D - this.renderMaxY) * (1.0D - this.renderMinZ), (1.0D - this.renderMaxY) * this.renderMinZ); - this.brightnessBottomRight = RenderBlocks.getInstance().mixAoBrightness(k1, l1, i2, j1, this.renderMinY * this.renderMinZ, this.renderMinY * (1.0D - this.renderMinZ), (1.0D - this.renderMinY) * (1.0D - this.renderMinZ), (1.0D - this.renderMinY) * this.renderMinZ); - this.brightnessTopRight = RenderBlocks.getInstance().mixAoBrightness(k1, l1, i2, j1, this.renderMinY * this.renderMaxZ, this.renderMinY * (1.0D - this.renderMaxZ), (1.0D - this.renderMinY) * (1.0D - this.renderMaxZ), (1.0D - this.renderMinY) * this.renderMaxZ); - - if (flag1) - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = R * 0.6F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = G * 0.6F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = B * 0.6F; - } - else - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.6F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.6F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.6F; - } - - this.colorRedTopLeft *= f3; - this.colorGreenTopLeft *= f3; - this.colorBlueTopLeft *= f3; - this.colorRedBottomLeft *= f4; - this.colorGreenBottomLeft *= f4; - this.colorBlueBottomLeft *= f4; - this.colorRedBottomRight *= f5; - this.colorGreenBottomRight *= f5; - this.colorBlueBottomRight *= f5; - this.colorRedTopRight *= f6; - this.colorGreenTopRight *= f6; - this.colorBlueTopRight *= f6; - iicon = this.getBlockIcon(block, blockAccess, xPos, yPos, zPos, 4); - CustomOreBlockRenderer.renderFaceXNeg(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - - RenderBlocks.getInstance(); - if (RenderBlocks.fancyGrass && iicon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) - { - this.colorRedTopLeft *= R; - this.colorRedBottomLeft *= R; - this.colorRedBottomRight *= R; - this.colorRedTopRight *= R; - this.colorGreenTopLeft *= G; - this.colorGreenBottomLeft *= G; - this.colorGreenBottomRight *= G; - this.colorGreenTopRight *= G; - this.colorBlueTopLeft *= B; - this.colorBlueBottomLeft *= B; - this.colorBlueBottomRight *= B; - this.colorBlueTopRight *= B; - CustomOreBlockRenderer.renderFaceXNeg(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - } - - flag = true; - } - - if (RenderBlocks.getInstance().renderAllFaces || block.shouldSideBeRendered(blockAccess, xPos + 1, yPos, zPos, 5)) - { - if (this.renderMaxX >= 1.0D) - { - ++xPos; - } - - this.aoLightValueScratchXYPN = blockAccess.getBlock(xPos, yPos - 1, zPos).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXZPN = blockAccess.getBlock(xPos, yPos, zPos - 1).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXZPP = blockAccess.getBlock(xPos, yPos, zPos + 1).getAmbientOcclusionLightValue(); - this.aoLightValueScratchXYPP = blockAccess.getBlock(xPos, yPos + 1, zPos).getAmbientOcclusionLightValue(); - this.aoBrightnessXYPN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos); - this.aoBrightnessXZPN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos - 1); - this.aoBrightnessXZPP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos, zPos + 1); - this.aoBrightnessXYPP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos); - flag2 = blockAccess.getBlock(xPos + 1, yPos + 1, zPos).getCanBlockGrass(); - flag3 = blockAccess.getBlock(xPos + 1, yPos - 1, zPos).getCanBlockGrass(); - flag4 = blockAccess.getBlock(xPos + 1, yPos, zPos + 1).getCanBlockGrass(); - flag5 = blockAccess.getBlock(xPos + 1, yPos, zPos - 1).getCanBlockGrass(); - - if (!flag3 && !flag5) - { - this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXZPN; - this.aoBrightnessXYZPNN = this.aoBrightnessXZPN; - } - else - { - this.aoLightValueScratchXYZPNN = blockAccess.getBlock(xPos, yPos - 1, zPos - 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos - 1); - } - - if (!flag3 && !flag4) - { - this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXZPP; - this.aoBrightnessXYZPNP = this.aoBrightnessXZPP; - } - else - { - this.aoLightValueScratchXYZPNP = blockAccess.getBlock(xPos, yPos - 1, zPos + 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos - 1, zPos + 1); - } - - if (!flag2 && !flag5) - { - this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXZPN; - this.aoBrightnessXYZPPN = this.aoBrightnessXZPN; - } - else - { - this.aoLightValueScratchXYZPPN = blockAccess.getBlock(xPos, yPos + 1, zPos - 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos - 1); - } - - if (!flag2 && !flag4) - { - this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXZPP; - this.aoBrightnessXYZPPP = this.aoBrightnessXZPP; - } - else - { - this.aoLightValueScratchXYZPPP = blockAccess.getBlock(xPos, yPos + 1, zPos + 1).getAmbientOcclusionLightValue(); - this.aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(blockAccess, xPos, yPos + 1, zPos + 1); - } - - if (this.renderMaxX >= 1.0D) - { - --xPos; - } - - i1 = l; - - if (this.renderMaxX >= 1.0D || !blockAccess.getBlock(xPos + 1, yPos, zPos).isOpaqueCube()) - { - i1 = block.getMixedBrightnessForBlock(blockAccess, xPos + 1, yPos, zPos); - } - - f7 = blockAccess.getBlock(xPos + 1, yPos, zPos).getAmbientOcclusionLightValue(); - f8 = (this.aoLightValueScratchXYPN + this.aoLightValueScratchXYZPNP + f7 + this.aoLightValueScratchXZPP) / 4.0F; - f9 = (this.aoLightValueScratchXYZPNN + this.aoLightValueScratchXYPN + this.aoLightValueScratchXZPN + f7) / 4.0F; - f10 = (this.aoLightValueScratchXZPN + f7 + this.aoLightValueScratchXYZPPN + this.aoLightValueScratchXYPP) / 4.0F; - f11 = (f7 + this.aoLightValueScratchXZPP + this.aoLightValueScratchXYPP + this.aoLightValueScratchXYZPPP) / 4.0F; - f3 = (float)((double)f8 * (1.0D - this.renderMinY) * this.renderMaxZ + (double)f9 * (1.0D - this.renderMinY) * (1.0D - this.renderMaxZ) + (double)f10 * this.renderMinY * (1.0D - this.renderMaxZ) + (double)f11 * this.renderMinY * this.renderMaxZ); - f4 = (float)((double)f8 * (1.0D - this.renderMinY) * this.renderMinZ + (double)f9 * (1.0D - this.renderMinY) * (1.0D - this.renderMinZ) + (double)f10 * this.renderMinY * (1.0D - this.renderMinZ) + (double)f11 * this.renderMinY * this.renderMinZ); - f5 = (float)((double)f8 * (1.0D - this.renderMaxY) * this.renderMinZ + (double)f9 * (1.0D - this.renderMaxY) * (1.0D - this.renderMinZ) + (double)f10 * this.renderMaxY * (1.0D - this.renderMinZ) + (double)f11 * this.renderMaxY * this.renderMinZ); - f6 = (float)((double)f8 * (1.0D - this.renderMaxY) * this.renderMaxZ + (double)f9 * (1.0D - this.renderMaxY) * (1.0D - this.renderMaxZ) + (double)f10 * this.renderMaxY * (1.0D - this.renderMaxZ) + (double)f11 * this.renderMaxY * this.renderMaxZ); - j1 = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYPN, this.aoBrightnessXYZPNP, this.aoBrightnessXZPP, i1); - k1 = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXZPP, this.aoBrightnessXYPP, this.aoBrightnessXYZPPP, i1); - l1 = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXZPN, this.aoBrightnessXYZPPN, this.aoBrightnessXYPP, i1); - i2 = RenderBlocks.getInstance().getAoBrightness(this.aoBrightnessXYZPNN, this.aoBrightnessXYPN, this.aoBrightnessXZPN, i1); - this.brightnessTopLeft = RenderBlocks.getInstance().mixAoBrightness(j1, i2, l1, k1, (1.0D - this.renderMinY) * this.renderMaxZ, (1.0D - this.renderMinY) * (1.0D - this.renderMaxZ), this.renderMinY * (1.0D - this.renderMaxZ), this.renderMinY * this.renderMaxZ); - this.brightnessBottomLeft = RenderBlocks.getInstance().mixAoBrightness(j1, i2, l1, k1, (1.0D - this.renderMinY) * this.renderMinZ, (1.0D - this.renderMinY) * (1.0D - this.renderMinZ), this.renderMinY * (1.0D - this.renderMinZ), this.renderMinY * this.renderMinZ); - this.brightnessBottomRight = RenderBlocks.getInstance().mixAoBrightness(j1, i2, l1, k1, (1.0D - this.renderMaxY) * this.renderMinZ, (1.0D - this.renderMaxY) * (1.0D - this.renderMinZ), this.renderMaxY * (1.0D - this.renderMinZ), this.renderMaxY * this.renderMinZ); - this.brightnessTopRight = RenderBlocks.getInstance().mixAoBrightness(j1, i2, l1, k1, (1.0D - this.renderMaxY) * this.renderMaxZ, (1.0D - this.renderMaxY) * (1.0D - this.renderMaxZ), this.renderMaxY * (1.0D - this.renderMaxZ), this.renderMaxY * this.renderMaxZ); - - if (flag1) - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = R * 0.6F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = G * 0.6F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = B * 0.6F; - } - else - { - this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.6F; - this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.6F; - this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.6F; - } - - this.colorRedTopLeft *= f3; - this.colorGreenTopLeft *= f3; - this.colorBlueTopLeft *= f3; - this.colorRedBottomLeft *= f4; - this.colorGreenBottomLeft *= f4; - this.colorBlueBottomLeft *= f4; - this.colorRedBottomRight *= f5; - this.colorGreenBottomRight *= f5; - this.colorBlueBottomRight *= f5; - this.colorRedTopRight *= f6; - this.colorGreenTopRight *= f6; - this.colorBlueTopRight *= f6; - iicon = this.getBlockIcon(block, blockAccess, xPos, yPos, zPos, 5); - CustomOreBlockRenderer.renderFaceXPos(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - - RenderBlocks.getInstance(); - if (RenderBlocks.fancyGrass && iicon.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) - { - this.colorRedTopLeft *= R; - this.colorRedBottomLeft *= R; - this.colorRedBottomRight *= R; - this.colorRedTopRight *= R; - this.colorGreenTopLeft *= G; - this.colorGreenBottomLeft *= G; - this.colorGreenBottomRight *= G; - this.colorGreenTopRight *= G; - this.colorBlueTopLeft *= B; - this.colorBlueBottomLeft *= B; - this.colorBlueBottomRight *= B; - this.colorBlueTopRight *= B; - CustomOreBlockRenderer.renderFaceXPos(aWorld, aRenderer, block, xPos, yPos, zPos, aTextures); - } - - flag = true; - } - - this.enableAO = false; - return flag; - } - -} diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderBatKing.java b/src/Java/gtPlusPlus/core/client/renderer/RenderBatKing.java deleted file mode 100644 index 000badb80f..0000000000 --- a/src/Java/gtPlusPlus/core/client/renderer/RenderBatKing.java +++ /dev/null @@ -1,152 +0,0 @@ -package gtPlusPlus.core.client.renderer; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.client.model.ModelBatKing; -import gtPlusPlus.core.entity.monster.EntityBatKing; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.client.renderer.entity.RenderLiving; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; - -@SideOnly(Side.CLIENT) -public class RenderBatKing extends RenderLiving { - - private static final ResourceLocation batTextures = new ResourceLocation(CORE.MODID+":"+"textures/entity/batKing.png"); - - /** - * not actually sure this is size, is not used as of now, but the model would be - * recreated if the value changed and it seems a good match for a bats size - */ - private int renderedBatSize; - - public RenderBatKing() { - super(new ModelBatKing(), 0.7F); - this.renderedBatSize = (((ModelBatKing) this.mainModel).getBatSize()); - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, - * always casting down its argument and then handing it off to a worker function - * which does the actual work. In all probabilty, the class Render is generic - * (Render<T extends Entity) and this method has signature public void - * func_76986_a(T entity, double d, double d1, double d2, float f, float f1). - * But JAD is pre 1.5 so doesn't do that. - */ - public void doRender(EntityBatKing p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, - float p_76986_8_, float p_76986_9_) { - int i = ((ModelBatKing) this.mainModel).getBatSize(); - - if (i != this.renderedBatSize) { - this.renderedBatSize = i; - this.mainModel = new ModelBatKing(); - } - - super.doRender((EntityLiving) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); - } - - /** - * Returns the location of an entity's texture. Doesn't seem to be called unless - * you call Render.bindEntityTexture. - */ - protected ResourceLocation getEntityTexture(EntityBatKing p_110775_1_) { - return batTextures; - } - - /** - * Allows the render to do any OpenGL state modifications necessary before the - * model is rendered. Args: entityLiving, partialTickTime - */ - protected void preRenderCallback(EntityBatKing p_77041_1_, float p_77041_2_) { - GL11.glScalef(0.35F, 0.35F, 0.35F); - } - - /** - * Sets a simple glTranslate on a LivingEntity. - */ - protected void renderLivingAt(EntityBatKing p_77039_1_, double p_77039_2_, double p_77039_4_, double p_77039_6_) { - super.renderLivingAt(p_77039_1_, p_77039_2_, p_77039_4_, p_77039_6_); - } - - protected void rotateCorpse(EntityBatKing p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) { - if (!p_77043_1_.getIsBatHanging()) { - GL11.glTranslatef(0.0F, MathHelper.cos(p_77043_2_ * 0.3F) * 0.1F, 0.0F); - } else { - GL11.glTranslatef(0.0F, -0.1F, 0.0F); - } - - super.rotateCorpse(p_77043_1_, p_77043_2_, p_77043_3_, p_77043_4_); - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, - * always casting down its argument and then handing it off to a worker function - * which does the actual work. In all probabilty, the class Render is generic - * (Render<T extends Entity) and this method has signature public void - * func_76986_a(T entity, double d, double d1, double d2, float f, float f1). - * But JAD is pre 1.5 so doesn't do that. - */ - public void doRender(EntityLiving p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, - float p_76986_8_, float p_76986_9_) { - this.doRender((EntityBatKing) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); - } - - /** - * Allows the render to do any OpenGL state modifications necessary before the - * model is rendered. Args: entityLiving, partialTickTime - */ - protected void preRenderCallback(EntityLivingBase p_77041_1_, float p_77041_2_) { - this.preRenderCallback((EntityBatKing) p_77041_1_, p_77041_2_); - } - - protected void rotateCorpse(EntityLivingBase p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) { - this.rotateCorpse((EntityBatKing) p_77043_1_, p_77043_2_, p_77043_3_, p_77043_4_); - } - - /** - * Sets a simple glTranslate on a LivingEntity. - */ - protected void renderLivingAt(EntityLivingBase p_77039_1_, double p_77039_2_, double p_77039_4_, - double p_77039_6_) { - this.renderLivingAt((EntityBatKing) p_77039_1_, p_77039_2_, p_77039_4_, p_77039_6_); - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, - * always casting down its argument and then handing it off to a worker function - * which does the actual work. In all probabilty, the class Render is generic - * (Render<T extends Entity) and this method has signature public void - * func_76986_a(T entity, double d, double d1, double d2, float f, float f1). - * But JAD is pre 1.5 so doesn't do that. - */ - public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, - float p_76986_8_, float p_76986_9_) { - this.doRender((EntityBatKing) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); - } - - /** - * Returns the location of an entity's texture. Doesn't seem to be called unless - * you call Render.bindEntityTexture. - */ - protected ResourceLocation getEntityTexture(Entity p_110775_1_) { - return this.getEntityTexture((EntityBatKing) p_110775_1_); - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, - * always casting down its argument and then handing it off to a worker function - * which does the actual work. In all probabilty, the class Render is generic - * (Render<T extends Entity) and this method has signature public void - * func_76986_a(T entity, double d, double d1, double d2, float f, float f1). - * But JAD is pre 1.5 so doesn't do that. - */ - public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, - float p_76986_9_) { - this.doRender((EntityBatKing) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderDecayChest.java b/src/Java/gtPlusPlus/core/client/renderer/RenderDecayChest.java deleted file mode 100644 index 73ab4093eb..0000000000 --- a/src/Java/gtPlusPlus/core/client/renderer/RenderDecayChest.java +++ /dev/null @@ -1,82 +0,0 @@ -package gtPlusPlus.core.client.renderer; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import cpw.mods.fml.client.registry.RenderingRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.client.model.ModelDecayChest; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; - -@SideOnly(Side.CLIENT) -public class RenderDecayChest extends TileEntitySpecialRenderer { - - private static final ResourceLocation mChestTexture = new ResourceLocation(CORE.MODID, "textures/blocks/TileEntities/DecayablesChest_full.png"); - private ModelDecayChest mChestModel = new ModelDecayChest(); - - public static RenderDecayChest INSTANCE; - public final int mRenderID; - - public RenderDecayChest() { - INSTANCE = this; - this.mRenderID = RenderingRegistry.getNextAvailableRenderId(); - Logger.INFO("Registered Lead Lined Chest Renderer."); - - } - - public void renderTileEntityAt(TileEntityDecayablesChest p_147500_1_, double p_147500_2_, double p_147500_4_, - double p_147500_6_, float p_147500_8_) { - - int i = 0; - - if (true) { - this.bindTexture(mChestTexture); - GL11.glPushMatrix(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glTranslatef((float) p_147500_2_, (float) p_147500_4_ + 1.0F, (float) p_147500_6_ + 1.0F); - GL11.glScalef(1.0F, -1.0F, -1.0F); - GL11.glTranslatef(0.5F, 0.5F, 0.5F); - short short1 = 0; - - if (i == 2) { - short1 = 180; - } - - if (i == 3) { - short1 = 0; - } - - if (i == 4) { - short1 = 90; - } - - if (i == 5) { - short1 = -90; - } - - GL11.glRotatef((float) short1, 0.0F, 1.0F, 0.0F); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - float f1 = p_147500_1_.prevLidAngle + (p_147500_1_.lidAngle - p_147500_1_.prevLidAngle) * p_147500_8_; - - f1 = 1.0F - f1; - f1 = 1.0F - f1 * f1 * f1; - mChestModel.chestLid.rotateAngleX = -(f1 * CORE.PI / 2.0F); - mChestModel.renderAll(); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - GL11.glPopMatrix(); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - } - } - - public void renderTileEntityAt(TileEntity p_147500_1_, double p_147500_2_, double p_147500_4_, double p_147500_6_, - float p_147500_8_) { - this.renderTileEntityAt((TileEntityDecayablesChest) p_147500_1_, p_147500_2_, p_147500_4_, p_147500_6_, p_147500_8_); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderGiantChicken.java b/src/Java/gtPlusPlus/core/client/renderer/RenderGiantChicken.java deleted file mode 100644 index cc1249280b..0000000000 --- a/src/Java/gtPlusPlus/core/client/renderer/RenderGiantChicken.java +++ /dev/null @@ -1,15 +0,0 @@ -package gtPlusPlus.core.client.renderer; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.renderer.entity.RenderChicken; - -@SideOnly(Side.CLIENT) -public class RenderGiantChicken extends RenderChicken { - - public RenderGiantChicken(ModelBase p_i1252_1_, float p_i1252_2_) - { - super(p_i1252_1_, p_i1252_2_); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java b/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java deleted file mode 100644 index 893982e8ac..0000000000 --- a/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java +++ /dev/null @@ -1,107 +0,0 @@ -package gtPlusPlus.core.client.renderer; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.entity.RenderTNTPrimed; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.entity.Entity; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.entity.EntityPrimedMiningExplosive; - -@SideOnly(Side.CLIENT) -public class RenderMiningExplosivesPrimed extends RenderTNTPrimed { - private final RenderBlocks blockRenderer = new RenderBlocks(); - - public RenderMiningExplosivesPrimed(){ - this.shadowSize = 0.5F; - Logger.WARNING("Rendering Mining Explosion. 1"); - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then - * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic - * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, - * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. - */ - public void doRender(final EntityPrimedMiningExplosive entity, final double p_76986_2_, final double p_76986_4_, final double p_76986_6_, final float p_76986_8_, final float p_76986_9_){ - Logger.WARNING("Rendering Mining Explosion. 2"); - GL11.glPushMatrix(); - GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_); - float f2; - - if (((entity.fuse - p_76986_9_) + 1.0F) < 10.0F) - { - f2 = 1.0F - (((entity.fuse - p_76986_9_) + 1.0F) / 10.0F); - - if (f2 < 0.0F) - { - f2 = 0.0F; - } - - if (f2 > 1.0F) - { - f2 = 1.0F; - } - - f2 *= f2; - f2 *= f2; - final float f3 = 1.0F + (f2 * 0.3F); - GL11.glScalef(f3, f3, f3); - } - - f2 = (1.0F - (((entity.fuse - p_76986_9_) + 1.0F) / 100.0F)) * 0.8F; - this.bindEntityTexture(entity); - this.blockRenderer.renderBlockAsItem(ModBlocks.blockMiningExplosive, 0, entity.getBrightness(p_76986_9_)); - - if (((entity.fuse / 5) % 2) == 0) - { - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA); - GL11.glColor4f(1.0F, 1.0F, 1.0F, f2); - this.blockRenderer.renderBlockAsItem(ModBlocks.blockMiningExplosive, 0, 1.0F); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_TEXTURE_2D); - } - - GL11.glPopMatrix(); - } - - /** - * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. - */ - protected ResourceLocation getEntityTexture(final EntityPrimedMiningExplosive p_110775_1_){ - return TextureMap.locationBlocksTexture; - } - - /** - * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. - */ - @Override - protected ResourceLocation getEntityTexture(final Entity p_110775_1_){ - Logger.WARNING("Rendering Mining Explosion. 4"); - return this.getEntityTexture((EntityPrimedMiningExplosive)p_110775_1_); - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then - * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic - * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, - * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. - */ - @Override - public void doRender(final Entity p_76986_1_, final double p_76986_2_, final double p_76986_4_, final double p_76986_6_, final float p_76986_8_, final float p_76986_9_){ - Logger.WARNING("Rendering Mining Explosion. 3"); - this.doRender((EntityPrimedMiningExplosive)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderPlasmaBolt.java b/src/Java/gtPlusPlus/core/client/renderer/RenderPlasmaBolt.java deleted file mode 100644 index b73154da10..0000000000 --- a/src/Java/gtPlusPlus/core/client/renderer/RenderPlasmaBolt.java +++ /dev/null @@ -1,168 +0,0 @@ -package gtPlusPlus.core.client.renderer; - -import java.util.Random; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.entity.Entity; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.random.XSTR; -import gtPlusPlus.core.entity.EntityTeslaTowerLightning; - -@SideOnly(Side.CLIENT) -public class RenderPlasmaBolt extends Render { - - public RenderPlasmaBolt(){ - Logger.INFO("[Render] Create custom lightning renderer."); - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, - * always casting down its argument and then handing it off to a worker - * function which does the actual work. In all probabilty, the class Render - * is generic (Render<T extends Entity) and this method has signature public - * void func_76986_a(T entity, double d, double d1, double d2, float f, - * float f1). But JAD is pre 1.5 so doesn't do that. - */ - public void doRender(EntityTeslaTowerLightning p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, - float p_76986_8_, float p_76986_9_) { - Logger.INFO("Render Plasma. 1"); - Tessellator tessellator = Tessellator.instance; - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); - double[] adouble = new double[8]; - double[] adouble1 = new double[8]; - double d3 = 0.0D; - double d4 = 0.0D; - Random random = new XSTR(p_76986_1_.boltVertex); - - for (int i = 7; i >= 0; --i) { - adouble[i] = d3; - adouble1[i] = d4; - d3 += (double) (random.nextInt(11) - 5); - d4 += (double) (random.nextInt(11) - 5); - } - - for (int k1 = 0; k1 < 4; ++k1) { - Random random1 = new XSTR(p_76986_1_.boltVertex); - - for (int j = 0; j < 3; ++j) { - int k = 7; - int l = 0; - - if (j > 0) { - k = 7 - j; - } - - if (j > 0) { - l = k - 2; - } - - double d5 = adouble[k] - d3; - double d6 = adouble1[k] - d4; - - for (int i1 = k; i1 >= l; --i1) { - double d7 = d5; - double d8 = d6; - - if (j == 0) { - d5 += (double) (random1.nextInt(11) - 5); - d6 += (double) (random1.nextInt(11) - 5); - } - else { - d5 += (double) (random1.nextInt(31) - 15); - d6 += (double) (random1.nextInt(31) - 15); - } - - tessellator.startDrawing(5); - float f2 = 0.5F; - tessellator.setColorRGBA_F(0.9F * f2, 0.9F * f2, 1.0F * f2, 0.3F); - double d9 = 0.1D + (double) k1 * 0.2D; - - if (j == 0) { - d9 *= (double) i1 * 0.1D + 1.0D; - } - - double d10 = 0.1D + (double) k1 * 0.2D; - - if (j == 0) { - d10 *= (double) (i1 - 1) * 0.1D + 1.0D; - } - - for (int j1 = 0; j1 < 5; ++j1) { - double d11 = p_76986_2_ + 0.5D - d9; - double d12 = p_76986_6_ + 0.5D - d9; - - if (j1 == 1 || j1 == 2) { - d11 += d9 * 2.0D; - } - - if (j1 == 2 || j1 == 3) { - d12 += d9 * 2.0D; - } - - double d13 = p_76986_2_ + 0.5D - d10; - double d14 = p_76986_6_ + 0.5D - d10; - - if (j1 == 1 || j1 == 2) { - d13 += d10 * 2.0D; - } - - if (j1 == 2 || j1 == 3) { - d14 += d10 * 2.0D; - } - - tessellator.addVertex(d13 + d5, p_76986_4_ + (double) (i1 * 16), d14 + d6); - tessellator.addVertex(d11 + d7, p_76986_4_ + (double) ((i1 + 1) * 16), d12 + d8); - } - - tessellator.draw(); - } - } - } - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_TEXTURE_2D); - } - - /** - * Returns the location of an entity's texture. Doesn't seem to be called - * unless you call Render.bindEntityTexture. - */ - protected ResourceLocation getEntityTexture(EntityTeslaTowerLightning p_110775_1_) { - return null; - } - - /** - * Returns the location of an entity's texture. Doesn't seem to be called - * unless you call Render.bindEntityTexture. - */ - protected ResourceLocation getEntityTexture(Entity p_110775_1_) { - Logger.INFO("Render Plasma. 5"); - return this.getEntityTexture((EntityTeslaTowerLightning) p_110775_1_); - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, - * always casting down its argument and then handing it off to a worker - * function which does the actual work. In all probabilty, the class Render - * is generic (Render<T extends Entity) and this method has signature public - * void func_76986_a(T entity, double d, double d1, double d2, float f, - * float f1). But JAD is pre 1.5 so doesn't do that. - */ - public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, - float p_76986_9_) { - Logger.INFO("Render Plasma. 2"); - this.doRender((EntityTeslaTowerLightning) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, - p_76986_9_); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderPotionthrow.java b/src/Java/gtPlusPlus/core/client/renderer/RenderPotionthrow.java deleted file mode 100644 index a0e396bc23..0000000000 --- a/src/Java/gtPlusPlus/core/client/renderer/RenderPotionthrow.java +++ /dev/null @@ -1,104 +0,0 @@ -package gtPlusPlus.core.client.renderer; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.entity.Entity; -import net.minecraft.entity.projectile.EntityPotion; -import net.minecraft.item.Item; -import net.minecraft.item.ItemPotion; -import net.minecraft.potion.PotionHelper; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; - -@SideOnly(Side.CLIENT) -public class RenderPotionthrow extends Render -{ - private Item mRenderItem; - private int mDamage; - - public RenderPotionthrow(Item p_i1259_1_, int p_i1259_2_) - { - this.mRenderItem = p_i1259_1_; - this.mDamage = p_i1259_2_; - } - - public RenderPotionthrow(Item p_i1260_1_) - { - this(p_i1260_1_, 0); - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then - * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic - * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, - * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. - */ - @Override - public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) - { - IIcon iicon = this.mRenderItem.getIconFromDamage(this.mDamage); - - if (iicon != null) - { - GL11.glPushMatrix(); - GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glScalef(0.5F, 0.5F, 0.5F); - this.bindEntityTexture(p_76986_1_); - Tessellator tessellator = Tessellator.instance; - - if (iicon == ItemPotion.func_94589_d("bottle_splash")) - { - int i = PotionHelper.func_77915_a(((EntityPotion)p_76986_1_).getPotionDamage(), false); - float f2 = (i >> 16 & 255) / 255.0F; - float f3 = (i >> 8 & 255) / 255.0F; - float f4 = (i & 255) / 255.0F; - GL11.glColor3f(f2, f3, f4); - GL11.glPushMatrix(); - this.func_77026_a(tessellator, ItemPotion.func_94589_d("overlay")); - GL11.glPopMatrix(); - GL11.glColor3f(1.0F, 1.0F, 1.0F); - } - - this.func_77026_a(tessellator, iicon); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - GL11.glPopMatrix(); - } - } - - /** - * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. - */ - @Override - protected ResourceLocation getEntityTexture(Entity p_110775_1_) - { - return TextureMap.locationItemsTexture; - } - - private void func_77026_a(Tessellator p_77026_1_, IIcon p_77026_2_) - { - float f = p_77026_2_.getMinU(); - float f1 = p_77026_2_.getMaxU(); - float f2 = p_77026_2_.getMinV(); - float f3 = p_77026_2_.getMaxV(); - float f4 = 1.0F; - float f5 = 0.5F; - float f6 = 0.25F; - GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); - p_77026_1_.startDrawingQuads(); - p_77026_1_.setNormal(0.0F, 1.0F, 0.0F); - p_77026_1_.addVertexWithUV(0.0F - f5, 0.0F - f6, 0.0D, f, f3); - p_77026_1_.addVertexWithUV(f4 - f5, 0.0F - f6, 0.0D, f1, f3); - p_77026_1_.addVertexWithUV(f4 - f5, f4 - f6, 0.0D, f1, f2); - p_77026_1_.addVertexWithUV(0.0F - f5, f4 - f6, 0.0D, f, f2); - p_77026_1_.draw(); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderSickBlaze.java b/src/Java/gtPlusPlus/core/client/renderer/RenderSickBlaze.java deleted file mode 100644 index e1e8360840..0000000000 --- a/src/Java/gtPlusPlus/core/client/renderer/RenderSickBlaze.java +++ /dev/null @@ -1,99 +0,0 @@ -package gtPlusPlus.core.client.renderer; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.renderer.entity.RenderLiving; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.core.client.model.ModelSickBlaze; -import gtPlusPlus.core.entity.monster.EntitySickBlaze; -import gtPlusPlus.core.lib.CORE; - -@SideOnly(Side.CLIENT) -public class RenderSickBlaze extends RenderLiving -{ - private static final ResourceLocation blazeTextures = new ResourceLocation(CORE.MODID+":"+"textures/entity/sickBlaze.png"); - private int field_77068_a; - - public RenderSickBlaze() - { - super(new ModelSickBlaze(), 0.5F); - this.field_77068_a = ((ModelSickBlaze)this.mainModel).func_78104_a(); - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then - * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic - * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, - * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. - */ - public void doRender(EntitySickBlaze p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) - { - int i = ((ModelSickBlaze)this.mainModel).func_78104_a(); - - if (i != this.field_77068_a) - { - this.field_77068_a = i; - this.mainModel = new ModelSickBlaze(); - } - - super.doRender(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); - } - - /** - * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. - */ - protected ResourceLocation getEntityTexture(EntitySickBlaze p_110775_1_) - { - return blazeTextures; - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then - * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic - * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, - * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. - */ - @Override - public void doRender(EntityLiving p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) - { - this.doRender((EntitySickBlaze)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then - * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic - * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, - * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. - */ - @Override - public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) - { - this.doRender((EntitySickBlaze)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); - } - - /** - * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. - */ - @Override - protected ResourceLocation getEntityTexture(Entity p_110775_1_) - { - return this.getEntityTexture((EntitySickBlaze)p_110775_1_); - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then - * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic - * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, - * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. - */ - @Override - public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) - { - this.doRender((EntitySickBlaze)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderStaballoyConstruct.java b/src/Java/gtPlusPlus/core/client/renderer/RenderStaballoyConstruct.java deleted file mode 100644 index c1fd88773d..0000000000 --- a/src/Java/gtPlusPlus/core/client/renderer/RenderStaballoyConstruct.java +++ /dev/null @@ -1,149 +0,0 @@ -package gtPlusPlus.core.client.renderer; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.entity.RenderLiving; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.init.Blocks; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.core.client.model.ModelStaballoyConstruct; -import gtPlusPlus.core.entity.monster.EntityStaballoyConstruct; -import gtPlusPlus.core.lib.CORE; - -@SideOnly(Side.CLIENT) -public class RenderStaballoyConstruct extends RenderLiving { - private static final ResourceLocation staballoyGolemTextures = new ResourceLocation(CORE.MODID+":"+"textures/entity/golemStaballoy.png"); - /** Staballoy Golem's Model. */ - private final ModelStaballoyConstruct staballoyGolemModel; - - public RenderStaballoyConstruct() { - super(new ModelStaballoyConstruct(), 0.8F); - this.staballoyGolemModel = (ModelStaballoyConstruct) this.mainModel; - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, - * always casting down its argument and then handing it off to a worker - * function which does the actual work. In all probabilty, the class Render - * is generic (Render<T extends Entity) and this method has signature public - * void func_76986_a(T entity, double d, double d1, double d2, float f, - * float f1). But JAD is pre 1.5 so doesn't do that. - */ - public void doRender(EntityStaballoyConstruct p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, - float p_76986_8_, float p_76986_9_) { - super.doRender(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); - } - - /** - * Returns the location of an entity's texture. Doesn't seem to be called - * unless you call Render.bindEntityTexture. - */ - protected ResourceLocation getEntityTexture(EntityStaballoyConstruct p_110775_1_) { - return staballoyGolemTextures; - } - - protected void rotateCorpse(EntityStaballoyConstruct p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) { - super.rotateCorpse(p_77043_1_, p_77043_2_, p_77043_3_, p_77043_4_); - - if (p_77043_1_.limbSwingAmount >= 0.01D) { - float f3 = 13.0F; - float f4 = p_77043_1_.limbSwing - p_77043_1_.limbSwingAmount * (1.0F - p_77043_4_) + 6.0F; - float f5 = (Math.abs(f4 % f3 - f3 * 0.5F) - f3 * 0.25F) / (f3 * 0.25F); - GL11.glRotatef(6.5F * f5, 0.0F, 0.0F, 1.0F); - } - } - - protected void renderEquippedItems(EntityStaballoyConstruct p_77029_1_, float p_77029_2_) { - super.renderEquippedItems(p_77029_1_, p_77029_2_); - - if (p_77029_1_.getHoldRoseTick() != 0) { - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glPushMatrix(); - GL11.glRotatef(5.0F + 180.0F * this.staballoyGolemModel.ironGolemRightArm.rotateAngleX / (float) Math.PI, 1.0F, - 0.0F, 0.0F); - GL11.glTranslatef(-0.6875F, 1.25F, -0.9375F); - GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); - float f1 = 0.8F; - GL11.glScalef(f1, -f1, f1); - int i = p_77029_1_.getBrightnessForRender(p_77029_2_); - int j = i % 65536; - int k = i / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.bindTexture(TextureMap.locationBlocksTexture); - this.field_147909_c.renderBlockAsItem(Blocks.red_flower, 0, 1.0F); - GL11.glPopMatrix(); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - } - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, - * always casting down its argument and then handing it off to a worker - * function which does the actual work. In all probabilty, the class Render - * is generic (Render<T extends Entity) and this method has signature public - * void func_76986_a(T entity, double d, double d1, double d2, float f, - * float f1). But JAD is pre 1.5 so doesn't do that. - */ - @Override - public void doRender(EntityLiving p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, - float p_76986_8_, float p_76986_9_) { - this.doRender((EntityStaballoyConstruct) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); - } - - @Override - protected void renderEquippedItems(EntityLivingBase p_77029_1_, float p_77029_2_) { - this.renderEquippedItems((EntityStaballoyConstruct) p_77029_1_, p_77029_2_); - } - - @Override - protected void rotateCorpse(EntityLivingBase p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) { - this.rotateCorpse((EntityStaballoyConstruct) p_77043_1_, p_77043_2_, p_77043_3_, p_77043_4_); - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, - * always casting down its argument and then handing it off to a worker - * function which does the actual work. In all probabilty, the class Render - * is generic (Render<T extends Entity) and this method has signature public - * void func_76986_a(T entity, double d, double d1, double d2, float f, - * float f1). But JAD is pre 1.5 so doesn't do that. - */ - @Override - public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, - float p_76986_8_, float p_76986_9_) { - this.doRender((EntityStaballoyConstruct) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); - } - - /** - * Returns the location of an entity's texture. Doesn't seem to be called - * unless you call Render.bindEntityTexture. - */ - @Override - protected ResourceLocation getEntityTexture(Entity p_110775_1_) { - return this.getEntityTexture((EntityStaballoyConstruct) p_110775_1_); - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, - * always casting down its argument and then handing it off to a worker - * function which does the actual work. In all probabilty, the class Render - * is generic (Render<T extends Entity) and this method has signature public - * void func_76986_a(T entity, double d, double d1, double d2, float f, - * float f1). But JAD is pre 1.5 so doesn't do that. - */ - @Override - public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, - float p_76986_9_) { - this.doRender((EntityStaballoyConstruct) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderToxinball.java b/src/Java/gtPlusPlus/core/client/renderer/RenderToxinball.java deleted file mode 100644 index 711cec169b..0000000000 --- a/src/Java/gtPlusPlus/core/client/renderer/RenderToxinball.java +++ /dev/null @@ -1,93 +0,0 @@ -package gtPlusPlus.core.client.renderer; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.entity.Entity; -import net.minecraft.init.Items; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.core.entity.projectile.EntityToxinball; - -@SideOnly(Side.CLIENT) -public class RenderToxinball extends Render -{ - private float mSize; - - public RenderToxinball(float scale) - { - this.mSize = scale; - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then - * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic - * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, - * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. - */ - public void doRender(EntityToxinball entity, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) - { - GL11.glPushMatrix(); - this.bindEntityTexture(entity); - GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - float f2 = this.mSize; - GL11.glScalef(f2 / 1.0F, f2 / 1.0F, f2 / 1.0F); - IIcon iicon = Items.slime_ball.getIconFromDamage(0); - Tessellator tessellator = Tessellator.instance; - float f3 = iicon.getMinU(); - float f4 = iicon.getMaxU(); - float f5 = iicon.getMinV(); - float f6 = iicon.getMaxV(); - float f7 = 1.0F; - float f8 = 0.5F; - float f9 = 0.25F; - GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 1.0F, 0.0F); - tessellator.addVertexWithUV(0.0F - f8, 0.0F - f9, 0.0D, f3, f6); - tessellator.addVertexWithUV(f7 - f8, 0.0F - f9, 0.0D, f4, f6); - tessellator.addVertexWithUV(f7 - f8, 1.0F - f9, 0.0D, f4, f5); - tessellator.addVertexWithUV(0.0F - f8, 1.0F - f9, 0.0D, f3, f5); - tessellator.draw(); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - GL11.glPopMatrix(); - } - - /** - * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. - */ - protected ResourceLocation getEntityTexture(EntityToxinball entity) - { - return TextureMap.locationItemsTexture; - } - - /** - * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. - */ - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - return this.getEntityTexture((EntityToxinball)entity); - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then - * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic - * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, - * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. - */ - @Override - public void doRender(Entity entity, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) - { - this.doRender((EntityToxinball)entity, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/renderer/particle/EntityDropParticleFX.java b/src/Java/gtPlusPlus/core/client/renderer/particle/EntityDropParticleFX.java deleted file mode 100644 index ed2fdff272..0000000000 --- a/src/Java/gtPlusPlus/core/client/renderer/particle/EntityDropParticleFX.java +++ /dev/null @@ -1,96 +0,0 @@ -package gtPlusPlus.core.client.renderer.particle; - -import cofh.lib.util.helpers.MathHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.BlockLiquid; -import net.minecraft.block.material.Material; -import net.minecraft.client.particle.EntityFX; -import net.minecraft.world.World; - -@SideOnly(Side.CLIENT) -public class EntityDropParticleFX extends EntityFX { - - private int bobTimer; - - public EntityDropParticleFX(World world, double x, double y, double z, float particleRed, float particleGreen, float particleBlue) { - - this(world, x, y, z, particleRed, particleGreen, particleBlue, -1); - } - - public EntityDropParticleFX(World world, double x, double y, double z, float particleRed, float particleGreen, float particleBlue, int gravityMod) { - - super(world, x, y, z, 0.0D, 0.0D, 0.0D); - this.motionX = this.motionY = this.motionZ = 0.0D; - - this.particleRed = particleRed; - this.particleGreen = particleGreen; - this.particleBlue = particleBlue; - - this.setParticleTextureIndex(113); - this.setSize(0.01F, 0.01F); - this.particleGravity = -0.06F * gravityMod; - this.bobTimer = 40; - this.particleMaxAge = (int) (48.0D / (Math.random() * 0.8D + 0.2D)); - this.motionX = this.motionY = this.motionZ = 0.0D; - } - - @Override - public void onUpdate() { - - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; - - this.motionY -= this.particleGravity; - - if (this.bobTimer-- > 0) { - this.motionX *= 0.02D; - this.motionY *= 0.02D; - this.motionZ *= 0.02D; - this.setParticleTextureIndex(113); - } else { - this.setParticleTextureIndex(112); - } - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= 0.9800000190734863D; - this.motionY *= 0.9800000190734863D; - this.motionZ *= 0.9800000190734863D; - - if (this.particleMaxAge-- <= 0) { - this.setDead(); - } - if (this.onGround) { - this.setParticleTextureIndex(114); - this.motionX *= 0.699999988079071D; - this.motionZ *= 0.699999988079071D; - } - if (this.particleGravity > 0) { - Material material = this.worldObj.getBlock(MathHelper.floor(this.posX), MathHelper.floor(this.posY), MathHelper.floor(this.posZ)).getMaterial(); - - if (material.isLiquid() || material.isSolid()) { - double d0 = MathHelper.floor(this.posY) - + 1 - - BlockLiquid.getLiquidHeightPercent(this.worldObj.getBlockMetadata(MathHelper.floor(this.posX), MathHelper.floor(this.posY), - MathHelper.floor(this.posZ))); - if (this.posY < d0) { - this.setDead(); - } - } - } else { - Material material = this.worldObj.getBlock(MathHelper.ceil(this.posX), MathHelper.ceil(this.posY), MathHelper.ceil(this.posZ)).getMaterial(); - - if (material.isLiquid() || material.isSolid()) { - double d0 = MathHelper.ceil(this.posY) - + 1 - - BlockLiquid.getLiquidHeightPercent(this.worldObj.getBlockMetadata(MathHelper.ceil(this.posX), MathHelper.ceil(this.posY), - MathHelper.ceil(this.posZ))); - if (this.posY > d0) { - this.setDead(); - } - } - } - } - -} diff --git a/src/Java/gtPlusPlus/core/client/renderer/tabula/RenderTabulaBase.java b/src/Java/gtPlusPlus/core/client/renderer/tabula/RenderTabulaBase.java deleted file mode 100644 index b4f64f9b35..0000000000 --- a/src/Java/gtPlusPlus/core/client/renderer/tabula/RenderTabulaBase.java +++ /dev/null @@ -1,46 +0,0 @@ -package gtPlusPlus.core.client.renderer.tabula; - -import cpw.mods.fml.client.registry.RenderingRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.client.model.tabula.ModelTabulaBase; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; - -@SideOnly(Side.CLIENT) -public class RenderTabulaBase extends TileEntitySpecialRenderer { - - private final ModelTabulaBase mModel; - private final ResourceLocation mTexture; - private final Class mTileClass; - - public final int mRenderID; - public final RenderTabulaBase mInstance; - - public RenderTabulaBase(ModelTabulaBase aModel, String aTexturePath, Class aTileClass) { - mModel = aModel; - mTexture = new ResourceLocation(CORE.MODID, aTexturePath); - mTileClass = aTileClass; - this.mRenderID = RenderingRegistry.getNextAvailableRenderId(); - mInstance = this; - } - - public void renderTileEntityAt(Object aTile, double p_147500_2_, double p_147500_4_, double p_147500_6_, float p_147500_8_) { - if (mTileClass.isInstance(aTile)) { - //Logger.INFO("Rendering EggBox"); - this.bindTexture(mTexture); - mModel.renderAll(); - } - } - - public void renderTileEntityAt(TileEntity aTile, double p_147500_2_, double p_147500_4_, double p_147500_6_, float p_147500_8_) { - if (mTileClass != null && aTile != null) { - if (mTileClass.isInstance(aTile)) { - this.renderTileEntityAt((Object) aTile, p_147500_2_, p_147500_4_, p_147500_6_, p_147500_8_); - } - } - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/commands/CommandDebugChunks.java b/src/Java/gtPlusPlus/core/commands/CommandDebugChunks.java deleted file mode 100644 index 8e86bcdcd6..0000000000 --- a/src/Java/gtPlusPlus/core/commands/CommandDebugChunks.java +++ /dev/null @@ -1,152 +0,0 @@ -package gtPlusPlus.core.commands; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.preloader.ChunkDebugger; -import gtPlusPlus.preloader.asm.AsmConfig; - - -public class CommandDebugChunks implements ICommand -{ - private final List<String> aliases; - - protected String fullEntityName; - protected Entity conjuredEntity; - - public CommandDebugChunks(){ - this.aliases = new ArrayList<>(); - aliases.add("debugchunks"); - aliases.add("DC"); - } - - @Override - public int compareTo(final Object o){ - return 0; - - } - - @Override - public String getCommandName(){ - return "DebugChunks"; - - } - - @Override - public String getCommandUsage(final ICommandSender var1){ - return "/DebugChunks"; - - } - - @Override - public List<String> getCommandAliases(){ - return this.aliases; - - } - - @Override - public void processCommand(final ICommandSender S, final String[] argString){ - Logger.INFO("Debug Command"); - - final World W = S.getEntityWorld(); - final EntityPlayer P = CommandUtils.getPlayer(S); - - if (!AsmConfig.enableChunkDebugging) { - PlayerUtils.messagePlayer(P, "Chunk Debugging is disabled."); - return; - } - - - Map<String, Integer> aTicketCounter = new LinkedHashMap<String, Integer>(); - for (Pair<String, String> f : ChunkDebugger.mChunkTicketsMap.values()) { - String aMod = f.getKey(); - String aDim = f.getValue(); - if (aMod != null) { - if (aTicketCounter.containsKey(aMod)) { - int aModTicketCount = aTicketCounter.get(aMod); - aModTicketCount++; - aTicketCounter.put(aMod, aModTicketCount); - } - else { - aTicketCounter.put(aMod, 1); - } - } - } - if (aTicketCounter.isEmpty()) { - PlayerUtils.messagePlayer(P, "No forced chunk tickets active."); - } - for (String x : aTicketCounter.keySet()) { - PlayerUtils.messagePlayer(P, x+" has "+aTicketCounter.get(x)+" tickets active."); - } - - - Map<String, Integer> aChunkCounter = new LinkedHashMap<String, Integer>(); - for (Pair<String, String> f : ChunkDebugger.mChunksLoadedByModsMap.values()) { - String aMod = f.getKey(); - String aDim = f.getValue(); - if (aMod == null) { - aMod = "Bad ModId"; - } - - if (aMod != null) { - //PlayerUtils.messagePlayer(P, aMod+" has "+aDim+" active."); - if (aChunkCounter.containsKey(aMod)) { - int aModTicketCount = aChunkCounter.get(aMod); - aModTicketCount = aModTicketCount + 1; - aChunkCounter.put(aMod, aModTicketCount); - Logger.INFO("Counting +1 for "+aMod+", total of "+aModTicketCount); - } - else { - aChunkCounter.put(aMod, 1); - Logger.INFO("Counting +1 for "+aMod); - } - } - } - if (aChunkCounter.isEmpty()) { - PlayerUtils.messagePlayer(P, "No chunks force loaded."); - } - for (String x : aChunkCounter.keySet()) { - PlayerUtils.messagePlayer(P, x+" has "+aChunkCounter.get(x)+" chunks active."); - } - - } - - @Override - public boolean canCommandSenderUseCommand(final ICommandSender var1){ - final EntityPlayer P = CommandUtils.getPlayer(var1); - if (P == null){ - return false; - } - if (PlayerUtils.isPlayerOP(P)) { - return true; - } - return false; - } - - @Override - public List<?> addTabCompletionOptions(final ICommandSender var1, final String[] var2){ - return new ArrayList<>(); - } - - @Override - public boolean isUsernameIndex(final String[] var1, final int var2){ - // TODO Auto-generated method stub - return false; - } - - public boolean playerUsesCommand(final World W, final EntityPlayer P, final int cost){ - return true; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java deleted file mode 100644 index 493b7d415d..0000000000 --- a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java +++ /dev/null @@ -1,270 +0,0 @@ -package gtPlusPlus.core.commands; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.preloader.CORE_Preloader; -import gtPlusPlus.preloader.asm.AsmConfig; -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; - - -public class CommandEnableDebugWhileRunning implements ICommand -{ - private final List<String> aliases; - - public CommandEnableDebugWhileRunning(){ - this.aliases = new ArrayList<>(); - this.aliases.add("gtplusplus"); - } - - @Override - public int compareTo(final Object o){ - if (o instanceof Comparable<?>) { - @SuppressWarnings("unchecked") - Comparable<ICommand> a = (Comparable<ICommand>) o; - if (a.equals(this)) { - return 0; - } - else { - return -1; - } - } - return -1; - } - - @Override - public String getCommandName(){ - return "gtpp"; - - } - - - // Use '/gtpp' along with 'logging' or 'debug' to toggle Debug mode and Logging. - // Using nothing after the command toggles both to their opposite states respectively. - @Override - public String getCommandUsage(final ICommandSender var1){ - return "/gtpp ?"; - } - - @Override - public List<String> getCommandAliases(){ - return this.aliases; - } - - @Override - public void processCommand(final ICommandSender S, final String[] argString){ - int aMaxArgumentsAllowed = 2; - - if ((argString == null || argString.length == 0 || argString.length > aMaxArgumentsAllowed) || argString[0].toLowerCase().equals("?")) { - Logger.INFO("Listing commands and their uses."); - final EntityPlayer P = CommandUtils.getPlayer(S); - AsmConfig.disableAllLogging = Utils.invertBoolean(AsmConfig.disableAllLogging); - PlayerUtils.messagePlayer(P, "The following are valid args for the '/gtpp' command:"); - PlayerUtils.messagePlayer(P, "? - This help command."); - PlayerUtils.messagePlayer(P, "logging - Toggles ALL GT++ logging for current session."); - PlayerUtils.messagePlayer(P, "hand - Lists information about held item."); - PlayerUtils.messagePlayer(P, "fuid xxx - Tries to find the fluid in the FluidRegistry."); - PlayerUtils.messagePlayer(P, "debug - Toggles GT++ Debug Mode. Only use when advised, may break everything. (OP)"); - } - else if (argString[0].toLowerCase().equals("debug")) { - Logger.INFO("Toggling Debug Mode."); - final EntityPlayer P = CommandUtils.getPlayer(S); - if (PlayerUtils.isPlayerOP(P)) { - CORE_Preloader.DEBUG_MODE = Utils.invertBoolean(CORE_Preloader.DEBUG_MODE); - PlayerUtils.messagePlayer(P, "Toggled GT++ Debug Mode - Enabled: "+CORE_Preloader.DEBUG_MODE); - } - } - else if (argString[0].toLowerCase().equals("logging")) { - Logger.INFO("Toggling Logging."); - final EntityPlayer P = CommandUtils.getPlayer(S); - AsmConfig.disableAllLogging = Utils.invertBoolean(AsmConfig.disableAllLogging); - PlayerUtils.messagePlayer(P, "Toggled GT++ Logging - Enabled: "+(!AsmConfig.disableAllLogging)); - } - /* else if (argString[0].toLowerCase().equals("test")) { - ItemStack mSemiFluidgen = ItemUtils.simpleMetaStack("IC2:blockGenerator", 7, 1); - final EntityPlayer P = CommandUtils.getPlayer(S); - if(mSemiFluidgen != null) { - PlayerUtils.messagePlayer(P, ItemUtils.getItemName(mSemiFluidgen)); - } - }*/ - - else if (argString[0].toLowerCase().equals("inv")) { - final EntityPlayer P = CommandUtils.getPlayer(S); - if (P != null && !P.worldObj.isRemote) { - ItemStack[] aInv = P.inventory.mainInventory; - for (ItemStack aItem : aInv) { - if (aItem != null) { - String aModID = GameRegistry.findUniqueIdentifierFor(aItem.getItem()).modId; - String aRegistryName = GameRegistry.findUniqueIdentifierFor(aItem.getItem()).name; - Logger.INFO(aModID+":"+aRegistryName); - } - } - } - } - else if (argString[0].toLowerCase().equals("hand")) { - final EntityPlayer P = CommandUtils.getPlayer(S); - if (P != null) { - ItemStack aHeldItem = PlayerUtils.getItemStackInPlayersHand(P); - if (aHeldItem != null) { - String aItemDisplayName = ItemUtils.getItemName(aHeldItem); - String aItemUnlocalName = ItemUtils.getUnlocalizedItemName(aHeldItem); - String aNbtString = tryIterateNBTData(aHeldItem); - AutoMap<String> aOreDictNames = new AutoMap<String>(); - - int[] aOreIDs = OreDictionary.getOreIDs(aHeldItem); - for (int id : aOreIDs) { - String aOreNameFromID = OreDictionary.getOreName(id); - if (aOreNameFromID != null && aOreNameFromID.length() > 0 && !aOreNameFromID.equals("Unknown")) { - aOreDictNames.add(aOreNameFromID); - } - } - - String aOreDictData = ""; - if (!aOreDictNames.isEmpty()) { - for (String tag : aOreDictNames) { - aOreDictData += (tag+", "); - } - if (aOreDictData.endsWith(", ")) { - aOreDictData = aOreDictData.substring(0, aOreDictData.length()-2); - } - } - - AutoMap<String> aFluidContainerData = new AutoMap<String>(); - FluidStack aHeldItemFluid = FluidContainerRegistry.getFluidForFilledItem(aHeldItem); - if (aHeldItemFluid != null) { - aFluidContainerData.put("FluidStack Unlocal Name: "+aHeldItemFluid.getUnlocalizedName()); - aFluidContainerData.put("FluidStack Local Name: "+aHeldItemFluid.getLocalizedName()); - aFluidContainerData.put("Fluid Unlocal Name: "+aHeldItemFluid.getFluid().getUnlocalizedName()); - aFluidContainerData.put("Fluid Local Name: "+aHeldItemFluid.getFluid().getLocalizedName()); - aFluidContainerData.put("Fluid Name: "+aHeldItemFluid.getFluid().getName()); - } - - PlayerUtils.messagePlayer(P, "["+aItemUnlocalName+"]"+"["+aItemDisplayName+"] "); - if (aFluidContainerData.size() > 0) { - for (String s : aFluidContainerData) { - PlayerUtils.messagePlayer(P, ""+s); - } - } - if (!aOreDictNames.isEmpty()) { - PlayerUtils.messagePlayer(P, ""+aOreDictData); - } - if (aNbtString.length() > 0) { - PlayerUtils.messagePlayer(P, ""+aNbtString); - } - } - else { - PlayerUtils.messagePlayer(P, "No item held."); - } - } - } - else if (argString[0].toLowerCase().equals("fluid")) { - if (argString.length > 1 && argString[1] != null && argString[1].length() > 0) { - final EntityPlayer P = CommandUtils.getPlayer(S); - FluidStack aFluid = FluidUtils.getWildcardFluidStack(argString[1], 1); - if (P != null && aFluid != null) { - PlayerUtils.messagePlayer(P, "Found fluid stack: "+FluidRegistry.getFluidName(aFluid)); - } - else if (P != null && aFluid == null) { - PlayerUtils.messagePlayer(P, "Could not find any fluids."); - } - } - } - else if (argString[0].toLowerCase().equals("item")) { - if (argString.length > 1 && argString[1] != null && argString[1].length() > 0) { - final EntityPlayer P = CommandUtils.getPlayer(S); - ItemStack aTest = ItemUtils.getItemStackFromFQRN(argString[1], 1); - if (P != null && aTest != null) { - PlayerUtils.messagePlayer(P, "Found fluid stack: "+ItemUtils.getItemName(aTest)); - } - else if (P != null && aTest == null) { - PlayerUtils.messagePlayer(P, "Could not find valid item."); - } - } - } - else { - final EntityPlayer P = CommandUtils.getPlayer(S); - PlayerUtils.messagePlayer(P, "Invalid command, use '?' as an argument for help.'"); - } - - } - - @Override - public boolean canCommandSenderUseCommand(final ICommandSender var1){ - if (var1 == null || CommandUtils.getPlayer(var1) == null) { - return false; - } - return true; - } - - @Override - public List<?> addTabCompletionOptions(final ICommandSender var1, final String[] var2){ - ArrayList<String> aTabCompletes = new ArrayList<String>(); - aTabCompletes.add("?"); - aTabCompletes.add("logging"); - aTabCompletes.add("debug"); - aTabCompletes.add("hand"); - aTabCompletes.add("fluid"); - return aTabCompletes; - } - - @Override - public boolean isUsernameIndex(final String[] var1, final int var2){ - // TODO Auto-generated method stub - return false; - } - - public boolean playerUsesCommand(final World W, final EntityPlayer P, final int cost){ - return true; - } - - public static String tryIterateNBTData(ItemStack aStack) { - try { - AutoMap<String> aItemDataTags = new AutoMap<String>(); - NBTTagCompound aNBT = NBTUtils.getNBT(aStack); - if (aNBT != null) { - if (!aNBT.hasNoTags()) { - Map<?, ?> mInternalMap = ReflectionUtils.getField(aNBT, "tagMap"); - if (mInternalMap != null) { - for (Map.Entry<?, ?> e : mInternalMap.entrySet()) { - aItemDataTags.add(e.getKey().toString()+":"+e.getValue()); - } - int a = 0; - String data = ""; - for (String tag : aItemDataTags) { - data += (tag+", "); - } - if (data.endsWith(", ")) { - data = data.substring(0, data.length()-2); - } - return data; - } else { - Logger.INFO("Data map reflected from NBTTagCompound was not valid."); - return "Bad NBT"; - } - } - } - } catch (Throwable t) {} - return ""; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/commands/CommandMath.java b/src/Java/gtPlusPlus/core/commands/CommandMath.java deleted file mode 100644 index 5ccfb3397f..0000000000 --- a/src/Java/gtPlusPlus/core/commands/CommandMath.java +++ /dev/null @@ -1,100 +0,0 @@ -package gtPlusPlus.core.commands; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.MiningUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.preloader.ChunkDebugger; - - -public class CommandMath implements ICommand -{ - private final List<String> aliases; - - protected String fullEntityName; - protected Entity conjuredEntity; - - public CommandMath(){ - this.aliases = new ArrayList<>(); - //this.aliases.add("hometele"); - //this.aliases.add("warphome"); - } - - @Override - public int compareTo(final Object o){ - return 0; - - } - - @Override - public String getCommandName(){ - return "alkalus"; - - } - - @Override - public String getCommandUsage(final ICommandSender var1){ - return "/alkalus [Dev Command]"; - - } - - @Override - public List<String> getCommandAliases(){ - return this.aliases; - - } - - @Override - public void processCommand(final ICommandSender S, final String[] argString){ - Logger.INFO("Debug Command"); - final World W = S.getEntityWorld(); - final EntityPlayer P = CommandUtils.getPlayer(S); - if (P.getDisplayName().equalsIgnoreCase("draknyte1")) { - Logger.INFO("[Bedrock Miner] OreType Scan"); - MiningUtils.iterateAllOreTypes(); - } - - } - - @Override - public boolean canCommandSenderUseCommand(final ICommandSender var1){ - final EntityPlayer P = CommandUtils.getPlayer(var1); - if (P == null){ - return false; - } - if (P.getDisplayName().toLowerCase().equals("draknyte1") || P.getCommandSenderName().toLowerCase().equals("draknyte1") || CORE.DEVENV) { - return true; - } - return false; - } - - @Override - public List<?> addTabCompletionOptions(final ICommandSender var1, final String[] var2){ - return null; - } - - @Override - public boolean isUsernameIndex(final String[] var1, final int var2){ - // TODO Auto-generated method stub - return false; - } - - public boolean playerUsesCommand(final World W, final EntityPlayer P, final int cost){ - - - return true; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/commands/CommandUtils.java b/src/Java/gtPlusPlus/core/commands/CommandUtils.java deleted file mode 100644 index 175925d40c..0000000000 --- a/src/Java/gtPlusPlus/core/commands/CommandUtils.java +++ /dev/null @@ -1,20 +0,0 @@ -package gtPlusPlus.core.commands; - -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayer; - -public class CommandUtils { - - public static EntityPlayer getPlayer(final ICommandSender icommandsender){ - EntityPlayer player; - - if(icommandsender instanceof EntityPlayer){ - player = (EntityPlayer)icommandsender; - return player; - } - else { - return null; - } - } - -} diff --git a/src/Java/gtPlusPlus/core/common/BasePlayer.java b/src/Java/gtPlusPlus/core/common/BasePlayer.java deleted file mode 100644 index 4686f34207..0000000000 --- a/src/Java/gtPlusPlus/core/common/BasePlayer.java +++ /dev/null @@ -1,212 +0,0 @@ -package gtPlusPlus.core.common; - -import api.player.client.ClientPlayerAPI; -import api.player.client.ClientPlayerBase; -import gtPlusPlus.core.handler.events.CustomMovementHandler; -import gtPlusPlus.core.handler.events.SneakManager; -import net.minecraft.client.Minecraft; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.potion.Potion; -import net.minecraft.util.MovementInputFromOptions; - -public class BasePlayer extends ClientPlayerBase -{ - private final Minecraft mc = Minecraft.getMinecraft(); - private final CustomMovementHandler customMovementInput = new CustomMovementHandler(); - private final GameSettings settings = this.mc.gameSettings; - - public BasePlayer(final ClientPlayerAPI api) - { - super(api); - } - - /* - * EntityPlayerSP.onLivingUpdate() - Adapted to PlayerAPI - */ - @Override - public void onLivingUpdate() { - - super.onLivingUpdate(); - EntityPlayer aPlayer = this.player; - if (aPlayer != null) { - SneakManager aSneak = SneakManager.get(aPlayer); - if (!aSneak.isWearingRing()) { - return; - } - } - - if(this.player.sprintingTicksLeft > 0) - { - --this.player.sprintingTicksLeft; - if(this.player.sprintingTicksLeft == 0) - { - this.player.setSprinting(false); - } - } - - if(this.playerAPI.getSprintToggleTimerField() > 0) - { - this.playerAPI.setSprintToggleTimerField(this.playerAPI.getSprintToggleTimerField() - 1); - } - - if(this.mc.playerController.enableEverythingIsScrewedUpMode()) - { - this.player.posX = this.player.posZ = 0.5D; - this.player.posX = 0.0D; - this.player.posZ = 0.0D; - this.player.rotationYaw = this.player.ticksExisted / 12.0F; - this.player.rotationPitch = 10.0F; - this.player.posY = 68.5D; - } - else - { - - - - - final boolean isJumping = this.player.movementInput.jump; - - final float minSpeed = 0.8F; - final boolean isMovingForward = this.player.movementInput.moveForward >= minSpeed; - this.customMovementInput.update(this.mc, (MovementInputFromOptions)this.player.movementInput, this.player); - - - /* - * Begin ToggleSneak Changes - ToggleSprint - */ - SneakManager aSneak = SneakManager.get(this.player); - - final boolean isSprintDisabled = false; - final boolean canDoubleTap = aSneak.optionDoubleTap; - - - // Detect when ToggleSprint was disabled in the in-game options menu - if(aSneak.wasSprintDisabled) - { - this.player.setSprinting(false); - this.customMovementInput.UpdateSprint(false, false, aSneak); - aSneak.wasSprintDisabled = false; - } - - // Default Sprint routine converted to PlayerAPI, use if ToggleSprint is disabled - TODO - Disable sprinting as a whole - if(isSprintDisabled) - { - //Utils.LOG_INFO("Sprint pressed"); - if(aSneak.optionDoubleTap && this.player.onGround && !isMovingForward && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isSprinting() && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness)) - { - if((this.playerAPI.getSprintToggleTimerField() <= 0) && !this.settings.keyBindSprint.getIsKeyPressed()) - { - this.playerAPI.setSprintToggleTimerField(7); - } - else - { - if (aSneak.Sprinting()){ - this.player.setSprinting(true); - this.customMovementInput.UpdateSprint(true, false, aSneak); - } - else { - this.player.setSprinting(false); - this.customMovementInput.UpdateSprint(false, false, aSneak); - } - } - } - - if(!this.player.isSprinting() && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && this.settings.keyBindSprint.getIsKeyPressed()) - { - if (aSneak.Sprinting()){ - this.player.setSprinting(true); - this.customMovementInput.UpdateSprint(true, false, aSneak); - } - else { - this.player.setSprinting(false); - this.customMovementInput.UpdateSprint(false, false, aSneak); - } - } - } - else - { - final boolean state = this.customMovementInput.sprint; - - // Only handle changes in state under the following conditions: - // On ground, not hungry, not eating/using item, not blind, and not Vanilla - // - // 5/6/14 - onGround check removed to match vanilla's 'start sprint while jumping' behavior. - //if(this.player.onGround && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && !this.customMovementInput.sprintHeldAndReleased) - - if(!this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && !this.customMovementInput.sprintHeldAndReleased) - { - if((canDoubleTap && !this.player.isSprinting()) || !canDoubleTap) - { - if (aSneak.Sprinting()){ - this.player.setSprinting(state); - } else { - this.player.setSprinting(false); - } - } - } - - if(canDoubleTap && !state && this.player.onGround && !isMovingForward && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isSprinting() && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness)) - { - if(this.playerAPI.getSprintToggleTimerField() == 0) - { - this.playerAPI.setSprintToggleTimerField(7); - } - else - { - if (aSneak.Sprinting()){ - this.player.setSprinting(true); - this.customMovementInput.UpdateSprint(true, true, aSneak); - this.playerAPI.setSprintToggleTimerField(0); - } - } - } - } - - // If sprinting, break the sprint in appropriate circumstances: - // Player stops moving forward, runs into something, or gets too hungry - if(this.player.isSprinting() && ((this.player.movementInput.moveForward < minSpeed) || this.player.isCollidedHorizontally)) - { - this.player.setSprinting(false); - - // Undo toggle if we resumed vanilla operation due to Hold&Release, DoubleTap, Fly, Ride - if ((this.customMovementInput.sprintHeldAndReleased == true) || isSprintDisabled || this.customMovementInput.sprintDoubleTapped || this.player.capabilities.isFlying || this.player.isRiding()) - { - this.customMovementInput.UpdateSprint(false, false, aSneak); - } - } - - /* - * End ToggleSneak Changes - ToggleSprint - */ - - // // - // // Debug Framework - Added 5/7/2014 - // // - // if (this.showDebug && this.settings.keyBindPickBlock.getIsKeyPressed() && !this.handledDebugPress) - // { - // this.player.addChatMessage(new ChatComponentText("+--------------------------------------+")); - // this.player.addChatMessage(new ChatComponentText("| ToggleSneak Debug Info |")); - // this.player.addChatMessage(new ChatComponentText("+--------------------------------------+")); - // this.player.addChatMessage(new ChatComponentText(" ")); - // this.player.addChatMessage(new ChatComponentText("isFlying - " + (this.player.capabilities.isFlying == true ? "True" : "False"))); - // this.player.addChatMessage(new ChatComponentText("isCreative - " + (this.player.capabilities.isCreativeMode == true ? "True" : "False"))); - // this.player.addChatMessage(new ChatComponentText("enableFlyBoost - " + (SneakManager.optionEnableFlyBoost == true ? "True" : "False"))); - // this.player.addChatMessage(new ChatComponentText("flyBoostAmount - " + SneakManager.optionFlyBoostAmount)); - // this.player.addChatMessage(new ChatComponentText(" ")); - // this.player.addChatMessage(new ChatComponentText("keybindSprint - " + (this.settings.keyBindSprint.getIsKeyPressed() == true ? "True" : "False"))); - // this.player.addChatMessage(new ChatComponentText("keybindSneak - " + (this.settings.keyBindSneak.getIsKeyPressed() == true ? "True" : "False"))); - // this.player.addChatMessage(new ChatComponentText("keybindJump - " + (this.settings.keyBindJump.getIsKeyPressed() == true ? "True" : "False"))); - // this.player.addChatMessage(new ChatComponentText(" ")); - // this.player.addChatMessage(new ChatComponentText(" ")); - // - // this.handledDebugPress = true; - // } - // else if (this.showDebug && !this.settings.keyBindPickBlock.getIsKeyPressed() && this.handledDebugPress) - // { - // this.handledDebugPress = false; - // } - - } - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java deleted file mode 100644 index c038afce8f..0000000000 --- a/src/Java/gtPlusPlus/core/common/CommonProxy.java +++ /dev/null @@ -1,306 +0,0 @@ -package gtPlusPlus.core.common; - -import cpw.mods.fml.common.event.*; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.enums.OrePrefixes; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.entity.InternalEntityRegistry; -import gtPlusPlus.core.entity.monster.EntityGiantChickenBase; -import gtPlusPlus.core.entity.monster.EntitySickBlaze; -import gtPlusPlus.core.entity.monster.EntityStaballoyConstruct; -import gtPlusPlus.core.fluids.FluidFactory; -import gtPlusPlus.core.handler.*; -import gtPlusPlus.core.handler.events.*; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.item.chemistry.GenericChem; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.CORE.ConfigSwitches; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.tileentities.ModTileEntities; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.debug.DEBUG_INIT; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.player.PlayerCache; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.plugin.villagers.block.BlockGenericSpawner; -import gtPlusPlus.preloader.CORE_Preloader; -import gtPlusPlus.xmod.eio.handler.HandlerTooltip_EIO; -import gtPlusPlus.xmod.galacticraft.handler.HandlerTooltip_GC; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.util.SpecialBehaviourTooltipHandler; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.entity.Entity; -import net.minecraft.entity.monster.EntityBlaze; -import net.minecraft.entity.monster.EntityZombie; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.client.IItemRenderer; - -public class CommonProxy { - - public CommonProxy() { - // Should Register Gregtech Materials I've Made - Utils.registerEvent(this); - if (!CORE.GTNH) { - Logger.INFO("We're using Gregtech " + Utils.getGregtechVersionAsString()); - } else { - Logger.INFO("We're using GTNH's Gregtech " + Utils.getGregtechVersionAsString()); - } - } - - public void preInit(final FMLPreInitializationEvent e) { - Logger.INFO("Doing some house cleaning."); - LoadedMods.checkLoaded(); - Logger.INFO("Making sure we're ready to party!"); - - if (!CORE_Preloader.DEBUG_MODE) { - Logger.WARNING("Development mode not enabled."); - } else if (CORE_Preloader.DEBUG_MODE) { - Logger.INFO("Development mode enabled."); - } else { - Logger.WARNING("Development mode not set."); - } - - AddToCreativeTab.initialiseTabs(); - EnumHelperHandler.init(); - - // Moved from Init after Debug Loading. - // 29/01/18 - Alkalus - // Moved earlier into PreInit, so that Items exist before they're called upon in - // recipes. - // 20/03/18 - Alkalus - ModItems.init(); - ModBlocks.init(); - CI.preInit(); - FluidFactory.preInit(); - COMPAT_IntermodStaging.preInit(e); - BookHandler.run(); - // Registration of entities and renderers - Logger.INFO("[Proxy] Calling Entity registrator."); - registerEntities(); - Logger.INFO("[Proxy] Calling Tile Entity registrator."); - registerTileEntities(); - - Logger.INFO("[Proxy] Calling Render registrator."); - registerRenderThings(); - - } - - public void init(final FMLInitializationEvent e) { - // Debug Loading - if (CORE_Preloader.DEBUG_MODE) { - DEBUG_INIT.registerHandlers(); - } - - registerCustomItemsForMaterials(); - ModBlocks.blockCustomMobSpawner = new BlockGenericSpawner(); - CI.init(); - FluidFactory.init(); - - /** - * Register the Event Handlers. - */ - - // Prevents my Safes being destroyed. - Utils.registerEvent(new PickaxeBlockBreakEventHandler()); - // Block Handler for all events. - Utils.registerEvent(new BlockEventHandler()); - Utils.registerEvent(new GeneralTooltipEventHandler()); - // Handles Tooltips for items giving custom multiblock behaviour - Utils.registerEvent(new SpecialBehaviourTooltipHandler()); - // Handles Custom tooltips for EIO. - Utils.registerEvent(new HandlerTooltip_EIO()); - // Handles Custom Tooltips for GC - Utils.registerEvent(new HandlerTooltip_GC()); - - if (CORE.DEVENV) { - Utils.registerEvent(new StopAnnoyingFuckingAchievements()); - } - - Utils.registerEvent(new EnderDragonDeathHandler()); - Utils.registerEvent(new EntityDeathHandler()); - - if (ConfigSwitches.disableZombieReinforcement) { - // Make Zombie reinforcements fuck off. - Utils.registerEvent(new ZombieBackupSpawnEventHandler()); - } - - /** - * End of Subscribe Event registration. - */ - - // Compat Handling - COMPAT_HANDLER.registerMyModsOreDictEntries(); - COMPAT_HANDLER.intermodOreDictionarySupport(); - COMPAT_IntermodStaging.init(e); - } - - public void postInit(final FMLPostInitializationEvent e) { - Logger.INFO("Cleaning up, doing postInit."); - PlayerCache.initCache(); - FluidFactory.postInit(); - - // Make Burnables burnable - if (!CORE.burnables.isEmpty()) { - BurnableFuelHandler fuelHandler = new BurnableFuelHandler(); - GameRegistry.registerFuelHandler(fuelHandler); - Logger.INFO("[Fuel Handler] Registering " + fuelHandler.getClass().getName()); - } - - // Compat Handling - Logger.INFO("Removing recipes from other mods."); - COMPAT_HANDLER.RemoveRecipesFromOtherMods(); - Logger.INFO("Initialising Handler, Then Adding Recipes"); - COMPAT_HANDLER.InitialiseHandlerThenAddRecipes(); - Logger.INFO("Loading Intermod staging."); - COMPAT_IntermodStaging.postInit(e); - Logger.INFO("Loading queued recipes."); - COMPAT_HANDLER.runQueuedRecipes(); - Logger.INFO("Registering custom mob drops."); - registerCustomMobDrops(); - - // Moved last in postInit(). - // 12/12/19 - Alkalus - // Moved last, to prevent recipes being generated post initialisation. - Logger.INFO("Loading Gregtech API recipes."); - COMPAT_HANDLER.startLoadingGregAPIBasedRecipes(); - } - - public void serverStarting(final FMLServerStartingEvent e) { - COMPAT_HANDLER.InitialiseLateHandlerThenAddRecipes(); - } - - public void onLoadComplete(FMLLoadCompleteEvent event) { - COMPAT_IntermodStaging.onLoadComplete(event); - COMPAT_HANDLER.onLoadComplete(event); - } - - public void registerNetworkStuff() { - GuiHandler.init(); - } - - public void registerEntities() { - InternalEntityRegistry.registerEntities(); - } - - public void registerTileEntities() { - ModTileEntities.init(); - } - - public void registerRenderThings() { - - } - - public int addArmor(final String armor) { - return 0; - } - - public void generateMysteriousParticles(final Entity entity) { - - } - - public void generateMobSpawners() { - // Try register some test spawners - Utils.createNewMobSpawner(0, EntityGiantChickenBase.class); - Utils.createNewMobSpawner(1, EntitySickBlaze.class); - Utils.createNewMobSpawner(2, EntityStaballoyConstruct.class); - } - - public void registerCustomItemsForMaterials() { - //Material.registerComponentForMaterial(GenericChem.CARBYNE, OrePrefixes.plate, GregtechItemList.Carbyne_Sheet_Finished.get(1)); - } - - public void registerCustomMobDrops() { - - //Zombie - EntityUtils.registerDropsForMob(EntityZombie.class, ItemUtils.getSimpleStack(ModItems.itemRope), 3, 100); - EntityUtils.registerDropsForMob(EntityZombie.class, ItemUtils.getSimpleStack(ModItems.itemFiber), 5, 250); - EntityUtils.registerDropsForMob(EntityZombie.class, ItemUtils.getSimpleStack(ModItems.itemSandstoneHammer), 1, 10); - EntityUtils.registerDropsForMob(EntityZombie.class, ItemUtils.getSimpleStack(ModItems.itemBomb), 2, 10); - EntityUtils.registerDropsForMob(EntityZombie.class, ALLOY.TUMBAGA.getTinyDust(1), 1, 10); - EntityUtils.registerDropsForMob(EntityZombie.class, ALLOY.POTIN.getTinyDust(1), 1, 10); - - //Blazes - if (ItemUtils.doesOreDictHaveEntryFor("dustPyrotheum")) { - EntityUtils.registerDropsForMob(EntityBlaze.class, ItemUtils.getItemStackOfAmountFromOreDict("dustPyrotheum", 1), 1, 10); - EntityUtils.registerDropsForMob(EntityBlaze.class, ItemUtils.getItemStackOfAmountFromOreDict("dustPyrotheum", 1), 1, 10); - } - - - //Special mobs Support - if (ReflectionUtils.doesClassExist("toast.specialMobs.entity.zombie.EntityBrutishZombie")) { - Class<?> aBrutishZombie = ReflectionUtils.getClass("toast.specialMobs.entity.zombie.EntityBrutishZombie"); - ItemStack aFortune1 = ItemUtils.getEnchantedBook(Enchantment.fortune, 1); - ItemStack aFortune2 = ItemUtils.getEnchantedBook(Enchantment.fortune, 1); - ItemStack aFortune3 = ItemUtils.getEnchantedBook(Enchantment.fortune, 1); - EntityUtils.registerDropsForMob(aBrutishZombie, aFortune1, 1, 100); - EntityUtils.registerDropsForMob(aBrutishZombie, aFortune2, 1, 50); - EntityUtils.registerDropsForMob(aBrutishZombie, aFortune3, 1, 1); - EntityUtils.registerDropsForMob(aBrutishZombie, ItemUtils.getItemStackOfAmountFromOreDict("ingotRedAlloy", 1), 3, 200); - } - - //GalaxySpace Support - if (ReflectionUtils.doesClassExist("galaxyspace.SolarSystem.moons.europa.entities.EntityEvolvedColdBlaze")) { - Class<?> aColdBlaze = ReflectionUtils.getClass("galaxyspace.SolarSystem.moons.europa.entities.EntityEvolvedColdBlaze"); - ItemStack aSmallBlizz, aTinyBlizz, aSmallCryo, aTinyCryo; - aSmallBlizz = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallBlizz", 1); - aTinyBlizz = ItemUtils.getItemStackOfAmountFromOreDict("dustTinyBlizz", 1); - aSmallCryo = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallCryotheum", 1); - aTinyCryo = ItemUtils.getItemStackOfAmountFromOreDict("dustTinyCryotheum", 1); - EntityUtils.registerDropsForMob(aColdBlaze, ItemUtils.getItemStackOfAmountFromOreDict("stickBlizz", 1), 2, 500); - if (aSmallBlizz != null) { - EntityUtils.registerDropsForMob(aColdBlaze, aSmallBlizz, 2, 750); - } - if (aTinyBlizz != null) { - EntityUtils.registerDropsForMob(aColdBlaze, aTinyBlizz, 4, 1500); - } - if (aSmallCryo != null) { - EntityUtils.registerDropsForMob(aColdBlaze, aSmallCryo, 1, 50); - } - if (aTinyCryo != null) { - EntityUtils.registerDropsForMob(aColdBlaze, aTinyCryo, 2, 100); - } - } - - } - - protected final AutoMap<Pair<Item, IItemRenderer>> mItemRenderMappings = new AutoMap<Pair<Item, IItemRenderer>>(); - - - public static void registerItemRendererGlobal(Item aItem, IItemRenderer aRenderer) { - GTplusplus.proxy.registerItemRenderer(aItem, aRenderer); - } - - public void registerItemRenderer(Item aItem, IItemRenderer aRenderer) { - if (Utils.isServer()) { - return; - } - else { - mItemRenderMappings.add(new Pair<Item, IItemRenderer>(aItem, aRenderer)); - } - } - - public World getClientWorld() { - return null; - } - - /** - * Returns a side-appropriate EntityPlayer for use during message handling - */ - public EntityPlayer getPlayerEntity(MessageContext ctx) { - return ctx.getServerHandler().playerEntity; - } - -} diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java deleted file mode 100644 index c9704603af..0000000000 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java +++ /dev/null @@ -1,71 +0,0 @@ -package gtPlusPlus.core.common.compat; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.item.bauble.BatteryPackBaseBauble; -import gtPlusPlus.core.item.bauble.FireProtectionBauble; -import gtPlusPlus.core.item.bauble.MonsterKillerBaseBauble; -import gtPlusPlus.core.item.general.ItemCloakingDevice; -import gtPlusPlus.core.item.general.ItemHealingDevice; -import gtPlusPlus.core.item.general.ItemSlowBuildingRing; -import gtPlusPlus.core.lib.LoadedMods; -import net.minecraft.entity.monster.EntityBlaze; -import net.minecraft.entity.monster.EntityCreeper; -import net.minecraft.entity.monster.EntityEnderman; -import net.minecraft.entity.monster.EntityGhast; -import net.minecraft.entity.monster.EntityMagmaCube; -import net.minecraft.entity.monster.EntityPigZombie; -import net.minecraft.entity.monster.EntitySkeleton; -import net.minecraft.entity.monster.EntitySpider; -import net.minecraft.entity.monster.EntityZombie; - -public class COMPAT_Baubles { - - public static void run(){ - if (LoadedMods.Baubles){ - baublesLoaded(); - } - else { - baublesNotLoaded(); - } - } - - public static void baublesLoaded(){ - Logger.INFO("Baubles Found - Loading Wearables."); - ModItems.itemPersonalCloakingDevice = new ItemCloakingDevice(0); - //itemPersonalCloakingDeviceCharged = new ItemCloakingDevice(0).set; - ModItems.itemPersonalHealingDevice = new ItemHealingDevice(); - ModItems.itemPersonalFireProofDevice = new FireProtectionBauble(); - - try { - ModItems.itemChargePack_Low_1 = new BatteryPackBaseBauble(1); - ModItems.itemChargePack_Low_2 = new BatteryPackBaseBauble(2); - ModItems.itemChargePack_Low_3 = new BatteryPackBaseBauble(3); - ModItems.itemChargePack_Low_4 = new BatteryPackBaseBauble(4); - ModItems.itemChargePack_Low_5 = new BatteryPackBaseBauble(5); - ModItems.itemChargePack_High_1 = new BatteryPackBaseBauble(6); - ModItems.itemChargePack_High_2 = new BatteryPackBaseBauble(7); - ModItems.itemChargePack_High_3 = new BatteryPackBaseBauble(8); - ModItems.itemChargePack_High_4 = new BatteryPackBaseBauble(9); - } - catch (Throwable t) { - t.printStackTrace(); - } - - ModItems.itemAmuletMonsterKiller_Zombie = new MonsterKillerBaseBauble(new Class[] {EntityZombie.class}, "Zombie", 3); - ModItems.itemAmuletMonsterKiller_Skeleton = new MonsterKillerBaseBauble(new Class[] {EntitySkeleton.class}, "Skeleton", 3); - ModItems.itemAmuletMonsterKiller_Spider = new MonsterKillerBaseBauble(new Class[] {EntitySpider.class}, "Spider", 3); - ModItems.itemAmuletMonsterKiller_Creeper = new MonsterKillerBaseBauble(new Class[] {EntityCreeper.class}, "Creeper", 4); - ModItems.itemAmuletMonsterKiller_Enderman = new MonsterKillerBaseBauble(new Class[] {EntityEnderman.class}, "Enderman", 4); - ModItems.itemAmuletMonsterKiller_Nether = new MonsterKillerBaseBauble(new Class[] {EntityPigZombie.class, EntityGhast.class, EntityMagmaCube.class, EntityBlaze.class}, "Hellish", 6); - - if (LoadedMods.PlayerAPI){ - ModItems.itemSlowBuildingRing = new ItemSlowBuildingRing(); - } - } - - public static void baublesNotLoaded(){ - Logger.INFO("Baubles Not Found - Skipping Resources."); - } - -} diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_BigReactors.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_BigReactors.java deleted file mode 100644 index 3854f6612f..0000000000 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_BigReactors.java +++ /dev/null @@ -1,21 +0,0 @@ -package gtPlusPlus.core.common.compat; - -import net.minecraft.item.ItemStack; - -import gregtech.api.util.GT_OreDictUnificator; - -import gtPlusPlus.core.item.ModItems; - -public class COMPAT_BigReactors { - - public static void OreDict(){ - run(); - } - - private static final void run(){ - GT_OreDictUnificator.registerOre("plateBlutonium", new ItemStack(ModItems.itemPlateBlutonium)); - GT_OreDictUnificator.registerOre("plateCyanite", new ItemStack(ModItems.itemPlateCyanite)); - GT_OreDictUnificator.registerOre("plateLudicrite", new ItemStack(ModItems.itemPlateLudicrite)); - } - -} diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_CompactWindmills.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_CompactWindmills.java deleted file mode 100644 index cd5d36b653..0000000000 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_CompactWindmills.java +++ /dev/null @@ -1,172 +0,0 @@ -package gtPlusPlus.core.common.compat; - -import static gtPlusPlus.core.handler.COMPAT_HANDLER.*; - -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.recipe.ShapedRecipeObject; -import gtPlusPlus.core.util.minecraft.ItemUtils; - - - -public class COMPAT_CompactWindmills { - - //Change IC2 Upgrades - public static ItemStack kineticWind = ItemUtils.simpleMetaStack("IC2:blockKineticGenerator", 0, 1); - public static ItemStack shaftIron = ItemUtils.simpleMetaStack("IC2:itemRecipePart", 11, 1); - public static ItemStack cableCopper = ItemUtils.simpleMetaStack("gregtech:gt.blockmachines", 1367, 1); - public static String plateRubber = "ore:plateRubber"; - - //Machine Casings - public static ItemStack elvCasing = ItemUtils.simpleMetaStack("gregtech:gt.blockcasings", 0, 1); - public static ItemStack lvCasing = ItemUtils.simpleMetaStack("gregtech:gt.blockcasings", 1, 1); - public static ItemStack mvCasing = ItemUtils.simpleMetaStack("gregtech:gt.blockcasings", 2, 1); - public static ItemStack hvCasing = ItemUtils.simpleMetaStack("gregtech:gt.blockcasings", 3, 1); - public static ItemStack evCasing = ItemUtils.simpleMetaStack("gregtech:gt.blockcasings", 4, 1); - public static ItemStack ivCasing = ItemUtils.simpleMetaStack("gregtech:gt.blockcasings", 5, 1); - - //GT Transformers - public static ItemStack elvTransformer = ItemUtils.simpleMetaStack("gregtech:gt.blockmachines", 20, 1); - public static ItemStack lvTransformer = ItemUtils.simpleMetaStack("gregtech:gt.blockmachines", 21, 1); - public static ItemStack mvTransformer = ItemUtils.simpleMetaStack("gregtech:gt.blockmachines", 22, 1); - public static ItemStack hvTransformer = ItemUtils.simpleMetaStack("gregtech:gt.blockmachines", 23, 1); - public static ItemStack evTransformer = ItemUtils.simpleMetaStack("gregtech:gt.blockmachines", 24, 1); - - //Compact Windmills - public static ItemStack elvWindmill = ItemUtils.simpleMetaStack("CompactWindmills:blockCompactWindmill", 0, 1); - public static ItemStack lvWindmill = ItemUtils.simpleMetaStack("CompactWindmills:blockCompactWindmill", 1, 1); - public static ItemStack mvWindmill = ItemUtils.simpleMetaStack("CompactWindmills:blockCompactWindmill", 2, 1); - public static ItemStack hvWindmill = ItemUtils.simpleMetaStack("CompactWindmills:blockCompactWindmill", 3, 1); - public static ItemStack evWindmill = ItemUtils.simpleMetaStack("CompactWindmills:blockCompactWindmill", 4, 1); - - //Compact Rotors - public static ItemStack rotor2 = ItemUtils.getItemStackFromFQRN("CompactWindmills:WOOL", 1); - public static ItemStack rotor1 = ItemUtils.getItemStackFromFQRN("CompactWindmills:WOOD", 1); - public static ItemStack rotor3 = ItemUtils.getItemStackFromFQRN("CompactWindmills:ALLOY", 1); - public static ItemStack rotor4 = ItemUtils.getItemStackFromFQRN("CompactWindmills:CARBON", 1); - public static ItemStack rotor5 = ItemUtils.getItemStackFromFQRN("CompactWindmills:IRIDIUM", 1); - - //IC2 Rotors - public static ItemStack rotorIC1 = ItemUtils.getItemStackFromFQRN("IC2:itemwoodrotor", 1); - public static ItemStack rotorIC2 = ItemUtils.getItemStackFromFQRN("IC2:itemironrotor", 1); - public static ItemStack rotorIC3 = ItemUtils.getItemStackFromFQRN("IC2:itemsteelrotor", 1); - public static ItemStack rotorIC4 = ItemUtils.getItemStackFromFQRN("IC2:itemwcarbonrotor", 1); - public static ItemStack rotorBlade1 = ItemUtils.simpleMetaStack("IC2:itemRecipePart", 7, 1); - public static ItemStack rotorBlade2 = ItemUtils.simpleMetaStack("IC2:itemRecipePart", 8, 1); - public static ItemStack rotorBlade3 = ItemUtils.simpleMetaStack("IC2:itemRecipePart", 10, 1); - public static ItemStack rotorBlade4 = ItemUtils.simpleMetaStack("IC2:itemRecipePart", 9, 1); - - //Plates - public static String plateTier1 = "ore:plateMagnalium"; - public static String plateTier2 = "ore:plateStainlessSteel"; - public static String plateTier3 = "ore:plateTitanium"; - public static String plateTier4 = "ore:plateTungstenSteel"; - public static String plateTier5 = "ore:plateNichrome"; - public static String plateCarbon = "ore:plateAlloyCarbon"; - public static String plateAlloy = "ore:plateAlloyAdvanced"; - - //Circuits - public static String circuitTier1 = "ore:circuitGood"; - public static String circuitTier2 = "ore:circuitAdvanced"; - public static String circuitTier3 = "ore:circuitData"; - public static String circuitTier4 = "ore:circuitElite"; - public static String circuitTier5 = "ore:circuitMaster"; - - //Wooden Rotor - public static ShapedRecipeObject Wooden_Rotor = new ShapedRecipeObject( - rotorBlade1, "ore:plateAnyIron", "ore:plateAnyIron", - "ore:screwAluminium", rotorIC1, "ore:screwAluminium", - rotorBlade1, "plateAnyIron", rotorBlade1, - rotor1); - //Alloy Rotor - public static ShapedRecipeObject Alloy_Rotor = new ShapedRecipeObject( - plateAlloy, plateAlloy, plateAlloy, - plateAlloy, rotorIC3, plateAlloy, - plateAlloy,plateAlloy, plateAlloy, - rotor3); - //Carbon Rotor - public static ShapedRecipeObject Carbon_Rotor = new ShapedRecipeObject( - plateCarbon, rotorBlade4, plateCarbon, - rotorBlade4, rotor3, rotorBlade4, - plateCarbon, rotorBlade4, plateCarbon, - rotor4); - - //Kinetic Wind Turbine - public static ShapedRecipeObject KWT = new ShapedRecipeObject( - plateCarbon, shaftIron, plateCarbon, - cableCopper, mvCasing, cableCopper, - plateRubber, plateCarbon, plateRubber, - kineticWind); - - //ELV Windmill - public static ShapedRecipeObject WM_ELV = new ShapedRecipeObject( - - circuitTier1, elvTransformer, circuitTier1, - plateTier1, lvCasing, plateTier1, - plateTier1, rotor1, plateTier1, - elvWindmill); - - - //LV Windmill - public static ShapedRecipeObject WM_LV = new ShapedRecipeObject( - circuitTier2, lvTransformer, circuitTier2, - plateTier2, mvCasing, plateTier2, - plateTier2, rotor2, plateTier2, - lvWindmill); - - //MV Windmill - public static ShapedRecipeObject WM_MV = new ShapedRecipeObject( - circuitTier3, mvTransformer, circuitTier3, - plateTier3, hvCasing, plateTier3, - plateTier3, rotor3, plateTier3, - mvWindmill); - - //HV Windmill - public static ShapedRecipeObject WM_HV = new ShapedRecipeObject( - circuitTier4, hvTransformer, circuitTier4, - plateTier4, evCasing, plateTier4, - plateTier4, rotor4, plateTier4, - hvWindmill); - - //EV Windmill - public static ShapedRecipeObject WM_EV = new ShapedRecipeObject( - circuitTier5, evTransformer, circuitTier5, - plateTier5, ivCasing, plateTier5, - plateTier5, rotor5, plateTier5, - evWindmill); - - public static void OreDict(){ - run(); - } - - private static final void run(){ - //RemoveRecipeQueue.add("CompactWindmills:WOOL"); - //RemoveRecipeQueue.add("CompactWindmills:WOOD"); - //RemoveRecipeQueue.add("CompactWindmills:ALLOY"); - //RemoveRecipeQueue.add("CompactWindmills:CARBON"); - //RemoveRecipeQueue.add("CompactWindmills:IRIDIUM"); - - //Remove Recipes - RemoveRecipeQueue.add(kineticWind); - RemoveRecipeQueue.add(elvWindmill); - RemoveRecipeQueue.add(lvWindmill); - RemoveRecipeQueue.add(mvWindmill); - RemoveRecipeQueue.add(hvWindmill); - RemoveRecipeQueue.add(evWindmill); - RemoveRecipeQueue.add(rotor1); - RemoveRecipeQueue.add(rotor3); - RemoveRecipeQueue.add(rotor4); - - //Add Recipes - AddRecipeQueue.add(Wooden_Rotor); - AddRecipeQueue.add(Alloy_Rotor); - AddRecipeQueue.add(Carbon_Rotor); - AddRecipeQueue.add(KWT); - AddRecipeQueue.add(WM_ELV); - AddRecipeQueue.add(WM_LV); - AddRecipeQueue.add(WM_MV); - AddRecipeQueue.add(WM_HV); - AddRecipeQueue.add(WM_EV); - - } -} diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_EnderIO.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_EnderIO.java deleted file mode 100644 index 6598a7e21e..0000000000 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_EnderIO.java +++ /dev/null @@ -1,28 +0,0 @@ -package gtPlusPlus.core.common.compat; - -import net.minecraft.item.ItemStack; - -import gregtech.api.util.GT_OreDictUnificator; - -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class COMPAT_EnderIO { - - public static void OreDict(){ - run(); - } - - private static final void run(){ - ItemUtils.getItemForOreDict("EnderIO:itemAlloy", "ingotVibrantAlloy", "Vibrant Alloy Ingot", 2); - GT_OreDictUnificator.registerOre("plateConductiveIron", new ItemStack(ModItems.itemPlateConductiveIron)); - GT_OreDictUnificator.registerOre("plateDarkSteel", new ItemStack(ModItems.itemPlateDarkSteel)); - GT_OreDictUnificator.registerOre("plateElectricalSteel", new ItemStack(ModItems.itemPlateElectricalSteel)); - GT_OreDictUnificator.registerOre("plateEnergeticAlloy", new ItemStack(ModItems.itemPlateEnergeticAlloy)); - GT_OreDictUnificator.registerOre("platePulsatingIron", new ItemStack(ModItems.itemPlatePulsatingIron)); - GT_OreDictUnificator.registerOre("plateRedstoneAlloy", new ItemStack(ModItems.itemPlateRedstoneAlloy)); - GT_OreDictUnificator.registerOre("plateSoularium", new ItemStack(ModItems.itemPlateSoularium)); - GT_OreDictUnificator.registerOre("plateVibrantAlloy", new ItemStack(ModItems.itemPlateVibrantAlloy)); - } - -} diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_ExtraUtils.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_ExtraUtils.java deleted file mode 100644 index d5ee51f61a..0000000000 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_ExtraUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package gtPlusPlus.core.common.compat; - -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.lib.CORE.ConfigSwitches; -import gtPlusPlus.core.recipe.RECIPES_Tools; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; - -public class COMPAT_ExtraUtils { - - public static void OreDict(){ - RECIPES_Tools.RECIPE_DivisionSigil = new ItemStack(ItemUtils.getItemFromFQRN("ExtraUtilities:divisionSigil")); - run(); - - } - - private static final void run(){ - ItemUtils.getItemForOreDict("ExtraUtilities:bedrockiumIngot", "ingotBedrockium", "Bedrockium Ingot", 0); - //GT_OreDictUnificator.registerOre("plateBedrockium", new ItemStack(ModItems.itemPlateBedrockium)); - - if (ConfigSwitches.enableAlternativeDivisionSigilRecipe){ - //Division Sigil - RecipeUtils.addShapedRecipe( - "plateNetherStar", "gemIridium", "plateNetherStar", - "plateIridium", RECIPES_Tools.craftingToolHardHammer, "plateIridium", - "plateNetherStar", "gemIridium", "plateNetherStar", - RECIPES_Tools.RECIPE_DivisionSigil); - } - } - -} diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_HarvestCraft.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_HarvestCraft.java deleted file mode 100644 index 9e148f0102..0000000000 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_HarvestCraft.java +++ /dev/null @@ -1,15 +0,0 @@ -package gtPlusPlus.core.common.compat; - -import gtPlusPlus.xmod.growthcraft.fishtrap.FishTrapHandler; - -public class COMPAT_HarvestCraft { - - public static void OreDict(){ - run(); - } - - private static final void run(){ - FishTrapHandler.pamsHarvestCraftCompat(); - } - -} diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_IC2.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_IC2.java deleted file mode 100644 index e1ed2a666a..0000000000 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_IC2.java +++ /dev/null @@ -1,64 +0,0 @@ -package gtPlusPlus.core.common.compat; - - -import static gtPlusPlus.core.handler.COMPAT_HANDLER.RemoveRecipeQueue; - -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.lib.CORE.ConfigSwitches; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.recipe.ShapedRecipeObject; -import gtPlusPlus.core.util.minecraft.ItemUtils; - - -public class COMPAT_IC2 { - - private static ItemStack itemCropnalyzer = ItemUtils.simpleMetaStack("IC2:itemCropnalyzer", 0, 1); - private static ItemStack itemSolarHelmet = ItemUtils.simpleMetaStack("IC2:itemSolarHelmet", 0, 1); - - public static ShapedRecipeObject Cropnalyzer = new ShapedRecipeObject( - "ore:cableGt02Copper", "ore:cableGt02Copper", null, - "minecraft:redstone", "ore:blockGlass", "minecraft:redstone", - "minecraft:redstone", "ore:circuitBasic", "minecraft:redstone", - itemCropnalyzer); - public static ShapedRecipeObject SolarHelmet = new ShapedRecipeObject( - "ore:plateIron", "ore:plateIron", "ore:plateIron", - "ore:plateIron", "gregtech:gt.metaitem.01:32750", "ore:plateIron", - "ore:craftingWireCopper", "ore:craftingWireCopper", "ore:craftingWireCopper", - itemSolarHelmet); - - - - public static void OreDict(){ - //Get ItemStacks for results - /*itemCropnalyzer = UtilsItems.getItemStack("IC2:itemCropnalyzer", 1); - itemSolarHelmet = UtilsItems.getItemStack("IC2:itemSolarHelmet", 1); */ - run(); - } - - private static final void run(){ - - if (ConfigSwitches.disableIC2Recipes){ - - - - if (LoadedMods.Gregtech){ - //Fuck these right off. - RemoveRecipeQueue.add("IC2:itemCable"); - RemoveRecipeQueue.add("IC2:itemCable:1"); - RemoveRecipeQueue.add("IC2:itemCable:2"); - RemoveRecipeQueue.add("IC2:itemCable:3"); - RemoveRecipeQueue.add("IC2:itemCable:5"); - RemoveRecipeQueue.add("IC2:itemCable:6"); - RemoveRecipeQueue.add("IC2:itemCable:10"); - RemoveRecipeQueue.add("IC2:itemCable:13"); - //RemoveRecipeQueue.add(itemCropnalyzer); - //RemoveRecipeQueue.add(itemSolarHelmet); - - //AddRecipeQueue.add(Cropnalyzer); - //AddRecipeQueue.add(SolarHelmet); - } - } - } - -} diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_MorePlanets.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_MorePlanets.java deleted file mode 100644 index b7da7c436e..0000000000 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_MorePlanets.java +++ /dev/null @@ -1,37 +0,0 @@ -package gtPlusPlus.core.common.compat; - -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class COMPAT_MorePlanets { - - - public static void OreDict(){ - run(); - } - - private final static void run(){ - //Metals - ItemUtils.getItemForOreDict("MorePlanet:kapteyn-b_item", "ingotFrozenIron", "Frozen Iron Ingot", 0); - ItemUtils.getItemForOreDict("MorePlanet:kapteyn-b_item", "ingotAnyIron", "Frozen Iron Ingot", 0); - ItemUtils.getItemForOreDict("MorePlanet:polongnius_item", "ingotPalladium", "Palladium Ingot", 5); - ItemUtils.getItemForOreDict("MorePlanet:fronos_item", "ingotIridium", "Iridium Ingot", 3); - ItemUtils.getItemForOreDict("MorePlanet:nibiru_item", "ingotNorium", "Norium Ingot", 1); - ItemUtils.getItemForOreDict("MorePlanet:venus_item", "ingotLead", "Lead Ingot", 0); - ItemUtils.getItemForOreDict("MorePlanet:diona_item", "ingotQuontonium", "Quontonium Ingot", 0); - ItemUtils.getItemForOreDict("MorePlanet:diona_item", "ingotFronisium", "Fronisium Ingot", 1); - ItemUtils.getItemForOreDict("MorePlanet:sirius-b_item", "ingotSulfur", "Sulfur Ingot", 3); - ItemUtils.getItemForOreDict("MorePlanet:koentus_item", "ingotKoentusMeteoricIron", "Koentus Meteoric Iron Ingot", 4); - ItemUtils.getItemForOreDict("MorePlanet:mercury_item", "ingotMetallic", "Metallic Ingot", 2); - ItemUtils.getItemForOreDict("MorePlanet:polongnius_item", "ingotPolongiusMeteoricIron", "Polongius Meteoric Iron Ingot", 4); - ItemUtils.getItemForOreDict("MorePlanet:mercury_item", "ingotMeteoricSteel", "Meteoric Steel Ingot", 3); - ItemUtils.getItemForOreDict("MorePlanet:sirius-b_item", "dustSulfur", "Sulfur Dust", 2); - - //Gems - ItemUtils.getItemForOreDict("MorePlanet:fronos_item", "gemBlackDiamond", "Black Diamond Gem", 2); - ItemUtils.getItemForOreDict("MorePlanet:koentus_item", "gemWhiteCrystal", "White Crystal", 0); - ItemUtils.getItemForOreDict("MorePlanet:nibiru_item", "gemRedCrystal", "Red Crystal", 0); - ItemUtils.getItemForOreDict("MorePlanet:pluto_item", "gemXeonius", "Xeonius Gem", 0); - ItemUtils.getItemForOreDict("MorePlanet:kapteyn-b_item", "gemUranium", "Uranium Gem", 1); - } - -} diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_OpenBlocks.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_OpenBlocks.java deleted file mode 100644 index 6381a6705e..0000000000 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_OpenBlocks.java +++ /dev/null @@ -1,29 +0,0 @@ -package gtPlusPlus.core.common.compat; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class COMPAT_OpenBlocks { - - public static void OreDict(){ - run(); - } - - private static final void run(){ - - Item aGraveItem = ItemUtils.getItemFromFQRN("OpenBlocks:grave"); - if (aGraveItem == null) { - return; - } - Block aGraveBlock = Block.getBlockFromItem(aGraveItem); - if (aGraveBlock == null) { - return; - } - - Logger.INFO("[Hungry Node Blacklist] Setting the Hardness of the OpenBlocks Grave to 6."); - aGraveBlock.setHardness(6f); - } - -} diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_PlayerAPI.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_PlayerAPI.java deleted file mode 100644 index 12b3a94083..0000000000 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_PlayerAPI.java +++ /dev/null @@ -1,52 +0,0 @@ -package gtPlusPlus.core.common.compat; - -import api.player.client.ClientPlayerAPI; -import gtPlusPlus.core.common.BasePlayer; -import gtPlusPlus.core.handler.events.SneakManager; -import gtPlusPlus.core.util.Utils; - -public class COMPAT_PlayerAPI { - - public static class commonProxy{ - public static void initPre(){ - - } - - public static void Init(){ - - } - - public static void initPost(){ - - } - } - - public static class clientProxy{ - public static void initPre(){ - //Utils.registerEvent(SneakManager.instance); - } - - public static void Init(){ - ClientPlayerAPI.register("SneakManager", BasePlayer.class); - } - - public static void initPost(){ - - } - } - - public static class serverProxy{ - public static void initPre(){ - - } - - public static void Init(){ - - } - - public static void initPost(){ - - } - } - -} diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_PneumaticCraft.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_PneumaticCraft.java deleted file mode 100644 index 0f80dc8be4..0000000000 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_PneumaticCraft.java +++ /dev/null @@ -1,19 +0,0 @@ -package gtPlusPlus.core.common.compat; - -import net.minecraft.item.ItemStack; - -import gregtech.api.util.GT_OreDictUnificator; - -import gtPlusPlus.core.item.ModItems; - -public class COMPAT_PneumaticCraft { - - public static void OreDict(){ - run(); - } - - private static final void run(){ - GT_OreDictUnificator.registerOre("plateCompressedIron", new ItemStack(ModItems.itemPlateCompressedIron)); - } - -} diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_RFTools.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_RFTools.java deleted file mode 100644 index 37c87ad99d..0000000000 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_RFTools.java +++ /dev/null @@ -1,20 +0,0 @@ -package gtPlusPlus.core.common.compat; - -import net.minecraft.item.ItemStack; - -import gregtech.api.util.GT_OreDictUnificator; - -import gtPlusPlus.core.item.ModItems; - -public class COMPAT_RFTools { - - public static void OreDict(){ - run(); - } - - private static final void run(){ - GT_OreDictUnificator.registerOre("plateDimensionShard", new ItemStack(ModItems.itemPlateDimensionShard)); - - } - -} diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Railcraft.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Railcraft.java deleted file mode 100644 index f6c8e86808..0000000000 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Railcraft.java +++ /dev/null @@ -1,14 +0,0 @@ -package gtPlusPlus.core.common.compat; - -public class COMPAT_Railcraft { - - public static void OreDict(){ - run(); - } - - private static final void run(){ - - - } - -} diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_SimplyJetpacks.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_SimplyJetpacks.java deleted file mode 100644 index 5f9976acb0..0000000000 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_SimplyJetpacks.java +++ /dev/null @@ -1,20 +0,0 @@ -package gtPlusPlus.core.common.compat; - -import net.minecraft.item.ItemStack; - -import gregtech.api.util.GT_OreDictUnificator; - -import gtPlusPlus.core.item.ModItems; - -public class COMPAT_SimplyJetpacks { - - public static void OreDict(){ - run(); - } - - private static final void run(){ - GT_OreDictUnificator.registerOre("plateEnrichedSoularium", new ItemStack(ModItems.itemPlateEnrichedSoularium)); - - } - -} diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Thaumcraft.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Thaumcraft.java deleted file mode 100644 index b78c10c8ce..0000000000 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Thaumcraft.java +++ /dev/null @@ -1,45 +0,0 @@ -package gtPlusPlus.core.common.compat; - -import gregtech.api.util.GT_OreDictUnificator; - -import gtPlusPlus.core.lib.CORE.ConfigSwitches; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class COMPAT_Thaumcraft { - - public static void OreDict(){ - - if (ConfigSwitches.enableThaumcraftShardUnification){ - run(); - } - } - - private static final void run(){ - - for(int i=0; i<=6; i++){ - //Utils.LOG_INFO(""+i); - ItemUtils.getItemForOreDict("Thaumcraft:ItemShard", "shardAny", "TC Shard "+i, i); - GT_OreDictUnificator.registerOre("shardAny", ItemUtils.getItemStackFromFQRN("Thaumcraft:ItemShard:"+i, 1)); - ItemUtils.getItemForOreDict("Thaumcraft:ItemShard", "gemInfusedAnything", "TC Shard "+i, i); - GT_OreDictUnificator.registerOre("gemInfusedAnything", ItemUtils.getItemStackFromFQRN("Thaumcraft:ItemShard:"+i, 1)); - //System.out.println("TC Shard registration count is: "+i); - } - - if (LoadedMods.ForbiddenMagic){ - for(int i=0; i<=6; i++){ - //Utils.LOG_INFO(""+i); - ItemUtils.getItemForOreDict("ForbiddenMagic:NetherShard", "shardAny", "FM Shard "+i, i); - GT_OreDictUnificator.registerOre("shardAny", ItemUtils.getItemStackFromFQRN("ForbiddenMagic:NetherShard:"+i, 1)); - ItemUtils.getItemForOreDict("ForbiddenMagic:NetherShard", "gemInfusedAnything", "FM Shard "+i, i); - GT_OreDictUnificator.registerOre("gemInfusedAnything", ItemUtils.getItemStackFromFQRN("ForbiddenMagic:NetherShard:"+i, 1)); - //System.out.println("TC Shard registration count is: "+i); - } - ItemUtils.getItemForOreDict("ForbiddenMagic:GluttonyShard", "shardAny", "FM Gluttony Shard", 0); - GT_OreDictUnificator.registerOre("shardAny", ItemUtils.getItemStackFromFQRN("ForbiddenMagic:GluttonyShard", 1)); - ItemUtils.getItemForOreDict("ForbiddenMagic:GluttonyShard", "gemInfusedAnything", "FM Gluttony Shard", 0); - GT_OreDictUnificator.registerOre("gemInfusedAnything", ItemUtils.getItemStackFromFQRN("ForbiddenMagic:GluttonyShard", 1)); - } - } - -} diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Witchery.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Witchery.java deleted file mode 100644 index cde6e3ae98..0000000000 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Witchery.java +++ /dev/null @@ -1,26 +0,0 @@ -package gtPlusPlus.core.common.compat; - -import static gtPlusPlus.core.lib.LoadedMods.Witchery; - -import gregtech.api.util.GT_OreDictUnificator; - -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.item.ItemStack; - -public class COMPAT_Witchery { - - public static void OreDict(){ - run(); - } - - private static final void run(){ - //Koboldite - ItemStack aKobolditeDust = ItemUtils.getItemStackWithMeta(Witchery, "witchery:ingredient", "Koboldite Dust", 148, 1); - ItemStack aKobolditeNugget = ItemUtils.getItemStackWithMeta(Witchery, "witchery:ingredient", "Koboldite Nugget", 149, 1); - ItemStack aKobolditeIngot = ItemUtils.getItemStackWithMeta(Witchery, "witchery:ingredient", "Koboldite Ingot", 150, 1); - if (aKobolditeDust != null) GT_OreDictUnificator.registerOre("dust"+"Koboldite", aKobolditeDust); - if (aKobolditeNugget != null) GT_OreDictUnificator.registerOre("nugget"+"Koboldite", aKobolditeNugget); - if (aKobolditeIngot != null) GT_OreDictUnificator.registerOre("ingot"+"Koboldite", aKobolditeIngot); - } - -} diff --git a/src/Java/gtPlusPlus/core/config/ConfigHandler.java b/src/Java/gtPlusPlus/core/config/ConfigHandler.java deleted file mode 100644 index 61610a03e9..0000000000 --- a/src/Java/gtPlusPlus/core/config/ConfigHandler.java +++ /dev/null @@ -1,245 +0,0 @@ -package gtPlusPlus.core.config; - -import static gtPlusPlus.core.item.general.RF2EU_Battery.rfPerEU; -import static gtPlusPlus.core.lib.CORE.*; -import static gtPlusPlus.core.lib.CORE.ConfigSwitches.*; -import static gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_WorldAccelerator.BlacklistedTileEntiyClassNames; - -import java.io.File; - -import cpw.mods.fml.common.event.FMLPreInitializationEvent; - -import net.minecraftforge.common.config.Configuration; - -public class ConfigHandler { - - public static void handleConfigFile(final FMLPreInitializationEvent event) { - final Configuration config = new Configuration( - new File(event.getModConfigurationDirectory(), "GTplusplus/GTplusplus.cfg")); - config.load(); - - // Debug - /* DEBUG = config.getBoolean("debugMode", "debug", false, - "Enables all sorts of debug logging. (Don't use unless told to, breaks other things.)");*/ - disableEnderIOIntegration = config.getBoolean("disableEnderIO", "debug", false, - "Disables EnderIO Integration."); - disableEnderIOIngotTooltips = config.getBoolean("disableEnderIOIngotTooltips", "debug", false, - "Disables EnderIO Ingot Tooltips. These apparently may cause issues for a very small number of users."); - MACHINE_INFO = config.getBoolean("enableMachineInfoLogging", "debug", false, - "Makes many machines display lots of debug logging."); - showHiddenNEIItems = config.getBoolean("showHiddenNEIItems", "debug", false, - "Makes all items hidden from NEI display."); - dumpItemAndBlockData = config.getBoolean("dumpItemAndBlockData", "debug", false, - "Dumps all GT++ and Toxic Everglade Data to en_US.lang in the config folder. This config option can be used by foreign players to generate blank .lang files, which they can populate with their language of choice."); - - - // Machines - enableThaumcraftShardUnification = config.getBoolean("enableThaumcraftShardUnification", "machines", false, - "Allows the use of TC shards across many recipes by oreDicting them into a common group."); - enableAlternativeBatteryAlloy = config.getBoolean("enableAlternativeBatteryAlloy", "machines", false, - "Adds a non-Antimony using Battery Alloy. Not Balanced at all.."); - disableIC2Recipes = config.getBoolean("disableIC2Recipes", "machines", false, - "Alkaluscraft Related - Removes IC2 Cables Except glass fibre. Few other Misc Tweaks."); - enableAlternativeDivisionSigilRecipe = config.getBoolean("enableAlternativeDivisionSigilRecipe", "machines", - false, "Utilizes Neutronium instead."); - boilerSteamPerSecond = config.getInt("boilerSteamPerSecond", "machines", 750, 0, 10000, "Sets the steam per second value in LV,MV,HV boilers (respectively 1x,2x,3x this number for the tiers)"); - - //requireControlCores - boolean temp = config.getBoolean("requireControlCores", "machines", true, "Multiblocks Require Control Cores"); - - - - //Circuits - enableCustomCircuits = config.getBoolean("enableCustomCircuits", "gregtech", false, - "Adds custom circuits to expand past the Master Tier. Only really recommended to enable if enableOldGTcircuits is enabled."); - enableOldGTcircuits = config.getBoolean("enableOldGTcircuits", "gregtech", false, - "Restores circuits and their recipes from Pre-5.09.28 times."); - - // Tools - enableSkookumChoochers = config.getBoolean("enableSkookumChoochers", "gregtech", true, - "Adds Custom GT Tools, called Skookum Choochers, functioning as a hard hammer and a wrench."); - enableMultiSizeTools = config.getBoolean("enableMultiSizeTools", "gregtech", true, - "Adds Custom GT Shovels and Pickaxes which mine in a 3x3 style. One of each whill be generated for each Gregtech Material which has Dense Plates and Long Rods available."); - - // GT-Fixes - enableNitroFix = config.getBoolean("enableNitroFix", "gregtech", false, - "Restores the old Nitro-Diesel recipes."); - enableSulfuricAcidFix = config.getBoolean("enableSulfuricAcidFix", "gregtech", false, - "Adds GT6 recipes for Sulfuric Acid. Should remove all pre-existing recipes."); - enableAnimatedTurbines = config.getBoolean("enableAnimatedTurbines", "gregtech", true, - "Gives GT Gas/Steam turbines animated textures while running."); - turbineCutoffBase = config.getInt("turbineCutoffBase", "gregtech", 75000, 0, Integer.MAX_VALUE, "Rotors below this durability will be removed, prevents NEI clutter. Minimum Durability is N * x, where N is the new value set and x is the turbine size, where 1 is Tiny and 4 is Huge. Set to 0 to disable."); - - enableHarderRecipesForHighTierCasings = config.getBoolean("enableHarderRecipesForHighTierCasings", "gregtech", false, - "Makes LuV+ Casings and Hulls more difficult to craft."); - - // Pipes & Cables - enableCustom_Pipes = config.getBoolean("enableCustom_Pipes", "gregtech", true, - "Adds Custom GT Fluid Pipes."); - enableCustom_Cables = config.getBoolean("enableCustom_Cables", "gregtech", true, - "Adds Custom GT Cables."); - - // Block Drops - chanceToDropDrainedShard = config.getInt("chanceToDropDrainedShard", "blockdrops", 196, 0, - 10000, "Drained shards have a 1 in X chance to drop."); - chanceToDropFluoriteOre = config.getInt("chanceToDropFluoriteOre", "blockdrops", 32, 0, - 10000, "Fluorite Ore has a 1 in X chance to drop from Limestone and a 1 in X*20 from Sandstone.."); - - // Single machines - enableMachine_SolarGenerators = config.getBoolean("enableSolarGenerators", "gregtech", - false, "These may be overpowered, Consult a local electrician."); - enableMachine_ComponentAssemblers = config.getBoolean("enableComponentAssemblers", "gregtech", - true, "These construct machine components."); - enableMachine_Safes = config.getBoolean("enableMachineSafes", "gregtech", true, - "These protect your goodies/rare stuff."); - enableMachine_Dehydrators = config.getBoolean("enableMachineDehydrators", "gregtech", true, - "These dehydrate stuff."); - enableMachine_SteamConverter = config.getBoolean("enableMachineSteamConverter", "gregtech", - true, "Converts IC2 steam -> Railcraft steam."); - enableMachine_FluidTanks = config.getBoolean("enableMachineFluidTanks", "gregtech", true, - "Portable fluid tanks."); - enableMachine_RocketEngines = config.getBoolean("enableMachineRocketEngines", "gregtech", - true, "Diesel egines with different internals, they consume less fuel overall."); - enableMachine_GeothermalEngines = config.getBoolean("enableMachineGeothermalEngines", - "gregtech", true, "These may be overpowered, Consult a local geologist."); - enableMachine_WorldAccelerators = config.getBoolean("enableMachineWorldAccelerators", - "gregtech", true, "These allow boosting Block/TileEntity Tick times [OP]."); - enableMachine_Tesseracts = config.getBoolean("enableMachineTesseracts", - "gregtech", true, "Tesseracts for wireless item/fluid movement."); - enableMachine_SimpleWasher = config.getBoolean("enableMachineSimpleWasher", - "gregtech", true, "Very basic automated cauldron for dust washing."); - enableMachine_Pollution = config.getBoolean("enableMachinePollution", - "gregtech", true, "Pollution Detector & Scrubbers."); - enableMachine_RF_Convetor = config.getBoolean("enableMachineRFConvetor", "gregtech", - true, "Converts RF to GTEU. Requires COFH-Core to be installed."); - - - // Multi machines - enableMultiblock_AlloyBlastSmelter = config.getBoolean("enableMultiblockAlloyBlastSmelter", - "gregtech", true, - "Required to smelt most high tier materials from GT++. Also smelts everything else to molten metal."); - enableMultiblock_IndustrialCentrifuge = config - .getBoolean("enableMultiblockIndustrialCentrifuge", "gregtech", true, "Spin, Spin, Spiiiin."); - enableMultiblock_IndustrialCokeOven = config.getBoolean( - "enableMultiblockIndustrialCokeOven", "gregtech", true, - "Pyro Oven Alternative, older, more realistic, better."); - enableMultiblock_IndustrialElectrolyzer = config.getBoolean( - "enableMultiblockIndustrialElectrolyzer", "gregtech", true, - "Electrolyzes things with extra bling factor."); - enableMultiblock_IndustrialMacerationStack = config.getBoolean( - "enableMultiblockIndustrialMacerationStack", "gregtech", true, - "A hyper efficient maceration tower, nets more bonus outputs."); - enableMultiblock_IndustrialPlatePress = config.getBoolean( - "enableMultiblockIndustrialPlatePress", "gregtech", true, "Industrial bendering machine thingo."); - enableMultiblock_IndustrialWireMill = config.getBoolean( - "enableMultiblockIndustrialWireMill", "gregtech", true, "Produces fine wire and exotic cables."); - enableMultiblock_IronBlastFurnace = config.getBoolean("enableMultiblockIronBlastFurnace", - "gregtech", true, "Skip the Bronze age, very slowly."); - enableMultiblock_MatterFabricator = config.getBoolean("enableMultiblockMatterFabricator", - "gregtech", true, "?FAB?RIC?ATE MA?TT?ER."); - enableMultiblock_MultiTank = config.getBoolean("enableMultiblockMultiTank", "gregtech", - true, "Tall tanks, each layer adds extra fluid storage."); - enableMultiblock_PowerSubstation = config.getBoolean("enableMultiblockPowerSubstation", - "gregtech", true, "For managing large power grids."); - enableMultiblock_LiquidFluorideThoriumReactor = config.getBoolean( - "enableMultiblockLiquidFluorideThoriumReactor", "gregtech", true, "For supplying large power grids."); - enableMultiblock_NuclearFuelRefinery = config.getBoolean( - "enableMultiblock_NuclearFuelRefinery", "gregtech", true, - "Refines molten chemicals into nuclear fuels."); - enableMultiblock_IndustrialSifter = config.getBoolean("enableMultiblock_IndustrialSifter", - "gregtech", true, "Large scale sifting."); - enableMultiblock_LargeAutoCrafter = config.getBoolean("enableMultiblock_LargeAutoCrafter", - "gregtech", true, "Can Assemble, Disassemble and Craft Project data from Data Sticks."); - enableMultiblock_IndustrialThermalCentrifuge = config.getBoolean("enableMultiblock_IndustrialThermalCentrifuge", - "gregtech", true, "Your warm spin for the ore thing."); - enableMultiblock_IndustrialWashPlant = config.getBoolean("enableMultiblock_IndustrialWashPlant", - "gregtech", true, "Used to wash the dirt, riiiiight offff.."); - enableMultiblock_ThermalBoiler = config.getBoolean("enableMachineThermalBoiler", - "gregtech", true, "Thermal Boiler from GT4. Can Filter Lava for resources."); - enableMultiblock_IndustrialCuttingMachine = config.getBoolean("enableMultiblock_IndustrialCuttingMachine", - "gregtech", true, "Very fast and efficient Cutting Machine."); - enableMultiblock_IndustrialFishingPort = config.getBoolean("enableMultiblock_IndustrialFishingPort", - "gregtech", true, "Fish the seas, except on land."); - enableMultiblock_IndustrialExtrudingMachine = config.getBoolean("enableMultiblock_IndustrialExtrudingMachine", - "gregtech", true, "Very fast and efficient Extruding Machine."); - enableMultiblock_IndustrialMultiMachine = config.getBoolean("enableMultiblock_IndustrialMultiMachine", - "gregtech", true, "Can run recipes for 9 different types of machines."); - enableMultiblock_Cyclotron = config.getBoolean("enableMultiblock_Cyclotron", - "gregtech", true, "COMET - Scientific Cyclotron."); - - // Options - rfPerEU = config.getInt("rfUsedPerEUForUniversalBatteries", "configurables", 4, 1, 1000, - "How much RF is a single unit of EU worth? (Most mods use 4:1 ratio)"); - - // Features - enableCustomCapes = config.getBoolean("enableSupporterCape", "features", true, - "Enables Custom GT++ Cape."); - disableZombieReinforcement = config.getBoolean("disableZombieReinforcement", "features", false, - "Disables Zombie Reinforcement on hard difficutly."); - enableWatchdogBGM = config.getInt("enableWatchdogBGM", "features", 0, 0, Short.MAX_VALUE, "Set to a value greater than 0 to reduce the ticks taken to delay between BGM tracks. Acceptable Values are 1-32767, where 0 is disabled. Vanilla Uses 12,000 & 24,000. 200 is 10s."); - - //Biomes - EVERGLADES_ID = config.getInt("darkworld_ID", "worldgen", 227, 1, 254, "The ID of the Dark Dimension."); - EVERGLADESBIOME_ID = config.getInt("darkbiome_ID", "worldgen", 238, 1, 254, "The biome within the Dark Dimension."); - - //Blacklisted Accelerator TileEntities - BlacklistedTileEntiyClassNames = new String[] { "com.rwtema.extrautils.tileentity.enderquarry.TileEntityEnderQuarry" }; - BlacklistedTileEntiyClassNames = config.getStringList( - "BlacklistedTileEntiyClassNames", "gregtech", - BlacklistedTileEntiyClassNames, - "The Canonical Class-Names of TileEntities that should be ignored by the WorldAccelerator"); - - //Pollution - pollutionPerSecondMultiPackager = config.get("pollution", "pollutionPerSecondMultiPackager", pollutionPerSecondMultiPackager,"pollution rate in gibbl/s for the Amazon warehousing depot").getInt(pollutionPerSecondMultiPackager); - pollutionPerSecondMultiIndustrialAlloySmelter = config.get("pollution", "pollutionPerSecondMultiIndustrialAlloySmelter", pollutionPerSecondMultiIndustrialAlloySmelter,"pollution rate in gibbl/s for the Alloy blast smelter").getInt(pollutionPerSecondMultiIndustrialAlloySmelter); - pollutionPerSecondMultiIndustrialArcFurnace = config.get("pollution", "pollutionPerSecondMultiIndustrialArcFurnace", pollutionPerSecondMultiIndustrialArcFurnace,"pollution rate in gibbl/s for the High current arc furnace").getInt(pollutionPerSecondMultiIndustrialArcFurnace); - pollutionPerSecondMultiIndustrialCentrifuge = config.get("pollution", "pollutionPerSecondMultiIndustrialCentrifuge", pollutionPerSecondMultiIndustrialCentrifuge,"pollution rate in gibbl/s for the Industrial centrifuge").getInt(pollutionPerSecondMultiIndustrialCentrifuge); - pollutionPerSecondMultiIndustrialCokeOven = config.get("pollution", "pollutionPerSecondMultiIndustrialCokeOven", pollutionPerSecondMultiIndustrialCokeOven,"pollution rate in gibbl/s for the Industrial coke oven").getInt(pollutionPerSecondMultiIndustrialCokeOven); - pollutionPerSecondMultiIndustrialCuttingMachine = config.get("pollution", "pollutionPerSecondMultiIndustrialCuttingMachine", pollutionPerSecondMultiIndustrialCuttingMachine,"pollution rate in gibbl/s for the Cutting factory").getInt(pollutionPerSecondMultiIndustrialCuttingMachine); - pollutionPerSecondMultiIndustrialDehydrator = config.get("pollution", "pollutionPerSecondMultiIndustrialDehydrator", pollutionPerSecondMultiIndustrialDehydrator,"pollution rate in gibbl/s for the Utupu-Tanuri").getInt(pollutionPerSecondMultiIndustrialDehydrator); - pollutionPerSecondMultiIndustrialElectrolyzer = config.get("pollution", "pollutionPerSecondMultiIndustrialElectrolyzer", pollutionPerSecondMultiIndustrialElectrolyzer,"pollution rate in gibbl/s for the Industrial electrolyzer").getInt(pollutionPerSecondMultiIndustrialElectrolyzer); - pollutionPerSecondMultiIndustrialExtruder = config.get("pollution", "pollutionPerSecondMultiIndustrialExtruder", pollutionPerSecondMultiIndustrialExtruder,"pollution rate in gibbl/s for the Industrial extrusion machine").getInt(pollutionPerSecondMultiIndustrialExtruder); - pollutionPerSecondMultiIndustrialMacerator = config.get("pollution", "pollutionPerSecondMultiIndustrialMacerator", pollutionPerSecondMultiIndustrialMacerator,"pollution rate in gibbl/s for the Maceration stack").getInt(pollutionPerSecondMultiIndustrialMacerator); - pollutionPerSecondMultiIndustrialMixer = config.get("pollution", "pollutionPerSecondMultiIndustrialMixer", pollutionPerSecondMultiIndustrialMixer,"pollution rate in gibbl/s for the Industrial mixing machine").getInt(pollutionPerSecondMultiIndustrialMixer); - pollutionPerSecondMultiIndustrialMultiMachine_ModeMetal = config.get("pollution", "pollutionPerSecondMultiIndustrialMultiMachine_ModeMetal", pollutionPerSecondMultiIndustrialMultiMachine_ModeMetal,"pollution rate in gibbl/s for the Large processing factory in metal mode").getInt(pollutionPerSecondMultiIndustrialMultiMachine_ModeMetal); - pollutionPerSecondMultiIndustrialMultiMachine_ModeFluid = config.get("pollution", "pollutionPerSecondMultiIndustrialMultiMachine_ModeFluid", pollutionPerSecondMultiIndustrialMultiMachine_ModeFluid,"pollution rate in gibbl/s for the Large processing factory in fluid mode").getInt(pollutionPerSecondMultiIndustrialMultiMachine_ModeFluid); - pollutionPerSecondMultiIndustrialMultiMachine_ModeMisc = config.get("pollution", "pollutionPerSecondMultiIndustrialMultiMachine_ModeMisc", pollutionPerSecondMultiIndustrialMultiMachine_ModeMisc,"pollution rate in gibbl/s for the Large processing factory in misc mode").getInt(pollutionPerSecondMultiIndustrialMultiMachine_ModeMisc); - pollutionPerSecondMultiIndustrialPlatePress_ModeForming = config.get("pollution", "pollutionPerSecondMultiIndustrialPlatePress_ModeForming", pollutionPerSecondMultiIndustrialPlatePress_ModeForming,"pollution rate in gibbl/s for the Industrial material press in forming mode").getInt(pollutionPerSecondMultiIndustrialPlatePress_ModeForming); - pollutionPerSecondMultiIndustrialPlatePress_ModeBending = config.get("pollution", "pollutionPerSecondMultiIndustrialPlatePress_ModeBending", pollutionPerSecondMultiIndustrialPlatePress_ModeBending,"pollution rate in gibbl/s for the Industrial material press in bending mode").getInt(pollutionPerSecondMultiIndustrialPlatePress_ModeBending); - pollutionPerSecondMultiIndustrialSifter = config.get("pollution", "pollutionPerSecondMultiIndustrialSifter", pollutionPerSecondMultiIndustrialSifter,"pollution rate in gibbl/s for the Large Sifter").getInt(pollutionPerSecondMultiIndustrialSifter); - pollutionPerSecondMultiIndustrialThermalCentrifuge = config.get("pollution", "pollutionPerSecondMultiIndustrialThermalCentrifuge", pollutionPerSecondMultiIndustrialThermalCentrifuge,"pollution rate in gibbl/s for the Large thermal refinery").getInt(pollutionPerSecondMultiIndustrialThermalCentrifuge); - pollutionPerSecondMultiIndustrialVacuumFreezer = config.get("pollution", "pollutionPerSecondMultiIndustrialVacuumFreezer", pollutionPerSecondMultiIndustrialVacuumFreezer,"pollution rate in gibbl/s for the Cryogenic freezer").getInt(pollutionPerSecondMultiIndustrialVacuumFreezer); - pollutionPerSecondMultiIndustrialWashPlant_ModeChemBath = config.get("pollution", "pollutionPerSecondMultiIndustrialWashPlant_ModeChemBath", pollutionPerSecondMultiIndustrialWashPlant_ModeChemBath,"pollution rate in gibbl/s for the Ore washing plant in chemical bath mode").getInt(pollutionPerSecondMultiIndustrialWashPlant_ModeChemBath); - pollutionPerSecondMultiIndustrialWashPlant_ModeWasher = config.get("pollution", "pollutionPerSecondMultiIndustrialWashPlant_ModeWasher", pollutionPerSecondMultiIndustrialWashPlant_ModeWasher,"pollution rate in gibbl/s for the Ore washing plant in ore washer mode").getInt(pollutionPerSecondMultiIndustrialWashPlant_ModeWasher); - pollutionPerSecondMultiIndustrialWireMill = config.get("pollution", "pollutionPerSecondMultiIndustrialWireMill", pollutionPerSecondMultiIndustrialWireMill,"pollution rate in gibbl/s for the Wire factory").getInt(pollutionPerSecondMultiIndustrialWireMill); - pollutionPerSecondMultiIsaMill = config.get("pollution", "pollutionPerSecondMultiIsaMill", pollutionPerSecondMultiIsaMill,"pollution rate in gibbl/s for the IsaMill grinding machine").getInt(pollutionPerSecondMultiIsaMill); - pollutionPerSecondMultiAdvDistillationTower_ModeDistillery = config.get("pollution", "pollutionPerSecondMultiAdvDistillationTower_ModeDistillery", pollutionPerSecondMultiAdvDistillationTower_ModeDistillery,"pollution rate in gibbl/s for the Dangote distillus in distillery mode").getInt(pollutionPerSecondMultiAdvDistillationTower_ModeDistillery); - pollutionPerSecondMultiAdvDistillationTower_ModeDT = config.get("pollution", "pollutionPerSecondMultiAdvDistillationTower_ModeDT", pollutionPerSecondMultiAdvDistillationTower_ModeDT,"pollution rate in gibbl/s for the Dangote distillus in distillation tower mode").getInt(pollutionPerSecondMultiAdvDistillationTower_ModeDT); - pollutionPerSecondMultiAdvEBF = config.get("pollution", "pollutionPerSecondMultiAdvEBF", pollutionPerSecondMultiAdvEBF,"pollution rate in gibbl/s for the Volcanus").getInt(pollutionPerSecondMultiAdvEBF); - pollutionPerSecondMultiAdvImplosion = config.get("pollution", "pollutionPerSecondMultiAdvImplosion", pollutionPerSecondMultiAdvImplosion,"pollution rate in gibbl/s for the Density^2").getInt(pollutionPerSecondMultiAdvImplosion); - pollutionPerSecondMultiABS = config.get("pollution", "pollutionPerSecondMultiABS", pollutionPerSecondMultiABS,"pollution rate in gibbl/s for the Alloy blast furnace").getInt(pollutionPerSecondMultiABS); - pollutionPerSecondMultiCyclotron = config.get("pollution", "pollutionPerSecondMultiCyclotron", pollutionPerSecondMultiCyclotron,"pollution rate in gibbl/s for the Cyclotron").getInt(pollutionPerSecondMultiCyclotron); - pollutionPerSecondMultiIndustrialFishingPond = config.get("pollution", "pollutionPerSecondMultiIndustrialFishingPond", pollutionPerSecondMultiIndustrialFishingPond,"pollution rate in gibbl/s for the Zuhai - fishing port").getInt(pollutionPerSecondMultiIndustrialFishingPond); - //pollutionPerSecondMultiLargeRocketEngine; - pollutionPerSecondMultiLargeSemiFluidGenerator = config.get("pollution", "pollutionPerSecondMultiLargeSemiFluidGenerator", pollutionPerSecondMultiLargeSemiFluidGenerator,"pollution rate in gibbl/s for the Large semifluid burner").getInt(pollutionPerSecondMultiLargeSemiFluidGenerator); - pollutionPerSecondMultiMassFabricator = config.get("pollution", "pollutionPerSecondMultiMassFabricator", pollutionPerSecondMultiMassFabricator,"pollution rate in gibbl/s for the Matter fabrication CPU").getInt(pollutionPerSecondMultiMassFabricator); - pollutionPerSecondMultiRefinery = config.get("pollution", "pollutionPerSecondMultiRefinery", pollutionPerSecondMultiRefinery,"pollution rate in gibbl/s for the Reactor fuel processing plant").getInt(pollutionPerSecondMultiRefinery); - //pollutionPerSecondMultiGeneratorArray; - pollutionPerSecondMultiTreeFarm = config.get("pollution", "pollutionPerSecondMultiTreeFarm", pollutionPerSecondMultiTreeFarm,"pollution rate in gibbl/s for the Tree growth simulator").getInt(pollutionPerSecondMultiTreeFarm); - pollutionPerSecondMultiFrothFlotationCell = config.get("pollution", "pollutionPerSecondMultiFrothFlotationCell", pollutionPerSecondMultiFrothFlotationCell,"pollution rate in gibbl/s for the Flotation cell regulator").getInt(pollutionPerSecondMultiFrothFlotationCell); - pollutionPerSecondMultiAutoCrafter = config.get("pollution", "pollutionPerSecondMultiAutoCrafter", pollutionPerSecondMultiAutoCrafter,"pollution rate in gibbl/s for the Large-Scale auto assembler v1.01").getInt(pollutionPerSecondMultiAutoCrafter); - pollutionPerSecondMultiThermalBoiler = config.get("pollution", "pollutionPerSecondMultiThermalBoiler", pollutionPerSecondMultiThermalBoiler,"pollution rate in gibbl/s for the Thermal boiler").getInt(pollutionPerSecondMultiThermalBoiler); - pollutionPerSecondMultiAlgaePond = config.get("pollution", "pollutionPerSecondMultiAlgaePond", pollutionPerSecondMultiAlgaePond,"pollution rate in gibbl/s for the Algae farm").getInt(pollutionPerSecondMultiAlgaePond); - basePollutionPerSecondSemiFluidGenerator = config.get("pollution", "basePollutionPerSecondSemiFluidGenerator", basePollutionPerSecondSemiFluidGenerator, "base pollution rate in gibbl/s for the single block semi fluid generators").getInt(basePollutionPerSecondSemiFluidGenerator); - pollutionReleasedByTierSemiFluidGenerator = config.get("pollution", "pollutionReleasedByTierSemiFluidGenerator", pollutionReleasedByTierSemiFluidGenerator, "coefficient applied to the base rate of the single block semi fluid generators based on its tier (first is tier 0 aka ULV)").getDoubleList(); - basePollutionPerSecondBoiler = config.get("pollution", "basePollutionPerSecondBoiler", basePollutionPerSecondBoiler,"base pollution rate in gibbl/s for the single block boilers").getInt(basePollutionPerSecondBoiler); - pollutionReleasedByTierBoiler = config.get("pollution", "pollutionReleasedByTierBoiler", pollutionReleasedByTierBoiler, "coefficient applied to the base rate of the single block semi fluid generators based on its tier (first is tier 0 aka ULV)").getDoubleList(); - baseMinPollutionPerSecondRocketFuelGenerator = config.get("pollution", "baseMinPollutionPerSecondRocketFuelGenerator", baseMinPollutionPerSecondRocketFuelGenerator, "minimum base pollution rate in gibbl/s for the single block rocket engines").getInt(baseMinPollutionPerSecondRocketFuelGenerator); - baseMaxPollutionPerSecondRocketFuelGenerator = config.get("pollution", "baseMaxPollutionPerSecondRocketFuelGenerator", baseMaxPollutionPerSecondRocketFuelGenerator, "maximum base pollution rate in gibbl/s for the single block rocket engines").getInt(baseMaxPollutionPerSecondRocketFuelGenerator); - pollutionReleasedByTierRocketFuelGenerator = config.get("pollution", "pollutionReleasedByTierRocketFuelGenerator", pollutionReleasedByTierRocketFuelGenerator, "coefficient applied to the base rate of the single block rocket engines based on its tier (first is tier 0 aka ULV)").getDoubleList(); - basePollutionPerSecondGeothermalGenerator = config.get("pollution", "basePollutionPerSecondGeothermalGenerator", basePollutionPerSecondGeothermalGenerator,"base pollution rate in gibbl/s for the geothermal engines").getInt(basePollutionPerSecondGeothermalGenerator); - pollutionReleasedByTierGeothermalGenerator = config.get("pollution", "pollutionReleasedByTierGeothermalGenerator", pollutionReleasedByTierGeothermalGenerator, "coefficient applied to the base rate of the single block geothermal engines based on its tier (first is tier 0 aka ULV)").getDoubleList(); - config.save(); - } - -} diff --git a/src/Java/gtPlusPlus/core/container/Container_BackpackBase.java b/src/Java/gtPlusPlus/core/container/Container_BackpackBase.java deleted file mode 100644 index ad76bebe81..0000000000 --- a/src/Java/gtPlusPlus/core/container/Container_BackpackBase.java +++ /dev/null @@ -1,208 +0,0 @@ -package gtPlusPlus.core.container; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.inventories.BaseInventoryBackpack; -import gtPlusPlus.core.slots.SlotItemBackpackInv; - -public class Container_BackpackBase extends Container -{ - /** The Item Inventory for this Container, only needed if you want to reference isUseableByPlayer */ - public final BaseInventoryBackpack inventory; - - /** Using these will make transferStackInSlot easier to understand and implement - * INV_START is the index of the first slot in the Player's Inventory, so our - * BaseInventoryBackpack's number of slots (e.g. 5 slots is array indices 0-4, so start at 5) - * Notice how we don't have to remember how many slots we made? We can just use - * BaseInventoryBackpack.INV_SIZE and if we ever change it, the Container updates automatically. */ - private static final int INV_START = BaseInventoryBackpack.INV_SIZE, INV_END = INV_START+26, - HOTBAR_START = INV_END+1, HOTBAR_END = HOTBAR_START+8; - - // If you're planning to add armor slots, put those first like this: - // ARMOR_START = BaseInventoryBackpack.INV_SIZE, ARMOR_END = ARMOR_START+3, - // INV_START = ARMOR_END+1, and then carry on like above. - - public Container_BackpackBase(final EntityPlayer par1Player, final InventoryPlayer inventoryPlayer, final BaseInventoryBackpack inventoryItem) - { - this.inventory = inventoryItem; - - int i; - - // ITEM INVENTORY - you'll need to adjust the slot locations to match your texture file - // I have them set vertically in columns of 4 to the right of the player model - for (i = 0; i < BaseInventoryBackpack.INV_SIZE; ++i) - { - // You can make a custom Slot if you need different behavior, - // such as only certain item types can be put into this slot - // We made a custom slot to prevent our inventory-storing item - // from being stored within itself, but if you want to allow that and - // you followed my advice at the end of the above step, then you - // could get away with using the vanilla Slot class - this.addSlotToContainer(new SlotItemBackpackInv(this.inventory, i, 80 + (18 * (i/4)), 8 + (18*(i%4)))); - } - - // If you want, you can add ARMOR SLOTS here as well, but you need to - // make a public version of SlotArmor. I won't be doing that in this tutorial. - /* - for (i = 0; i < 4; ++i) - { - // These are the standard positions for survival inventory layout - this.addSlotToContainer(new SlotArmor(this.player, inventoryPlayer, inventoryPlayer.getSizeInventory() - 1 - i, 8, 8 + i * 18, i)); - } - */ - - // PLAYER INVENTORY - uses default locations for standard inventory texture file - for (i = 0; i < 3; ++i) - { - for (int j = 0; j < 9; ++j) - { - this.addSlotToContainer(new Slot(inventoryPlayer, j + (i * 9) + 9, 8 + (j * 18), 84 + (i * 18))); - } - } - - // PLAYER ACTION BAR - uses default locations for standard action bar texture file - for (i = 0; i < 9; ++i) - { - this.addSlotToContainer(new Slot(inventoryPlayer, i, 8 + (i * 18), 142)); - } - } - - @Override - public boolean canInteractWith(final EntityPlayer entityplayer) - { - // be sure to return the inventory's isUseableByPlayer method - // if you defined special behavior there: - return this.inventory.isUseableByPlayer(entityplayer); - } - - /** - * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. - */ - @Override - public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int index) - { - ItemStack itemstack = null; - final Slot slot = (Slot) this.inventorySlots.get(index); - - if ((slot != null) && slot.getHasStack()) - { - final ItemStack itemstack1 = slot.getStack(); - itemstack = itemstack1.copy(); - - // If item is in our custom Inventory or armor slot - if (index < INV_START) - { - // try to place in player inventory / action bar - if (!this.mergeItemStack(itemstack1, INV_START, HOTBAR_END+1, true)) - { - return null; - } - - slot.onSlotChange(itemstack1, itemstack); - } - // Item is in inventory / hotbar, try to place in custom inventory or armor slots - else - { - /* - If your inventory only stores certain instances of Items, - you can implement shift-clicking to your inventory like this: - - // Check that the item is the right type - if (itemstack1.getItem() instanceof ItemCustom) - { - // Try to merge into your custom inventory slots - // We use 'BaseInventoryBackpack.INV_SIZE' instead of INV_START just in case - // you also add armor or other custom slots - if (!this.mergeItemStack(itemstack1, 0, BaseInventoryBackpack.INV_SIZE, false)) - { - return null; - } - } - // If you added armor slots, check them here as well: - // Item being shift-clicked is armor - try to put in armor slot - if (itemstack1.getItem() instanceof ItemArmor) - { - int type = ((ItemArmor) itemstack1.getItem()).armorType; - if (!this.mergeItemStack(itemstack1, ARMOR_START + type, ARMOR_START + type + 1, false)) - { - return null; - } - } - Otherwise, you have basically 2 choices: - 1. shift-clicking between player inventory and custom inventory - 2. shift-clicking between action bar and inventory - - Be sure to choose only ONE of the following implementations!!! - */ - /** - * Implementation number 1: Shift-click into your custom inventory - */ - if (index >= INV_START) - { - // place in custom inventory - if (!this.mergeItemStack(itemstack1, 0, INV_START, false)) - { - return null; - } - } - - /** - * Implementation number 2: Shift-click items between action bar and inventory - */ - // item is in player's inventory, but not in action bar - if ((index >= INV_START) && (index < HOTBAR_START)) - { - // place in action bar - if (!this.mergeItemStack(itemstack1, HOTBAR_START, HOTBAR_END+1, false)) - { - return null; - } - } - // item in action bar - place in player inventory - else if ((index >= HOTBAR_START) && (index < (HOTBAR_END+1))) - { - if (!this.mergeItemStack(itemstack1, INV_START, INV_END+1, false)) - { - return null; - } - } - } - - if (itemstack1.stackSize == 0) - { - slot.putStack((ItemStack) null); - } - else - { - slot.onSlotChanged(); - } - - if (itemstack1.stackSize == itemstack.stackSize) - { - return null; - } - - slot.onPickupFromSlot(par1EntityPlayer, itemstack1); - } - - return itemstack; - } - - /** - * You should override this method to prevent the player from moving the stack that - * opened the inventory, otherwise if the player moves it, the inventory will not - * be able to save properly - */ - @Override - public ItemStack slotClick(final int slot, final int button, final int flag, final EntityPlayer player) { - // this will prevent the player from interacting with the item that opened the inventory: - if ((slot >= 0) && (this.getSlot(slot) != null) && (this.getSlot(slot).getStack() == player.getHeldItem())) { - return null; - } - return super.slotClick(slot, button, flag, player); - } -} diff --git a/src/Java/gtPlusPlus/core/container/Container_CircuitProgrammer.java b/src/Java/gtPlusPlus/core/container/Container_CircuitProgrammer.java deleted file mode 100644 index d8ce521fb5..0000000000 --- a/src/Java/gtPlusPlus/core/container/Container_CircuitProgrammer.java +++ /dev/null @@ -1,190 +0,0 @@ -package gtPlusPlus.core.container; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.InventoryCircuitProgrammer; -import gtPlusPlus.core.slots.SlotIntegratedCircuit; -import gtPlusPlus.core.slots.SlotNoInput; -import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer; - -public class Container_CircuitProgrammer extends Container { - - protected TileEntityCircuitProgrammer tile_entity; - public final InventoryCircuitProgrammer inventoryChest; - - private final World worldObj; - private final int posX; - private final int posY; - private final int posZ; - - public static final int SLOT_OUTPUT = 25; - - public static int StorageSlotNumber = 26; // Number of slots in storage area - public static int InventorySlotNumber = 36; // Inventory Slots (Inventory - // and Hotbar) - public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All - // slots - - public Container_CircuitProgrammer(final InventoryPlayer inventory, final TileEntityCircuitProgrammer te) { - this.tile_entity = te; - this.inventoryChest = te.getInventory(); - - int var6; - int var7; - this.worldObj = te.getWorldObj(); - this.posX = te.xCoord; - this.posY = te.yCoord; - this.posZ = te.zCoord; - Logger.INFO("1"); - - int o = 0; - - // Storage Side - /*for (var6 = 0; var6 < 3; var6++) { - for (var7 = 0; var7 < 5; var7++) { - this.addSlotToContainer(new SlotIntegratedCircuit(o, this.inventoryChest, o, 44 + (var7 * 18), 15 + (var6 * 18))); - o++; - } - }*/ - - - int xStart = 8; - int yStart = 5; - - try { - //0 - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart, yStart)); - //1-10 - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+18)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+18)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+18)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+18)); - //11-20 - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+18)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+18)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+36)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+36)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+36)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+36)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+36)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+36)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+54)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+54)); - //21-24 - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+54)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+54)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+54)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+54)); - Logger.INFO("2"); - - //Add Output - this.addSlotToContainer(new SlotNoInput(this.inventoryChest, SLOT_OUTPUT, xStart+(8*18), yStart+54)); - o++; - Logger.INFO("3"); - - - - // Player Inventory - for (var6 = 0; var6 < 3; ++var6) { - for (var7 = 0; var7 < 9; ++var7) { - this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); - } - } - // Player Hotbar - for (var6 = 0; var6 < 9; ++var6) { - this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); - } - - - - Logger.INFO("4"); - } - catch (Throwable t) {} - - } - - @Override - public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, - final EntityPlayer aPlayer) { - - if (!aPlayer.worldObj.isRemote) { - if ((aSlotIndex == 999) || (aSlotIndex == -999)) { - // Utils.LOG_WARNING("??? - "+aSlotIndex); - } - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public void onContainerClosed(final EntityPlayer par1EntityPlayer) { - super.onContainerClosed(par1EntityPlayer); - } - - @Override - public boolean canInteractWith(final EntityPlayer par1EntityPlayer) { - if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockCircuitProgrammer) { - return false; - } - - return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; - } - - @Override - public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) { - ItemStack var3 = null; - final Slot var4 = (Slot) this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - /* - * if (par2 == 0) { if (!this.mergeItemStack(var5, - * InOutputSlotNumber, FullSlotNumber, true)) { return null; } - * - * var4.onSlotChange(var5, var3); } else if (par2 >= - * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if - * (!this.mergeItemStack(var5, InventoryOutSlotNumber, - * FullSlotNumber, false)) { return null; } } else if (par2 >= - * InventoryOutSlotNumber && par2 < FullSlotNumber) { if - * (!this.mergeItemStack(var5, InOutputSlotNumber, - * InventoryOutSlotNumber, false)) { return null; } } else if - * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, - * false)) { return null; } - */ - - if (var5.stackSize == 0) { - var4.putStack((ItemStack) null); - } else { - var4.onSlotChanged(); - } - - if (var5.stackSize == var3.stackSize) { - return null; - } - - var4.onPickupFromSlot(par1EntityPlayer, var5); - } - - return var3; - } - - // Can merge Slot - @Override - public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) { - return super.func_94530_a(p_94530_1_, p_94530_2_); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_DecayablesChest.java b/src/Java/gtPlusPlus/core/container/Container_DecayablesChest.java deleted file mode 100644 index 5bc384cd29..0000000000 --- a/src/Java/gtPlusPlus/core/container/Container_DecayablesChest.java +++ /dev/null @@ -1,140 +0,0 @@ -package gtPlusPlus.core.container; - -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.Inventory_DecayablesChest; -import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public class Container_DecayablesChest extends Container { - - protected TileEntityDecayablesChest tile_entity; - public final Inventory_DecayablesChest inventoryChest; - - private final World worldObj; - private final int posX; - private final int posY; - private final int posZ; - - public static int StorageSlotNumber = 15; // Number of slots in storage area - public static int InventorySlotNumber = 36; // Inventory Slots (Inventory - // and Hotbar) - public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All - // slots - - private final int[] slotStorage = new int[15]; - - public Container_DecayablesChest(final InventoryPlayer inventory, final TileEntityDecayablesChest te) { - this.tile_entity = te; - this.inventoryChest = te.getInventory(); - te.openInventory(); - - int var6; - int var7; - this.worldObj = te.getWorldObj(); - this.posX = te.xCoord; - this.posY = te.yCoord; - this.posZ = te.zCoord; - - int o = 0; - - // Storage Side - for (var6 = 0; var6 < 3; var6++) { - for (var7 = 0; var7 < 5; var7++) { - this.slotStorage[o] = o; - this.addSlotToContainer(new Slot(this.inventoryChest, o++, 44 + (var7 * 18), 15 + (var6 * 18))); - } - } - - // Player Inventory - for (var6 = 0; var6 < 3; ++var6) { - for (var7 = 0; var7 < 9; ++var7) { - this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); - } - } - - // Player Hotbar - for (var6 = 0; var6 < 9; ++var6) { - this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); - } - - } - - @Override - public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, - final EntityPlayer aPlayer) { - - if (!aPlayer.worldObj.isRemote) { - if ((aSlotIndex == 999) || (aSlotIndex == -999)) { - // Utils.LOG_WARNING("??? - "+aSlotIndex); - } - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public void onContainerClosed(final EntityPlayer par1EntityPlayer) { - super.onContainerClosed(par1EntityPlayer); - tile_entity.closeInventory(); - } - - @Override - public boolean canInteractWith(final EntityPlayer par1EntityPlayer) { - if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockDecayablesChest) { - return false; - } - - return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; - } - - @Override - public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) { - ItemStack var3 = null; - final Slot var4 = (Slot) this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - /* - * if (par2 == 0) { if (!this.mergeItemStack(var5, - * InOutputSlotNumber, FullSlotNumber, true)) { return null; } - * - * var4.onSlotChange(var5, var3); } else if (par2 >= - * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if - * (!this.mergeItemStack(var5, InventoryOutSlotNumber, - * FullSlotNumber, false)) { return null; } } else if (par2 >= - * InventoryOutSlotNumber && par2 < FullSlotNumber) { if - * (!this.mergeItemStack(var5, InOutputSlotNumber, - * InventoryOutSlotNumber, false)) { return null; } } else if - * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, - * false)) { return null; } - */ - - if (var5.stackSize == 0) { - var4.putStack((ItemStack) null); - } else { - var4.onSlotChanged(); - } - - if (var5.stackSize == var3.stackSize) { - return null; - } - - var4.onPickupFromSlot(par1EntityPlayer, var5); - } - - return var3; - } - - // Can merge Slot - @Override - public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) { - return super.func_94530_a(p_94530_1_, p_94530_2_); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_EggBox.java b/src/Java/gtPlusPlus/core/container/Container_EggBox.java deleted file mode 100644 index c4396cca6f..0000000000 --- a/src/Java/gtPlusPlus/core/container/Container_EggBox.java +++ /dev/null @@ -1,140 +0,0 @@ -package gtPlusPlus.core.container; - -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.Inventory_EggBox; -import gtPlusPlus.core.tileentities.general.TileEntityEggBox; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public class Container_EggBox extends Container { - - protected TileEntityEggBox tile_entity; - public final Inventory_EggBox inventoryChest; - - private final World worldObj; - private final int posX; - private final int posY; - private final int posZ; - - public static int StorageSlotNumber = 15; // Number of slots in storage area - public static int InventorySlotNumber = 36; // Inventory Slots (Inventory - // and Hotbar) - public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All - // slots - - private final int[] slotStorage = new int[15]; - - public Container_EggBox(final InventoryPlayer inventory, final TileEntityEggBox te) { - this.tile_entity = te; - this.inventoryChest = te.getInventory(); - te.openInventory(); - - int var6; - int var7; - this.worldObj = te.getWorldObj(); - this.posX = te.xCoord; - this.posY = te.yCoord; - this.posZ = te.zCoord; - - int o = 0; - - // Storage Side - for (var6 = 0; var6 < 3; var6++) { - for (var7 = 0; var7 < 5; var7++) { - this.slotStorage[o] = o; - this.addSlotToContainer(new Slot(this.inventoryChest, o++, 44 + (var7 * 18), 15 + (var6 * 18))); - } - } - - // Player Inventory - for (var6 = 0; var6 < 3; ++var6) { - for (var7 = 0; var7 < 9; ++var7) { - this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); - } - } - - // Player Hotbar - for (var6 = 0; var6 < 9; ++var6) { - this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); - } - - } - - @Override - public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, - final EntityPlayer aPlayer) { - - if (!aPlayer.worldObj.isRemote) { - if ((aSlotIndex == 999) || (aSlotIndex == -999)) { - // Utils.LOG_WARNING("??? - "+aSlotIndex); - } - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public void onContainerClosed(final EntityPlayer par1EntityPlayer) { - super.onContainerClosed(par1EntityPlayer); - tile_entity.closeInventory(); - } - - @Override - public boolean canInteractWith(final EntityPlayer par1EntityPlayer) { - if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockEggBox) { - return false; - } - - return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; - } - - @Override - public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) { - ItemStack var3 = null; - final Slot var4 = (Slot) this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - /* - * if (par2 == 0) { if (!this.mergeItemStack(var5, - * InOutputSlotNumber, FullSlotNumber, true)) { return null; } - * - * var4.onSlotChange(var5, var3); } else if (par2 >= - * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if - * (!this.mergeItemStack(var5, InventoryOutSlotNumber, - * FullSlotNumber, false)) { return null; } } else if (par2 >= - * InventoryOutSlotNumber && par2 < FullSlotNumber) { if - * (!this.mergeItemStack(var5, InOutputSlotNumber, - * InventoryOutSlotNumber, false)) { return null; } } else if - * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, - * false)) { return null; } - */ - - if (var5.stackSize == 0) { - var4.putStack((ItemStack) null); - } else { - var4.onSlotChanged(); - } - - if (var5.stackSize == var3.stackSize) { - return null; - } - - var4.onPickupFromSlot(par1EntityPlayer, var5); - } - - return var3; - } - - // Can merge Slot - @Override - public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) { - return super.func_94530_a(p_94530_1_, p_94530_2_); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_FishTrap.java b/src/Java/gtPlusPlus/core/container/Container_FishTrap.java deleted file mode 100644 index a2f44441d9..0000000000 --- a/src/Java/gtPlusPlus/core/container/Container_FishTrap.java +++ /dev/null @@ -1,142 +0,0 @@ -package gtPlusPlus.core.container; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.InventoryFishTrap; -import gtPlusPlus.core.slots.SlotNoInput; -import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; - -public class Container_FishTrap extends Container { - - protected TileEntityFishTrap tile_entity; - public final InventoryFishTrap inventoryChest; - - private final World worldObj; - private final int posX; - private final int posY; - private final int posZ; - - public static int StorageSlotNumber = 15; // Number of slots in storage area - public static int InventorySlotNumber = 36; // Inventory Slots (Inventory - // and Hotbar) - public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All - // slots - - private final int[] slotStorage = new int[15]; - - public Container_FishTrap(final InventoryPlayer inventory, final TileEntityFishTrap te) { - this.tile_entity = te; - this.inventoryChest = te.getInventory(); - - te.openInventory(); - int var6; - int var7; - this.worldObj = te.getWorldObj(); - this.posX = te.xCoord; - this.posY = te.yCoord; - this.posZ = te.zCoord; - - int o = 0; - - // Storage Side - for (var6 = 0; var6 < 3; var6++) { - for (var7 = 0; var7 < 5; var7++) { - this.slotStorage[o] = o; - this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, 44 + (var7 * 18), 15 + (var6 * 18))); - } - } - - // Player Inventory - for (var6 = 0; var6 < 3; ++var6) { - for (var7 = 0; var7 < 9; ++var7) { - this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); - } - } - - // Player Hotbar - for (var6 = 0; var6 < 9; ++var6) { - this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); - } - - } - - @Override - public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, - final EntityPlayer aPlayer) { - - if (!aPlayer.worldObj.isRemote) { - if ((aSlotIndex == 999) || (aSlotIndex == -999)) { - // Utils.LOG_WARNING("??? - "+aSlotIndex); - } - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public void onContainerClosed(final EntityPlayer par1EntityPlayer) { - super.onContainerClosed(par1EntityPlayer); - tile_entity.closeInventory(); - } - - @Override - public boolean canInteractWith(final EntityPlayer par1EntityPlayer) { - if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockFishTrap) { - return false; - } - - return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; - } - - @Override - public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) { - ItemStack var3 = null; - final Slot var4 = (Slot) this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - /* - * if (par2 == 0) { if (!this.mergeItemStack(var5, - * InOutputSlotNumber, FullSlotNumber, true)) { return null; } - * - * var4.onSlotChange(var5, var3); } else if (par2 >= - * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if - * (!this.mergeItemStack(var5, InventoryOutSlotNumber, - * FullSlotNumber, false)) { return null; } } else if (par2 >= - * InventoryOutSlotNumber && par2 < FullSlotNumber) { if - * (!this.mergeItemStack(var5, InOutputSlotNumber, - * InventoryOutSlotNumber, false)) { return null; } } else if - * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, - * false)) { return null; } - */ - - if (var5.stackSize == 0) { - var4.putStack((ItemStack) null); - } else { - var4.onSlotChanged(); - } - - if (var5.stackSize == var3.stackSize) { - return null; - } - - var4.onPickupFromSlot(par1EntityPlayer, var5); - } - - return var3; - } - - // Can merge Slot - @Override - public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) { - return super.func_94530_a(p_94530_1_, p_94530_2_); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_Grindle.java b/src/Java/gtPlusPlus/core/container/Container_Grindle.java deleted file mode 100644 index 4ab79322c9..0000000000 --- a/src/Java/gtPlusPlus/core/container/Container_Grindle.java +++ /dev/null @@ -1,160 +0,0 @@ -package gtPlusPlus.core.container; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.inventories.BaseInventoryGrindle; -import gtPlusPlus.core.slots.SlotDataStick; - -public class Container_Grindle extends Container { - /** - * The Item Inventory for this Container, only needed if you want to reference - * isUseableByPlayer - */ - public final BaseInventoryGrindle inventory; - - /** - * Using these will make transferStackInSlot easier to understand and implement - * INV_START is the index of the first slot in the Player's Inventory, so our - * BaseInventoryBackpack's number of slots (e.g. 5 slots is array indices 0-4, - * so start at 5) Notice how we don't have to remember how many slots we made? - * We can just use BaseInventoryBackpack.INV_SIZE and if we ever change it, the - * Container updates automatically. - */ - private static final int - INV_START = BaseInventoryGrindle.INV_SIZE, - INV_END = INV_START + 0, - HOTBAR_START = INV_END, - HOTBAR_END = HOTBAR_START + 8; - - public Container_Grindle(final EntityPlayer par1Player, final InventoryPlayer inventoryPlayer, - final BaseInventoryGrindle inventoryItem) { - this.inventory = inventoryItem; - - int i; - - // Actual Scan Slot - this.addSlotToContainer(new SlotDataStick(this.inventory, 0, 152, 5)); - - for (i = 1; i < BaseInventoryGrindle.INV_SIZE; ++i) { - this.addSlotToContainer(new SlotDataStick(this.inventory, i, 153, 30 + (18 * i))); - } - - // PLAYER ACTION BAR - uses default locations for standard action bar texture - // file - for (i = 0; i < 9; ++i) { - this.addSlotToContainer(new Slot(inventoryPlayer, i, 8 + (i * 18), 142)); - } - } - - @Override - public boolean canInteractWith(final EntityPlayer entityplayer) { - return this.inventory.isUseableByPlayer(entityplayer); - } - - /** - * Called when a player shift-clicks on a slot. You must override this or you - * will crash when someone does that. - */ - @Override - public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int index) { - ItemStack itemstack = null; - final Slot slot = (Slot) this.inventorySlots.get(index); - - if ((slot != null) && slot.getHasStack()) { - final ItemStack itemstack1 = slot.getStack(); - itemstack = itemstack1.copy(); - - // If item is in our custom Inventory or armor slot - if (index < INV_START) { - // try to place in player inventory / action bar - if (!this.mergeItemStack(itemstack1, INV_START, HOTBAR_END + 1, true)) { - return null; - } - - slot.onSlotChange(itemstack1, itemstack); - } - // Item is in inventory / hotbar, try to place in custom inventory or armor - // slots - else {/* - - * If your inventory only stores certain instances of Items, you can implement - * shift-clicking to your inventory like this: - * - * // Check that the item is the right type if (itemstack1.getItem() instanceof - * ItemCustom) { // Try to merge into your custom inventory slots // We use - * 'BaseInventoryBackpack.INV_SIZE' instead of INV_START just in case // you - * also add armor or other custom slots if (!this.mergeItemStack(itemstack1, 0, - * BaseInventoryBackpack.INV_SIZE, false)) { return null; } } // If you added - * armor slots, check them here as well: // Item being shift-clicked is armor - - * try to put in armor slot if (itemstack1.getItem() instanceof ItemArmor) { int - * type = ((ItemArmor) itemstack1.getItem()).armorType; if - * (!this.mergeItemStack(itemstack1, ARMOR_START + type, ARMOR_START + type + 1, - * false)) { return null; } } Otherwise, you have basically 2 choices: 1. - * shift-clicking between player inventory and custom inventory 2. - * shift-clicking between action bar and inventory - * - * Be sure to choose only ONE of the following implementations!!! - - *//** - * Implementation number 1: Shift-click into your custom inventory - *//* - if (index >= INV_START) { - // place in custom inventory - if (!this.mergeItemStack(itemstack1, 0, INV_START, false)) { - return null; - } - } - - *//** - * Implementation number 2: Shift-click items between action bar and inventory - *//* - // item is in player's inventory, but not in action bar - if ((index >= INV_START) && (index < HOTBAR_START)) { - // place in action bar - if (!this.mergeItemStack(itemstack1, HOTBAR_START, HOTBAR_END + 1, false)) { - return null; - } - } - // item in action bar - place in player inventory - else if ((index >= HOTBAR_START) && (index < (HOTBAR_END + 1))) { - if (!this.mergeItemStack(itemstack1, INV_START, INV_END + 1, false)) { - return null; - } - } - */} - - if (itemstack1.stackSize == 0) { - slot.putStack((ItemStack) null); - } else { - slot.onSlotChanged(); - } - - if (itemstack1.stackSize == itemstack.stackSize) { - return null; - } - - slot.onPickupFromSlot(par1EntityPlayer, itemstack1); - } - - return itemstack; - } - - /** - * You should override this method to prevent the player from moving the stack - * that opened the inventory, otherwise if the player moves it, the inventory - * will not be able to save properly - */ - @Override - public ItemStack slotClick(final int slot, final int button, final int flag, final EntityPlayer player) { - // this will prevent the player from interacting with the item that opened the - // inventory: - if ((slot >= 0) && (this.getSlot(slot) != null) && (this.getSlot(slot).getStack() == player.getHeldItem())) { - return null; - } - return super.slotClick(slot, button, flag, player); - } -} diff --git a/src/Java/gtPlusPlus/core/container/Container_HeliumGenerator.java b/src/Java/gtPlusPlus/core/container/Container_HeliumGenerator.java deleted file mode 100644 index 39e07f2f0e..0000000000 --- a/src/Java/gtPlusPlus/core/container/Container_HeliumGenerator.java +++ /dev/null @@ -1,193 +0,0 @@ -package gtPlusPlus.core.container; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.InventoryHeliumGenerator; -import gtPlusPlus.core.slots.SlotFuelRod; -import gtPlusPlus.core.slots.SlotNoInput; -import gtPlusPlus.core.tileentities.general.TileEntityHeliumGenerator; - -public class Container_HeliumGenerator extends Container { - - protected TileEntityHeliumGenerator tile_entity; - public final InventoryHeliumGenerator inventoryChest; - - private final World worldObj; - private final int posX; - private final int posY; - private final int posZ; - - - public static int StorageSlotNumber = 19; //Number of slots in storage area - public static int InventorySlotNumber = 36; //Inventory Slots (Inventory and Hotbar) - public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; //All slots - - //0 Is output, 1-18 are input. - private final int[] slotStorage = new int[19]; - - public Container_HeliumGenerator(final InventoryPlayer inventory, final TileEntityHeliumGenerator te){ - this.tile_entity = te; - this.inventoryChest = te.getInventory(); - - int var6; - int var7; - this.worldObj = te.getWorldObj(); - this.posX = te.xCoord; - this.posY = te.yCoord; - this.posZ = te.zCoord; - - int o=0; - - //Output - this.addSlotToContainer(new SlotNoInput(this.inventoryChest, 0, 80, 53)); - this.slotStorage[o] = o; - o++; - - //Side A - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 3; ++var7) - { - Logger.INFO("Adding slots at var:"+(o)+" x:"+(8 + var7 * 18)+" y:"+(9 + var6 * 18)); - this.addSlotToContainer(new SlotFuelRod(this.inventoryChest, o, 8 + (var7 * 18), 18 + (var6 * 18))); - this.slotStorage[o] = o; - o++; - } - } - - //Side B - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 3; ++var7) - { - Logger.INFO("Adding slots at var:"+(o)+" x:"+(90+8+(var7 * 18))+" y:"+(9 + var6 * 18)); - this.addSlotToContainer(new SlotFuelRod(this.inventoryChest, o, 116 + (var7 * 18), 18 + (var6 * 18))); - this.slotStorage[o] = o; - o++; - } - } - - o=0; - - //Player Inventory - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 9; ++var7) - { - this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); - } - } - - //Player Hotbar - for (var6 = 0; var6 < 9; ++var6) - { - this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); - } - - } - - @Override - public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer){ - - if (!aPlayer.worldObj.isRemote){ - if ((aSlotIndex == 999) || (aSlotIndex == -999)){ - //Utils.LOG_WARNING("??? - "+aSlotIndex); - } - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - - - - - @Override - public void onContainerClosed(final EntityPlayer par1EntityPlayer){ - super.onContainerClosed(par1EntityPlayer); - } - - - @Override - public boolean canInteractWith(final EntityPlayer par1EntityPlayer){ - if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockHeliumGenerator){ - return false; - } - - return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; - } - - - @Override - public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) - { - ItemStack var3 = null; - final Slot var4 = (Slot)this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) - { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - /*if (par2 == 0) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) - { - return null; - } - - var4.onSlotChange(var5, var3); - } - else if (par2 >= InOutputSlotNumber && par2 < InventoryOutSlotNumber) - { - if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) - { - return null; - } - } - else if (par2 >= InventoryOutSlotNumber && par2 < FullSlotNumber) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, InventoryOutSlotNumber, false)) - { - return null; - } - } - else if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false)) - { - return null; - }*/ - - if (var5.stackSize == 0) - { - var4.putStack((ItemStack)null); - } - else - { - var4.onSlotChanged(); - } - - if (var5.stackSize == var3.stackSize) - { - return null; - } - - var4.onPickupFromSlot(par1EntityPlayer, var5); - } - - return var3; - } - - //Can merge Slot - @Override - public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) { - return super.func_94530_a(p_94530_1_, p_94530_2_); - } - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_ModularityTable.java b/src/Java/gtPlusPlus/core/container/Container_ModularityTable.java deleted file mode 100644 index e0fb51fe61..0000000000 --- a/src/Java/gtPlusPlus/core/container/Container_ModularityTable.java +++ /dev/null @@ -1,252 +0,0 @@ -package gtPlusPlus.core.container; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.modulartable.InventoryModularMain; -import gtPlusPlus.core.inventories.modulartable.InventoryModularOutput; -import gtPlusPlus.core.slots.SlotModularBauble; -import gtPlusPlus.core.slots.SlotModularBaubleUpgrades; -import gtPlusPlus.core.slots.SlotNoInput; -import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; - -public class Container_ModularityTable extends Container { - - /** The crafting matrix inventory (3x3). */ - - protected TileEntityModularityTable tile_entity; - public final InventoryModularMain inventoryGrid; - public final InventoryModularOutput inventoryOutputs; - public int mRecipeTime; - - private final World worldObj; - private final int posX; - private final int posY; - private final int posZ; - - private final int[] slotOutputs = new int[3]; - private final int[] slotGrid = new int[9]; - - - public Container_ModularityTable(final InventoryPlayer inventory, final TileEntityModularityTable tile){ - this.tile_entity = tile; - this.inventoryGrid = tile.inventoryGrid; - this.inventoryOutputs = tile.inventoryOutputs; - this.tile_entity.setContainer(this); - this.mRecipeTime = this.tile_entity.getRecipeTime(); - Logger.INFO("Container: "+this.mRecipeTime); - - int var6; - int var7; - this.worldObj = tile.getWorldObj(); - this.posX = tile.xCoord; - this.posY = tile.yCoord; - this.posZ = tile.zCoord; - - int nextFreeSlot = 0; - - - //Output slots - this.addSlotToContainer(new SlotModularBauble(this.inventoryOutputs, 0, 26+(18*6), 8)); - this.addSlotToContainer(new SlotModularBaubleUpgrades(this.inventoryOutputs, 1, 26+(18*5), 8)); - this.addSlotToContainer(new SlotNoInput(this.inventoryOutputs, 2, 26+(18*6), 44)); - - int o = 0; - - //Storage Side - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 3; ++var7) - { - //Utils.LOG_WARNING("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * 18)); - this.addSlotToContainer(new SlotModularBaubleUpgrades(this.inventoryGrid, nextFreeSlot, 8+18 + (var7 * 18), 17 + (var6 * 18))); - this.slotGrid[o] = nextFreeSlot; - nextFreeSlot++; - o++; - } - } - - //Player Inventory - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 9; ++var7) - { - this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); - } - } - - //Player Hotbar - for (var6 = 0; var6 < 9; ++var6) - { - this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); - } - - //this.onCraftMatrixChanged(this.craftMatrix); - - } - - /** - * Callback for when the crafting matrix is changed. - */ - /* public void onCraftMatrixChanged(IInventory p_75130_1_) - { - this.craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj)); - }*/ - - /** - * Called when the container is closed. - */ - @Override - public void onContainerClosed(EntityPlayer p_75134_1_){ - super.onContainerClosed(p_75134_1_); - if (!this.worldObj.isRemote){ - /* for (int i = 0; i < 9; ++i){ - ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i); - if (itemstack != null){ - p_75134_1_.dropPlayerItemWithRandomChoice(itemstack, false); - } - }*/ - } - } - - public TileEntityModularityTable getTileentityViaContainer(){ - if (this.tile_entity != null){ - return this.tile_entity; - } - return null; - } - - @Override - public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer){ - - if (!aPlayer.worldObj.isRemote){ - if ((aSlotIndex == 999) || (aSlotIndex == -999)){ - //Utils.LOG_WARNING("??? - "+aSlotIndex); - } - - if (aSlotIndex == 0){ - Logger.INFO("Player Clicked on the bauble slot"); - //TODO - } - else if (aSlotIndex == 1){ - Logger.INFO("Player Clicked on the upgrade slot"); - //TODO - } - else if (aSlotIndex == 2){ - Logger.INFO("Player Clicked on the output slot"); - //TODO - } - else { - for (final int x : this.slotGrid){ - if (aSlotIndex == x){ - Logger.INFO("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); - } - } - } - } - //Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Grid"); - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public boolean canInteractWith(final EntityPlayer par1EntityPlayer){ - if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockModularTable){ - return false; - } - - return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; - } - - - @Override - public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) - { - - return null; - - /*ItemStack var3 = null; - final Slot var4 = (Slot)this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) - { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - if (par2 == 0) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) - { - return null; - } - - var4.onSlotChange(var5, var3); - } - else if ((par2 >= InOutputSlotNumber) && (par2 < InventoryOutSlotNumber)) - { - if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) - { - return null; - } - } - else if ((par2 >= InventoryOutSlotNumber) && (par2 < FullSlotNumber)) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, InventoryOutSlotNumber, false)) - { - return null; - } - } - else if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false)) - { - return null; - } - - if (var5.stackSize == 0) - { - var4.putStack((ItemStack)null); - } - else - { - var4.onSlotChanged(); - } - - if (var5.stackSize == var3.stackSize) - { - return null; - } - - var4.onPickupFromSlot(par1EntityPlayer, var5); - } - - return var3;*/ - } - - //Can merge Slot - /*public boolean func_94530_a(ItemStack p_94530_1_, Slot p_94530_2_){ - return p_94530_2_.inventory != this.craftResult && super.func_94530_a(p_94530_1_, p_94530_2_); - }*/ - - /*public ItemStack getOutputContent(){ - ItemStack output = this.craftResult.getStackInSlot(0); - if (output != null){ - return output; - } - return null; - } - - public ItemStack[] getInputComponents(){ - ItemStack inputs[] = new ItemStack[9]; - for (int r=0;r<this.craftMatrix.getSizeInventory();r++){ - ItemStack temp = this.craftMatrix.getStackInSlot(r); - inputs[r] = temp; - } - return inputs; - }*/ - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_PestKiller.java b/src/Java/gtPlusPlus/core/container/Container_PestKiller.java deleted file mode 100644 index 2f25c5aace..0000000000 --- a/src/Java/gtPlusPlus/core/container/Container_PestKiller.java +++ /dev/null @@ -1,154 +0,0 @@ -package gtPlusPlus.core.container; - -import gregtech.api.gui.GT_Slot_Render; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.InventoryPestKiller; -import gtPlusPlus.core.slots.SlotGeneric; -import gtPlusPlus.core.slots.SlotNoInput; -import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.fluids.FluidStack; - -public class Container_PestKiller extends Container { - - public TileEntityPestKiller tile_entity; - public final InventoryPestKiller inventoryChest; - - private final World worldObj; - private final int posX; - private final int posY; - private final int posZ; - - public static int StorageSlotNumber = 3; // Number of slots in storage area - public static int InventorySlotNumber = 36; // Inventory Slots (Inventory - // and Hotbar) - public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All - // slots - - public Container_PestKiller(final InventoryPlayer inventory, final TileEntityPestKiller te) { - this.tile_entity = te; - this.inventoryChest = te.getInventory(); - te.openInventory(); - int var6; - int var7; - this.worldObj = te.getWorldObj(); - this.posX = te.xCoord; - this.posY = te.yCoord; - this.posZ = te.zCoord; - int o = 0; - - int aSlotX = 134; - - this.addSlotToContainer(new SlotGeneric(this.inventoryChest, o++, aSlotX, 10)); - this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, aSlotX, 60)); - addSlotToContainer(new GT_Slot_Render(tile_entity, o++, aSlotX, 35)); - - // Player Inventory - for (var6 = 0; var6 < 3; ++var6) { - for (var7 = 0; var7 < 9; ++var7) { - this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); - } - } - - // Player Hotbar - for (var6 = 0; var6 < 9; ++var6) { - this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); - } - - } - - public FluidStack getFluidOfStoredTank() { - if (tile_entity != null) { - if (tile_entity.getTank() != null) { - return tile_entity.getTank().getFluid(); - } - } - return null; - } - - public int getFluidStoredAmount() { - FluidStack f = getFluidOfStoredTank(); - return f == null ? 0 : f.amount; - } - - @Override - public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer) { - boolean fluid = false; - if (aSlotIndex == 2) { - fluid = true; - } - if (!fluid) { - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - else { - return null; - } - } - - @Override - public void onContainerClosed(final EntityPlayer par1EntityPlayer) { - super.onContainerClosed(par1EntityPlayer); - tile_entity.closeInventory(); - } - - @Override - public boolean canInteractWith(final EntityPlayer par1EntityPlayer) { - if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockPestKiller) { - return false; - } - return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; - } - - @Override - public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) { - ItemStack var3 = null; - final Slot var4 = (Slot) this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - /* - * if (par2 == 0) { if (!this.mergeItemStack(var5, - * InOutputSlotNumber, FullSlotNumber, true)) { return null; } - * - * var4.onSlotChange(var5, var3); } else if (par2 >= - * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if - * (!this.mergeItemStack(var5, InventoryOutSlotNumber, - * FullSlotNumber, false)) { return null; } } else if (par2 >= - * InventoryOutSlotNumber && par2 < FullSlotNumber) { if - * (!this.mergeItemStack(var5, InOutputSlotNumber, - * InventoryOutSlotNumber, false)) { return null; } } else if - * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, - * false)) { return null; } - */ - - if (var5.stackSize == 0) { - var4.putStack((ItemStack) null); - } else { - var4.onSlotChanged(); - } - - if (var5.stackSize == var3.stackSize) { - return null; - } - - var4.onPickupFromSlot(par1EntityPlayer, var5); - } - - return var3; - } - - // Can merge Slot - @Override - public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) { - return super.func_94530_a(p_94530_1_, p_94530_2_); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_ProjectTable.java b/src/Java/gtPlusPlus/core/container/Container_ProjectTable.java deleted file mode 100644 index 2cdf7ee783..0000000000 --- a/src/Java/gtPlusPlus/core/container/Container_ProjectTable.java +++ /dev/null @@ -1,242 +0,0 @@ -package gtPlusPlus.core.container; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.*; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.projecttable.InventoryProjectMain; -import gtPlusPlus.core.inventories.projecttable.InventoryProjectOutput; -import gtPlusPlus.core.slots.SlotCraftingNoCollect; -import gtPlusPlus.core.slots.SlotDataStick; -import gtPlusPlus.core.slots.SlotNoInput; -import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; - -public class Container_ProjectTable extends Container { - - /** The crafting matrix inventory (3x3). */ - public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); - public IInventory craftResult = new InventoryCraftResult(); - - protected TileEntityProjectTable tile_entity; - public final InventoryProjectMain inventoryGrid; - public final InventoryProjectOutput inventoryOutputs; - - private final World worldObj; - private final int posX; - private final int posY; - private final int posZ; - - private final int[] slotOutputs = new int[2]; - private final int[] slotGrid = new int[9]; - - - public Container_ProjectTable(final InventoryPlayer inventory, final TileEntityProjectTable tile){ - this.tile_entity = tile; - this.inventoryGrid = tile.inventoryGrid; - this.inventoryOutputs = tile.inventoryOutputs; - this.tile_entity.setContainer(this); - - int var6; - int var7; - this.worldObj = tile.getWorldObj(); - this.posX = tile.xCoord; - this.posY = tile.yCoord; - this.posZ = tile.zCoord; - - int nextFreeSlot = 0; - - - //Output slots - this.addSlotToContainer(new SlotDataStick(this.inventoryOutputs, 0, 26+(18*6), 8)); - this.addSlotToContainer(new SlotNoInput(this.inventoryOutputs, 1, 26+(18*6), 44)); - - this.addSlotToContainer(new SlotCraftingNoCollect(inventory.player, this.craftMatrix, this.craftResult, 0, 26+(18*4), 25)); - - - int o = 0; - //Storage Side - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 3; ++var7) - { - //Utils.LOG_WARNING("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * 18)); - this.addSlotToContainer(new Slot(this.craftMatrix, nextFreeSlot, 8+18 + (var7 * 18), 8 + (var6 * 18))); - this.slotGrid[o] = nextFreeSlot; - nextFreeSlot++; - o++; - } - } - - - //Player Inventory - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 9; ++var7) - { - this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); - } - } - - //Player Hotbar - for (var6 = 0; var6 < 9; ++var6) - { - this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); - } - - this.onCraftMatrixChanged(this.craftMatrix); - - } - - /** - * Callback for when the crafting matrix is changed. - */ - @Override - public void onCraftMatrixChanged(IInventory p_75130_1_) - { - this.craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj)); - } - - /** - * Called when the container is closed. - */ - @Override - public void onContainerClosed(EntityPlayer p_75134_1_){ - super.onContainerClosed(p_75134_1_); - if (!this.worldObj.isRemote){ - for (int i = 0; i < 9; ++i){ - ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i); - if (itemstack != null){ - p_75134_1_.dropPlayerItemWithRandomChoice(itemstack, false); - } - } - } - } - - @Override - public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer){ - - if (!aPlayer.worldObj.isRemote){ - if ((aSlotIndex == 999) || (aSlotIndex == -999)){ - //Utils.LOG_WARNING("??? - "+aSlotIndex); - } - - if (aSlotIndex == 0){ - Logger.INFO("Player Clicked on the Data Stick slot"); - //TODO - }if (aSlotIndex == 1){ - Logger.INFO("Player Clicked on the output slot"); - //TODO - } - - for (final int x : this.slotGrid){ - if (aSlotIndex == x){ - Logger.INFO("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); - } - } - } - //Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Grid"); - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public boolean canInteractWith(final EntityPlayer par1EntityPlayer){ - if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockProjectTable){ - return false; - } - - return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; - } - - - @Override - public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) - { - - return null; - - /*ItemStack var3 = null; - final Slot var4 = (Slot)this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) - { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - if (par2 == 0) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) - { - return null; - } - - var4.onSlotChange(var5, var3); - } - else if ((par2 >= InOutputSlotNumber) && (par2 < InventoryOutSlotNumber)) - { - if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) - { - return null; - } - } - else if ((par2 >= InventoryOutSlotNumber) && (par2 < FullSlotNumber)) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, InventoryOutSlotNumber, false)) - { - return null; - } - } - else if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false)) - { - return null; - } - - if (var5.stackSize == 0) - { - var4.putStack((ItemStack)null); - } - else - { - var4.onSlotChanged(); - } - - if (var5.stackSize == var3.stackSize) - { - return null; - } - - var4.onPickupFromSlot(par1EntityPlayer, var5); - } - - return var3;*/ - } - - //Can merge Slot - @Override - public boolean func_94530_a(ItemStack p_94530_1_, Slot p_94530_2_){ - return p_94530_2_.inventory != this.craftResult && super.func_94530_a(p_94530_1_, p_94530_2_); - } - - public ItemStack getOutputContent(){ - ItemStack output = this.craftResult.getStackInSlot(0); - if (output != null){ - return output; - } - return null; - } - - public ItemStack[] getInputComponents(){ - ItemStack inputs[] = new ItemStack[9]; - for (int r=0;r<this.craftMatrix.getSizeInventory();r++){ - ItemStack temp = this.craftMatrix.getStackInSlot(r); - inputs[r] = temp; - } - return inputs; - } - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_RoundRobinator.java b/src/Java/gtPlusPlus/core/container/Container_RoundRobinator.java deleted file mode 100644 index cbd08c2cca..0000000000 --- a/src/Java/gtPlusPlus/core/container/Container_RoundRobinator.java +++ /dev/null @@ -1,246 +0,0 @@ -package gtPlusPlus.core.container; - -import java.util.Iterator; - -import org.apache.commons.lang3.ArrayUtils; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.GT_Values; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.Inventory_RoundRobinator; -import gtPlusPlus.core.slots.SlotNoInput; -import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public class Container_RoundRobinator extends Container { - - public TileEntityRoundRobinator tile_entity; - public final Inventory_RoundRobinator inventoryChest; - - private final World worldObj; - private final int posX; - private final int posY; - private final int posZ; - - private final boolean[] mActiveData = new boolean[] {false, false, false, false}; - - public static int mStorageSlotNumber = 4; // Number of slots in storage area - public static int mInventorySlotNumber = 36; // Inventory Slots (Inventory - // and Hotbar) - public static int mFullSlotNumber = mInventorySlotNumber + mStorageSlotNumber; // All - // slots - - public Container_RoundRobinator(final InventoryPlayer inventory, final TileEntityRoundRobinator te) { - this.tile_entity = te; - this.inventoryChest = te.getInventory(); - boolean [] aTemp = te.getActiveSides(); - if (aTemp != null && aTemp.length == 4) { - for (int i=0;i<4;i++) { - mActiveData[i] = aTemp[i]; - } - } - - int var6; - int var7; - this.worldObj = te.getWorldObj(); - this.posX = te.xCoord; - this.posY = te.yCoord; - this.posZ = te.zCoord; - - int o = 0; - int xStart = 134; - int yStart = 32; - - try { - //0 - this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart, yStart)); - this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart+18, yStart)); - this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart, yStart+17)); - this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart+18, yStart+17)); - - // Player Inventory - for (var6 = 0; var6 < 3; ++var6) { - for (var7 = 0; var7 < 9; ++var7) { - this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); - } - } - // Player Hotbar - for (var6 = 0; var6 < 9; ++var6) { - this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); - } - } - catch (Throwable t) { - t.printStackTrace(); - } - this.detectAndSendChanges(); - - } - - @Override - public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, - final EntityPlayer aPlayer) { - - if (!aPlayer.worldObj.isRemote) { - if (aSlotIndex < 4) { - this.tile_entity.toggleSide(aSlotIndex+2); - //Logger.INFO("Toggling side: "+(aSlotIndex+2)+" | Active: "+this.tile_entity.getSideActive(aSlotIndex+2)+" | Data:"+this.tile_entity.getDataString()); - } - } - return GT_Values.NI; - //return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public void onContainerClosed(final EntityPlayer par1EntityPlayer) { - super.onContainerClosed(par1EntityPlayer); - } - - @Override - public boolean canInteractWith(final EntityPlayer par1EntityPlayer) { - if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockRoundRobinator) { - return false; - } - - return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; - } - - - - public final void addCraftingToCrafters(ICrafting par1ICrafting) { - try { - super.addCraftingToCrafters(par1ICrafting); - } catch (Throwable var3) { - var3.printStackTrace(); - } - } - - public final void removeCraftingFromCrafters(ICrafting par1ICrafting) { - try { - super.removeCraftingFromCrafters(par1ICrafting); - } catch (Throwable var3) { - var3.printStackTrace(); - } - } - - public final void detectAndSendChanges() { - try { - super.detectAndSendChanges(); - detectAndSendChangesEx(); - } catch (Throwable var2) { - var2.printStackTrace(); - } - } - - public final void updateProgressBar(int par1, int par2) { - try { - super.updateProgressBar(par1, par2); - updateProgressBarEx(par1, par2); - } catch (Throwable var4) { - var4.printStackTrace(); - } - } - - - public int mSide_1 = 0; - public int mSide_2 = 0; - public int mSide_3 = 0; - public int mSide_4 = 0; - public int mTier = 1; - public int mTickRate = 50; - - private int oSide_1 = 0; - private int oSide_2 = 0; - private int oSide_3 = 0; - private int oSide_4 = 0; - private int oTier = 1; - private int oTickRate = 50; - - private int mTimer = 0; - - - - public void detectAndSendChangesEx() { - super.detectAndSendChanges(); - if (!this.tile_entity.getWorldObj().isRemote) { - boolean [] aTemp = tile_entity.getActiveSides(); - for (int i=0;i<4;i++) { - mActiveData[i] = aTemp[i]; - } - this.mSide_1 = aTemp[0] ? 1 : 0; - this.mSide_2 = aTemp[1] ? 1 : 0; - this.mSide_3 = aTemp[2] ? 1 : 0; - this.mSide_4 = aTemp[3] ? 1 : 0; - this.mTier = this.tile_entity.getTier(); - this.mTickRate = this.tile_entity.getTickRate(); - ++this.mTimer; - Iterator var2 = this.crafters.iterator(); - - while (true) { - ICrafting var1; - do { - if (!var2.hasNext()) { - this.oSide_1 = this.mSide_1; - this.oSide_2 = this.mSide_2; - this.oSide_3 = this.mSide_3; - this.oSide_4 = this.mSide_4; - this.oTier = this.mTier; - this.oTickRate = this.mTickRate; - return; - } - var1 = (ICrafting) var2.next(); - if (this.mTimer % 500 == 10 || this.oSide_1 != this.mSide_1) { - var1.sendProgressBarUpdate(this, 2, this.mSide_1); - } - if (this.mTimer % 500 == 10 || this.oSide_2 != this.mSide_2) { - var1.sendProgressBarUpdate(this, 4, this.mSide_2); - } - if (this.mTimer % 500 == 10 || this.oSide_3 != this.mSide_3) { - var1.sendProgressBarUpdate(this, 6, this.mSide_3); - } - if (this.mTimer % 500 == 10 || this.oSide_4 != this.mSide_4) { - var1.sendProgressBarUpdate(this, 8, this.mSide_4); - } - if (this.mTimer % 500 == 10 || this.oTier != this.mTier) { - var1.sendProgressBarUpdate(this, 10, this.mTier); - } - if (this.mTimer % 500 == 10 || this.oTickRate != this.mTickRate) { - var1.sendProgressBarUpdate(this, 12, this.mTickRate); - } - } while (this.mTimer % 500 != 10); - - } - } - } - - @SideOnly(Side.CLIENT) - public void updateProgressBarEx(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 2 : - this.mSide_1 = par2; - break; - case 4 : - this.mSide_2 = par2; - break; - case 6 : - this.mSide_3 = par2; - case 8 : - this.mSide_4 = par2; - case 10 : - this.mTier = par2; - case 12 : - this.mTickRate = par2; - break; - } - - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java b/src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java deleted file mode 100644 index f9bf617e1b..0000000000 --- a/src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java +++ /dev/null @@ -1,251 +0,0 @@ -package gtPlusPlus.core.container; - -import java.util.Iterator; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox; -import gtPlusPlus.core.inventories.Inventory_SuperJukebox; -import gtPlusPlus.core.slots.SlotIntegratedCircuit; -import gtPlusPlus.core.slots.SlotJukebox; -import gtPlusPlus.core.slots.SlotNoInput; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public class Container_SuperJukebox extends Container { - - protected TileEntitySuperJukebox tile_entity; - public final Inventory_SuperJukebox inventoryChest; - - private final World worldObj; - private final int posX; - private final int posY; - private final int posZ; - - - public static final int SLOT_HOLO_PLAY = 18; - public static final int SLOT_HOLO_LOOP = 19; - public static final int SLOT_OUTPUT = 20; - - public static int StorageSlotNumber = 26; // Number of slots in storage area - public static int InventorySlotNumber = 36; // Inventory Slots (Inventory - // and Hotbar) - public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All - // slots - - public Container_SuperJukebox(final InventoryPlayer inventory, final TileEntitySuperJukebox te) { - this.tile_entity = te; - this.inventoryChest = te.getInventory(); - - int var6; - int var7; - this.worldObj = te.getWorldObj(); - this.posX = te.xCoord; - this.posY = te.yCoord; - this.posZ = te.zCoord; - Logger.INFO("1"); - - int o = 0; - - // Storage Side - /*for (var6 = 0; var6 < 3; var6++) { - for (var7 = 0; var7 < 5; var7++) { - this.addSlotToContainer(new SlotIntegratedCircuit(o, this.inventoryChest, o, 44 + (var7 * 18), 15 + (var6 * 18))); - o++; - } - }*/ - - - int xStart = 9; - int yStart = 20; - - try { - - //Row One - for (int c = 0; c < 9; c++) { - if (c >= 3 && c < 6) { - continue; - } - this.addSlotToContainer(new SlotJukebox(this.inventoryChest, o++, xStart+(18*c), yStart)); - } - - //Row Two - for (int c = 0; c < 9; c++) { - if (c >= 3 && c < 6) { - continue; - } - this.addSlotToContainer(new SlotJukebox(this.inventoryChest, o++, xStart+(18*c), yStart+18)); - } - - //Row Two - for (int c = 0; c < 9; c++) { - if (c >= 3 && c < 6) { - continue; - } - this.addSlotToContainer(new SlotJukebox(this.inventoryChest, o++, xStart+(18*c), yStart+36)); - } - - - //Controls - int c = 4; - - //Two Control Buttons - this.addSlotToContainer(new SlotNoInput(this.inventoryChest, SLOT_HOLO_PLAY, xStart+(18*c), 12)); - this.addSlotToContainer(new SlotNoInput(this.inventoryChest, SLOT_HOLO_LOOP, xStart+(18*c), 12+(1*18))); - - //Active playing slot for visual - this.addSlotToContainer(new SlotJukebox(this.inventoryChest, SLOT_OUTPUT, xStart+(18*c), 18+(2*18), true)); - - - - - // Player Inventory - for (var6 = 0; var6 < 3; ++var6) { - for (var7 = 0; var7 < 9; ++var7) { - this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); - } - } - // Player Hotbar - for (var6 = 0; var6 < 9; ++var6) { - this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); - } - - - Logger.INFO("3"); - - } - catch (Throwable t) { - t.printStackTrace(); - } - - } - - @Override - public void onContainerClosed(final EntityPlayer par1EntityPlayer) { - super.onContainerClosed(par1EntityPlayer); - } - - @Override - public boolean canInteractWith(final EntityPlayer par1EntityPlayer) { - if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockCustomJukebox) { - return false; - } - - return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; - } - - @Override - public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) { - ItemStack var3 = null; - final Slot var4 = (Slot) this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - /* - * if (par2 == 0) { if (!this.mergeItemStack(var5, - * InOutputSlotNumber, FullSlotNumber, true)) { return null; } - * - * var4.onSlotChange(var5, var3); } else if (par2 >= - * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if - * (!this.mergeItemStack(var5, InventoryOutSlotNumber, - * FullSlotNumber, false)) { return null; } } else if (par2 >= - * InventoryOutSlotNumber && par2 < FullSlotNumber) { if - * (!this.mergeItemStack(var5, InOutputSlotNumber, - * InventoryOutSlotNumber, false)) { return null; } } else if - * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, - * false)) { return null; } - */ - - if (var5.stackSize == 0) { - var4.putStack((ItemStack) null); - } else { - var4.onSlotChanged(); - } - - if (var5.stackSize == var3.stackSize) { - return null; - } - - var4.onPickupFromSlot(par1EntityPlayer, var5); - } - - return var3; - } - - // Can merge Slot - @Override - public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) { - return super.func_94530_a(p_94530_1_, p_94530_2_); - } - - - - @Override - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (tile_entity == null || tile_entity.getWorldObj().isRemote) return null; - switch (aSlotIndex) { - case SLOT_HOLO_PLAY: - if (tile_entity == null) return null; - tile_entity.mIsPlaying = !tile_entity.mIsPlaying; - Logger.INFO("Jukebox | Playing: "+tile_entity.mIsPlaying); - tile_entity.jukeboxLogicUpdate(); - return null; - case SLOT_HOLO_LOOP: - if (tile_entity == null) return null; - tile_entity.mIsLooping = !tile_entity.mIsLooping; - Logger.INFO("Jukebox | Looping: "+tile_entity.mIsLooping); - return null; - case 20: - return null; - default: - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - } - - public boolean isPlaying; - public boolean isLooping; - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (tile_entity == null || tile_entity.getWorldObj().isRemote) return; - - isPlaying = tile_entity.mIsPlaying; - isLooping = tile_entity.mIsLooping; - - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 102, isPlaying ? 1 : 0); - var1.sendProgressBarUpdate(this, 103, isLooping ? 1 : 0); - } - } - - @Override - public void addCraftingToCrafters(ICrafting par1ICrafting) { - super.addCraftingToCrafters(par1ICrafting); - } - - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 102: - isPlaying = (par2 != 0); - break; - case 103: - isLooping = (par2 != 0); - break; - } - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_TradeTable.java b/src/Java/gtPlusPlus/core/container/Container_TradeTable.java deleted file mode 100644 index f812e384a7..0000000000 --- a/src/Java/gtPlusPlus/core/container/Container_TradeTable.java +++ /dev/null @@ -1,223 +0,0 @@ -package gtPlusPlus.core.container; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.tradetable.InventoryTradeMain; -import gtPlusPlus.core.inventories.tradetable.InventoryTradeOutput; -import gtPlusPlus.core.slots.SlotGeneric; -import gtPlusPlus.core.slots.SlotNoInput; -import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; - -public class Container_TradeTable extends Container { - - protected TileEntityTradeTable tile_entity; - public final InventoryTradeMain inventoryChest; - public final InventoryTradeOutput inventoryOutputs; - - private final World worldObj; - private final int posX; - private final int posY; - private final int posZ; - - private final int[] slotOutputs = new int[2]; - private final int[] slotGrid = new int[9]; - - - public Container_TradeTable(final InventoryPlayer inventory, final TileEntityTradeTable te){ - - this.tile_entity = te; - this.inventoryChest = te.inventoryGrid; - this.inventoryOutputs = te.inventoryOutputs; - this.tile_entity.setContainer(this); - - if (te.isServerSide()) - Logger.INFO("Container - "+te.mOwnerName); - - int var6; - int var7; - this.worldObj = te.getWorldObj(); - this.posX = te.xCoord; - this.posY = te.yCoord; - this.posZ = te.zCoord; - - int nextFreeSlot = 0; - - - //Output slots - this.addSlotToContainer(new SlotGeneric(this.inventoryOutputs, 0, 26+(18*6), 8)); - this.addSlotToContainer(new SlotNoInput(this.inventoryOutputs, 1, 26+(18*6), 44)); - - //this.addSlotToContainer(new SlotCraftingNoCollect(inventory.player, this.craftMatrix, this.craftResult, 0, 26+(18*4), 25)); - - int o = 0; - //Storage Side - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 3; ++var7) - { - //Utils.LOG_WARNING("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * 18)); - this.addSlotToContainer(new Slot(this.inventoryChest, nextFreeSlot, 8+18 + (var7 * 18), 8 + (var6 * 18))); - this.slotGrid[o] = nextFreeSlot; - nextFreeSlot++; - o++; - } - } - - //Player Inventory - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 9; ++var7) - { - this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); - } - } - - //Player Hotbar - for (var6 = 0; var6 < 9; ++var6) - { - this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); - } - - //this.onCraftMatrixChanged(this.craftMatrix); - } - - /** - * Called when the container is closed. - */ - @Override - public void onContainerClosed(EntityPlayer p_75134_1_){ - super.onContainerClosed(p_75134_1_); - if (!this.worldObj.isRemote){ - for (int i = 0; i < 9; ++i){ - ItemStack itemstack = this.inventoryChest.getStackInSlotOnClosing(i); - if (itemstack != null){ - p_75134_1_.dropPlayerItemWithRandomChoice(itemstack, false); - } - } - } - } - - @Override - public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer){ - - if (!aPlayer.worldObj.isRemote){ - if ((aSlotIndex == 999) || (aSlotIndex == -999)){ - //Utils.LOG_WARNING("??? - "+aSlotIndex); - } - - if (aSlotIndex == 0){ - Logger.INFO("Player Clicked on the Data Stick slot"); - //TODO - }if (aSlotIndex == 1){ - Logger.INFO("Player Clicked on the output slot"); - //TODO - } - - for (final int x : this.slotGrid){ - if (aSlotIndex == x){ - Logger.INFO("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); - } - } - } - //Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Grid"); - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public boolean canInteractWith(final EntityPlayer par1EntityPlayer){ - if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockTradeTable){ - return false; - } - - return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; - } - - - @Override - public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) - { - - return null; - - /*ItemStack var3 = null; - final Slot var4 = (Slot)this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) - { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - if (par2 == 0) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) - { - return null; - } - - var4.onSlotChange(var5, var3); - } - else if ((par2 >= InOutputSlotNumber) && (par2 < InventoryOutSlotNumber)) - { - if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) - { - return null; - } - } - else if ((par2 >= InventoryOutSlotNumber) && (par2 < FullSlotNumber)) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, InventoryOutSlotNumber, false)) - { - return null; - } - } - else if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false)) - { - return null; - } - - if (var5.stackSize == 0) - { - var4.putStack((ItemStack)null); - } - else - { - var4.onSlotChanged(); - } - - if (var5.stackSize == var3.stackSize) - { - return null; - } - - var4.onPickupFromSlot(par1EntityPlayer, var5); - } - - return var3;*/ - } - - public ItemStack getOutputContent(){ - ItemStack output = this.inventoryOutputs.getStackInSlot(0); - if (output != null){ - return output; - } - return null; - } - - public ItemStack[] getInputComponents(){ - ItemStack inputs[] = new ItemStack[9]; - for (int r=0;r<this.inventoryChest.getSizeInventory();r++){ - ItemStack temp = this.inventoryChest.getStackInSlot(r); - inputs[r] = temp; - } - return inputs; - } - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java b/src/Java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java deleted file mode 100644 index de3106c957..0000000000 --- a/src/Java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java +++ /dev/null @@ -1,185 +0,0 @@ -package gtPlusPlus.core.container; - -import java.util.Iterator; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.Inventory_VolumetricFlaskSetter; -import gtPlusPlus.core.slots.SlotNoInput; -import gtPlusPlus.core.slots.SlotVolumetricFlask; -import gtPlusPlus.core.tileentities.general.TileEntityVolumetricFlaskSetter; -import gtPlusPlus.core.util.Utils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public class Container_VolumetricFlaskSetter extends Container { - - public TileEntityVolumetricFlaskSetter mTileEntity; - public final Inventory_VolumetricFlaskSetter inventoryChest; - - - public short mCustomValue; - private short oCustomValue; - private int mTimer; - - - private final World worldObj; - private final int posX; - private final int posY; - private final int posZ; - - public static final int SLOT_OUTPUT = 8; - - public static int StorageSlotNumber = 8; // Number of slots in storage area - public static int InventorySlotNumber = 36; // Inventory Slots (Inventory - // and Hotbar) - public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All - // slots - - public Container_VolumetricFlaskSetter(final InventoryPlayer inventory, final TileEntityVolumetricFlaskSetter te) { - this.mTileEntity = te; - this.inventoryChest = te.getInventory(); - - int var6; - int var7; - this.worldObj = te.getWorldObj(); - this.posX = te.xCoord; - this.posY = te.yCoord; - this.posZ = te.zCoord; - //mCustomValue = te.getCustomValue(); - - int o = 0; - - // Storage Side - /*for (var6 = 0; var6 < 3; var6++) { - for (var7 = 0; var7 < 5; var7++) { - this.addSlotToContainer(new SlotIntegratedCircuit(o, this.inventoryChest, o, 44 + (var7 * 18), 15 + (var6 * 18))); - o++; - } - }*/ - - - int xStart = 26; - int yStart = 12; - - try { - //0 - this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart, yStart)); - this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart+=18, yStart)); - this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart+=18, yStart)); - this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart+=18, yStart)); - this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart+=18, yStart)); - this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart+=18, yStart)); - this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart+=18, yStart)); - this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart, yStart+18)); - - //Add Output - this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, 8+(8*18), 59)); - o++; - - - - // Player Inventory - for (var6 = 0; var6 < 3; ++var6) { - for (var7 = 0; var7 < 9; ++var7) { - this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); - } - } - // Player Hotbar - for (var6 = 0; var6 < 9; ++var6) { - this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); - } - detectAndSendChanges(); - } - catch (Throwable t) {} - - } - - - @Override - public boolean canInteractWith(final EntityPlayer par1EntityPlayer) { - if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockVolumetricFlaskSetter) { - return false; - } - return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; - } - - @Override - public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) { - ItemStack var3 = null; - final Slot var4 = (Slot) this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - /* - * if (par2 == 0) { if (!this.mergeItemStack(var5, - * InOutputSlotNumber, FullSlotNumber, true)) { return null; } - * - * var4.onSlotChange(var5, var3); } else if (par2 >= - * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if - * (!this.mergeItemStack(var5, InventoryOutSlotNumber, - * FullSlotNumber, false)) { return null; } } else if (par2 >= - * InventoryOutSlotNumber && par2 < FullSlotNumber) { if - * (!this.mergeItemStack(var5, InOutputSlotNumber, - * InventoryOutSlotNumber, false)) { return null; } } else if - * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, - * false)) { return null; } - */ - - if (var5.stackSize == 0) { - var4.putStack((ItemStack) null); - } else { - var4.onSlotChanged(); - } - - if (var5.stackSize == var3.stackSize) { - return null; - } - - var4.onPickupFromSlot(par1EntityPlayer, var5); - } - - return var3; - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if ((Utils.isClient()) || (this.mTileEntity == null)) { - return; - } - - mCustomValue = mTileEntity.getCustomValue(); - mTimer++; - - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - if (mTimer % 20 == 10 || oCustomValue != mCustomValue) { - var1.sendProgressBarUpdate(this, 0, mCustomValue); - } - } - - oCustomValue = mCustomValue; - } - - @SideOnly(Side.CLIENT) - @Override - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 0: - mCustomValue = (short) par2; - break; - } - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_Workbench.java b/src/Java/gtPlusPlus/core/container/Container_Workbench.java deleted file mode 100644 index 55ef1a3d0c..0000000000 --- a/src/Java/gtPlusPlus/core/container/Container_Workbench.java +++ /dev/null @@ -1,413 +0,0 @@ -package gtPlusPlus.core.container; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.*; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.world.World; - -import gregtech.api.gui.GT_Slot_Holo; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.interfaces.IItemBlueprint; -import gtPlusPlus.core.inventories.InventoryWorkbenchChest; -import gtPlusPlus.core.inventories.InventoryWorkbenchHoloSlots; -import gtPlusPlus.core.inventories.InventoryWorkbenchTools; -import gtPlusPlus.core.item.general.ItemBlueprint; -import gtPlusPlus.core.slots.*; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class Container_Workbench extends Container { - - protected TileEntityWorkbench tile_entity; - public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); - public final InventoryWorkbenchChest inventoryChest; - public final InventoryWorkbenchTools inventoryTool; - public final InventoryWorkbenchHoloSlots inventoryHolo; - //public final InventoryWorkbenchHoloCrafting inventoryCrafting; - - private final World worldObj; - private final int posX; - private final int posY; - private final int posZ; - - public static int HoloSlotNumber = 6; - public static int InputSlotNumber = 0; //Number of Slots in the Crafting Grid - public static int StorageSlotNumber = 16; //Number of slots in storage area - public static int ToolSlotNumber = 5; // Number of slots in the tool area up top - public static int InOutputSlotNumber = InputSlotNumber + StorageSlotNumber + ToolSlotNumber + HoloSlotNumber; //Same plus Output Slot - public static int InventorySlotNumber = 36; //Inventory Slots (Inventory and Hotbar) - public static int InventoryOutSlotNumber = InventorySlotNumber + 1; //Inventory Slot Number + Output - public static int FullSlotNumber = InventorySlotNumber + InOutputSlotNumber; //All slots - - private final int slotOutput = 0; - private final int[] slotHolo = new int[5]; - private final int[] slotCrafting = new int[9]; - private final int[] slotStorage = new int[16]; - private final int[] slotTools = new int[5]; - - public void moveCraftingToChest(){ - //Check Chest Space - for (int i=0;i<9;i++){ - if (this.craftMatrix.getStackInSlot(i) != null){ - for (int r=0;r<16;r++){ - if ((this.inventoryChest.getStackInSlot(r) == null) || ((this.inventoryChest.getStackInSlot(r).getItem() == this.craftMatrix.getStackInSlot(i).getItem()) && ((64-this.craftMatrix.getStackInSlot(i).stackSize) <= (64-this.craftMatrix.getStackInSlot(i).stackSize)))){ - this.inventoryChest.setInventorySlotContents(r, this.craftMatrix.getStackInSlot(i)); - this.craftMatrix.setInventorySlotContents(i, null); - break; - } - } - } - } - //For Each Space or already existing itemstack, move one itemstack or fill current partial stack - //Remove old itemstack or partial stack from crafting grid - } - - public void moveChestToCrafting(){ - //Check Crafting items and slots - for (int i=0;i<9;i++){ - if ((this.craftMatrix.getStackInSlot(i) == null) || (this.craftMatrix.getStackInSlot(i).stackSize > 0)){ - for (int r=0;r<16;r++){ - if (this.inventoryChest.getStackInSlot(r) != null){ - this.craftMatrix.setInventorySlotContents(i, this.craftMatrix.getStackInSlot(r)); - this.inventoryChest.setInventorySlotContents(r, null); - } - } - } - } - //For Each already existing itemstack, fill current partial stack - //Remove partial stack from chest area - } - - - public Container_Workbench(final InventoryPlayer inventory, final TileEntityWorkbench tile){ - this.tile_entity = tile; - this.inventoryChest = tile.inventoryChest; - this.inventoryTool = tile.inventoryTool; - this.inventoryHolo = tile.inventoryHolo; - //this.inventoryCrafting = tile.inventoryCrafting; - - int var6; - int var7; - this.worldObj = tile.getWorldObj(); - this.posX = tile.xCoord; - this.posY = tile.yCoord; - this.posZ = tile.zCoord; - - int o=0; - - //Output slot - this.addSlotToContainer(new SlotOutput(inventory.player, this.craftMatrix, tile.inventoryCraftResult, 0, 136, 64)); - //Util Slots - this.addSlotToContainer(new SlotBlueprint(this.inventoryHolo, 1, 136, 28)); //Blueprint - this.addSlotToContainer(new SlotNoInput(this.inventoryHolo, 2, 154, 28)); //Hopper - this.addSlotToContainer(new GT_Slot_Holo(this.inventoryHolo, 3, 154, 64, false, false, 64)); //Parking - //Holo Slots - this.addSlotToContainer(new GT_Slot_Holo(this.inventoryHolo, 4, 154, 46, false, false, 1)); - this.addSlotToContainer(new GT_Slot_Holo(this.inventoryHolo, 5, 136, 46, false, false, 1)); - - for (int i=1; i<6; i++){ - this.slotHolo[o] = o+1; - o++; - } - - o=0; - - this.updateCraftingMatrix(); - - //Crafting Grid - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 3; ++var7) - { - //this.addSlotToContainer(new Slot(this.craftMatrix, var7 + (var6 * 3), 82 + (var7 * 18), 28 + (var6 * 18))); - - /*if (this.inventoryCrafting.getStackInSlot(o) != null){ - this.craftMatrix.setInventorySlotContents(o, inventoryCrafting.getStackInSlot(o)); - this.inventoryCrafting.setInventorySlotContents(o, null); - } */ - this.slotCrafting[o] = o+6; - o++; - } - } - - o=0; - - //Storage Side - for (var6 = 0; var6 < 4; ++var6) - { - for (var7 = 0; var7 < 4; ++var7) - { - //Utils.LOG_WARNING("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * 18)); - this.addSlotToContainer(new Slot(this.inventoryChest, var7 + (var6 * 4), 8 + (var7 * 18), 7 + (var6 * 18))); - this.slotStorage[o] = o+15; - o++; - } - } - - o=0; - - //Tool Slots - for (var6 = 0; var6 < 1; ++var6) - { - for (var7 = 0; var7 < 5; ++var7) - { - this.addSlotToContainer(new SlotGtTool(this.inventoryTool, var7 + (var6 * 3), 82 + (var7 * 18), 8 + (var6 * 18))); - this.slotTools[o] = o+31; - o++; - } - } - - //Player Inventory - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 9; ++var7) - { - this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); - } - } - - //Player Hotbar - for (var6 = 0; var6 < 9; ++var6) - { - this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); - } - - this.onCraftMatrixChanged(this.craftMatrix); - - } - - @Override - public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer){ - - if (!aPlayer.worldObj.isRemote){ - if ((aSlotIndex == 999) || (aSlotIndex == -999)){ - //Utils.LOG_WARNING("??? - "+aSlotIndex); - } - - if (aSlotIndex == this.slotOutput){ - Logger.WARNING("Player Clicked on the output slot"); - //TODO - } - - for (final int x : this.slotHolo){ - if (aSlotIndex == x){ - Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the Holo Grid"); - if (x == 1){ - Logger.WARNING("Player Clicked Blueprint slot in the Holo Grid"); - } - else if (x == 2){ - Logger.WARNING("Player Clicked Right Arrow slot in the Holo Grid"); - if (this.inventoryHolo.getStackInSlot(1) != null){ - Logger.WARNING("Found an ItemStack."); - if (this.inventoryHolo.getStackInSlot(1).getItem() instanceof IItemBlueprint){ - Logger.WARNING("Found a blueprint."); - final ItemStack tempBlueprint = this.inventoryHolo.getStackInSlot(1); - final ItemBlueprint tempItemBlueprint = (ItemBlueprint) tempBlueprint.getItem(); - if ((this.inventoryHolo.getStackInSlot(0) != null) && !tempItemBlueprint.hasBlueprint(tempBlueprint)){ - Logger.WARNING("Output slot was not empty."); - Logger.WARNING("Trying to manipulate NBT data on the blueprint stack, then replace it with the new one."); - tempItemBlueprint.setBlueprint(this.inventoryHolo.getStackInSlot(1), this.craftMatrix, this.inventoryHolo.getStackInSlot(0)); - final ItemStack newTempBlueprint = ItemUtils.getSimpleStack(tempItemBlueprint); - this.inventoryHolo.setInventorySlotContents(1, newTempBlueprint); - Logger.WARNING(ItemUtils.getArrayStackNames(tempItemBlueprint.getBlueprint(newTempBlueprint))); - } - else { - if (tempItemBlueprint.hasBlueprint(tempBlueprint)){ - Logger.WARNING("Blueprint already holds a recipe."); - } - else { - Logger.WARNING("Output slot was empty."); - } - } - } - else { - Logger.WARNING("ItemStack found was not a blueprint."); - } - } - else { - Logger.WARNING("No ItemStack found in Blueprint slot."); - } - } - else if (x == 3){ - Logger.WARNING("Player Clicked Big [P] slot in the Holo Grid"); - } - else if (x == 4){ - Logger.WARNING("Player Clicked Transfer to Crafting Grid slot in the Holo Grid"); - } - else if (x == 5){ - Logger.WARNING("Player Clicked Transfer to Storage Grid slot in the Holo Grid"); - } - } - } - - for (final int x : this.slotCrafting){ - if (aSlotIndex == x){ - Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); - } - } - for (final int x : this.slotStorage){ - if (aSlotIndex == x){ - Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the storage Grid"); - } - } - for (final int x : this.slotTools){ - if (aSlotIndex == x){ - Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the tool Grid"); - } - } - } - //Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Grid"); - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - private void updateCraftingMatrix() { - for (int i = 0; i < this.craftMatrix.getSizeInventory(); i++) { - //this.craftMatrix.setInventorySlotContents(i, this.tile_entity.inventoryCrafting.getStackInSlot(i)); - } - } - - @Override - public void onCraftMatrixChanged(final IInventory iiventory) { - this.tile_entity.inventoryCraftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj)); - } - - @Override - public void onContainerClosed(final EntityPlayer par1EntityPlayer) - { - super.onContainerClosed(par1EntityPlayer); - this.saveCraftingMatrix(); - } - - private void saveCraftingMatrix() { - for (int i = 0; i < this.craftMatrix.getSizeInventory(); i++) { - //this.tile_entity.inventoryCrafting.setInventorySlotContents(i, this.craftMatrix.getStackInSlot(i)); - } - } - - - - - /*@Override - public void onCraftMatrixChanged(IInventory par1IInventory){ - //Custom Recipe Handler - //craftResult.setInventorySlotContents(0, Workbench_CraftingHandler.getInstance().findMatchingRecipe(craftMatrix, worldObj)); - - //Vanilla CraftingManager - Utils.LOG_WARNING("checking crafting grid for a valid output."); - ItemStack temp = CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj); - if (temp != null){ - Utils.LOG_WARNING("Output found. "+temp.getDisplayName()+" x"+temp.stackSize); - craftResult.setInventorySlotContents(slotOutput, temp); - } - else { - Utils.LOG_WARNING("No Valid output found."); - craftResult.setInventorySlotContents(slotOutput, null); - } - }*/ - - /*@Override - public void onContainerClosed(EntityPlayer par1EntityPlayer) - { - for (int o=0; o<craftMatrix.getSizeInventory(); o++){ - this.inventoryCrafting.setInventorySlotContents(o, craftMatrix.getStackInSlot(o)); - this.craftMatrix.setInventorySlotContents(o, null); - }*/ - - //super.onContainerClosed(par1EntityPlayer); - - /*if (worldObj.isRemote) - { - return; - } - - for (int i = 0; i < InputSlotNumber; i++) - { - ItemStack itemstack = craftMatrix.getStackInSlotOnClosing(i); - - if (itemstack != null) - { - par1EntityPlayer.dropPlayerItemWithRandomChoice(itemstack, false); - } - }*/ - - @Override - public boolean canInteractWith(final EntityPlayer par1EntityPlayer){ - if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockWorkbench){ - return false; - } - - return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; - } - - - @Override - public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) - { - ItemStack var3 = null; - final Slot var4 = (Slot)this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) - { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - if (par2 == 0) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) - { - return null; - } - - var4.onSlotChange(var5, var3); - } - else if ((par2 >= InOutputSlotNumber) && (par2 < InventoryOutSlotNumber)) - { - if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) - { - return null; - } - } - else if ((par2 >= InventoryOutSlotNumber) && (par2 < FullSlotNumber)) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, InventoryOutSlotNumber, false)) - { - return null; - } - } - else if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false)) - { - return null; - } - - if (var5.stackSize == 0) - { - var4.putStack((ItemStack)null); - } - else - { - var4.onSlotChanged(); - } - - if (var5.stackSize == var3.stackSize) - { - return null; - } - - var4.onPickupFromSlot(par1EntityPlayer, var5); - } - - return var3; - } - - //Can merge Slot - @Override - public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) { - return (p_94530_2_.inventory != this.tile_entity.inventoryCraftResult) && super.func_94530_a(p_94530_1_, p_94530_2_); - } - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java deleted file mode 100644 index dc499c570f..0000000000 --- a/src/Java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java +++ /dev/null @@ -1,377 +0,0 @@ -package gtPlusPlus.core.container; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.*; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.world.World; - -import gregtech.api.gui.GT_Slot_Holo; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.interfaces.IItemBlueprint; -import gtPlusPlus.core.inventories.*; -import gtPlusPlus.core.item.general.ItemBlueprint; -import gtPlusPlus.core.slots.*; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class Container_WorkbenchAdvanced extends Container { - - protected TileEntityWorkbenchAdvanced tile_entity; - public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); - public final InventoryWorkbenchChest inventoryChest; - public final InventoryWorkbenchToolsElectric inventoryTool; - public final InventoryWorkbenchHoloSlots inventoryHolo; - public final InventoryWorkbenchHoloCrafting inventoryCrafting; - - private final World worldObj; - private final int posX; - private final int posY; - private final int posZ; - - public static int HoloSlotNumber = 6; - public static int InputSlotNumber = 9; //Number of Slots in the Crafting Grid - public static int StorageSlotNumber = 16; //Number of slots in storage area - public static int ToolSlotNumber = 5; // Number of slots in the tool area up top - public static int InOutputSlotNumber = InputSlotNumber + StorageSlotNumber + ToolSlotNumber + HoloSlotNumber; //Same plus Output Slot - public static int InventorySlotNumber = 36; //Inventory Slots (Inventory and Hotbar) - public static int InventoryOutSlotNumber = InventorySlotNumber + 1; //Inventory Slot Number + Output - public static int FullSlotNumber = InventorySlotNumber + InOutputSlotNumber; //All slots - - private final int slotOutput = 0; - private final int[] slotHolo = new int[5]; - private final int[] slotCrafting = new int[9]; - private final int[] slotStorage = new int[16]; - private final int[] slotTools = new int[5]; - - public Container_WorkbenchAdvanced(final InventoryPlayer inventory, final TileEntityWorkbenchAdvanced tile){ - this.tile_entity = tile; - this.inventoryChest = tile.inventoryChest; - this.inventoryTool = tile.inventoryTool; - this.inventoryHolo = tile.inventoryHolo; - this.inventoryCrafting = tile.inventoryCrafting; - - int var6; - int var7; - this.worldObj = tile.getWorldObj(); - this.posX = tile.xCoord; - this.posY = tile.yCoord; - this.posZ = tile.zCoord; - - int o=0; - - //Output slot - this.addSlotToContainer(new SlotOutput(inventory.player, this.craftMatrix, tile.inventoryCraftResult, 0, 136, 64)); - //Util Slots - this.addSlotToContainer(new SlotBlueprint(this.inventoryHolo, 1, 136, 28)); //Blueprint - this.addSlotToContainer(new SlotNoInput(this.inventoryHolo, 2, 154, 28)); //Hopper - this.addSlotToContainer(new GT_Slot_Holo(this.inventoryHolo, 3, 154, 64, false, false, 64)); //Parking - //Holo Slots - this.addSlotToContainer(new GT_Slot_Holo(this.inventoryHolo, 4, 154, 46, false, false, 1)); - this.addSlotToContainer(new GT_Slot_Holo(this.inventoryHolo, 5, 136, 46, false, false, 1)); - - for (int i=1; i<6; i++){ - this.slotHolo[o] = o+1; - o++; - } - - o=0; - - this.updateCraftingMatrix(); - - //Crafting Grid - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 3; ++var7) - { - this.addSlotToContainer(new Slot(this.craftMatrix, var7 + (var6 * 3), 82 + (var7 * 18), 28 + (var6 * 18))); - - /*if (this.inventoryCrafting.getStackInSlot(o) != null){ - this.craftMatrix.setInventorySlotContents(o, inventoryCrafting.getStackInSlot(o)); - this.inventoryCrafting.setInventorySlotContents(o, null); - } */ - this.slotCrafting[o] = o+6; - o++; - } - } - - o=0; - - //Storage Side - for (var6 = 0; var6 < 4; ++var6) - { - for (var7 = 0; var7 < 4; ++var7) - { - //Utils.LOG_WARNING("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * 18)); - this.addSlotToContainer(new Slot(this.inventoryChest, var7 + (var6 * 4), 8 + (var7 * 18), 7 + (var6 * 18))); - this.slotStorage[o] = o+15; - o++; - } - } - - o=0; - - //Tool Slots - for (var6 = 0; var6 < 1; ++var6) - { - for (var7 = 0; var7 < 5; ++var7) - { - this.addSlotToContainer(new SlotGtToolElectric(this.inventoryTool, var7 + (var6 * 3), 82 + (var7 * 18), 8 + (var6 * 18), 3, false)); - this.slotTools[o] = o+31; - o++; - } - } - - //Player Inventory - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 9; ++var7) - { - this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); - } - } - - //Player Hotbar - for (var6 = 0; var6 < 9; ++var6) - { - this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); - } - - this.onCraftMatrixChanged(this.craftMatrix); - - } - - @Override - public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer){ - - if (!aPlayer.worldObj.isRemote){ - if ((aSlotIndex == 999) || (aSlotIndex == -999)){ - //Utils.LOG_WARNING("??? - "+aSlotIndex); - } - - if (aSlotIndex == this.slotOutput){ - Logger.WARNING("Player Clicked on the output slot"); - //TODO - } - - for (final int x : this.slotHolo){ - if (aSlotIndex == x){ - Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the Holo Grid"); - if (x == 1){ - Logger.WARNING("Player Clicked Blueprint slot in the Holo Grid"); - } - else if (x == 2){ - Logger.WARNING("Player Clicked Right Arrow slot in the Holo Grid"); - if (this.inventoryHolo.getStackInSlot(1) != null){ - Logger.WARNING("Found an ItemStack."); - if (this.inventoryHolo.getStackInSlot(1).getItem() instanceof IItemBlueprint){ - Logger.WARNING("Found a blueprint."); - final ItemStack tempBlueprint = this.inventoryHolo.getStackInSlot(1); - final ItemBlueprint tempItemBlueprint = (ItemBlueprint) tempBlueprint.getItem(); - if ((this.inventoryHolo.getStackInSlot(0) != null) && !tempItemBlueprint.hasBlueprint(tempBlueprint)){ - Logger.WARNING("Output slot was not empty."); - Logger.WARNING("Trying to manipulate NBT data on the blueprint stack, then replace it with the new one."); - tempItemBlueprint.setBlueprint(this.inventoryHolo.getStackInSlot(1), this.craftMatrix, this.inventoryHolo.getStackInSlot(0)); - final ItemStack newTempBlueprint = ItemUtils.getSimpleStack(tempItemBlueprint); - this.inventoryHolo.setInventorySlotContents(1, newTempBlueprint); - Logger.WARNING(ItemUtils.getArrayStackNames(tempItemBlueprint.getBlueprint(newTempBlueprint))); - } - else { - if (tempItemBlueprint.hasBlueprint(tempBlueprint)){ - Logger.WARNING("Blueprint already holds a recipe."); - } - else { - Logger.WARNING("Output slot was empty."); - } - } - } - else { - Logger.WARNING("ItemStack found was not a blueprint."); - } - } - else { - Logger.WARNING("No ItemStack found in Blueprint slot."); - } - } - else if (x == 3){ - Logger.WARNING("Player Clicked Big [P] slot in the Holo Grid"); - } - else if (x == 4){ - Logger.WARNING("Player Clicked Transfer to Crafting Grid slot in the Holo Grid"); - } - else if (x == 5){ - Logger.WARNING("Player Clicked Transfer to Storage Grid slot in the Holo Grid"); - } - } - } - - for (final int x : this.slotCrafting){ - if (aSlotIndex == x){ - Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); - } - } - for (final int x : this.slotStorage){ - if (aSlotIndex == x){ - Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the storage Grid"); - } - } - for (final int x : this.slotTools){ - if (aSlotIndex == x){ - Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the tool Grid"); - } - } - } - //Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Grid"); - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - private void updateCraftingMatrix() { - for (int i = 0; i < this.craftMatrix.getSizeInventory(); i++) { - this.craftMatrix.setInventorySlotContents(i, this.tile_entity.inventoryCrafting.getStackInSlot(i)); - } - } - - @Override - public void onCraftMatrixChanged(final IInventory iiventory) { - this.tile_entity.inventoryCraftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj)); - } - - @Override - public void onContainerClosed(final EntityPlayer par1EntityPlayer) - { - super.onContainerClosed(par1EntityPlayer); - this.saveCraftingMatrix(); - } - - private void saveCraftingMatrix() { - for (int i = 0; i < this.craftMatrix.getSizeInventory(); i++) { - this.tile_entity.inventoryCrafting.setInventorySlotContents(i, this.craftMatrix.getStackInSlot(i)); - } - } - - - - - /*@Override - public void onCraftMatrixChanged(IInventory par1IInventory){ - //Custom Recipe Handler - //craftResult.setInventorySlotContents(0, Workbench_CraftingHandler.getInstance().findMatchingRecipe(craftMatrix, worldObj)); - - //Vanilla CraftingManager - Utils.LOG_WARNING("checking crafting grid for a valid output."); - ItemStack temp = CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj); - if (temp != null){ - Utils.LOG_WARNING("Output found. "+temp.getDisplayName()+" x"+temp.stackSize); - craftResult.setInventorySlotContents(slotOutput, temp); - } - else { - Utils.LOG_WARNING("No Valid output found."); - craftResult.setInventorySlotContents(slotOutput, null); - } - }*/ - - /*@Override - public void onContainerClosed(EntityPlayer par1EntityPlayer) - { - for (int o=0; o<craftMatrix.getSizeInventory(); o++){ - this.inventoryCrafting.setInventorySlotContents(o, craftMatrix.getStackInSlot(o)); - this.craftMatrix.setInventorySlotContents(o, null); - }*/ - - //super.onContainerClosed(par1EntityPlayer); - - /*if (worldObj.isRemote) - { - return; - } - - for (int i = 0; i < InputSlotNumber; i++) - { - ItemStack itemstack = craftMatrix.getStackInSlotOnClosing(i); - - if (itemstack != null) - { - par1EntityPlayer.dropPlayerItemWithRandomChoice(itemstack, false); - } - }*/ - - @Override - public boolean canInteractWith(final EntityPlayer par1EntityPlayer){ - if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockWorkbench){ - return false; - } - - return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; - } - - - @Override - public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) - { - ItemStack var3 = null; - final Slot var4 = (Slot)this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) - { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - if (par2 == 0) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) - { - return null; - } - - var4.onSlotChange(var5, var3); - } - else if ((par2 >= InOutputSlotNumber) && (par2 < InventoryOutSlotNumber)) - { - if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) - { - return null; - } - } - else if ((par2 >= InventoryOutSlotNumber) && (par2 < FullSlotNumber)) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, InventoryOutSlotNumber, false)) - { - return null; - } - } - else if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false)) - { - return null; - } - - if (var5.stackSize == 0) - { - var4.putStack((ItemStack)null); - } - else - { - var4.onSlotChanged(); - } - - if (var5.stackSize == var3.stackSize) - { - return null; - } - - var4.onPickupFromSlot(par1EntityPlayer, var5); - } - - return var3; - } - - //Can merge Slot - @Override - public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) { - return (p_94530_2_.inventory != this.tile_entity.inventoryCraftResult) && super.func_94530_a(p_94530_1_, p_94530_2_); - } - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/box/LunchBoxContainer.java b/src/Java/gtPlusPlus/core/container/box/LunchBoxContainer.java deleted file mode 100644 index 8e56c661f2..0000000000 --- a/src/Java/gtPlusPlus/core/container/box/LunchBoxContainer.java +++ /dev/null @@ -1,13 +0,0 @@ -package gtPlusPlus.core.container.box; - -import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; -import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory; -import gtPlusPlus.core.slots.SlotLunchBox; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; - -public class LunchBoxContainer extends ContainerBoxBase { - public LunchBoxContainer(EntityPlayer par1Player, InventoryPlayer inventoryPlayer, CustomBoxInventory CustomBoxInventory) { - super(par1Player, inventoryPlayer, CustomBoxInventory, SlotLunchBox.class, gtPlusPlus.core.item.tool.misc.box.AutoLunchBox.SLOTS); - } -} diff --git a/src/Java/gtPlusPlus/core/container/box/MagicBagContainer.java b/src/Java/gtPlusPlus/core/container/box/MagicBagContainer.java deleted file mode 100644 index 7820d56814..0000000000 --- a/src/Java/gtPlusPlus/core/container/box/MagicBagContainer.java +++ /dev/null @@ -1,13 +0,0 @@ -package gtPlusPlus.core.container.box; - -import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; -import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory; -import gtPlusPlus.core.slots.SlotMagicToolBag; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; - -public class MagicBagContainer extends ContainerBoxBase { - public MagicBagContainer(EntityPlayer par1Player, InventoryPlayer inventoryPlayer, CustomBoxInventory CustomBoxInventory) { - super(par1Player, inventoryPlayer, CustomBoxInventory, SlotMagicToolBag.class, gtPlusPlus.core.item.tool.misc.box.MagicToolBag.SLOTS); - } -} diff --git a/src/Java/gtPlusPlus/core/container/box/ToolBoxContainer.java b/src/Java/gtPlusPlus/core/container/box/ToolBoxContainer.java deleted file mode 100644 index 49719aa9ba..0000000000 --- a/src/Java/gtPlusPlus/core/container/box/ToolBoxContainer.java +++ /dev/null @@ -1,15 +0,0 @@ -package gtPlusPlus.core.container.box; - -import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; -import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory; -import gtPlusPlus.core.item.tool.misc.box.UniversalToolBox; -import gtPlusPlus.core.slots.SlotToolBox; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; - -public class ToolBoxContainer extends ContainerBoxBase { - public ToolBoxContainer(EntityPlayer par1Player, InventoryPlayer inventoryPlayer, - CustomBoxInventory CustomBoxInventory) { - super(par1Player, inventoryPlayer, CustomBoxInventory, SlotToolBox.class, UniversalToolBox.SLOTS); - } -} diff --git a/src/Java/gtPlusPlus/core/creative/AddToCreativeTab.java b/src/Java/gtPlusPlus/core/creative/AddToCreativeTab.java deleted file mode 100644 index 218bef46bd..0000000000 --- a/src/Java/gtPlusPlus/core/creative/AddToCreativeTab.java +++ /dev/null @@ -1,35 +0,0 @@ -package gtPlusPlus.core.creative; - -import net.minecraft.creativetab.CreativeTabs; -import gregtech.api.util.GT_CreativeTab; -import gtPlusPlus.core.creative.tabs.*; -import gtPlusPlus.xmod.bop.creative.MiscUtilsBOPTab; - -public class AddToCreativeTab { - - public static CreativeTabs tabBlock; - public static CreativeTabs tabMisc; - public static CreativeTabs tabCombat; - public static CreativeTabs tabTools; - public static CreativeTabs tabMachines; - public static CreativeTabs tabOther; - public static CreativeTabs tabBOP; - - public static void initialiseTabs() { - //GT_CreativeTab - /*tabBlock = new MiscUtilCreativeTabBlock("MiscUtilBlockTab"); - tabMisc = new MiscUtilCreativeTabMisc("MiscUtilMiscTab"); - tabTools = new MiscUtilCreativeTabTools("MiscUtilToolsTab"); - tabMachines = new MiscUtilCreativeTabMachines("MiscUtilMachineTab"); - tabOther = new MiscUtilCreativeTabOther("MiscUtilOtherTab"); - tabBOP = new MiscUtilsBOPTab("MiscUtilBOP");*/ - - tabBlock = new GT_CreativeTab("GTPP_BLOCKS", "GT++ Blocks"); - tabMisc = new GT_CreativeTab("GTPP_MISC", "GT++ Misc"); - tabTools = new GT_CreativeTab("GTPP_TOOLS", "GT++ Tools"); - tabMachines = new GT_CreativeTab("GTPP_MACHINES", "GT++ Machines"); - tabOther = new GT_CreativeTab("GTPP_OTHER", "GT++ Other"); - tabBOP = new GT_CreativeTab("GTPP_OTHER_2", "GT++ Other II"); - - } -} diff --git a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabBlock.java b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabBlock.java deleted file mode 100644 index 2851a514d0..0000000000 --- a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabBlock.java +++ /dev/null @@ -1,27 +0,0 @@ -package gtPlusPlus.core.creative.tabs; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.block.ModBlocks; - -public class MiscUtilCreativeTabBlock extends CreativeTabs { - - public MiscUtilCreativeTabBlock(final String lable) { - super(lable); - } - - @Override - public Item getTabIconItem() { - return Item.getItemFromBlock(Blocks.bedrock); - } - - @SideOnly(Side.CLIENT) - @Override - public int func_151243_f(){ - return 0; - } - -} diff --git a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMachines.java b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMachines.java deleted file mode 100644 index 96c809c4da..0000000000 --- a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMachines.java +++ /dev/null @@ -1,21 +0,0 @@ -package gtPlusPlus.core.creative.tabs; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Items; -import net.minecraft.item.Item; - -import gtPlusPlus.core.item.ModItems; - -public class MiscUtilCreativeTabMachines extends CreativeTabs { - - - public MiscUtilCreativeTabMachines(final String lable) { - super(lable); - } - - @Override - public Item getTabIconItem() { - return Items.netherbrick; - } - -} diff --git a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMisc.java b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMisc.java deleted file mode 100644 index a67668bbf0..0000000000 --- a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMisc.java +++ /dev/null @@ -1,20 +0,0 @@ -package gtPlusPlus.core.creative.tabs; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Items; -import net.minecraft.item.Item; - -import gtPlusPlus.core.item.ModItems; - -public class MiscUtilCreativeTabMisc extends CreativeTabs { - - public MiscUtilCreativeTabMisc(final String lable) { - super(lable); - } - - @Override - public Item getTabIconItem() { - return Items.painting; - } - -} diff --git a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabOther.java b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabOther.java deleted file mode 100644 index afd89346c0..0000000000 --- a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabOther.java +++ /dev/null @@ -1,20 +0,0 @@ -package gtPlusPlus.core.creative.tabs; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Items; -import net.minecraft.item.Item; - -import gtPlusPlus.core.item.ModItems; - -public class MiscUtilCreativeTabOther extends CreativeTabs { - - public MiscUtilCreativeTabOther(final String lable) { - super(lable); - } - - @Override - public Item getTabIconItem() { - return Items.repeater; - } - -} diff --git a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabTools.java b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabTools.java deleted file mode 100644 index ab1ab069de..0000000000 --- a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabTools.java +++ /dev/null @@ -1,20 +0,0 @@ -package gtPlusPlus.core.creative.tabs; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Items; -import net.minecraft.item.Item; - -import gtPlusPlus.core.item.ModItems; - -public class MiscUtilCreativeTabTools extends CreativeTabs { - - public MiscUtilCreativeTabTools(final String lable) { - super(lable); - } - - @Override - public Item getTabIconItem() { - return Items.diamond_pickaxe; - } - -} diff --git a/src/Java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java b/src/Java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java deleted file mode 100644 index 9abd07392d..0000000000 --- a/src/Java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java +++ /dev/null @@ -1,216 +0,0 @@ -package gtPlusPlus.core.entity; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityTNTPrimed; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; - -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.world.explosions.ExplosionHandler; - -public class EntityPrimedMiningExplosive extends EntityTNTPrimed -{ - /** How long the fuse is */ - private EntityLivingBase tntPlacedBy; - - public EntityPrimedMiningExplosive(final World world){ - super(world); - this.fuse = 160; - this.preventEntitySpawning = true; - this.setSize(0.98F, 0.98F); - this.yOffset = this.height / 2.0F; - } - - public EntityPrimedMiningExplosive(final World world, final double x, final double y, final double z, final EntityLivingBase placingEntity) - { - this(world); - this.setPosition(x, y, z); - final float f = (float)(Math.random() * Math.PI * 2.0D); - this.motionX = -((float)Math.sin(f)) * 0.02F; - this.motionY = 0.20000000298023224D; - this.motionZ = -((float)Math.cos(f)) * 0.02F; - this.fuse = 160; - this.prevPosX = x; - this.prevPosY = y; - this.prevPosZ = z; - this.tntPlacedBy = placingEntity; - } - - @Override - protected void entityInit() {} - - /** - * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to - * prevent them from trampling crops - */ - @Override - protected boolean canTriggerWalking() - { - return false; - } - - /** - * Returns true if other Entities should be prevented from moving through this Entity. - */ - @Override - public boolean canBeCollidedWith() - { - return !this.isDead; - } - - /** - * Called to update the entity's position/logic. - */ - @Override - public void onUpdate() - { - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; - this.motionY -= 0.03999999910593033D; - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= 0.9800000190734863D; - this.motionY *= 0.9800000190734863D; - this.motionZ *= 0.9800000190734863D; - - if (this.onGround) - { - this.motionX *= 0.699999988079071D; - this.motionZ *= 0.699999988079071D; - this.motionY *= -0.5D; - } - - if (this.fuse-- <= 0) - { - this.setDead(); - - if (!this.worldObj.isRemote) - { - this.explode(); - } - } - else - { - - int t = MathUtils.randInt(0, 15); - - if (t <= 2){ - int e = MathUtils.randInt(0, 3); - if (e <= 1){ - this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - } - else if (e == 2){ - this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - - } - } - else if (t <= 4){ - int e = MathUtils.randInt(0, 5); - if (e <= 1){ - this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - } - else if (e == 2){ - this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - - } - } - else if (t <= 6){ - int e = MathUtils.randInt(0, 4); - if (e <= 1){ - this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - } - else if (e == 2){ - this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - - } - } - else if (t <= 8){ - int e = MathUtils.randInt(0, 1); - if (e <= 1){ - this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - } - else if (e == 2){ - this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - - } - } - else if (t <= 10){ - int e = MathUtils.randInt(0, 6); - if (e <= 1){ - this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - } - else if (e >= 2){ - this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - - } - } - - } - } - - private void explode() - { - final float f = 100.0F; - - ExplosionHandler explode = new ExplosionHandler(); - explode.createExplosion(this.worldObj, this, this.posX, this.posY, this.posZ, f, false, true); - - /*this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true); - this.worldObj.createExplosion(this, this.posX+MathUtils.randDouble(-10, 10), this.posY, this.posZ+MathUtils.randDouble(-10, 10), f+MathUtils.randFloat(-5F, 5F), true); - this.worldObj.createExplosion(this, this.posX+MathUtils.randDouble(-10, 10), this.posY, this.posZ+MathUtils.randDouble(-10, 10), f+MathUtils.randFloat(-5F, 5F), true); - this.worldObj.createExplosion(this, this.posX+MathUtils.randDouble(-10, 10), this.posY, this.posZ+MathUtils.randDouble(-10, 10), f+MathUtils.randFloat(-5F, 5F), true); - this.worldObj.createExplosion(this, this.posX+MathUtils.randDouble(-10, 10), this.posY, this.posZ+MathUtils.randDouble(-10, 10), f+MathUtils.randFloat(-5F, 5F), true);*/ - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - @Override - protected void writeEntityToNBT(final NBTTagCompound tag) - { - tag.setByte("Fuse", (byte)this.fuse); - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - @Override - protected void readEntityFromNBT(final NBTTagCompound tag) - { - this.fuse = tag.getByte("Fuse"); - } - - /** - * returns null or the entityliving it was placed or ignited by - */ - @Override - public EntityLivingBase getTntPlacedBy() - { - return this.tntPlacedBy; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/EntityTeleportFX.java b/src/Java/gtPlusPlus/core/entity/EntityTeleportFX.java deleted file mode 100644 index ea667b8667..0000000000 --- a/src/Java/gtPlusPlus/core/entity/EntityTeleportFX.java +++ /dev/null @@ -1,247 +0,0 @@ -package gtPlusPlus.core.entity; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; - -public class EntityTeleportFX extends Entity -{ - /** 'x' location the eye should float towards. */ - private double targetX; - /** 'y' location the eye should float towards. */ - private double targetY; - /** 'z' location the eye should float towards. */ - private double targetZ; - private int despawnTimer; - private boolean shatterOrDrop; - private static final String __OBFID = "CL_00001716"; - - public EntityTeleportFX(final World p_i1757_1_) - { - super(p_i1757_1_); - this.setSize(0.25F, 0.25F); - } - - @Override - protected void entityInit() {} - - /** - * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge - * length * 64 * renderDistanceWeight Args: distance - */ - @Override - @SideOnly(Side.CLIENT) - public boolean isInRangeToRenderDist(final double p_70112_1_) - { - double d1 = this.boundingBox.getAverageEdgeLength() * 4.0D; - d1 *= 64.0D; - return p_70112_1_ < (d1 * d1); - } - - public EntityTeleportFX(final World p_i1758_1_, final double p_i1758_2_, final double p_i1758_4_, final double p_i1758_6_) - { - super(p_i1758_1_); - this.despawnTimer = 0; - this.setSize(0.25F, 0.25F); - this.setPosition(p_i1758_2_, p_i1758_4_, p_i1758_6_); - this.yOffset = 0.0F; - } - - /** - * The location the eye should float/move towards. Currently used for moving towards the nearest stronghold. Args: - * strongholdX, strongholdY, strongholdZ - */ - public void moveTowards(final double p_70220_1_, final int p_70220_3_, final double p_70220_4_) - { - final double d2 = p_70220_1_ - this.posX; - final double d3 = p_70220_4_ - this.posZ; - final float f = MathHelper.sqrt_double((d2 * d2) + (d3 * d3)); - - if (f > 12.0F) - { - this.targetX = this.posX + ((d2 / f) * 12.0D); - this.targetZ = this.posZ + ((d3 / f) * 12.0D); - this.targetY = this.posY + 8.0D; - } - else - { - this.targetX = p_70220_1_; - this.targetY = p_70220_3_; - this.targetZ = p_70220_4_; - } - - this.despawnTimer = 0; - this.shatterOrDrop = this.rand.nextInt(5) > 0; - } - - /** - * Sets the velocity to the args. Args: x, y, z - */ - @Override - @SideOnly(Side.CLIENT) - public void setVelocity(final double p_70016_1_, final double p_70016_3_, final double p_70016_5_) - { - this.motionX = p_70016_1_; - this.motionY = p_70016_3_; - this.motionZ = p_70016_5_; - - if ((this.prevRotationPitch == 0.0F) && (this.prevRotationYaw == 0.0F)) - { - final float f = MathHelper.sqrt_double((p_70016_1_ * p_70016_1_) + (p_70016_5_ * p_70016_5_)); - this.prevRotationYaw = this.rotationYaw = (float)((Math.atan2(p_70016_1_, p_70016_5_) * 180.0D) / Math.PI); - this.prevRotationPitch = this.rotationPitch = (float)((Math.atan2(p_70016_3_, f) * 180.0D) / Math.PI); - } - } - - /** - * Called to update the entity's position/logic. - */ - @Override - public void onUpdate() - { - this.lastTickPosX = this.posX; - this.lastTickPosY = this.posY; - this.lastTickPosZ = this.posZ; - super.onUpdate(); - this.posX += this.motionX; - this.posY += this.motionY; - this.posZ += this.motionZ; - final float f = MathHelper.sqrt_double((this.motionX * this.motionX) + (this.motionZ * this.motionZ)); - this.rotationYaw = (float)((Math.atan2(this.motionX, this.motionZ) * 180.0D) / Math.PI); - - for (this.rotationPitch = (float)((Math.atan2(this.motionY, f) * 180.0D) / Math.PI); (this.rotationPitch - this.prevRotationPitch) < -180.0F; this.prevRotationPitch -= 360.0F) - { - ; - } - - while ((this.rotationPitch - this.prevRotationPitch) >= 180.0F) - { - this.prevRotationPitch += 360.0F; - } - - while ((this.rotationYaw - this.prevRotationYaw) < -180.0F) - { - this.prevRotationYaw -= 360.0F; - } - - while ((this.rotationYaw - this.prevRotationYaw) >= 180.0F) - { - this.prevRotationYaw += 360.0F; - } - - this.rotationPitch = this.prevRotationPitch + ((this.rotationPitch - this.prevRotationPitch) * 0.2F); - this.rotationYaw = this.prevRotationYaw + ((this.rotationYaw - this.prevRotationYaw) * 0.2F); - - if (!this.worldObj.isRemote) - { - final double d0 = this.targetX - this.posX; - final double d1 = this.targetZ - this.posZ; - final float f1 = (float)Math.sqrt((d0 * d0) + (d1 * d1)); - final float f2 = (float)Math.atan2(d1, d0); - double d2 = f + ((f1 - f) * 0.0025D); - - if (f1 < 1.0F) - { - d2 *= 0.8D; - this.motionY *= 0.8D; - } - - this.motionX = Math.cos(f2) * d2; - this.motionZ = Math.sin(f2) * d2; - - if (this.posY < this.targetY) - { - this.motionY += (1.0D - this.motionY) * 0.014999999664723873D; - } - else - { - this.motionY += (-1.0D - this.motionY) * 0.014999999664723873D; - } - } - - final float f3 = 0.25F; - - if (this.isInWater()) - { - for (int i = 0; i < 4; ++i) - { - this.worldObj.spawnParticle("bubble", this.posX - (this.motionX * f3), this.posY - (this.motionY * f3), this.posZ - (this.motionZ * f3), this.motionX, this.motionY, this.motionZ); - } - } - else - { - this.worldObj.spawnParticle("portal", ((this.posX - (this.motionX * f3)) + (this.rand.nextDouble() * 0.6D)) - 0.3D, this.posY - (this.motionY * f3) - 0.5D, ((this.posZ - (this.motionZ * f3)) + (this.rand.nextDouble() * 0.6D)) - 0.3D, this.motionX, this.motionY, this.motionZ); - } - - if (!this.worldObj.isRemote) - { - this.setPosition(this.posX, this.posY, this.posZ); - ++this.despawnTimer; - - if ((this.despawnTimer > 80) && !this.worldObj.isRemote) - { - this.setDead(); - - if (this.shatterOrDrop) - { - this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(Items.ender_eye))); - } - else - { - this.worldObj.playAuxSFX(2003, (int)Math.round(this.posX), (int)Math.round(this.posY), (int)Math.round(this.posZ), 0); - } - } - } - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - @Override - public void writeEntityToNBT(final NBTTagCompound p_70014_1_) {} - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - @Override - public void readEntityFromNBT(final NBTTagCompound p_70037_1_) {} - - @Override - @SideOnly(Side.CLIENT) - public float getShadowSize() - { - return 0.0F; - } - - /** - * Gets how bright this entity is. - */ - @Override - public float getBrightness(final float p_70013_1_) - { - return 1.0F; - } - - @Override - @SideOnly(Side.CLIENT) - public int getBrightnessForRender(final float p_70070_1_) - { - return 15728880; - } - - /** - * If returns false, the item will not inflict any damage against entities. - */ - @Override - public boolean canAttackWithItem() - { - return false; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/EntityTeslaTowerLightning.java b/src/Java/gtPlusPlus/core/entity/EntityTeslaTowerLightning.java deleted file mode 100644 index bf629bd147..0000000000 --- a/src/Java/gtPlusPlus/core/entity/EntityTeslaTowerLightning.java +++ /dev/null @@ -1,168 +0,0 @@ -package gtPlusPlus.core.entity; -import java.util.List; -import java.util.Random; -import java.util.UUID; - -import net.minecraft.block.material.Material; -import net.minecraft.entity.Entity; -import net.minecraft.entity.effect.EntityWeatherEffect; -import net.minecraft.init.Blocks; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.MathHelper; -import net.minecraft.world.EnumDifficulty; -import net.minecraft.world.World; - -import gtPlusPlus.api.damage.DamageTeslaTower; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.random.XSTR; -import gtPlusPlus.core.util.minecraft.EntityUtils; - -public class EntityTeslaTowerLightning extends EntityWeatherEffect -{ - /** Declares which state the lightning bolt is in. Whether it's in the air, hit the ground, etc. */ - private int lightningState; - /** A random long that is used to change the vertex of the lightning rendered in RenderLightningBolt */ - public long boltVertex; - /** Determines the time before the EntityLightningBolt is destroyed. It is a random integer decremented over time. */ - private int boltLivingTime; - - private final UUID boltID; - private final UUID boltOwnerID; - - private final Entity boltValidDamageTarget; - - - public EntityTeslaTowerLightning(World p_i1703_1_, double p_i1703_2_, double p_i1703_4_, double p_i1703_6_, Entity valid, UUID owner) - { - super(p_i1703_1_); - Logger.INFO("Plasma Bolt - Created."); - Random rand = new XSTR(p_i1703_1_.getSeed()); - this.setLocationAndAngles(p_i1703_2_, p_i1703_4_, p_i1703_6_, 0.0F, 0.0F); - this.lightningState = 2; - this.boltVertex = rand.nextLong(); - this.boltLivingTime = (1) + rand.nextInt(3) + 1; - this.boltValidDamageTarget = valid; - this.boltID = UUID.randomUUID(); - this.boltOwnerID = owner; - - //Puts fires out - if (!p_i1703_1_.isRemote && p_i1703_1_.getGameRules().getGameRuleBooleanValue("doFireTick") && (p_i1703_1_.difficultySetting == EnumDifficulty.NORMAL || p_i1703_1_.difficultySetting == EnumDifficulty.HARD) && p_i1703_1_.doChunksNearChunkExist(MathHelper.floor_double(p_i1703_2_), MathHelper.floor_double(p_i1703_4_), MathHelper.floor_double(p_i1703_6_), 10)) - { - Logger.INFO("Plasma Bolt - Putting out fires?."); - int i = MathHelper.floor_double(p_i1703_2_); - int j = MathHelper.floor_double(p_i1703_4_); - int k = MathHelper.floor_double(p_i1703_6_); - - if (p_i1703_1_.getBlock(i, j, k).getMaterial() == Material.fire) - { - p_i1703_1_.setBlock(i, j, k, Blocks.air); - } - - for (i = 0; i < 4; ++i) - { - j = MathHelper.floor_double(p_i1703_2_) + rand.nextInt(3) - 1; - k = MathHelper.floor_double(p_i1703_4_) + rand.nextInt(3) - 1; - int l = MathHelper.floor_double(p_i1703_6_) + rand.nextInt(3) - 1; - - if (p_i1703_1_.getBlock(j, k, l).getMaterial() == Material.fire) - { - p_i1703_1_.setBlock(j, k, l, Blocks.air); - } - } - } - } - - /** - * Called to update the entity's position/logic. - */ - public void onUpdate() - { - //Logger.INFO("Zap"); - super.onUpdate(); - Logger.INFO("Plasma Bolt - Tick."); - Random rand = new XSTR(this.worldObj.getSeed()); - - if (this.lightningState == 2) - { - Logger.INFO("Plasma Bolt - Playing Sound."); - this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0F, 0.8F + rand.nextFloat() * 0.2F); - } - --this.lightningState; - - - if (this.lightningState >= 0) - { - Logger.INFO("Plasma Bolt - state >= 0."); - if (this.worldObj.isRemote) - { - Logger.INFO("Plasma Bolt - World is remote, resetting state to 2."); - this.worldObj.lastLightningBolt = 2; - } - else - { - Logger.INFO("Plasma Bolt - World is server side."); - double d0 = 3.0D; - List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getBoundingBox(this.posX - d0, this.posY - d0, this.posZ - d0, this.posX + d0, this.posY + 6.0D + d0, this.posZ + d0)); - - for (int l = 0; l < list.size(); ++l) - { - Entity entity = list.get(l); - if (this.boltValidDamageTarget.getUniqueID().equals(entity.getUniqueID())){ - if (!entity.getUniqueID().equals(boltOwnerID)){ - Logger.INFO("Plasma Bolt - Hurting Entity."); - Logger.INFO("Plasma Bolt - "+entity.getCommandSenderName()+"."); - //if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(entity, this)) - EntityUtils.doFireDamage(entity, 5); - EntityUtils.doDamage(entity, new DamageTeslaTower(entity), 20); - } - } - } - - } - } - - if (this.lightningState < 0) - { - Logger.INFO("Plasma Bolt - state < 0."); - if (this.boltLivingTime == 0) - { - Logger.INFO("Plasma Bolt - setting dead."); - this.setDead(); - } - else if (this.lightningState < -rand.nextInt(10)) - { - Logger.INFO("Plasma Bolt - dunno."); - --this.boltLivingTime; - this.lightningState = 1; - this.boltVertex = rand.nextLong(); - //Puts fires out. - if (!this.worldObj.isRemote && this.worldObj.getGameRules().getGameRuleBooleanValue("doFireTick") && this.worldObj.doChunksNearChunkExist(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ), 10)) - { - Logger.INFO("Plasma Bolt - Putting fires out [2]."); - int i = MathHelper.floor_double(this.posX); - int j = MathHelper.floor_double(this.posY); - int k = MathHelper.floor_double(this.posZ); - - if (this.worldObj.getBlock(i, j, k).getMaterial() == Material.fire) - { - this.worldObj.setBlock(i, j, k, Blocks.air); - } - } - - } - } - } - - protected void entityInit() {} - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {} - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {} -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java b/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java deleted file mode 100644 index 6b88d5775c..0000000000 --- a/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java +++ /dev/null @@ -1,96 +0,0 @@ -package gtPlusPlus.core.entity; - -import cpw.mods.fml.common.registry.EntityRegistry; - -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.australia.entity.type.EntityAustralianSpiderBase; -import gtPlusPlus.australia.entity.type.EntityBoar; -import gtPlusPlus.australia.entity.type.EntityDingo; -import gtPlusPlus.australia.entity.type.EntityOctopus; -import gtPlusPlus.core.entity.monster.EntityBatKing; -import gtPlusPlus.core.entity.monster.EntityGiantChickenBase; -import gtPlusPlus.core.entity.monster.EntitySickBlaze; -import gtPlusPlus.core.entity.monster.EntityStaballoyConstruct; -import gtPlusPlus.core.entity.projectile.EntityHydrofluoricAcidPotion; -import gtPlusPlus.core.entity.projectile.EntityLightningAttack; -import gtPlusPlus.core.entity.projectile.EntitySulfuricAcidPotion; -import gtPlusPlus.core.entity.projectile.EntityThrowableBomb; -import gtPlusPlus.core.entity.projectile.EntityToxinballSmall; -import gtPlusPlus.core.item.general.spawn.ItemCustomSpawnEgg; -import gtPlusPlus.core.util.Utils; - -public class InternalEntityRegistry { - - static int mEntityID = 0; - - public static void registerEntities(){ - Logger.INFO("Registering GT++ Entities."); - - //EntityRegistry.registerGlobalEntityID(EntityPrimedMiningExplosive.class, "MiningCharge", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(0, 0, 0), Utils.rgbtoHexValue(125, 125, 125)); - EntityRegistry.registerModEntity(EntityPrimedMiningExplosive.class, "MiningCharge", mEntityID++, GTplusplus.instance, 64, 20, true); - - //EntityRegistry.registerGlobalEntityID(EntitySulfuricAcidPotion.class, "throwablePotionSulfuric", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(200, 0, 200), Utils.rgbtoHexValue(125, 125, 125)); - EntityRegistry.registerModEntity(EntitySulfuricAcidPotion.class, "throwablePotionSulfuric", mEntityID++, GTplusplus.instance, 64, 20, true); - - - //EntityRegistry.registerGlobalEntityID(EntityHydrofluoricAcidPotion.class, "throwablePotionHydrofluoric", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(0, 0, 0), Utils.rgbtoHexValue(255, 255, 255)); - EntityRegistry.registerModEntity(EntityHydrofluoricAcidPotion.class, "throwablePotionHydrofluoric", mEntityID++, GTplusplus.instance, 64, 20, true); - - - //EntityRegistry.registerGlobalEntityID(EntityToxinballSmall.class, "toxinBall", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(0, 25, 0), Utils.rgbtoHexValue(0, 125, 0)); - EntityRegistry.registerModEntity(EntityToxinballSmall.class, "toxinBall", mEntityID++, GTplusplus.instance, 64, 20, true); - - - //EntityRegistry.registerGlobalEntityID(EntityStaballoyConstruct.class, "constructStaballoy", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(0, 75, 0), Utils.rgbtoHexValue(50, 220, 50)); - EntityRegistry.registerModEntity(EntityStaballoyConstruct.class, "constructStaballoy", mEntityID++, GTplusplus.instance, 64, 20, true); - ItemCustomSpawnEgg.registerEntityForSpawnEgg(0, "constructStaballoy", Utils.rgbtoHexValue(20, 200, 20), Utils.rgbtoHexValue(20, 20, 20)); - - //EntityRegistry.registerGlobalEntityID(EntitySickBlaze.class, "sickBlaze", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(0, 75, 0), Utils.rgbtoHexValue(75, 175, 75)); - EntityRegistry.registerModEntity(EntitySickBlaze.class, "sickBlaze", mEntityID++, GTplusplus.instance, 64, 20, true); - ItemCustomSpawnEgg.registerEntityForSpawnEgg(1, "sickBlaze", Utils.rgbtoHexValue(40, 180, 40), Utils.rgbtoHexValue(75, 75, 75)); - - //EntityRegistry.registerGlobalEntityID(EntityTeslaTowerLightning.class, "plasmaBolt", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(255, 0, 0), Utils.rgbtoHexValue(125, 125, 125)); - EntityRegistry.registerModEntity(EntityTeslaTowerLightning.class, "plasmaBolt", mEntityID++, GTplusplus.instance, 64, 5, true); - - EntityRegistry.registerModEntity(EntityThrowableBomb.class, "EntityThrowableBomb", mEntityID++, GTplusplus.instance, 64, 10, true); - - EntityRegistry.registerModEntity(EntityLightningAttack.class, "EntityLightningAttack", mEntityID++, GTplusplus.instance, 64, 20, true); - - /** - * Globals, which generate spawn eggs. (Currently required for Giant chicken spawning) - */ - - EntityRegistry.registerModEntity(EntityGiantChickenBase.class, "bigChickenFriendly", mEntityID++, GTplusplus.instance, 64, 20, true); - ItemCustomSpawnEgg.registerEntityForSpawnEgg(2, "bigChickenFriendly", Utils.rgbtoHexValue(255, 0, 0), Utils.rgbtoHexValue(175, 175, 175)); - EntityRegistry.registerModEntity(EntityBatKing.class, "batKing", mEntityID++, GTplusplus.instance, 64, 20, true); - ItemCustomSpawnEgg.registerEntityForSpawnEgg(3, "batKing", Utils.rgbtoHexValue(175, 175, 0), Utils.rgbtoHexValue(0, 175, 175)); - //EntityRegistry.registerModEntity(EntityGiantChickenBase.class, "bigChickenFriendly", mEntityID++, GTplusplus.instance, 64, 20, true); - - - - - - //Australia - EntityRegistry.registerModEntity(EntityAustralianSpiderBase.class, "AusSpider", mEntityID++, GTplusplus.instance, 64, 20, true); - ItemCustomSpawnEgg.registerEntityForSpawnEgg(30, "AusSpider", Utils.rgbtoHexValue(125, 0, 125), Utils.rgbtoHexValue(175, 175, 175)); - EntityRegistry.registerModEntity(EntityBoar.class, "AusBoar", mEntityID++, GTplusplus.instance, 64, 20, true); - ItemCustomSpawnEgg.registerEntityForSpawnEgg(31, "AusBoar", Utils.rgbtoHexValue(75, 75, 0), Utils.rgbtoHexValue(175, 175, 75)); - EntityRegistry.registerModEntity(EntityDingo.class, "AusDingo", mEntityID++, GTplusplus.instance, 64, 20, true); - ItemCustomSpawnEgg.registerEntityForSpawnEgg(32, "AusDingo", Utils.rgbtoHexValue(175, 125, 0), Utils.rgbtoHexValue(175, 75, 175)); - EntityRegistry.registerModEntity(EntityOctopus.class, "AusOctopus", mEntityID++, GTplusplus.instance, 32, 20, true); - ItemCustomSpawnEgg.registerEntityForSpawnEgg(33, "AusOctopus", Utils.rgbtoHexValue(150, 50, 150), Utils.rgbtoHexValue(75, 175, 175)); - //EntityRegistry.registerGlobalEntityID(EntityAustralianSpiderBase.class, "AusSpider", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(255, 0, 0), Utils.rgbtoHexValue(175, 175, 175)); - //EntityRegistry.registerGlobalEntityID(EntityBoar.class, "AusBoar", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(255, 0, 0), Utils.rgbtoHexValue(175, 175, 175)); - //EntityRegistry.registerGlobalEntityID(EntityDingo.class, "AusDingo", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(255, 0, 0), Utils.rgbtoHexValue(175, 175, 175)); - //EntityRegistry.registerGlobalEntityID(EntityOctopus.class, "AusOctopus", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(255, 0, 0), Utils.rgbtoHexValue(175, 175, 175)); - - - - - - - - } - -} diff --git a/src/Java/gtPlusPlus/core/entity/ai/batking/EntityAIBatKingAttack.java b/src/Java/gtPlusPlus/core/entity/ai/batking/EntityAIBatKingAttack.java deleted file mode 100644 index 52d1d6100c..0000000000 --- a/src/Java/gtPlusPlus/core/entity/ai/batking/EntityAIBatKingAttack.java +++ /dev/null @@ -1,406 +0,0 @@ -package gtPlusPlus.core.entity.ai.batking; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.entity.monster.EntityBatKing; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.IRangedAttackMob; -import net.minecraft.entity.ai.EntityAIBase; -import net.minecraft.pathfinding.PathEntity; -import net.minecraft.pathfinding.PathPoint; -import net.minecraft.util.MathHelper; - -public class EntityAIBatKingAttack extends EntityAIBase { - - private final Ranged mRangedAI; - private final Melee mMeleeAI; - private boolean mIsMelee = false; - - /** The Bat King in control of this AI. */ - private final EntityBatKing mAttackingEntity; - - /** The PathEntity of our entity. */ - private PathEntity mEntityPathEntity; - - /** The current target of Bat King in control of this AI. */ - private EntityLivingBase mEntityTarget; - - private final Class mClassTarget; - - public EntityAIBatKingAttack(EntityBatKing aAttacker, Class aClassTarget, - double aMovementSpeed, int someInt, int aMaxRangedAttackTime, float someFloat, boolean aLongMemory) { - mRangedAI = new Ranged(this, aMovementSpeed, someInt, 5, someFloat); - mMeleeAI = new Melee(this, aClassTarget, aMovementSpeed, aLongMemory); - mAttackingEntity = aAttacker; - mClassTarget = aClassTarget; - } - - @Override - public boolean shouldExecute() { - determineCombatStyle(); - EntityLivingBase entitylivingbase = this.mAttackingEntity.getAttackTarget(); - if (entitylivingbase == null) { - this.mEntityTarget = null; - return false; - } else if (!entitylivingbase.isEntityAlive()) { - return false; - } else if (this.mClassTarget != null && !this.mClassTarget.isAssignableFrom(entitylivingbase.getClass())) { - return false; - } else { - if (this.mIsMelee) { - return this.mMeleeAI.shouldExecute(); - } - else { - this.mEntityTarget = entitylivingbase; - this.mEntityPathEntity = this.mAttackingEntity.getNavigator().getPathToEntityLiving(entitylivingbase); - return mRangedAI != null && mMeleeAI != null && hasValidTarget(); - } - } - } - - public EntityBatKing getBatKing() { - return this.mAttackingEntity; - } - - public IRangedAttackMob getBatKingAsIRangedAttackMob() { - return this.mAttackingEntity; - } - - public boolean hasValidTarget() { - return this.mEntityTarget != null; - } - - public EntityLivingBase getTarget() { - return mEntityTarget; - } - - @Override - public boolean continueExecuting() { - determineCombatStyle(); - if (mIsMelee) { - return mMeleeAI.continueExecuting(); - } else { - return mRangedAI.continueExecuting(); - } - } - - @Override - public boolean isInterruptible() { - if (mIsMelee) { - - } else { - - } - return super.isInterruptible(); - } - - @Override - public void startExecuting() { - determineCombatStyle(); - if (mIsMelee) { - mMeleeAI.startExecuting(); - } else { - mRangedAI.startExecuting(); - } - } - - @Override - public void resetTask() { - determineCombatStyle(); - if (mIsMelee) { - mMeleeAI.resetTask(); - } else { - mRangedAI.resetTask(); - } - } - - @Override - public void updateTask() { - determineCombatStyle(); - if (mIsMelee) { - mMeleeAI.updateTask(); - } else { - mRangedAI.updateTask(); - } - } - - - private final void determineCombatStyle() { - boolean aisMeleeNow = this.mIsMelee; - if (this.mEntityTarget != null && EntityUtils.getDistance(getBatKing(), mEntityTarget) < 4) { - this.mIsMelee = true; - } - else { - this.mIsMelee = false; - } - if (aisMeleeNow != this.mIsMelee) { - Logger.INFO("Bat King changed combat style from "+(aisMeleeNow ? "Melee" : "Ranged")+" to "+(this.mIsMelee ? "Melee" : "Ranged")); - } - } - - private class Ranged { - - private final EntityAIBatKingAttack parentAI; - - /** - * A decrementing tick that spawns a ranged attack once this value reaches 0. It - * is then set back to the maxRangedAttackTime. - */ - private int rangedAttackTime; - private double entityMoveSpeed; - private int mCooldownTime; - private int field_96561_g; - /** - * The maximum time the AI has to wait before performing another ranged attack. - */ - private int maxRangedAttackTime; - private float field_96562_i; - private float field_82642_h; //Max range - - public Ranged(EntityAIBatKingAttack aParent, double aMovementSpeed, int someInt, - int aMaxRangedAttackTime, float someFloat) { - this.rangedAttackTime = -1; - this.parentAI = aParent; - this.entityMoveSpeed = aMovementSpeed; - this.field_96561_g = someInt; - this.maxRangedAttackTime = aMaxRangedAttackTime; - this.field_96562_i = someFloat; - this.field_82642_h = someFloat * someFloat * 8; - parentAI.setMutexBits(3); - - } - - /** - * Execute a one shot task or start executing a continuous task - */ - public void startExecuting() { - parentAI.getBatKing().getNavigator().setPath(parentAI.mEntityPathEntity, this.entityMoveSpeed); - } - - /** - * Returns whether an in-progress EntityAIBase should continue executing - */ - public boolean continueExecuting() { - return parentAI.shouldExecute() || !parentAI.getBatKing().getNavigator().noPath(); - } - - /** - * Resets the task - */ - public void resetTask() { - parentAI.mEntityTarget = null; - this.mCooldownTime = 0; - this.rangedAttackTime = -1; - } - - /** - * Updates the task - */ - public void updateTask() { - - if (MathUtils.randInt(0, 100) == 0) { - maxRangedAttackTime = MathUtils.balance(maxRangedAttackTime, 20, 40); - } - - double d0 = parentAI.getBatKing().getDistanceSq(parentAI.mEntityTarget.posX, parentAI.mEntityTarget.boundingBox.minY, - parentAI.mEntityTarget.posZ); - boolean flag = parentAI.getBatKing().getEntitySenses().canSee(parentAI.mEntityTarget); - - if (flag) { - ++this.mCooldownTime; - } else { - this.mCooldownTime = 0; - } - - if (d0 <= (double) this.field_82642_h && this.mCooldownTime >= 20) { - parentAI.getBatKing().getNavigator().clearPathEntity(); - } else { - if (parentAI.getBatKing().getNavigator().tryMoveToEntityLiving(parentAI.mEntityTarget, this.entityMoveSpeed)) { - Logger.INFO("Doing Ranged Ai Task."); - } - else { - Logger.INFO("Not Doing Ranged Ai Task."); - } - } - - parentAI.getBatKing().getLookHelper().setLookPositionWithEntity(parentAI.mEntityTarget, 30.0F, 30.0F); - float f; - Logger.INFO("Ranged AI - "+rangedAttackTime); - - if (--this.rangedAttackTime == 0) { - if (d0 > (double) this.field_82642_h || !flag) { - Logger.INFO("Stopping ranged attack. "+flag+"|"+(d0 > (double) this.field_82642_h)+"|"+d0+"|"+(double) this.field_82642_h); - return; - } - - f = MathHelper.sqrt_double(d0) / this.field_96562_i; - float f1 = f; - - if (f < 0.1F) { - f1 = 0.1F; - } - - if (f1 > 1.0F) { - f1 = 1.0F; - } - Logger.INFO("Trying to do a ranged attack."); - parentAI.getBatKingAsIRangedAttackMob().attackEntityWithRangedAttack(parentAI.mEntityTarget, f1); - this.rangedAttackTime = MathHelper.floor_float( - f * (float) (this.maxRangedAttackTime - this.field_96561_g) + (float) this.field_96561_g); - } else if (this.rangedAttackTime < 0) { - f = MathHelper.sqrt_double(d0) / this.field_96562_i; - this.rangedAttackTime = MathHelper.floor_float( - f * (float) (this.maxRangedAttackTime - this.field_96561_g) + (float) this.field_96561_g); - } - } - - } - - private class Melee { - - private final EntityAIBatKingAttack parentAI; - - /** - * An amount of decrementing ticks that allows the entity to attack once the - * tick reaches 0. - */ - int attackTick; - /** The speed with which the mob will approach the target */ - double speedTowardsTarget; - /** - * When true, the mob will continue chasing its target, even if it can't find a - * path to them right now. - */ - boolean longMemory; - Class classTarget; - private int field_75445_i; - private double field_151497_i; - private double field_151495_j; - private double field_151496_k; - - private int failedPathFindingPenalty; - - public Melee(EntityAIBatKingAttack aParent, Class aClassTarget, - double aMoveToTargetSpeed, boolean aLongMemory) { - this.parentAI = aParent; - this.classTarget = aClassTarget; - this.speedTowardsTarget = aMoveToTargetSpeed; - this.longMemory = aLongMemory; - parentAI.setMutexBits(3); - } - - /** - * Returns whether the EntityAIBase should begin execution. - */ - public boolean shouldExecute() { - if (!parentAI.hasValidTarget()) { - return false; - } - EntityLivingBase entitylivingbase = parentAI.getTarget(); - - if (entitylivingbase == null) { - return false; - } else if (!entitylivingbase.isEntityAlive()) { - return false; - } else if (this.classTarget != null && !this.classTarget.isAssignableFrom(entitylivingbase.getClass())) { - return false; - } else { - if (--this.field_75445_i <= 0) { - parentAI.mEntityPathEntity = parentAI.mAttackingEntity.getNavigator().getPathToEntityLiving(entitylivingbase); - this.field_75445_i = 4 + parentAI.mAttackingEntity.getRNG().nextInt(7); - return parentAI.mEntityPathEntity != null; - } else { - return true; - } - } - } - - /** - * Returns whether an in-progress EntityAIBase should continue executing - */ - public boolean continueExecuting() { - EntityLivingBase entitylivingbase = parentAI.mAttackingEntity.getAttackTarget(); - return entitylivingbase == null ? false - : (!entitylivingbase.isEntityAlive() ? false - : (!this.longMemory ? !parentAI.mAttackingEntity.getNavigator().noPath() - : parentAI.mAttackingEntity.isWithinHomeDistance(MathHelper.floor_double(entitylivingbase.posX), - MathHelper.floor_double(entitylivingbase.posY), - MathHelper.floor_double(entitylivingbase.posZ)))); - } - - /** - * Execute a one shot task or start executing a continuous task - */ - public void startExecuting() { - parentAI.mAttackingEntity.getNavigator().setPath(parentAI.mEntityPathEntity, this.speedTowardsTarget); - this.field_75445_i = 0; - } - - /** - * Resets the task - */ - public void resetTask() { - parentAI.mAttackingEntity.getNavigator().clearPathEntity(); - } - - /** - * Updates the task - */ - public void updateTask() { - EntityLivingBase entitylivingbase = parentAI.mAttackingEntity.getAttackTarget(); - parentAI.mAttackingEntity.getLookHelper().setLookPositionWithEntity(entitylivingbase, 30.0F, 30.0F); - double d0 = parentAI.mAttackingEntity.getDistanceSq(entitylivingbase.posX, entitylivingbase.boundingBox.minY, - entitylivingbase.posZ); - double d1 = (double) (parentAI.mAttackingEntity.width * 2.0F * parentAI.mAttackingEntity.width * 2.0F + entitylivingbase.width); - --this.field_75445_i; - - if ((this.longMemory || parentAI.mAttackingEntity.getEntitySenses().canSee(entitylivingbase)) && this.field_75445_i <= 0 - && (this.field_151497_i == 0.0D && this.field_151495_j == 0.0D && this.field_151496_k == 0.0D - || entitylivingbase.getDistanceSq(this.field_151497_i, this.field_151495_j, - this.field_151496_k) >= 1.0D - || parentAI.mAttackingEntity.getRNG().nextFloat() < 0.05F)) { - this.field_151497_i = entitylivingbase.posX; - this.field_151495_j = entitylivingbase.boundingBox.minY; - this.field_151496_k = entitylivingbase.posZ; - this.field_75445_i = failedPathFindingPenalty + 4 + parentAI.mAttackingEntity.getRNG().nextInt(7); - - if (parentAI.mAttackingEntity.getNavigator().getPath() != null) { - PathPoint finalPathPoint = parentAI.mAttackingEntity.getNavigator().getPath().getFinalPathPoint(); - if (finalPathPoint != null && entitylivingbase.getDistanceSq(finalPathPoint.xCoord, - finalPathPoint.yCoord, finalPathPoint.zCoord) < 1) { - failedPathFindingPenalty = 0; - } else { - failedPathFindingPenalty += 10; - } - } else { - failedPathFindingPenalty += 10; - } - - if (d0 > 1024.0D) { - this.field_75445_i += 10; - } else if (d0 > 256.0D) { - this.field_75445_i += 5; - } - - if (!parentAI.mAttackingEntity.getNavigator().tryMoveToEntityLiving(entitylivingbase, this.speedTowardsTarget)) { - this.field_75445_i += 15; - } - } - - this.attackTick = Math.max(this.attackTick - 1, 0); - - if (d0 <= d1 && this.attackTick <= 20) { - this.attackTick = 20; - - if (parentAI.mAttackingEntity.getHeldItem() != null) { - parentAI.mAttackingEntity.swingItem(); - } - - parentAI.mAttackingEntity.attackEntityAsMob(entitylivingbase); - } - } - - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/item/ItemEntityGiantEgg.java b/src/Java/gtPlusPlus/core/entity/item/ItemEntityGiantEgg.java deleted file mode 100644 index 8e0b1b48ce..0000000000 --- a/src/Java/gtPlusPlus/core/entity/item/ItemEntityGiantEgg.java +++ /dev/null @@ -1,117 +0,0 @@ -package gtPlusPlus.core.entity.item; - -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.entity.monster.EntityGiantChickenBase; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.NBTUtils; - -public class ItemEntityGiantEgg extends EntityItem { - - /** - * The maximum age of this Chicken Egg. The item will try hatch once this is reached. - */ - public int mEggAge = 10000; - public int mEggSize = -1; - - public ItemEntityGiantEgg(World aWorld) { - super(aWorld); - } - - public ItemEntityGiantEgg(World aWorld, double aX, double aY, double aZ) { - super(aWorld, aX, aY, aZ); - } - - public ItemEntityGiantEgg(World aWorld, double aX, double aY, double aZ, ItemStack aStack) { - super(aWorld, aX, aY, aZ, aStack); - } - - private boolean spawnGiantChicken() { - try { - EntityGiantChickenBase entitychicken = new EntityGiantChickenBase(this.worldObj); - entitychicken.setGrowingAge(-MathUtils.randInt(20000, 40000)); - entitychicken.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F); - return this.worldObj.spawnEntityInWorld(entitychicken); - } - catch (Throwable t) { - return false; - } - } - - //These eggs also do not combine. - @Override - public boolean combineItems(EntityItem p_70289_1_) { - return false; - } - - @Override - public void writeEntityToNBT(NBTTagCompound aNBT) { - super.writeEntityToNBT(aNBT); - aNBT.setInteger("mEggAge", mEggAge); - aNBT.setInteger("mTicksExisted", this.age); - } - - @Override - public void readEntityFromNBT(NBTTagCompound aNBT) { - super.readEntityFromNBT(aNBT); - mEggAge = aNBT.getInteger("mEggAge"); - } - - //They're fireproof - @Override - public void setFire(int p_70015_1_) { - } - - @Override - public boolean isBurning() { - return false; - } - - @Override - public void onEntityUpdate() { - super.onEntityUpdate(); - Logger.INFO("1"); - //Large eggs don't despawn, because they will try hatch first. - if (this.lifespan != Integer.MAX_VALUE-1) { - this.lifespan = Integer.MAX_VALUE-1; - } - - if (this.getEntityItem() != null) { - ItemStack g = this.getEntityItem(); - NBTUtils.setInteger(g, "mTicksExisted", this.age); - NBTUtils.setInteger(g, "lifespan", this.lifespan); - NBTUtils.setBoolean(g, "playerHeld", false); - this.setEntityItemStack(g); - Logger.INFO("Writing age to NBT of stored stack item."); - } - else { - ItemStack g = ItemUtils.getSimpleStack(ModItems.itemBigEgg); - NBTUtils.setInteger(g, "mTicksExisted", this.age); - NBTUtils.setInteger(g, "lifespan", this.lifespan); - NBTUtils.setBoolean(g, "playerHeld", false); - this.setEntityItemStack(g); - Logger.INFO("Writing age to NBT of new stack item."); - - } - - if (this.age >= 1000) { - //Cache the value for efficiency - if (mEggSize == -1) - mEggSize = (this.getEntityItem() != null ? (this.getEntityItem().hasTagCompound() ? (this.getEntityItem().getTagCompound().hasKey("size") ? this.getEntityItem().getTagCompound().getInteger("size") : 1) : 1) : 1); - if (MathUtils.randInt(100*mEggSize, 1000) >= MathUtils.randInt(950, 1000)) { - //Spawn Chicken - if (spawnGiantChicken()) { - this.kill(); - } - } - } - } - - -} diff --git a/src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java b/src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java deleted file mode 100644 index 55e0f4c571..0000000000 --- a/src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java +++ /dev/null @@ -1,712 +0,0 @@ -package gtPlusPlus.core.entity.monster; - -import java.lang.reflect.Field; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.entity.ai.batking.EntityAIBatKingAttack; -import gtPlusPlus.core.entity.projectile.EntityThrowableBomb; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.EnumCreatureAttribute; -import net.minecraft.entity.IRangedAttackMob; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.EntityAIAttackOnCollide; -import net.minecraft.entity.ai.EntityAIHurtByTarget; -import net.minecraft.entity.ai.EntityAINearestAttackableTarget; -import net.minecraft.entity.ai.EntityAIWander; -import net.minecraft.entity.ai.RandomPositionGenerator; -import net.minecraft.entity.monster.EntityMob; -import net.minecraft.entity.passive.EntityBat; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.entity.projectile.EntityLargeFireball; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MathHelper; -import net.minecraft.util.Vec3; -import net.minecraft.world.EnumDifficulty; -import net.minecraft.world.World; - -public class EntityBatKing extends EntityMob implements IRangedAttackMob { - - public int courseChangeCooldown; - public double waypointX; - public double waypointY; - public double waypointZ; - private Entity targetedEntity; - private int aggroCooldown; - public int prevAttackCounter; - public int attackCounter; - private int explosionStrength = 1; - - private EntityAIBatKingAttack aiAttack = new EntityAIBatKingAttack(this, null, 1.0D, 20, 60, 15.0F, true); - private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, - false); - - public EntityBatKing(World p_i1680_1_) { - super(p_i1680_1_); - this.setSize(2.5F, 1.5F); - - this.setIsBatHanging(false); - this.isImmuneToFire = true; - this.experienceValue = 1000; - - this.tasks.addTask(3, this.aiAttack); - //this.tasks.addTask(4, this.aiAttackOnCollide); - //this.tasks.addTask(4, new EntityAIRestrictSun(this)); - //this.tasks.addTask(5, new EntityAIFleeSun(this, 1.0D)); - this.tasks.addTask(4, new EntityAIWander(this, 1.0D)); - //this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); - //this.tasks.addTask(6, new EntityAILookIdle(this)); - - this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); - //this.targetTasks.addTask(2, this.aiAttack); - this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); - this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityBat.class, 0, false)); - - } - - protected void entityInit() { - super.entityInit(); - } - - /** - * Get this Entity's EnumCreatureAttribute - */ - public EnumCreatureAttribute getCreatureAttribute() { - return EnumCreatureAttribute.UNDEAD; - } - - /** - * Gets the pitch of living sounds in living entities. - */ - protected float getSoundPitch() { - return super.getSoundPitch() * 0.15F; - } - - /** - * Returns the sound this mob makes while it's alive. - */ - protected String getLivingSound() { - int aRand = MathUtils.randInt(0, 10); - if (aRand < 6) { - return null; - } else if (aRand <= 8) { - return "mob.bat.idle"; - } else { - return "mob.blaze.breathe"; - } - } - - /** - * Returns the sound this mob makes when it is hurt. - */ - protected String getHurtSound() { - return "mob.blaze.hit"; - } - - /** - * Returns the sound this mob makes on death. - */ - protected String getDeathSound() { - return "mob.bat.death"; - } - - /** - * Returns true if this entity should push and be pushed by other entities when - * colliding. - */ - public boolean canBePushed() { - return true; - } - - protected void collideWithEntity(Entity aEntity) { - if (aEntity != null) { - if (aEntity instanceof EntityPlayer) { - EntityUtils.doDamage(aEntity, DamageSource.magic, (int) (((EntityPlayer) aEntity).getHealth() / 20)); - } - } - } - - protected void collideWithNearbyEntities() { - } - - protected void applyEntityAttributes() { - - this.getAttributeMap().registerAttribute(SharedMonsterAttributes.maxHealth); - this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); - this.getAttributeMap().registerAttribute(SharedMonsterAttributes.knockbackResistance); - this.getAttributeMap().registerAttribute(SharedMonsterAttributes.movementSpeed); - this.getAttributeMap().registerAttribute(SharedMonsterAttributes.followRange); - - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(250.0D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D); - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(120.0D); - } - - public boolean getIsBatHanging() { - return false; - } - - public void setIsBatHanging(boolean p_82236_1_) { - generateParticles(this); - generateParticles(this); - generateParticles(this); - for (int i = 0; i < 32; ++i) { - // - String particleName = "lava"; - if (MathUtils.randInt(0, 3) <= 2) { - particleName = "crit"; - } - this.worldObj.spawnParticle(particleName, - this.posX + (this.rand.nextDouble() - 0.5D) * (double) this.width, - this.posY + this.rand.nextDouble() * (double) this.height, - this.posZ + (this.rand.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D); - } - - } - - /** - * Returns true if the newer Entity AI code should be run - */ - protected boolean isAIEnabled() { - return true; - } - - /** - * Called to update the entity's position/logic. - */ - public void onUpdate() { - super.onUpdate(); - generateParticles(this); - - if (!this.worldObj.isRemote && (this.targetedEntity == null || this.aggroCooldown-- <= 0)) { - this.targetedEntity = this.worldObj.getClosestVulnerablePlayerToEntity(this, 100.0D); - - if (this.targetedEntity != null) { - this.aggroCooldown = 30; - if (aiAttack.hasValidTarget()) { - this.setAttackTarget(aiAttack.getTarget()); - } - else { - Logger.INFO("No valid target."); - if (ReflectionUtils.doesFieldExist(aiAttack.getClass(), "mEntityTarget")) { - Logger.INFO("Found field."); - } - else { - Logger.INFO("Did not find field."); - } - Field target = ReflectionUtils.getField(EntityAIBatKingAttack.class, "mEntityTarget"); - if (target != null) { - ReflectionUtils.setField(aiAttack, target, this.targetedEntity); - Logger.INFO("Set target."); - } - else { - Logger.INFO("Could not set via reflection."); - } - - - } - } - else { - Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this, 32, 20); - if (vec3 != null) { - double xPosition = vec3.xCoord; - double yPosition = vec3.yCoord; - double zPosition = vec3.zCoord; - this.getNavigator().tryMoveToXYZ(xPosition, yPosition, zPosition, 3); - } - } - } - - } - - private static void generateParticles(EntityBatKing aKing) { - for (int i = 0; i < 20; ++i) { - // - if (MathUtils.randInt(0, 50) <= 1) { - String particleName = "smoke"; - if (MathUtils.randInt(0, 3) <= 2) { - particleName = "largesmoke"; - } - aKing.worldObj.spawnParticle(particleName, - aKing.posX + (aKing.rand.nextDouble() - 0.5D) * (double) aKing.width, - aKing.posY + aKing.rand.nextDouble() * (double) aKing.height, - aKing.posZ + (aKing.rand.nextDouble() - 0.5D) * (double) aKing.width, 0.0D, 0.0D, 0.0D); - } - if (MathUtils.randInt(0, 100) <= 1) { - String particleName = "smoke"; - int test2 = MathUtils.randInt(0, 3); - if (test2 == 2) { - particleName = "dripLava"; - } else if (test2 == 3) { - particleName = "portal"; - } - aKing.worldObj.spawnParticle(particleName, - aKing.posX + (aKing.rand.nextDouble() - 0.5D) * (double) aKing.width, - aKing.posY + aKing.rand.nextDouble() * (double) aKing.height, - aKing.posZ + (aKing.rand.nextDouble() - 0.5D) * (double) aKing.width, 0.0D, 0.0D, 0.0D); - } - } - } - - protected void updateAITasks() { - super.updateAITasks(); - } - - private boolean isFlying() { - if (this.onGround) { - return false; - } - return true; - } - - private boolean hasAir() { - BlockPos p = EntityUtils.findBlockPosUnderEntity(this); - int y = p.yPos; - int yOriginal = p.yPos; - - for (int u = 0; u<5;u++) { - if (u > 50 || y <= 0) { - break; - } - if (!this.worldObj.isAirBlock(p.xPos, y, p.zPos)) { - break; - } - y--; - } - if (yOriginal != y) { - for (int i = 0; i < y; y++) { - this.jump(); - } - return true; - } - return false; - } - - /** - * returns if this entity triggers Block.onEntityWalking on the blocks they walk - * on. used for spiders and wolves to prevent them from trampling crops - */ - protected boolean canTriggerWalking() { - return false; - } - - /** - * Return whether this entity should NOT trigger a pressure plate or a tripwire. - */ - public boolean doesEntityNotTriggerPressurePlate() { - return true; - } - - /** - * Called when the entity is attacked. - */ - public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) { - if (this.isEntityInvulnerable()) { - return false; - } else { - if (!this.worldObj.isRemote && this.getIsBatHanging()) { - this.setIsBatHanging(false); - } - - return super.attackEntityFrom(p_70097_1_, p_70097_2_); - } - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - public void readEntityFromNBT(NBTTagCompound p_70037_1_) { - super.readEntityFromNBT(p_70037_1_); - if (p_70037_1_.hasKey("ExplosionPower", 99)) { - this.explosionStrength = p_70037_1_.getInteger("ExplosionPower"); - } - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - public void writeEntityToNBT(NBTTagCompound p_70014_1_) { - super.writeEntityToNBT(p_70014_1_); - p_70014_1_.setInteger("ExplosionPower", this.explosionStrength); - } - - /** - * Attack the specified entity using a ranged attack. - */ - @Override - public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_) { - Logger.INFO("Trying to do ranged attack 1 |"+(this.targetedEntity != null)+"|"); - - if (!this.isFlying() || !this.isAirBorne) { - //this.hasAir(); - /* - * for (int i=0;i<3;i++) { this.jump(); } - */ - } - - - double d4 = 64.0D; - if (this.targetedEntity != null && this.targetedEntity.getDistanceSqToEntity(this) < d4 * d4 * 8) { - Logger.INFO("Trying to do ranged attack 2"); - double d5 = this.targetedEntity.posX - this.posX; - double d6 = this.targetedEntity.boundingBox.minY + (double) (this.targetedEntity.height / 2.0F) - - (this.posY + (double) (this.height / 2.0F)); - double d7 = this.targetedEntity.posZ - this.posZ; - this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(d5, d7)) * 180.0F / (float) Math.PI; - - ++this.attackCounter; - - if (this.canEntityBeSeen(this.targetedEntity)) { - Logger.INFO("Trying to do ranged attack 3a | "+attackCounter); - - - if (this.attackCounter >= 2) { - Logger.INFO("Trying to do ranged attack 3a1"); - - this.worldObj.playAuxSFXAtEntity((EntityPlayer) null, 1008, (int) this.posX, (int) this.posY, - (int) this.posZ, 0); - setIsBatHanging(true); - - EntityThrowableBomb entitylargefireball = new EntityThrowableBomb(this.worldObj, this/*d5, d6, d7*/); - //entitylargefireball.field_92057_e = this.explosionStrength; - //entitylargefireball.accelerationX *= 2; - //entitylargefireball.accelerationY *= 2; - //entitylargefireball.accelerationZ *= 2; - double d8 = 4.0D; - Vec3 vec3 = this.getLook(1.0F); - entitylargefireball.posX = this.posX + vec3.xCoord * d8; - entitylargefireball.posY = this.posY + (double) (this.height / 2.0F) + 0.5D; - entitylargefireball.posZ = this.posZ + vec3.zCoord * d8; - this.worldObj.spawnEntityInWorld(entitylargefireball); - - for (int u=0; u<MathUtils.randInt(2, 10);u++) { - if (this.attackCounter > 0) { - Logger.INFO("Trying to do ranged attack 5a"); - --this.attackCounter; - EntityArrow entityarrow = new EntityArrow(this.worldObj, this, p_82196_1_, MathUtils.randFloat(1f, 3f), - (float) (14 - this.worldObj.difficultySetting.getDifficultyId() * 4)); - int i = MathUtils.randInt(0, 4); - int j = MathUtils.randInt(0, 3); - int k = MathUtils.randInt(0, 3); - entityarrow.setDamage((double) (p_82196_2_ * 2.0F) + this.rand.nextGaussian() * 0.25D - + (double) ((float) this.worldObj.difficultySetting.getDifficultyId() * 0.11F)); - - boolean boostAttack = MathUtils.randInt(0, 100) <= 21; - if (boostAttack) { - if (i > 0) { - entityarrow.setDamage(entityarrow.getDamage() + (double) i * 0.5D + 0.5D); - } - - if (j > 0) { - entityarrow.setKnockbackStrength(j); - } - if (k > 0) { - entityarrow.setFire(50 * k); - } - } - - this.playSound("mob.skeleton.say", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); - this.worldObj.spawnEntityInWorld(entityarrow); - Logger.INFO("Trying to do ranged attack 5a done"); - } - } - - - - - this.attackCounter = 0; - } - } else if (this.attackCounter > 0) { - Logger.INFO("Trying to do ranged attack 3b"); - --this.attackCounter; - } - } else { - Logger.INFO("Trying to do ranged attack 4a"); - this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(this.motionX, this.motionZ)) * 180.0F - / (float) Math.PI; - - if (this.attackCounter > 0) { - Logger.INFO("Trying to do ranged attack 5a"); - --this.attackCounter; - EntityArrow entityarrow = new EntityArrow(this.worldObj, this, p_82196_1_, 1.6F, - (float) (14 - this.worldObj.difficultySetting.getDifficultyId() * 4)); - int i = MathUtils.randInt(0, 4); - int j = MathUtils.randInt(0, 3); - int k = MathUtils.randInt(0, 3); - entityarrow.setDamage((double) (p_82196_2_ * 2.0F) + this.rand.nextGaussian() * 0.25D - + (double) ((float) this.worldObj.difficultySetting.getDifficultyId() * 0.11F)); - - boolean boostAttack = MathUtils.randInt(0, 100) <= 21; - if (boostAttack) { - if (i > 0) { - entityarrow.setDamage(entityarrow.getDamage() + (double) i * 0.5D + 0.5D); - } - - if (j > 0) { - entityarrow.setKnockbackStrength(j); - } - if (k > 0) { - entityarrow.setFire(50 * k); - } - } - - this.playSound("mob.skeleton.say", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); - this.worldObj.spawnEntityInWorld(entityarrow); - Logger.INFO("Trying to do ranged attack 5a done"); - } - - } - - } - - /** - * Returns the volume for the sounds this mob makes. - */ - protected float getSoundVolume() { - return 10.0F; - } - - /** - * Checks if the entity's current position is a valid location to spawn this - * entity. - */ - public boolean getCanSpawnHere() { - return super.getCanSpawnHere() && this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL; - } - - /** - * Will return how many at most can spawn in a chunk at once. - */ - public int getMaxSpawnedInChunk() { - return 1; - } - - protected Item getDropItem() { - return Items.gunpowder; - } - - /** - * Drop 0-2 items of this living's type. @param par1 - Whether this entity has - * recently been hit by a player. @param par2 - Level of Looting used to kill - * this mob. - */ - protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) { - int j = this.rand.nextInt(2) + this.rand.nextInt(1 + p_70628_2_); - int k; - - for (k = 0; k < j; ++k) { - this.dropItem(Items.ghast_tear, 1); - } - - j = this.rand.nextInt(3) + this.rand.nextInt(1 + p_70628_2_); - - for (k = 0; k < j; ++k) { - this.dropItem(Items.gunpowder, 1); - } - } - - @Override - protected void updateEntityActionState() { - if (!this.worldObj.isRemote && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) { - this.setDead(); - } - - this.despawnEntity(); - this.prevAttackCounter = this.attackCounter; - double d0 = this.waypointX - this.posX; - double d1 = this.waypointY - this.posY; - double d2 = this.waypointZ - this.posZ; - double d3 = d0 * d0 + d1 * d1 + d2 * d2; - - if (d3 < 1.0D || d3 > 3600.0D) { - this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); - this.waypointY = this.posY + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); - this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); - } - - if (this.courseChangeCooldown-- <= 0) { - this.courseChangeCooldown += this.rand.nextInt(5) + 2; - d3 = (double) MathHelper.sqrt_double(d3); - - if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, d3)) { - this.motionX += d0 / d3 * 0.1D; - this.motionY += d1 / d3 * 0.1D; - this.motionZ += d2 / d3 * 0.1D; - } else { - this.waypointX = this.posX; - this.waypointY = this.posY; - this.waypointZ = this.posZ; - } - } - - if (this.targetedEntity != null && this.targetedEntity.isDead) { - this.targetedEntity = null; - } - - if (this.targetedEntity == null || this.aggroCooldown-- <= 0) { - this.targetedEntity = this.worldObj.getClosestVulnerablePlayerToEntity(this, 100.0D); - - if (this.targetedEntity != null) { - this.aggroCooldown = 20; - } - } - - double d4 = 64.0D; - - if (this.targetedEntity != null && this.targetedEntity.getDistanceSqToEntity(this) < d4 * d4) { - double d5 = this.targetedEntity.posX - this.posX; - double d6 = this.targetedEntity.boundingBox.minY + (double) (this.targetedEntity.height / 2.0F) - - (this.posY + (double) (this.height / 2.0F)); - double d7 = this.targetedEntity.posZ - this.posZ; - this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(d5, d7)) * 180.0F / (float) Math.PI; - - if (this.canEntityBeSeen(this.targetedEntity)) { - if (this.attackCounter == 10) { - this.worldObj.playAuxSFXAtEntity((EntityPlayer) null, 1007, (int) this.posX, (int) this.posY, - (int) this.posZ, 0); - } - - ++this.attackCounter; - - if (this.attackCounter == 20) { - this.worldObj.playAuxSFXAtEntity((EntityPlayer) null, 1008, (int) this.posX, (int) this.posY, - (int) this.posZ, 0); - EntityLargeFireball entitylargefireball = new EntityLargeFireball(this.worldObj, this, d5, d6, d7); - entitylargefireball.field_92057_e = this.explosionStrength; - double d8 = 4.0D; - Vec3 vec3 = this.getLook(1.0F); - entitylargefireball.posX = this.posX + vec3.xCoord * d8; - entitylargefireball.posY = this.posY + (double) (this.height / 2.0F) + 0.5D; - entitylargefireball.posZ = this.posZ + vec3.zCoord * d8; - this.worldObj.spawnEntityInWorld(entitylargefireball); - this.attackCounter = -40; - } - } else if (this.attackCounter > 0) { - --this.attackCounter; - } - } else { - this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(this.motionX, this.motionZ)) * 180.0F - / (float) Math.PI; - - if (this.attackCounter > 0) { - --this.attackCounter; - } - } - - if (!this.worldObj.isRemote) { - byte b1 = this.dataWatcher.getWatchableObjectByte(16); - byte b0 = (byte) (this.attackCounter > 10 ? 1 : 0); - - if (b1 != b0) { - this.dataWatcher.updateObject(16, Byte.valueOf(b0)); - } - } - } - - /** - * True if the ghast has an unobstructed line of travel to the waypoint. - */ - private boolean isCourseTraversable(double p_70790_1_, double p_70790_3_, double p_70790_5_, double p_70790_7_) { - double d4 = (this.waypointX - this.posX) / p_70790_7_; - double d5 = (this.waypointY - this.posY) / p_70790_7_; - double d6 = (this.waypointZ - this.posZ) / p_70790_7_; - AxisAlignedBB axisalignedbb = this.boundingBox.copy(); - - for (int i = 1; (double) i < p_70790_7_; ++i) { - axisalignedbb.offset(d4, d5, d6); - - /* - * if (!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty()) - * { return false; } - */ - } - - return true; - } - - /** - * Called when the mob is falling. Calculates and applies fall damage. - */ - protected void fall(float p_70069_1_) { - } - - /** - * Takes in the distance the entity has fallen this tick and whether its on the - * ground to update the fall distance and deal fall damage if landing on the - * ground. Args: distanceFallenThisTick, onGround - */ - protected void updateFallState(double p_70064_1_, boolean p_70064_3_) { - } - - /** - * Moves the entity based on the specified heading. Args: strafe, forward - */ - public void moveEntityWithHeading(float p_70612_1_, float p_70612_2_) { - if (this.isInWater()) { - this.moveFlying(p_70612_1_, p_70612_2_, 0.02F); - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= 0.800000011920929D; - this.motionY *= 0.800000011920929D; - this.motionZ *= 0.800000011920929D; - } else if (this.handleLavaMovement()) { - this.moveFlying(p_70612_1_, p_70612_2_, 0.02F); - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= 0.5D; - this.motionY *= 0.5D; - this.motionZ *= 0.5D; - } else { - float f2 = 0.91F; - - if (this.onGround) { - f2 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), - MathHelper.floor_double(this.boundingBox.minY) - 1, - MathHelper.floor_double(this.posZ)).slipperiness * 0.91F; - } - - float f3 = 0.16277136F / (f2 * f2 * f2); - this.moveFlying(p_70612_1_, p_70612_2_, this.onGround ? 0.1F * f3 : 0.02F); - f2 = 0.91F; - - if (this.onGround) { - f2 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), - MathHelper.floor_double(this.boundingBox.minY) - 1, - MathHelper.floor_double(this.posZ)).slipperiness * 0.91F; - } - - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= (double) f2; - this.motionY *= (double) f2; - this.motionZ *= (double) f2; - } - - this.prevLimbSwingAmount = this.limbSwingAmount; - double d1 = this.posX - this.prevPosX; - double d0 = this.posZ - this.prevPosZ; - float f4 = MathHelper.sqrt_double(d1 * d1 + d0 * d0) * 4.0F; - - if (f4 > 1.0F) { - f4 = 1.0F; - } - - this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F; - this.limbSwing += this.limbSwingAmount; - } - - /** - * returns true if this entity is by a ladder, false otherwise - */ - public boolean isOnLadder() { - return false; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/monster/EntityGiantChickenBase.java b/src/Java/gtPlusPlus/core/entity/monster/EntityGiantChickenBase.java deleted file mode 100644 index 3a094e129b..0000000000 --- a/src/Java/gtPlusPlus/core/entity/monster/EntityGiantChickenBase.java +++ /dev/null @@ -1,311 +0,0 @@ -package gtPlusPlus.core.entity.monster; - -import net.minecraft.entity.*; -import net.minecraft.entity.ai.*; -import net.minecraft.entity.effect.EntityLightningBolt; -import net.minecraft.entity.passive.EntityChicken; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.potion.Potion; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; - -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.item.general.ItemGemShards; -import gtPlusPlus.core.util.math.MathUtils; -import net.minecraftforge.common.ForgeHooks; - -public class EntityGiantChickenBase extends EntityChicken { - - /** The time until the next egg is spawned. */ - public int timeUntilNextBigEgg; - - public EntityGiantChickenBase(World aWorld) - { - super(aWorld); - this.setSize(0.6F, 1.4F); //Double - this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000; - this.timeUntilNextBigEgg = this.rand.nextInt(16000) + 4000; - this.tasks.addTask(0, new EntityAISwimming(this)); - this.tasks.addTask(1, new EntityAIPanic(this, 1.4D)); - this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); - this.tasks.addTask(3, new EntityAITempt(this, 1.0D, ModItems.itemGemShards, false)); - this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D)); - this.tasks.addTask(4, new EntityAIEatGrass(this)); - this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); - this.tasks.addTask(5, new EntityAILookIdle(this)); - this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); - - } - - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.35D); - } - - /** - * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons - * use this to react to sunlight and start to burn. - */ - public void onLivingUpdate() - { - super.onLivingUpdate(); - this.field_70888_h = this.field_70886_e; - this.field_70884_g = this.destPos; - this.destPos = (float)((double)this.destPos + (double)(this.onGround ? -1 : 4) * 0.3D); - - if (this.destPos < 0.0F) - { - this.destPos = 0.0F; - } - - if (this.destPos > 1.0F) - { - this.destPos = 1.0F; - } - - if (!this.onGround && this.field_70889_i < 1.0F) - { - this.field_70889_i = 1.0F; - } - - this.field_70889_i = (float)((double)this.field_70889_i * 0.9D); - - if (!this.onGround && this.motionY < 0.0D) - { - this.motionY *= 0.6D; - } - - if (MathUtils.randInt(0, 10000) <= 5) { - jump(); - } - - this.field_70886_e += this.field_70889_i * 2.0F; - - if (!this.worldObj.isRemote && --this.timeUntilNextEgg <= 0) - { - this.playSound("mob.chicken.plop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); - this.dropItem(Items.egg, 1); - this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000; - } - if (!this.worldObj.isRemote && !this.isChild() && --this.timeUntilNextEgg <= 0) - { - this.playSound("mob.chicken.plop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); - this.dropItem(ModItems.itemBigEgg, MathUtils.randInt(1, 4)); - this.timeUntilNextBigEgg = this.rand.nextInt(16000) + 4000; - } - } - - /** - * Called when the mob is falling. Calculates and applies fall damage. - */ - protected void fall(float p_70069_1_) { - - if (MathUtils.randInt(0, 10) <= 5) { - jump(); - } - - } - - protected Item getDropItem() - { - return ModItems.itemBigEgg; - } - - /** - * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param - * par2 - Level of Looting used to kill this mob. - */ - protected void dropFewItems(boolean recentHit, int lootLevel) - { - int j = this.rand.nextInt(3) + this.rand.nextInt(1 + lootLevel); - - for (int k = 0; k < j; ++k) - { - this.dropItem(Items.feather, 1); - } - - //Large Egg Chance - for (int k = 0; k < j*2; ++k) - { - this.dropItem(ModItems.itemBigEgg, MathUtils.getRandomFromArray(new int[] {1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2})); - } - - //Chicken Corpses Dropped - int mBodies = MathUtils.getRandomFromArray(new int[] {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6}); - if (this.isBurning()) - { - this.dropItem(Items.cooked_chicken, mBodies); - } - else - { - this.dropItem(Items.chicken, mBodies); - } - } - - public EntityGiantChickenBase createChild(EntityAgeable p_90011_1_) - { - return new EntityGiantChickenBase(this.worldObj); - } - - /** - * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on - * the animal type) - */ - public boolean isBreedingItem(ItemStack aStack) - { - return aStack != null && aStack.getItem() instanceof ItemGemShards; - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - public void readEntityFromNBT(NBTTagCompound aNBT) - { - super.readEntityFromNBT(aNBT); - timeUntilNextBigEgg = aNBT.getInteger("timeUntilNextBigEgg"); - } - - /** - * Get the experience points the entity currently has. - */ - protected int getExperiencePoints(EntityPlayer p_70693_1_) - { - return this.isChickenJockey() ? 20 : super.getExperiencePoints(p_70693_1_); - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - public void writeEntityToNBT(NBTTagCompound aNBT) - { - super.writeEntityToNBT(aNBT); - aNBT.setInteger("timeUntilNextBigEgg", timeUntilNextBigEgg); - } - - /** - * Determines if an entity can be despawned, used on idle far away entities - */ - protected boolean canDespawn() - { - return this.isChickenJockey() && this.riddenByEntity == null; - } - - public void updateRiderPosition() - { - super.updateRiderPosition(); - float f = MathHelper.sin(this.renderYawOffset * (float)Math.PI / 180.0F); - float f1 = MathHelper.cos(this.renderYawOffset * (float)Math.PI / 180.0F); - float f2 = 0.1F; - float f3 = 0.0F; - this.riddenByEntity.setPosition(this.posX + (double)(f2 * f), this.posY + (double)(this.height * 0.5F) + this.riddenByEntity.getYOffset() + (double)f3, this.posZ - (double)(f2 * f1)); - - if (this.riddenByEntity instanceof EntityLivingBase) - { - ((EntityLivingBase)this.riddenByEntity).renderYawOffset = this.renderYawOffset; - } - } - - public boolean isChickenJockey() { - return func_152116_bZ(); - } - public void setIsChickenJockey(boolean isJockey) { - func_152117_i(isJockey); - } - - @Override - protected Entity findPlayerToAttack() { - // TODO Auto-generated method stub - return super.findPlayerToAttack(); - } - - @Override - public boolean interact(EntityPlayer p_70085_1_) { - // TODO Auto-generated method stub - return super.interact(p_70085_1_); - } - - @Override - public void setHomeArea(int p_110171_1_, int p_110171_2_, int p_110171_3_, int p_110171_4_) { - // TODO Auto-generated method stub - super.setHomeArea(p_110171_1_, p_110171_2_, p_110171_3_, p_110171_4_); - } - - @Override - public ChunkCoordinates getHomePosition() { - // TODO Auto-generated method stub - return super.getHomePosition(); - } - - @Override - public void detachHome() { - // TODO Auto-generated method stub - super.detachHome(); - } - - @Override - public boolean hasHome() { - // TODO Auto-generated method stub - return super.hasHome(); - } - - @Override - public void eatGrassBonus() { - if (this.isChild()) { - this.addGrowth(60); - } - } - - @Override - public float getRenderSizeModifier() { - return 1.0f; - } - - @Override - protected void jump() { - this.motionY = 0.68999998688697815D; - this.motionY += 0.068999998688697815D; - if (this.isPotionActive(Potion.jump)) - { - this.motionY += (double)((float)(this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.5F); - } - - if (this.isSprinting()) - { - float f = this.rotationYaw * 0.017453292F; - this.motionX -= (double)(MathHelper.sin(f) * 0.2F); - this.motionZ += (double)(MathHelper.cos(f) * 0.2F); - } - - this.isAirBorne = true; - - if (MathUtils.randInt(0, 10) < 10) { - jump(); - } - - ForgeHooks.onLivingJump(this); - } - - @Override - public void onStruckByLightning(EntityLightningBolt p_70077_1_) { - this.spawnExplosionParticle(); - this.spawnExplosionParticle(); - this.spawnExplosionParticle(); - this.spawnExplosionParticle(); - this.spawnExplosionParticle(); - this.spawnExplosionParticle(); - this.spawnExplosionParticle(); - super.onStruckByLightning(p_70077_1_); - } - - @Override - public boolean shouldDismountInWater(Entity rider) { - return true; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/monster/EntitySickBlaze.java b/src/Java/gtPlusPlus/core/entity/monster/EntitySickBlaze.java deleted file mode 100644 index a530f294e1..0000000000 --- a/src/Java/gtPlusPlus/core/entity/monster/EntitySickBlaze.java +++ /dev/null @@ -1,225 +0,0 @@ -package gtPlusPlus.core.entity.monster; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.monster.EntityMob; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; - -import gtPlusPlus.core.entity.projectile.EntityToxinballSmall; - -public class EntitySickBlaze extends EntityMob { - /** Random offset used in floating behaviour */ - private float heightOffset = 0.5F; - /** ticks until heightOffset is randomized */ - private int heightOffsetUpdateTime; - private int field_70846_g; - private final int mDataWatcherID = 30; - - public EntitySickBlaze(World p_i1731_1_) { - super(p_i1731_1_); - this.isImmuneToFire = true; - this.experienceValue = 10; - } - - @Override - protected void applyEntityAttributes() { - super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.5D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D); - } - - @Override - protected void entityInit() { - super.entityInit(); - this.dataWatcher.addObject(mDataWatcherID, new Byte((byte) 0)); - } - - /** - * Returns the sound this mob makes while it's alive. - */ - @Override - protected String getLivingSound() { - return "mob.blaze.breathe"; - } - - /** - * Returns the sound this mob makes when it is hurt. - */ - @Override - protected String getHurtSound() { - return "mob.blaze.hit"; - } - - /** - * Returns the sound this mob makes on death. - */ - @Override - protected String getDeathSound() { - return "mob.blaze.death"; - } - - @Override - @SideOnly(Side.CLIENT) - public int getBrightnessForRender(float p_70070_1_) { - return 15728880; - } - - /** - * Gets how bright this entity is. - */ - @Override - public float getBrightness(float p_70013_1_) { - return p_70013_1_; - } - - /** - * Called frequently so the entity can update its state every tick as - * required. For example, zombies and skeletons use this to react to - * sunlight and start to burn. - */ - @Override - public void onLivingUpdate() { - if (!this.worldObj.isRemote) { - if (this.isWet()) { - this.attackEntityFrom(DamageSource.drown, 1.0F); - } - - --this.heightOffsetUpdateTime; - - if (this.heightOffsetUpdateTime <= 0) { - this.heightOffsetUpdateTime = 100; - this.heightOffset = 0.5F + (float) this.rand.nextGaussian() * 3.0F; - } - - if (this.getEntityToAttack() != null && this.getEntityToAttack().posY - + this.getEntityToAttack().getEyeHeight() > this.posY + this.getEyeHeight() + this.heightOffset) { - this.motionY += (0.30000001192092896D - this.motionY) * 0.30000001192092896D; - } - } - - if (this.rand.nextInt(24) == 0) { - /*this.worldObj.playSoundEffect(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, "fire.fire", - 1.0F + this.rand.nextFloat(), this.rand.nextFloat() * 0.7F + 0.3F);*/ - } - - if (!this.onGround && this.motionY < 0.0D) { - this.motionY *= 0.6D; - } - - for (int i = 0; i < 2; ++i) { - this.worldObj.spawnParticle("crit", this.posX + (this.rand.nextDouble() - 0.5D) * this.width, - this.posY + this.rand.nextDouble() * this.height, - this.posZ + (this.rand.nextDouble() - 0.5D) * this.width, 0.0D, 0.0D, 0.0D); - } - - super.onLivingUpdate(); - } - - /** - * Basic mob attack. Default to touch of death in EntityCreature. Overridden - * by each mob to define their attack. - */ - @Override - protected void attackEntity(Entity entity, float p_70785_2_) { - if (this.attackTime <= 0 && p_70785_2_ < 2.0F && entity.boundingBox.maxY > this.boundingBox.minY - && entity.boundingBox.minY < this.boundingBox.maxY) { - this.attackTime = 20; - this.attackEntityAsMob(entity); - } - else if (p_70785_2_ < 30.0F) { - double d0 = entity.posX - this.posX; - double d1 = entity.boundingBox.minY + entity.height / 2.0F - (this.posY + this.height / 2.0F); - double d2 = entity.posZ - this.posZ; - - if (this.attackTime == 0) { - ++this.field_70846_g; - - if (this.field_70846_g == 1) { - this.attackTime = 60; - } - else if (this.field_70846_g <= 4) { - this.attackTime = 6; - } - else { - this.attackTime = 100; - this.field_70846_g = 0; - } - - if (this.field_70846_g > 1) { - float f1 = MathHelper.sqrt_float(p_70785_2_) * 0.5F; - this.worldObj.playAuxSFXAtEntity((EntityPlayer) null, 1009, (int) this.posX, (int) this.posY, - (int) this.posZ, 0); - - for (int i = 0; i < 1; ++i) { - EntityToxinballSmall entitysmalltoxinball = new EntityToxinballSmall(this.worldObj, this, - d0 + this.rand.nextGaussian() * f1, d1, d2 + this.rand.nextGaussian() * f1); - entitysmalltoxinball.posY = this.posY + this.height / 2.0F + 0.5D; - this.worldObj.spawnEntityInWorld(entitysmalltoxinball); - } - } - } - - this.rotationYaw = (float) (Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F; - this.hasAttacked = true; - } - } - - /** - * Called when the mob is falling. Calculates and applies fall damage. - */ - @Override - protected void fall(float p_70069_1_) { - } - - @Override - protected Item getDropItem() { - return Items.slime_ball; - } - - /** - * Returns true if the entity is on fire. Used by render to add the fire - * effect on rendering. - */ - @Override - public boolean isBurning() { - return false; - } - - /** - * Drop 0-2 items of this living's type. @param par1 - Whether this entity - * has recently been hit by a player. @param par2 - Level of Looting used to - * kill this mob. - */ - @Override - protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) { - if (p_70628_1_) { - int j = this.rand.nextInt(2 + p_70628_2_); - - for (int k = 0; k < j; ++k) { - this.dropItem(getDropItem(), 1); - } - } - } - - /** - * Checks to make sure the light is not too bright where the mob is spawning - */ - @Override - protected boolean isValidLightLevel() { - return true; - } - - @Override - public int getMaxSpawnedInChunk() { - return 8; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java b/src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java deleted file mode 100644 index f6f397f59e..0000000000 --- a/src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java +++ /dev/null @@ -1,553 +0,0 @@ -package gtPlusPlus.core.entity.monster; - -import java.lang.reflect.Field; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.core.world.explosions.ExplosionHandler; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.entity.*; -import net.minecraft.entity.ai.*; -import net.minecraft.entity.effect.EntityLightningBolt; -import net.minecraft.entity.monster.EntityIronGolem; -import net.minecraft.entity.monster.IMob; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MathHelper; -import net.minecraft.village.Village; -import net.minecraft.world.World; - -public class EntityStaballoyConstruct extends EntityIronGolem { - - /* - * Determines whether or not the entity is in a fluid at all. - */ - private boolean inFluid = false; - private boolean mReflectFirstUpdate = true; - private boolean isReadyToExplode = false; - private int fuse = 60; - private int attackTimer; - - public EntityStaballoyConstruct(World world) { - super(world); - this.experienceValue = 250; - this.setSize(1.4F, 2.9F); - this.getNavigator().setAvoidsWater(true); - this.getNavigator().setBreakDoors(true); - this.getNavigator().setCanSwim(false); - this.getNavigator().setAvoidSun(false); - this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); - this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); - //this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); - this.tasks.addTask(3, new EntityAIMoveTowardsRestriction(this, 1.0D)); - this.tasks.addTask(4, new EntityAIWander(this, 0.6D)); - this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); - this.tasks.addTask(6, new EntityAILookIdle(this)); - this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false)); - this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - @Override - public void writeEntityToNBT(NBTTagCompound p_70014_1_) { - super.writeEntityToNBT(p_70014_1_); - p_70014_1_.setBoolean("inFluid", this.inFluid); - p_70014_1_.setBoolean("isReadyToExplode", this.isReadyToExplode); - p_70014_1_.setInteger("fuse", this.fuse); - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - @Override - public void readEntityFromNBT(NBTTagCompound p_70037_1_) { - super.readEntityFromNBT(p_70037_1_); - this.inFluid = p_70037_1_.getBoolean("inFluid"); - this.isReadyToExplode = p_70037_1_.getBoolean("isReadyToExplode"); - this.fuse = p_70037_1_.getInteger("fuse"); - } - - @Override - protected void entityInit() { - super.entityInit(); - this.dataWatcher.addObject(17, Byte.valueOf((byte) 0)); - } - - /** - * Returns true if the newer Entity AI code should be run - */ - @Override - public boolean isAIEnabled() { - return true; - } - - /** - * main AI tick function, replaces updateEntityActionState - */ - @Override - protected void updateAITick() { - super.updateAITick(); - } - - @Override - protected void applyEntityAttributes() { - super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(500.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D); - } - - /** - * Decrements the entity's air supply when underwater - */ - @Override - protected int decreaseAirSupply(int p_70682_1_) { - return 0; - } - - @Override - protected void collideWithEntity(Entity p_82167_1_) { - if (p_82167_1_ instanceof IMob && this.getRNG().nextInt(20) == 0) { - this.setAttackTarget((EntityLivingBase) p_82167_1_); - } - - super.collideWithEntity(p_82167_1_); - } - - /** - * Called frequently so the entity can update its state every tick as - * required. For example, zombies and skeletons use this to react to - * sunlight and start to burn. - */ - @Override - public void onLivingUpdate() { - super.onLivingUpdate(); - - if (this.attackTimer > 0) { - --this.attackTimer; - } - - if (this.motionX * this.motionX + this.motionZ * this.motionZ > 2.500000277905201E-7D - && this.rand.nextInt(5) == 0) { - int i = MathHelper.floor_double(this.posX); - int j = MathHelper.floor_double(this.posY - 0.20000000298023224D - this.yOffset); - int k = MathHelper.floor_double(this.posZ); - Block block = this.worldObj.getBlock(i, j, k); - - - - if (block.getMaterial() != Material.air) { - this.worldObj.spawnParticle( - "blockcrack_" + Block.getIdFromBlock(block) + "_" + this.worldObj.getBlockMetadata(i, j, k), - this.posX + (this.rand.nextFloat() - 0.5D) * this.width, - this.boundingBox.minY + 0.1D, - this.posZ + (this.rand.nextFloat() - 0.5D) * this.width, - 4.0D * (this.rand.nextFloat() - 0.5D), 0.5D, - (this.rand.nextFloat() - 0.5D) * 4.0D); - } - } - } - - /** - * Returns true if this entity can attack entities of the specified class. - */ - @Override - public boolean canAttackClass(Class clazz) { - return clazz.equals(this.getClass()) ? false : true; - } - - @Override - public boolean attackEntityAsMob(Entity p_70652_1_) { - this.attackTimer = 10; - this.worldObj.setEntityState(this, (byte) 4); - boolean flag = p_70652_1_.attackEntityFrom(DamageSource.causeMobDamage(this), - 7 + this.rand.nextInt(15)); - - if (flag) { - p_70652_1_.motionY += 0.4000000059604645D; - } - - this.playSound("mob.irongolem.throw", 1.0F, 1.0F); - return flag; - } - - @Override - @SideOnly(Side.CLIENT) - public void handleHealthUpdate(byte p_70103_1_) { - if (p_70103_1_ == 4) { - this.attackTimer = 10; - this.playSound("mob.irongolem.throw", 1.0F, 1.0F); - } - else { - super.handleHealthUpdate(p_70103_1_); - } - } - - @Override - public Village getVillage() { - return null; - } - - @Override - @SideOnly(Side.CLIENT) - public int getAttackTimer() { - return this.attackTimer; - } - - /** - * Returns the sound this mob makes when it is hurt. - */ - @Override - protected String getHurtSound() { - return "mob.irongolem.hit"; - } - - /** - * Returns the sound this mob makes on death. - */ - @Override - protected String getDeathSound() { - return "mob.irongolem.death"; - } - - @Override - protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) { - this.playSound("mob.irongolem.walk", 1.0F, 1.0F); - } - - /** - * Drop 0-2 items of this living's type. @param par1 - Whether this entity - * has recently been hit by a player. @param par2 - Level of Looting used to - * kill this mob. - */ - @Override - protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) { - int lootingChance = p_70628_2_+1; - int j = this.rand.nextInt(3); - int k; - - for (k = 0; k < j; ++k) { - this.entityDropItem(ItemUtils.getItemStackOfAmountFromOreDict("blockStaballoy", 1), 0f); - } - - k = 3 + this.rand.nextInt(3); - - for (int l = 0; l < k; ++l) { - this.entityDropItem(ItemUtils.getItemStackOfAmountFromOreDict("ingotStaballoy", lootingChance), 0f); - if (MathUtils.randInt(0, 2) == 0){ - this.entityDropItem(ItemUtils.getItemStackOfAmountFromOreDict("plateStaballoy", lootingChance), 0f); - } - } - } - - @Override - public boolean isPlayerCreated() { - return false; - } - - @Override - public void setPlayerCreated(boolean p_70849_1_) { - - } - - /** - * Called when the mob's health reaches 0. - */ - @Override - public void onDeath(DamageSource p_70645_1_) { - super.onDeath(p_70645_1_); - } - - @Override - protected String getLivingSound() { //TODO - return super.getLivingSound(); - } - - @Override - public int getTalkInterval() { - return 0; - } - - @Override - protected boolean canDespawn() { - return true; - } - - @Override - public void onEntityUpdate() { - //Set Fire Immunity - if (!this.isImmuneToFire){ - this.isImmuneToFire = true; - } - - if (!this.worldObj.isRemote) { - final float hp = getHealth(); - final float modifier = MathUtils.randInt(5,10)/100F; - final float amountToExplode = (hp*modifier); - - if (hp <= amountToExplode && !isReadyToExplode){ - if (this.ticksExisted >= 50) { - //Logger.INFO("Construct has low hp, trying to enable explosions. HP: "+this.getHealth()+", Max: "+this.getMaxHealth()+", Mod: "+modifier); - //Logger.INFO("Construct required HP to be <= "+amountToExplode); - float r = MathUtils.randFloat(0, 10); - if (r <= 0.1){ - this.isReadyToExplode = true; - //Logger.INFO("Construct can now explode."); - } - } - } - //Handle Exploding - else if (hp <= amountToExplode && isReadyToExplode){ - //Logger.INFO("Trying to explode. ["+this.fuse+"]"); - if (this.fuse-- <= 0){ - //Logger.INFO("Fuse has run out."); - this.setDead(); - if (!this.worldObj.isRemote) - { - this.explode(); - } - } - else { - //Logger.INFO("Ticking fuse and spawning particles."); - - int maxFuse = 60; - int fuseUsed = maxFuse-this.fuse; - float var2 = (float) (fuseUsed * 0.1); - - this.setSize(1.4F+(var2/2), 2.9F+(var2/2)); - - float r = MathUtils.randFloat(0, 1); - int r2 = MathUtils.randInt(5, 15); - for (int o=0;o<r2;o++){ - if (r <= 0.3){ - this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - - } - else if (r <= 0.6){ - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - - } - if (r <= 0.3){ - this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - - } - else if (r <= 0.7){ - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - - } - if (r <= 0.2){ - this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - - } - else if (r <= 0.5){ - this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - - } - else if (r <= 0.7){ - this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - - } - } - - - } - } - else { - - } - - //Get a private field from a super class if it exists. - if (mFirstUpdateField == null) { - mFirstUpdateField = ReflectionUtils.getField(this.getClass(), "firstUpdate"); - } - if (mFirstUpdateField != null && mReflectFirstUpdate == true){ - try { - this.mReflectFirstUpdate = (boolean) mFirstUpdateField.get(this); - } - catch (IllegalArgumentException | IllegalAccessException e) {} - } - } - super.onEntityUpdate(); - } - - private static Field mFirstUpdateField; - - @Override - public int getMaxSpawnedInChunk() { - return 1; - } - - @Override - public boolean canBreatheUnderwater() { - return true; - } - - @Override - public void knockBack(Entity p_70653_1_, float p_70653_2_, double p_70653_3_, double p_70653_5_) { - // Do Nothing because he weighs metric shittonnes. - } - - @Override - protected void setOnFireFromLava() { - extinguish(); - } - - @Override - public void setFire(int p_70015_1_) { - extinguish(); - } - - @Override - protected void dealFireDamage(int p_70081_1_) { - - } - - @Override - public boolean isInWater() { - if (super.isInWater()){ - return true; - } - else { - this.moveForward *= 0.98F; - return false; - } - } - - @Override - public boolean handleWaterMovement() { - this.moveForward *= 0.74F; - return handleFluidMovement(Material.water); - } - - @Override - public boolean handleLavaMovement() { - this.moveForward *= 0.74F; - return handleFluidMovement(Material.lava); - } - - /** - * Returns if this entity is in water and will end up adding the waters velocity to the entity - */ - public boolean handleFluidMovement(Material fluid){ - - - - if (this.worldObj.handleMaterialAcceleration(this.boundingBox.expand(0.0D, -0.4000000059604645D, 0.0D).contract(0.001D, 0.001D, 0.001D), fluid, this)) - { - if (!this.inFluid && !this.mReflectFirstUpdate) - { - float f = MathHelper.sqrt_double(this.motionX * this.motionX * 0.20000000298023224D + this.motionY * this.motionY + this.motionZ * this.motionZ * 0.20000000298023224D) * 0.2F; - - if (f > 1.0F) - { - f = 1.0F; - } - - this.playSound(this.getSplashSound(), f, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.4F); - float f1 = MathHelper.floor_double(this.boundingBox.minY); - int i; - float f2; - float f3; - - for (i = 0; i < 1.0F + this.width * 20.0F; ++i) - { - f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; - f3 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; - this.worldObj.spawnParticle("bubble", this.posX + f2, f1 + 1.0F, this.posZ + f3, this.motionX, this.motionY - this.rand.nextFloat() * 0.2F, this.motionZ); - } - - for (i = 0; i < 1.0F + this.width * 20.0F; ++i) - { - f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; - f3 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; - this.worldObj.spawnParticle("splash", this.posX + f2, f1 + 1.0F, this.posZ + f3, this.motionX, this.motionY, this.motionZ); - } - } - this.fallDistance = 0.0F; - this.inFluid = true; - } - else - { - this.inFluid = false; - } - return this.inFluid; - } - - @Override - public void onChunkLoad() { - // TODO Auto-generated method stub - super.onChunkLoad(); - } - - @Override - public void onStruckByLightning(EntityLightningBolt p_70077_1_) { - this.isReadyToExplode = true; - this.fuse = 20; - } - - private void explode(){ - /* float f = 12.0F; - this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true);*/ - - if (!this.worldObj.isRemote) { - final float f = 6.5F; - ExplosionHandler explode = new ExplosionHandler(); - explode.createExplosion(this.worldObj, this, this.posX, this.posY, this.posZ, f, true, true); - - float r = MathUtils.randFloat(0, 1); - int r2 = MathUtils.randInt(20, 40); - for (int o=0;o<r2;o++){ - if (r <= 0.3){ - this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(0, 3), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D); - - } - else if (r <= 0.6){ - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D); - - } - if (r <= 0.3){ - this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D); - - } - else if (r <= 0.7){ - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D); - - } - if (r <= 0.2){ - this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D); - - } - else if (r <= 0.5){ - this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D); - - } - else if (r <= 0.7){ - this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D); - - } - } - } - - } - - @Override - public boolean canAttackWithItem() { - return true; - } - - @Override - public boolean canRenderOnFire() { - return false; - } - - @Override - public boolean isPushedByWater() { - return false; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/projectile/EntityHydrofluoricAcidPotion.java b/src/Java/gtPlusPlus/core/entity/projectile/EntityHydrofluoricAcidPotion.java deleted file mode 100644 index 9f3e6b8bf1..0000000000 --- a/src/Java/gtPlusPlus/core/entity/projectile/EntityHydrofluoricAcidPotion.java +++ /dev/null @@ -1,127 +0,0 @@ -package gtPlusPlus.core.entity.projectile; - -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.projectile.EntityThrowable; -import net.minecraft.init.Blocks; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; - -import gregtech.api.util.GT_Utility; - -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EntityUtils; - -public class EntityHydrofluoricAcidPotion extends EntityThrowable { - - public EntityHydrofluoricAcidPotion(World world) { - super(world); - } - - public EntityHydrofluoricAcidPotion(World world, EntityLivingBase entity) { - super(world, entity); - } - - public EntityHydrofluoricAcidPotion(World world, double posX, double posY, double posZ) { - super(world, posX, posY, posZ); - } - - /** - * Called when this EntityThrowable hits a block or entity. - */ - @Override - protected void onImpact(MovingObjectPosition object) { - int xBlock = object.blockX; - int yBlock = object.blockY; - int zBlock = object.blockZ; - if (object.entityHit != null) { - byte b0 = 6; - if (!GT_Utility.isWearingFullRadioHazmat((EntityLivingBase) object.entityHit)){ - object.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), b0); - EntityUtils.setEntityOnFire(object.entityHit, 5); - - if (object.entityHit instanceof EntityPlayer){ - EntityPlayer mPlayer = (EntityPlayer) object.entityHit; - mPlayer.addPotionEffect(new PotionEffect(Potion.blindness.getId(), 200, 1)); - mPlayer.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 300, 2)); - mPlayer.addPotionEffect(new PotionEffect(Potion.confusion.getId(), 250, 2)); - } - - object.entityHit.fireResistance = 0; - ravage(EntityUtils.findBlockPosUnderEntity(object.entityHit)); - - } - } - if (object.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK){ - ravage(new BlockPos(xBlock, yBlock, zBlock)); - } - - String mParticleType = "reddust"; - int e=0; - for (int i = 0; i < 24; ++i) { - if ((e = MathUtils.randInt(0, 5)) <= 1){ - if (e==0) - mParticleType = "largesmoke"; - if (e==1) - mParticleType = "flame"; - } - this.worldObj.spawnParticle(mParticleType, this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - } - - if (!this.worldObj.isRemote) { - this.setDead(); - } - } - - private boolean ravage(BlockPos blockpos){ - - int radius = 2; - - for (int i=(blockpos.xPos-radius);i<(blockpos.xPos+radius);i++){ - for (int j=(blockpos.yPos-radius);j<(blockpos.yPos+radius);j++){ - for (int h=(blockpos.zPos-radius);h<(blockpos.zPos+radius);h++){ - - int mChance = MathUtils.randInt(1, 10); - if (mChance <= 3){ - Block mBlockhit = worldObj.getBlock(i, j, h); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - - //GT_Pollution.addPollution(worldObj.getChunkFromBlockCoords(blockpos.xPos, blockpos.zPos), mPol); - - if (mBlockhit == Blocks.grass || mBlockhit == Blocks.mycelium){ - worldObj.setBlock(i, j+1, h, Blocks.fire); - worldObj.setBlock(i, j, h, Blocks.dirt); - } - else if (mBlockhit == Blocks.leaves || mBlockhit == Blocks.leaves2){ - worldObj.setBlock(i, j, h, Blocks.fire); - } - else if (mBlockhit == Blocks.tallgrass){ - worldObj.setBlock(i, j, h, Blocks.fire); - if (worldObj.getBlock(i, j-1, h) == Blocks.grass){ - worldObj.setBlock(i, j-1, h, Blocks.dirt); - } - } - else if (mBlockhit == Blocks.carrots || mBlockhit == Blocks.melon_block || mBlockhit == Blocks.pumpkin || mBlockhit == Blocks.potatoes){ - worldObj.setBlock(i, j+1, h, Blocks.fire); - worldObj.setBlock(i, j, h, Blocks.dirt); - } - else if (mBlockhit == Blocks.air){ - worldObj.setBlock(i, j, h, Blocks.fire); - } - } - } - } - } - - - return true; - } - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/projectile/EntityLightningAttack.java b/src/Java/gtPlusPlus/core/entity/projectile/EntityLightningAttack.java deleted file mode 100644 index 868517d1db..0000000000 --- a/src/Java/gtPlusPlus/core/entity/projectile/EntityLightningAttack.java +++ /dev/null @@ -1,76 +0,0 @@ -package gtPlusPlus.core.entity.projectile; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.projectile.EntityWitherSkull; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.EnumDifficulty; -import net.minecraft.world.World; - -public class EntityLightningAttack extends EntityWitherSkull { - - public EntityLightningAttack(World p_i1793_1_) - { - super(p_i1793_1_); - this.setSize(0.3125F, 0.3125F); - } - - public EntityLightningAttack(World p_i1794_1_, EntityLivingBase p_i1794_2_, double p_i1794_3_, double p_i1794_5_, double p_i1794_7_) - { - super(p_i1794_1_, p_i1794_2_, p_i1794_3_, p_i1794_5_, p_i1794_7_); - this.setSize(0.3125F, 0.3125F); - } - - @SideOnly(Side.CLIENT) - public EntityLightningAttack(World p_i1795_1_, double p_i1795_2_, double p_i1795_4_, double p_i1795_6_, double p_i1795_8_, double p_i1795_10_, double p_i1795_12_) - { - super(p_i1795_1_, p_i1795_2_, p_i1795_4_, p_i1795_6_, p_i1795_8_, p_i1795_10_, p_i1795_12_); - this.setSize(0.3125F, 0.3125F); - } - - - /** - * Called when this EntityFireball hits a block or entity. - */ - protected void onImpact(MovingObjectPosition p_70227_1_) { - - if (!this.worldObj.isRemote) { - if (p_70227_1_.entityHit != null) { - if (this.shootingEntity != null) { - if (p_70227_1_.entityHit.attackEntityFrom(DamageSource.causeMobDamage(this.shootingEntity), 8.0F) - && !p_70227_1_.entityHit.isEntityAlive()) { - this.shootingEntity.heal(0.5F); - } - } else { - p_70227_1_.entityHit.attackEntityFrom(DamageSource.lava, 10.0F); - } - - if (p_70227_1_.entityHit instanceof EntityLivingBase) { - byte b0 = 0; - - if (this.worldObj.difficultySetting == EnumDifficulty.NORMAL) { - b0 = 10; - } else if (this.worldObj.difficultySetting == EnumDifficulty.HARD) { - b0 = 40; - } - - if (b0 > 0) { - ((EntityLivingBase) p_70227_1_.entityHit).addPotionEffect(new PotionEffect(Potion.poison.id, 20 * b0, 1)); - ((EntityLivingBase) p_70227_1_.entityHit).addPotionEffect(new PotionEffect(Potion.confusion.id, 20 * b0, 1)); - ((EntityLivingBase) p_70227_1_.entityHit).addPotionEffect(new PotionEffect(Potion.weakness.id, 20 * b0, 1)); - } - } - } - - this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, 1.0F, false, - this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")); - this.setDead(); - } - } - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/projectile/EntitySulfuricAcidPotion.java b/src/Java/gtPlusPlus/core/entity/projectile/EntitySulfuricAcidPotion.java deleted file mode 100644 index 7660dd1b75..0000000000 --- a/src/Java/gtPlusPlus/core/entity/projectile/EntitySulfuricAcidPotion.java +++ /dev/null @@ -1,115 +0,0 @@ -package gtPlusPlus.core.entity.projectile; - -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.projectile.EntityThrowable; -import net.minecraft.init.Blocks; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; - -import gregtech.api.util.GT_Utility; - -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EntityUtils; - -public class EntitySulfuricAcidPotion extends EntityThrowable { - - public EntitySulfuricAcidPotion(World world) { - super(world); - } - - public EntitySulfuricAcidPotion(World world, EntityLivingBase entity) { - super(world, entity); - } - - public EntitySulfuricAcidPotion(World world, double posX, double posY, double posZ) { - super(world, posX, posY, posZ); - } - - /** - * Called when this EntityThrowable hits a block or entity. - */ - @Override - protected void onImpact(MovingObjectPosition object) { - int xBlock = object.blockX; - int yBlock = object.blockY; - int zBlock = object.blockZ; - if (object.entityHit != null) { - byte b0 = 6; - if (!GT_Utility.isWearingFullRadioHazmat((EntityLivingBase) object.entityHit)){ - object.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), b0); - EntityUtils.setEntityOnFire(object.entityHit, 10); - object.entityHit.fireResistance = 0; - ravage(EntityUtils.findBlockPosUnderEntity(object.entityHit)); - } - } - if (object.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK){ - ravage(new BlockPos(xBlock, yBlock, zBlock)); - } - - String mParticleType = "reddust"; - int e=0; - for (int i = 0; i < 24; ++i) { - if ((e = MathUtils.randInt(0, 5)) <= 1){ - if (e==0) - mParticleType = "largesmoke"; - if (e==1) - mParticleType = "flame"; - } - this.worldObj.spawnParticle(mParticleType, this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - } - - if (!this.worldObj.isRemote) { - this.setDead(); - } - } - - private boolean ravage(BlockPos blockpos){ - - int radius = 1; - - for (int i=(blockpos.xPos-radius);i<(blockpos.xPos+radius);i++){ - for (int j=(blockpos.yPos-radius);j<(blockpos.yPos+radius);j++){ - for (int h=(blockpos.zPos-radius);h<(blockpos.zPos+radius);h++){ - - int mChance = MathUtils.randInt(1, 10); - if (mChance <= 3){ - Block mBlockhit = worldObj.getBlock(i, j, h); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - - //GT_Pollution.addPollution(worldObj.getChunkFromBlockCoords(blockpos.xPos, blockpos.zPos), mPol); - - if (mBlockhit == Blocks.grass || mBlockhit == Blocks.mycelium){ - worldObj.setBlock(i, j+1, h, Blocks.fire); - worldObj.setBlock(i, j, h, Blocks.dirt); - } - else if (mBlockhit == Blocks.leaves || mBlockhit == Blocks.leaves2){ - worldObj.setBlock(i, j, h, Blocks.fire); - } - else if (mBlockhit == Blocks.tallgrass){ - worldObj.setBlock(i, j, h, Blocks.fire); - if (worldObj.getBlock(i, j-1, h) == Blocks.grass){ - worldObj.setBlock(i, j-1, h, Blocks.dirt); - } - } - else if (mBlockhit == Blocks.carrots || mBlockhit == Blocks.melon_block || mBlockhit == Blocks.pumpkin || mBlockhit == Blocks.potatoes){ - worldObj.setBlock(i, j+1, h, Blocks.fire); - worldObj.setBlock(i, j, h, Blocks.dirt); - } - else if (mBlockhit == Blocks.air){ - worldObj.setBlock(i, j, h, Blocks.fire); - } - } - } - } - } - - - return true; - } - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/projectile/EntityThrowableBomb.java b/src/Java/gtPlusPlus/core/entity/projectile/EntityThrowableBomb.java deleted file mode 100644 index 49daa459e0..0000000000 --- a/src/Java/gtPlusPlus/core/entity/projectile/EntityThrowableBomb.java +++ /dev/null @@ -1,145 +0,0 @@ -package gtPlusPlus.core.entity.projectile; - -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.projectile.EntityThrowable; -import net.minecraft.init.Blocks; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; - -import gregtech.api.util.GT_Utility; - -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; - -public class EntityThrowableBomb extends EntityThrowable { - - public EntityThrowableBomb(World world) { - super(world); - } - - public EntityThrowableBomb(World world, EntityLivingBase entity) { - super(world, entity); - } - - public EntityThrowableBomb(World world, double posX, double posY, double posZ) { - super(world, posX, posY, posZ); - } - - /** - * Called when this EntityThrowable hits a block or entity. - */ - @Override - protected void onImpact(MovingObjectPosition object) { - int xBlock = object.blockX; - int yBlock = object.blockY; - int zBlock = object.blockZ; - if (object.entityHit != null) { - byte b0 = 6; - if (!GT_Utility.isWearingFullRadioHazmat((EntityLivingBase) object.entityHit)){ - object.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 20); - EntityUtils.setEntityOnFire(object.entityHit, 20); - object.entityHit.fireResistance = 0; - ravage(EntityUtils.findBlockPosUnderEntity(object.entityHit)); - } - } - if (object.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK){ - - ravage(new BlockPos(xBlock, yBlock, zBlock)); - for (BlockPos aSur : new BlockPos(xBlock, yBlock, zBlock).getSurroundingBlocks()) { - ravage(new BlockPos(aSur.xPos, aSur.yPos, aSur.zPos)); - for (BlockPos aSur2 : new BlockPos(aSur.xPos, aSur.yPos, aSur.zPos).getSurroundingBlocks()) { - //ravage(new BlockPos(aSur2.xPos, aSur2.yPos, aSur2.zPos)); - } - } - } - - String mParticleType = "reddust"; - int e=0; - for (int i = 0; i < 127; ++i) { - if ((e = MathUtils.randInt(0, 5)) <= 1){ - if (e==0) - mParticleType = "largesmoke"; - if (e==1) - mParticleType = "flame"; - } - this.worldObj.spawnParticle(mParticleType, this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - } - - if (!this.worldObj.isRemote) { - this.setDead(); - } - } - - private boolean ravage(BlockPos blockpos){ - - int radius = 5; - - for (int i=(blockpos.xPos-radius);i<(blockpos.xPos+radius);i++){ - for (int j=(blockpos.yPos-radius);j<(blockpos.yPos+radius);j++){ - for (int h=(blockpos.zPos-radius);h<(blockpos.zPos+radius);h++){ - - int mChance = MathUtils.randInt(0, 100); - if (mChance <= 3){ - Block mBlockhit = worldObj.getBlock(i, j, h); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); - - PollutionUtils.addPollution(worldObj.getChunkFromBlockCoords(blockpos.xPos, blockpos.zPos), 500); - this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 0.01f, true); - if (mBlockhit == Blocks.grass || mBlockhit == Blocks.mycelium){ - worldObj.setBlock(i, j+1, h, Blocks.fire); - worldObj.setBlock(i, j, h, Blocks.dirt); - } - else if (mBlockhit == Blocks.leaves || mBlockhit == Blocks.leaves2){ - worldObj.setBlock(i, j, h, Blocks.fire); - } - else if (mBlockhit == Blocks.tallgrass){ - worldObj.setBlock(i, j, h, Blocks.fire); - if (worldObj.getBlock(i, j-1, h) == Blocks.grass){ - worldObj.setBlock(i, j-1, h, Blocks.dirt); - } - } - else if (mBlockhit == Blocks.carrots || mBlockhit == Blocks.melon_block || mBlockhit == Blocks.pumpkin || mBlockhit == Blocks.potatoes){ - worldObj.setBlock(i, j+1, h, Blocks.fire); - worldObj.setBlock(i, j, h, Blocks.dirt); - } - else if (mBlockhit == Blocks.air){ - worldObj.setBlock(i, j, h, Blocks.fire); - } - } - } - } - } - - - return true; - } - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/projectile/EntityToxinball.java b/src/Java/gtPlusPlus/core/entity/projectile/EntityToxinball.java deleted file mode 100644 index 4fe72345b2..0000000000 --- a/src/Java/gtPlusPlus/core/entity/projectile/EntityToxinball.java +++ /dev/null @@ -1,327 +0,0 @@ -package gtPlusPlus.core.entity.projectile; - -import java.util.List; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.projectile.EntityFireball; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.*; -import net.minecraft.world.World; - -public abstract class EntityToxinball extends EntityFireball { - protected int entityX = -1; - protected int entityY = -1; - protected int entityZ = -1; - private Block block; - private boolean inGround; - private int ticksAlive; - private int ticksInAir; - - public EntityToxinball(World world) { - super(world); - this.setSize(1.0F, 1.0F); - } - - @Override - protected void entityInit() { - } - - /** - * Checks if the entity is in range to render by using the past in distance - * and comparing it to its average edge length * 64 * renderDistanceWeight - * Args: distance - */ - @Override - @SideOnly(Side.CLIENT) - public boolean isInRangeToRenderDist(double p_70112_1_) { - double d1 = this.boundingBox.getAverageEdgeLength() * 4.0D; - d1 *= 64.0D; - return p_70112_1_ < d1 * d1; - } - - public EntityToxinball(World world, double x, double y, double z, double f1, double f2, double f3) { - super(world); - this.setSize(1.0F, 1.0F); - this.setLocationAndAngles(x, y, z, this.rotationYaw, this.rotationPitch); - this.setPosition(x, y, z); - double d6 = MathHelper - .sqrt_double(f1 * f1 + f2 * f2 + f3 * f3); - this.accelerationX = f1 / d6 * 0.1D; - this.accelerationY = f2 / d6 * 0.1D; - this.accelerationZ = f3 / d6 * 0.1D; - } - - public EntityToxinball(World world, EntityLivingBase entity, double x, double y, double z) { - super(world); - this.shootingEntity = entity; - this.setSize(1.0F, 1.0F); - this.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, - entity.rotationPitch); - this.setPosition(this.entityX, this.entityY, this.entityZ); - this.yOffset = 0.0F; - this.motionX = this.motionY = this.motionZ = 0.0D; - x += this.rand.nextGaussian() * 0.4D; - y += this.rand.nextGaussian() * 0.4D; - z += this.rand.nextGaussian() * 0.4D; - double d3 = MathHelper.sqrt_double(x * x + y * y + z * z); - this.accelerationX = x / d3 * 0.1D; - this.accelerationY = y / d3 * 0.1D; - this.accelerationZ = z / d3 * 0.1D; - } - - /** - * Called to update the entity's position/logic. - */ - @Override - public void onUpdate() { - if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead - || !this.worldObj.blockExists(this.entityX, this.entityY, this.entityZ))) { - this.setDead(); - } - else { - super.onUpdate(); - this.setFire(1); - - if (this.inGround) { - if (this.worldObj.getBlock(this.entityX, this.entityY, - this.entityZ) == this.block) { - ++this.ticksAlive; - - if (this.ticksAlive == 600) { - this.setDead(); - } - - return; - } - - this.inGround = false; - this.motionX *= this.rand.nextFloat() * 0.2F; - this.motionY *= this.rand.nextFloat() * 0.2F; - this.motionZ *= this.rand.nextFloat() * 0.2F; - this.ticksAlive = 0; - this.ticksInAir = 0; - } - else { - ++this.ticksInAir; - } - - Vec3 vec3 = Vec3.createVectorHelper(this.entityX, this.entityY, this.entityZ); - Vec3 vec31 = Vec3.createVectorHelper(this.entityX + this.motionX, this.entityY + this.motionY, - this.entityZ + this.motionZ); - MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3, vec31); - vec3 = Vec3.createVectorHelper(this.entityX, this.entityY, this.entityZ); - vec31 = Vec3.createVectorHelper(this.entityX + this.motionX, this.entityY + this.motionY, - this.entityZ + this.motionZ); - - if (movingobjectposition != null) { - vec31 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, - movingobjectposition.hitVec.zCoord); - } - - Entity entity = null; - List<?> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, - this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); - double d0 = 0.0D; - - for (int i = 0; i < list.size(); ++i) { - Entity entity1 = (Entity) list.get(i); - - if (entity1.canBeCollidedWith() - && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) { - float f = 0.3F; - AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f); - MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); - - if (movingobjectposition1 != null) { - double d1 = vec3.distanceTo(movingobjectposition1.hitVec); - - if (d1 < d0 || d0 == 0.0D) { - entity = entity1; - d0 = d1; - } - } - } - } - - if (entity != null) { - movingobjectposition = new MovingObjectPosition(entity); - } - - if (movingobjectposition != null) { - this.onImpact(movingobjectposition); - } - - this.entityX += this.motionX; - this.entityY += this.motionY; - this.entityZ += this.motionZ; - float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.rotationYaw = (float) (Math.atan2(this.motionZ, this.motionX) * 180.0D / Math.PI) + 90.0F; - - for (this.rotationPitch = (float) (Math.atan2(f1, this.motionY) * 180.0D / Math.PI) - - 90.0F; this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { - ; - } - - while (this.rotationPitch - this.prevRotationPitch >= 180.0F) { - this.prevRotationPitch += 360.0F; - } - - while (this.rotationYaw - this.prevRotationYaw < -180.0F) { - this.prevRotationYaw -= 360.0F; - } - - while (this.rotationYaw - this.prevRotationYaw >= 180.0F) { - this.prevRotationYaw += 360.0F; - } - - this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; - this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; - float f2 = this.getMotionFactor(); - - if (this.isInWater()) { - for (int j = 0; j < 4; ++j) { - float f3 = 0.25F; - this.worldObj.spawnParticle("bubble", this.entityX - this.motionX * f3, this.entityY - this.motionY * f3, - this.entityZ - this.motionZ * f3, this.motionX, this.motionY, this.motionZ); - } - - f2 = 0.8F; - } - - this.motionX += this.accelerationX; - this.motionY += this.accelerationY; - this.motionZ += this.accelerationZ; - this.motionX *= f2; - this.motionY *= f2; - this.motionZ *= f2; - this.worldObj.spawnParticle("smoke", this.entityX, this.entityY + 0.5D, this.entityZ, 0.0D, 0.0D, 0.0D); - this.setPosition(this.entityX, this.entityY, this.entityZ); - } - } - - /** - * Return the motion factor for this projectile. The factor is multiplied by - * the original motion. - */ - @Override - protected float getMotionFactor() { - return 0.95F; - } - - /** - * Called when this EntityFireball hits a block or entity. - */ - @Override - protected abstract void onImpact(MovingObjectPosition p_70227_1_); - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - @Override - public void writeEntityToNBT(NBTTagCompound aTag) { - aTag.setShort("xTile", (short) this.entityX); - aTag.setShort("yTile", (short) this.entityY); - aTag.setShort("zTile", (short) this.entityZ); - aTag.setByte("inTile", (byte) Block.getIdFromBlock(this.block)); - aTag.setByte("inGround", (byte) (this.inGround ? 1 : 0)); - aTag.setTag("direction", - this.newDoubleNBTList(new double[] { this.motionX, this.motionY, this.motionZ })); - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - @Override - public void readEntityFromNBT(NBTTagCompound aTag) { - this.entityX = aTag.getShort("xTile"); - this.entityY = aTag.getShort("yTile"); - this.entityZ = aTag.getShort("zTile"); - this.block = Block.getBlockById(aTag.getByte("inTile") & 255); - this.inGround = aTag.getByte("inGround") == 1; - - if (aTag.hasKey("direction", 9)) { - NBTTagList nbttaglist = aTag.getTagList("direction", 6); - this.motionX = nbttaglist.func_150309_d(0); - this.motionY = nbttaglist.func_150309_d(1); - this.motionZ = nbttaglist.func_150309_d(2); - } - else { - this.setDead(); - } - } - - /** - * Returns true if other Entities should be prevented from moving through - * this Entity. - */ - @Override - public boolean canBeCollidedWith() { - return true; - } - - @Override - public float getCollisionBorderSize() { - return 1.0F; - } - - /** - * Called when the entity is attacked. - */ - @Override - public boolean attackEntityFrom(DamageSource damage, float p_70097_2_) { - if (this.isEntityInvulnerable()) { - return false; - } - else { - this.setBeenAttacked(); - - if (damage.getEntity() != null) { - Vec3 vec3 = damage.getEntity().getLookVec(); - - if (vec3 != null) { - this.motionX = vec3.xCoord; - this.motionY = vec3.yCoord; - this.motionZ = vec3.zCoord; - this.accelerationX = this.motionX * 0.1D; - this.accelerationY = this.motionY * 0.1D; - this.accelerationZ = this.motionZ * 0.1D; - } - - if (damage.getEntity() instanceof EntityLivingBase) { - this.shootingEntity = (EntityLivingBase) damage.getEntity(); - } - - return true; - } - else { - return false; - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public float getShadowSize() { - return 0.0F; - } - - /** - * Gets how bright this entity is. - */ - @Override - public float getBrightness(float p_70013_1_) { - return 1.0F; - } - - @Override - @SideOnly(Side.CLIENT) - public int getBrightnessForRender(float p_70070_1_) { - return 15728880; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/projectile/EntityToxinballSmall.java b/src/Java/gtPlusPlus/core/entity/projectile/EntityToxinballSmall.java deleted file mode 100644 index 78469c9dad..0000000000 --- a/src/Java/gtPlusPlus/core/entity/projectile/EntityToxinballSmall.java +++ /dev/null @@ -1,88 +0,0 @@ -package gtPlusPlus.core.entity.projectile; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.init.Blocks; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; - -public class EntityToxinballSmall extends EntityToxinball { - - public EntityToxinballSmall(World p_i1770_1_) { - super(p_i1770_1_); - this.setSize(0.3125F, 0.3125F); - } - - public EntityToxinballSmall(World world, EntityLivingBase entity, double x, double y, double z) { - super(world, entity, x, y, z); - this.setSize(0.3125F, 0.3125F); - } - - public EntityToxinballSmall(World p_i1772_1_, double p_i1772_2_, double p_i1772_4_, double p_i1772_6_, double p_i1772_8_, double p_i1772_10_, double p_i1772_12_) { - super(p_i1772_1_, p_i1772_2_, p_i1772_4_, p_i1772_6_, p_i1772_8_, p_i1772_10_, p_i1772_12_); - this.setSize(0.3125F, 0.3125F); - } - - /** - * Called when this EntityFireball hits a block or entity. - */ - @Override - protected void onImpact(MovingObjectPosition MoP) { - if (!this.worldObj.isRemote) { - if (MoP.entityHit != null) { - if (!MoP.entityHit.isImmuneToFire() && MoP.entityHit - .attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 5.0F)) { - MoP.entityHit.setFire(5); - } - } - else { - int i = MoP.blockX; - int j = MoP.blockY; - int k = MoP.blockZ; - - switch (MoP.sideHit) { - case 0: - --j; - break; - case 1: - ++j; - break; - case 2: - --k; - break; - case 3: - ++k; - break; - case 4: - --i; - break; - case 5: - ++i; - } - - if (this.worldObj.isAirBlock(i, j, k)) { - this.worldObj.setBlock(i, j, k, Blocks.fire); - } - } - - this.setDead(); - } - } - - /** - * Returns true if other Entities should be prevented from moving through - * this Entity. - */ - @Override - public boolean canBeCollidedWith() { - return false; - } - - /** - * Called when the entity is attacked. - */ - @Override - public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) { - return false; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/fluids/BlockFluidBase.java b/src/Java/gtPlusPlus/core/fluids/BlockFluidBase.java deleted file mode 100644 index dc7c9c2e78..0000000000 --- a/src/Java/gtPlusPlus/core/fluids/BlockFluidBase.java +++ /dev/null @@ -1,104 +0,0 @@ -package gtPlusPlus.core.fluids; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.BlockFluidClassic; -import net.minecraftforge.fluids.Fluid; - -public class BlockFluidBase extends BlockFluidClassic { - - @SideOnly(Side.CLIENT) - protected static IIcon stillIcon; - @SideOnly(Side.CLIENT) - protected static IIcon flowingIcon; - - protected final short[] mRGB; - - - public BlockFluidBase(Fluid fluid, short[] aRGB) { - this(fluid, Material.water, aRGB); - } - - public BlockFluidBase(Fluid fluid, Material material, short[] aRGB) { - super(fluid, material); - mRGB = aRGB; - this.setHardness(100.0F); - this.setLightOpacity(3); - this.disableStats(); - } - - @Override - public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity ent) { - if (!(ent instanceof EntityLivingBase)) { - return; - } - /*EntityLivingBase player = (EntityLivingBase) ent; - int pot = world.rand.nextInt(Potion.potionTypes.length); - Potion.potionTypes[pot].performEffect(player, 40);*/ - } - - @Override - public IIcon getIcon(int side, int meta) { - return (side == 0 || side == 1) ? stillIcon : flowingIcon; - } - - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(IIconRegister register) { - if (stillIcon == null) { - stillIcon = register.registerIcon(CORE.MODID+ ":" + "fluids/fluid.fluid.autogenerated.still"); - } - if (flowingIcon == null) { - flowingIcon = register.registerIcon(CORE.MODID+ ":" + "fluids/fluid.fluid.autogenerated.flowing"); - } - } - - @Override - public int getBlockColor() { - if (mRGB != null && mRGB.length >= 3) { - return Utils.rgbtoHexValue(mRGB[0], mRGB[1], mRGB[2]); - } - return super.getBlockColor(); - } - - @Override - public int getRenderColor(int aMeta) { - if (mRGB != null && mRGB.length >= 3) { - return Utils.rgbtoHexValue(mRGB[0], mRGB[1], mRGB[2]); - } - return super.getRenderColor(aMeta); - } - - @Override - public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour) { - // TODO Auto-generated method stub - return super.recolourBlock(world, x, y, z, side, colour); - } - - @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/gtPlusPlus/core/fluids/FactoryFluid.java b/src/Java/gtPlusPlus/core/fluids/FactoryFluid.java deleted file mode 100644 index e3383aee91..0000000000 --- a/src/Java/gtPlusPlus/core/fluids/FactoryFluid.java +++ /dev/null @@ -1,49 +0,0 @@ -package gtPlusPlus.core.fluids; -import gregtech.api.GregTech_API; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.block.Block; -import net.minecraft.item.EnumRarity; -import net.minecraftforge.fluids.Fluid; - -public class FactoryFluid extends Fluid implements Runnable { - - private final String mTextureName; - private final short[] mRGBa; - - public FactoryFluid(String fluidName, final short[] aRGBa) { - this(fluidName, null, Short.MIN_VALUE, Short.MIN_VALUE, Short.MIN_VALUE, Short.MIN_VALUE, false, EnumRarity.common, aRGBa); - } - - public FactoryFluid(String fluidName, int luminosity, int density, int temp, int viscosity, final short[] aRGBa) { - this(fluidName, null, luminosity, density, temp, viscosity, (density == Short.MIN_VALUE || density >= 0 ? false : true), EnumRarity.common, aRGBa); - } - - public FactoryFluid(String fluidName, Block aBlock, int luminosity, int density, int temp, int viscosity, boolean gas, EnumRarity aRarity, final short[] aRGBa) { - super(fluidName); - this.mRGBa = aRGBa; - this.setBlock(aBlock); - if (luminosity != Short.MIN_VALUE) - this.setLuminosity(luminosity); - if (density != Short.MIN_VALUE) - this.setDensity(density); - if (temp != Short.MIN_VALUE) - this.setTemperature(temp); - if (viscosity != Short.MIN_VALUE) - this.setViscosity(viscosity); - this.setGaseous(gas); - this.setRarity(aRarity); - this.mTextureName = CORE.MODID+":fluids/fluid.fluid.autogenerated"; - GregTech_API.sGTBlockIconload.add(this); - } - - @Override - public int getColor() { - return (Math.max(0, Math.min(255, this.mRGBa[0])) << 16) | (Math.max(0, Math.min(255, this.mRGBa[1])) << 8) | Math.max(0, Math.min(255, this.mRGBa[2])); - } - - @Override - public void run() { - this.setIcons(GregTech_API.sBlockIcons.registerIcon(this.mTextureName)); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/fluids/FluidFactory.java b/src/Java/gtPlusPlus/core/fluids/FluidFactory.java deleted file mode 100644 index d94fa35af7..0000000000 --- a/src/Java/gtPlusPlus/core/fluids/FluidFactory.java +++ /dev/null @@ -1,214 +0,0 @@ -package gtPlusPlus.core.fluids; - -import java.util.LinkedHashMap; -import java.util.Map; - -import cpw.mods.fml.common.eventhandler.Event.Result; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.GTplusplus.INIT_PHASE; -import gtPlusPlus.api.objects.GregtechException; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.item.base.itemblock.FluidItemBlock; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; -import net.minecraftforge.event.entity.player.FillBucketEvent; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidRegistry; - -public class FluidFactory { - - public static final Map<String, Fluid> mNameToFluidMap = new LinkedHashMap<String, Fluid>(); - public static final Map<String, ItemStack> mNameToBucketMap = new LinkedHashMap<String, ItemStack>(); - public static final Map<String, Block> mNameToBlockMap = new LinkedHashMap<String, Block>(); - public static final Map<String, Integer> mNameToMetaMap = new LinkedHashMap<String, Integer>(); - - public static final Map<Fluid, String> mFluidToNameMap = new LinkedHashMap<Fluid, String>(); - public static final Map<Fluid, ItemStack> mFluidToBucketMap = new LinkedHashMap<Fluid, ItemStack>(); - public static final Map<Fluid, Block> mFluidToBlockMap = new LinkedHashMap<Fluid, Block>(); - public static final Map<Fluid, Integer> mFluidToMetaMap = new LinkedHashMap<Fluid, Integer>(); - - public static final Map<ItemStack, Fluid> mBucketToFluidMap = new LinkedHashMap<ItemStack, Fluid>(); - public static final Map<ItemStack, String> mBucketToNameMap = new LinkedHashMap<ItemStack, String>(); - public static final Map<ItemStack, Block> mBucketToBlockMap = new LinkedHashMap<ItemStack, Block>(); - public static final Map<ItemStack, Integer> mBucketToMetaMap = new LinkedHashMap<ItemStack, Integer>(); - - public static final Map<Block, String> mBlockToNameMap = new LinkedHashMap<Block, String>(); - public static final Map<Block, Fluid> mBlockToFluidMap = new LinkedHashMap<Block, Fluid>(); - public static final Map<Block, ItemStack> mBlockToBucketMap = new LinkedHashMap<Block, ItemStack>(); - public static final Map<Block, Integer> mBlockToMetaMap = new LinkedHashMap<Block, Integer>(); - - public static final Map<Integer, String> mMetaToNameMap = new LinkedHashMap<Integer, String>(); - public static final Map<Integer, Fluid> mMetaToFluidMap = new LinkedHashMap<Integer, Fluid>(); - public static final Map<Integer, ItemStack> mMetaToBucketMap = new LinkedHashMap<Integer, ItemStack>(); - public static final Map<Integer, Block> mMetaToBlockMap = new LinkedHashMap<Integer, Block>(); - - - //Special Colour Handling - public static final Map<Integer, Integer> mMetaToColourMap = new LinkedHashMap<Integer, Integer>(); - - - public static Item mGenericBucket; - private static FluidPackage mErrorFluid; - private static AutoMap<FluidPackage> mGeneratedFluids = new AutoMap<FluidPackage>(); - - public static void preInit() { - - } - - public static void init() { - mGenericBucket = new ItemGenericFluidBucket(Blocks.air); - GameRegistry.registerItem(mGenericBucket, "gtpp.bucket.generic"); - for (FluidPackage y : mGeneratedFluids) { - if (!y.valid()) { - continue; - } - GameRegistry.registerBlock(y.mBlock, FluidItemBlock.class, "gtpp_" + y.mName); - FluidContainerRegistry.registerFluidContainer(y.get(), y.mBucket, new ItemStack(Items.bucket)); - } - Utils.registerEvent(BucketHandler.INSTANCE); - } - - public static void postInit() { - - } - - /** - * Generates a 'Water' type fluid. - * @param aID - The Fluid ID (Must be unique) - * @param aUnlocalName - Unlocalized Fluid Name - * @param aRGB - a {@link Short[]} containing the RGB of the FluidPackage. - * @return - A fully constructed & registered {@linkplain FluidPackage} - */ - public static FluidPackage generate(int aID, String aUnlocalName, short[] aRGB) { - return generate(aID, aUnlocalName, Short.MIN_VALUE, Short.MIN_VALUE, Short.MIN_VALUE, Short.MIN_VALUE, aRGB); - } - - /** - * Generate a {@link FluidPackage} from the data provided. This FluidPackage is automatically registered and handled internally. - * Pass in {@link Short}.MIN_VALUE for any of the Fluid Fields (Besides ID, Name or RGB) and it will default to water values. - * @param aID - The Fluid ID (Must be unique) - * @param aUnlocalName - Unlocalized Fluid Name - * @param luminosity - How bright is the fluid. - * @param density - completely arbitrary; negative density indicates that the fluid is - * lighter than air. Default value is approximately the real-life density of water in kg/m^3. - * @param temp - completely arbitrary; higher temperature indicates that the fluid is - * hotter than air. Default value is approximately the real-life room temperature of water in degrees Kelvin - * @param viscosity - completely arbitrary; negative values are not - * permissible. Default value is approximately the real-life density of water in m/s^2 (x10^-3). * - * Higher viscosity means that a fluid flows more slowly, like molasses. - * Lower viscosity means that a fluid flows more quickly, like helium. - * @param aRGB - a {@link Short[]} containing the RGB of the FluidPackage. - * @return - A fully constructed & registered {@linkplain FluidPackage} - */ - public static FluidPackage generate(int aID, String aUnlocalName, int luminosity, int density, int temp, - int viscosity, short[] aRGB) { - - FluidPackage aFluidToGenerate = null; - - // Check Load Phase for some Safety, only allow this to be called in Pre-Init. - if (GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.PRE_INIT) { - try { - throw new GregtechException("Cannot generate Fluid Packages outside of Pre-Init!"); - } catch (GregtechException e) { - e.printStackTrace(); - CORE.crash("Cannot generate Fluid Packages outside of Pre-Init!"); - } - } - - Fluid aGenFluid = fluid(aUnlocalName, luminosity, density, temp, viscosity, aRGB); - Block aGenBlock = block(aGenFluid, aRGB); - ItemStack aGenBucket = bucket(aID); - - aFluidToGenerate = new FluidPackage(aID, aUnlocalName, aGenFluid, aGenBucket, aGenBlock); - - if (aFluidToGenerate != null && aFluidToGenerate.valid()) { - FluidRegistry.registerFluid(aFluidToGenerate.get()); - mGeneratedFluids.put(aFluidToGenerate); - } - else { - // Handle Bad generation - if (mErrorFluid == null) { - mErrorFluid = new FluidPackage(0, "", FluidUtils.getWater(1).getFluid(), ItemUtils.getSimpleStack(Items.water_bucket), Blocks.water); - } - return mErrorFluid; - } - - - return aFluidToGenerate; - } - - - - private static Fluid fluid(String aUnlocalName, int luminosity, int density, int temp, - int viscosity, short[] aRGB) { - return new FactoryFluid(aUnlocalName, luminosity, density, temp, viscosity, aRGB); - } - - private static ItemStack bucket(int aID) { - return ItemGenericFluidBucket.registerFluidForBucket(aID); - } - - private static Block block(Fluid aFluidForBlock, short[] aRGB) { - if (aFluidForBlock != null) { - FluidRegistry.registerFluid(aFluidForBlock); - return new BlockFluidBase(aFluidForBlock, aRGB); - } - return Blocks.dirt; - } - - /** - * Copyright © SpaceToad, 2011 http://www.mod-buildcraft.com BuildCraft is - * distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. - * Please check the contents of the license located in - * http://www.mod-buildcraft.com/MMPL-1.0.txt - * - * Modified version of the BC BucketHandler, except using ItemStacks > Items - * (Why?) - * - * @author Alkalus - */ - - public static class BucketHandler { - - public static BucketHandler INSTANCE = new BucketHandler(); - - private BucketHandler() { - - } - - @SubscribeEvent - public void onBucketFill(FillBucketEvent event) { - ItemStack result = fillCustomBucket(event.world, event.target); - if (result == null) { - return; - } - event.result = result; - event.setResult(Result.ALLOW); - } - - private ItemStack fillCustomBucket(World world, MovingObjectPosition pos) { - Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ); - ItemStack bucket = mBlockToBucketMap.get(block); - if (bucket != null && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0) { - world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ); - return ItemUtils.getSimpleStack(bucket, 1); - } else { - return null; - } - } - - } - -} diff --git a/src/Java/gtPlusPlus/core/fluids/FluidPackage.java b/src/Java/gtPlusPlus/core/fluids/FluidPackage.java deleted file mode 100644 index 29f831776b..0000000000 --- a/src/Java/gtPlusPlus/core/fluids/FluidPackage.java +++ /dev/null @@ -1,83 +0,0 @@ -package gtPlusPlus.core.fluids; - -import static gtPlusPlus.core.fluids.FluidFactory.mBlockToBucketMap; -import static gtPlusPlus.core.fluids.FluidFactory.mBlockToFluidMap; -import static gtPlusPlus.core.fluids.FluidFactory.mBlockToMetaMap; -import static gtPlusPlus.core.fluids.FluidFactory.mBlockToNameMap; -import static gtPlusPlus.core.fluids.FluidFactory.mBucketToBlockMap; -import static gtPlusPlus.core.fluids.FluidFactory.mBucketToFluidMap; -import static gtPlusPlus.core.fluids.FluidFactory.mBucketToMetaMap; -import static gtPlusPlus.core.fluids.FluidFactory.mBucketToNameMap; -import static gtPlusPlus.core.fluids.FluidFactory.mFluidToBlockMap; -import static gtPlusPlus.core.fluids.FluidFactory.mFluidToBucketMap; -import static gtPlusPlus.core.fluids.FluidFactory.mFluidToMetaMap; -import static gtPlusPlus.core.fluids.FluidFactory.mFluidToNameMap; -import static gtPlusPlus.core.fluids.FluidFactory.mMetaToBlockMap; -import static gtPlusPlus.core.fluids.FluidFactory.mMetaToBucketMap; -import static gtPlusPlus.core.fluids.FluidFactory.mMetaToColourMap; -import static gtPlusPlus.core.fluids.FluidFactory.mMetaToFluidMap; -import static gtPlusPlus.core.fluids.FluidFactory.mMetaToNameMap; -import static gtPlusPlus.core.fluids.FluidFactory.mNameToBlockMap; -import static gtPlusPlus.core.fluids.FluidFactory.mNameToBucketMap; -import static gtPlusPlus.core.fluids.FluidFactory.mNameToFluidMap; -import static gtPlusPlus.core.fluids.FluidFactory.mNameToMetaMap; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; - -public class FluidPackage { - - - public final int mID; - public final String mName; - private final Fluid mFluid; - public final ItemStack mBucket; - public final Block mBlock; - - public FluidPackage(int aID, String aName, Fluid aFluid, ItemStack aBucket, Block aBlock) { - - mNameToFluidMap.put(aName, aFluid); - mNameToBucketMap.put(aName, aBucket); - mNameToBlockMap.put(aName, aBlock); - mNameToMetaMap.put(aName, aID); - - mFluidToNameMap.put(aFluid, aName); - mFluidToBucketMap.put(aFluid, aBucket); - mFluidToBlockMap.put(aFluid, aBlock); - mFluidToMetaMap.put(aFluid, aID); - - mBucketToFluidMap.put(aBucket, aFluid); - mBucketToNameMap.put(aBucket, aName); - mBucketToBlockMap.put(aBucket, aBlock); - mBucketToMetaMap.put(aBucket, aID); - - mBlockToNameMap.put(aBlock, aName); - mBlockToFluidMap.put(aBlock, aFluid); - mBlockToBucketMap.put(aBlock, aBucket); - mBlockToMetaMap.put(aBlock, aID); - - mMetaToNameMap.put(aID, aName); - mMetaToFluidMap.put(aID, aFluid); - mMetaToBucketMap.put(aID, aBucket); - mMetaToBlockMap.put(aID, aBlock); - - mMetaToColourMap.put(aID, aFluid.getColor()); - - mID = aID; - mName = aName; - mFluid = aFluid; - mBucket = aBucket; - mBlock = aBlock; - - } - - public Fluid get() { - return mFluid; - } - - public boolean valid() { - return mName != null && mName.length() > 0 && mFluid != null && mBucket != null && mBlock != null; - } - -} diff --git a/src/Java/gtPlusPlus/core/fluids/FluidRegistryHandler.java b/src/Java/gtPlusPlus/core/fluids/FluidRegistryHandler.java deleted file mode 100644 index bc4df596de..0000000000 --- a/src/Java/gtPlusPlus/core/fluids/FluidRegistryHandler.java +++ /dev/null @@ -1,53 +0,0 @@ -package gtPlusPlus.core.fluids; - -import static gtPlusPlus.core.block.ModBlocks.*; - -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.block.material.Material; - -import gtPlusPlus.core.block.general.fluids.BlockFluidSludge; -import gtPlusPlus.core.lib.CORE; -import net.minecraftforge.fluids.FluidRegistry; - -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(){ - fluidSludge(); - } - - private static void fluidSludge(){ - //testFluid - fluidSludge.setLuminosity(8); - fluidSludge.setDensity(8196); - fluidSludge.setTemperature(295); - fluidSludge.setViscosity(3000); - fluidSludge.setGaseous(false); - fluidSludge.setUnlocalizedName("fluid.sludge"); - FluidRegistry.registerFluid(fluidSludge); - blockFluidSludge = new BlockFluidSludge(fluidSludge, Material.cactus).setBlockName("fluidBlockSludge"); - GameRegistry.registerBlock(blockFluidSludge, CORE.MODID + "_" + blockFluidSludge.getUnlocalizedName().substring(5)); - fluidSludge.setUnlocalizedName(blockFluidSludge.getUnlocalizedName()); - } - -} diff --git a/src/Java/gtPlusPlus/core/fluids/ItemGenericFluidBucket.java b/src/Java/gtPlusPlus/core/fluids/ItemGenericFluidBucket.java deleted file mode 100644 index 6354be632d..0000000000 --- a/src/Java/gtPlusPlus/core/fluids/ItemGenericFluidBucket.java +++ /dev/null @@ -1,319 +0,0 @@ -package gtPlusPlus.core.fluids; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import cpw.mods.fml.common.eventhandler.Event; -import gtPlusPlus.api.objects.GregtechException; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -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.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBucket; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.player.FillBucketEvent; - -public class ItemGenericFluidBucket extends ItemBucket { - - private static IIcon mBaseBucketTexture; - private static IIcon mOverlayBucketTexture; - private static AutoMap<Block> mInternalFluidCache = new AutoMap<Block>(); - - public ItemGenericFluidBucket(Block aFluid) { - super(aFluid); - this.setContainerItem(Items.bucket); - this.maxStackSize = 1; - mInternalFluidCache.put(aFluid); - } - - public static ItemStack registerFluidForBucket(int aID) { - - if (FluidFactory.mMetaToBucketMap.containsKey(aID)) { - try { - throw new GregtechException(""+aID+" is already registered! Unable to register fluid: "+FluidFactory.mMetaToFluidMap.get(aID).getLocalizedName()); - } catch (GregtechException e) { - e.printStackTrace(); - CORE.crash(""+aID+" is already registered! Unable to register fluid: "+FluidFactory.mMetaToFluidMap.get(aID).getLocalizedName()); - } - } - mInternalFluidCache.put(FluidFactory.mMetaToBlockMap.get(aID)); - return ItemUtils.simpleMetaStack(FluidFactory.mGenericBucket, aID, 1); - } - - Map<Integer, IIcon> mIconCache = new LinkedHashMap<Integer, IIcon>(); - - /** - * Called whenever this item is equipped and the right mouse button is pressed. - * Args: itemStack, world, entityPlayer - */ - public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - - Block isFull = FluidFactory.mMetaToBlockMap.get(aStack.getItemDamage()); - - boolean flag = isFull == Blocks.air; - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(aWorld, aPlayer, flag); - - if (movingobjectposition == null || isFull == null) { - return aStack; - } else { - FillBucketEvent event = new FillBucketEvent(aPlayer, aStack, aWorld, movingobjectposition); - if (MinecraftForge.EVENT_BUS.post(event)) { - return aStack; - } - - if (event.getResult() == Event.Result.ALLOW) { - if (aPlayer.capabilities.isCreativeMode) { - return aStack; - } - - if (--aStack.stackSize <= 0) { - return event.result; - } - - if (!aPlayer.inventory.addItemStackToInventory(event.result)) { - aPlayer.dropPlayerItemWithRandomChoice(event.result, false); - } - - return aStack; - } - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; - - if (!aWorld.canMineBlock(aPlayer, i, j, k)) { - return aStack; - } - - if (flag) { - if (!aPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, aStack)) { - return aStack; - } - - Material material = aWorld.getBlock(i, j, k).getMaterial(); - int l = aWorld.getBlockMetadata(i, j, k); - - if (material == Material.water && l == 0) { - aWorld.setBlockToAir(i, j, k); - return this.func_150910_a(aStack, aPlayer, Items.water_bucket); - } - - if (material == Material.lava && l == 0) { - aWorld.setBlockToAir(i, j, k); - return this.func_150910_a(aStack, aPlayer, Items.lava_bucket); - } - } else { - if (isFull == Blocks.air) { - return new ItemStack(Items.bucket); - } - - if (movingobjectposition.sideHit == 0) { - --j; - } - - if (movingobjectposition.sideHit == 1) { - ++j; - } - - if (movingobjectposition.sideHit == 2) { - --k; - } - - if (movingobjectposition.sideHit == 3) { - ++k; - } - - if (movingobjectposition.sideHit == 4) { - --i; - } - - if (movingobjectposition.sideHit == 5) { - ++i; - } - - if (!aPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, aStack)) { - return aStack; - } - - if (this.tryPlaceContainedLiquid(isFull, aWorld, i, j, k) && !aPlayer.capabilities.isCreativeMode) { - return new ItemStack(Items.bucket); - } - } - } - - return aStack; - } - } - - private ItemStack func_150910_a(ItemStack p_150910_1_, EntityPlayer p_150910_2_, Item p_150910_3_) { - if (p_150910_2_.capabilities.isCreativeMode) { - return p_150910_1_; - } else if (--p_150910_1_.stackSize <= 0) { - return new ItemStack(p_150910_3_); - } else { - if (!p_150910_2_.inventory.addItemStackToInventory(new ItemStack(p_150910_3_))) { - p_150910_2_.dropPlayerItemWithRandomChoice(new ItemStack(p_150910_3_, 1, 0), false); - } - - return p_150910_1_; - } - } - - /** - * Attempts to place the liquid contained inside the bucket. - */ - public boolean tryPlaceContainedLiquid(Block isFull, World aWorld, int aX, int aY, int aZ) { - if (isFull == Blocks.air) { - return false; - } else { - Material material = aWorld.getBlock(aX, aY, aZ).getMaterial(); - boolean flag = !material.isSolid(); - - if (!aWorld.isAirBlock(aX, aY, aZ) && !flag) { - return false; - } else { - - if (!aWorld.isRemote && flag && !material.isLiquid()) { - aWorld.func_147480_a(aX, aY, aZ, true); - } - - aWorld.setBlock(aX, aY, aZ, isFull, 0, 3); - - return true; - } - } - } - - @Override - public IIcon getIconFromDamage(int aMeta) { - IIcon aTemp = mIconCache.get(aMeta); - return aTemp != null ? aTemp : super.getIconFromDamage(aMeta); - } - - @Override - public boolean getHasSubtypes() { - return mInternalFluidCache.size() > 0; - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - list.add(new ItemStack(item, 1, 0)); - for (Block f : mInternalFluidCache) { - Integer aMeta; - if (f != null) { - aMeta = FluidFactory.mBlockToMetaMap.get(f); - if (aMeta != null) { - list.add(new ItemStack(item, 1, aMeta)); - } - } - } - } - - @Override - public int getMaxDamage() { - return 512; - } - - @Override - public boolean isDamageable() { - return false; - } - - @Override - public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) { - // TODO Auto-generated method stub - super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_); - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public boolean isRepairable() { - return false; - } - - @Override - public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { - if (stack != null && renderPass == 1) { - return mOverlayBucketTexture; - } - else { - return mBaseBucketTexture; - } - /*IIcon aTemp = mIconCache.get(stack.getItemDamage()); - return aTemp != null ? aTemp : super.getIcon(stack, renderPass, player, usingItem, useRemaining);*/ - } - - @Override - public boolean isBookEnchantable(ItemStack stack, ItemStack book) { - return false; - } - - @Override - public int getMaxDamage(ItemStack stack) { - return 512; - } - - @Override - public boolean isDamaged(ItemStack stack) { - return false; - } - - @Override - public int getItemEnchantability(ItemStack stack) { - return 0; - } - - @Override - public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { - if (pass == 1) { - return mOverlayBucketTexture; - } - else { - return mBaseBucketTexture; - } - } - - @Override - public void registerIcons(final IIconRegister i) { - mBaseBucketTexture = i.registerIcon("bucket_empty"); - mOverlayBucketTexture = i.registerIcon(CORE.MODID+":bucket.generic.overlay"); - } - - @Override - public boolean tryPlaceContainedLiquid(World p_77875_1_, int p_77875_2_, int p_77875_3_, int p_77875_4_) { - return tryPlaceContainedLiquid(Blocks.air, p_77875_1_, p_77875_2_, p_77875_3_, p_77875_4_); - } - - @Override - public int getColorFromItemStack(ItemStack aStack, int aPass) { - if (aPass == 0) { - return super.getColorFromItemStack(aStack, aPass); - } - else { - return FluidFactory.mMetaToColourMap.get(aStack.getItemDamage()); - } - } - - @Override - public boolean requiresMultipleRenderPasses() { - return true; - } - - -} diff --git a/src/Java/gtPlusPlus/core/gui/GUI_Base_Tile_Entity.java b/src/Java/gtPlusPlus/core/gui/GUI_Base_Tile_Entity.java deleted file mode 100644 index aa10363e7c..0000000000 --- a/src/Java/gtPlusPlus/core/gui/GUI_Base_Tile_Entity.java +++ /dev/null @@ -1,15 +0,0 @@ -package gtPlusPlus.core.gui; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.Container; - -public abstract class GUI_Base_Tile_Entity extends GuiContainer { - - public final Container mContainer; - - public GUI_Base_Tile_Entity(Container aContainer) { - super(aContainer); - mContainer = aContainer; - } - -} diff --git a/src/Java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java b/src/Java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java deleted file mode 100644 index 1212054f01..0000000000 --- a/src/Java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java +++ /dev/null @@ -1,56 +0,0 @@ -package gtPlusPlus.core.gui.beta; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import gtPlusPlus.core.interfaces.IGuiManagerMiscUtils; - -public class Gui_ID_Registry -{ - private static final Map<Class<? extends IGuiManagerMiscUtils>, MU_GuiId> classMap = new HashMap<Class<? extends IGuiManagerMiscUtils>, MU_GuiId>(); - private static final Map<Integer, MU_GuiId> idMap = new HashMap<Integer, MU_GuiId>(); - private static int nextId = 0; - - static - { - //registerGuiHandlers(Gui_Types.Tile, Arrays.asList(new Class[] {TileAlveary.class})); - //registerGuiHandlers(MU_GuiType.Item, Arrays.asList(new Class[] { ItemBackpack.class, ItemBackpackNaturalist.class, ItemBeealyzer.class, ItemCatalogue.class, ItemFlutterlyzer.class, ItemHabitatLocator.class, ItemImprinter.class, ItemInfuser.class, ItemLetter.class, ItemSolderingIron.class, ItemTreealyzer.class })); - //registerGuiHandlers(MU_GuiType.Entity, Arrays.asList(new Class[] { EntityMinecartApiary.class, EntityMinecartBeehouse.class })); - } - - private static void registerGuiHandlers(final Gui_Types MU_GuiType, final List<Class<? extends IGuiManagerMiscUtils>> guiHandlerClasses) - { - for (final Class<? extends IGuiManagerMiscUtils> tileGuiHandlerClass : guiHandlerClasses) - { - final MU_GuiId guiId = new MU_GuiId(nextId++, MU_GuiType, tileGuiHandlerClass); - classMap.put(tileGuiHandlerClass, guiId); - idMap.put(Integer.valueOf(guiId.getId()), guiId); - } - } - - public static MU_GuiId getGuiIdForGuiHandler(final IGuiManagerMiscUtils guiHandler) - { - final Class<? extends IGuiManagerMiscUtils> guiHandlerClass = guiHandler.getClass(); - MU_GuiId guiId = classMap.get(guiHandlerClass); - if (guiId == null) { - for (final Map.Entry<Class<? extends IGuiManagerMiscUtils>, MU_GuiId> classGuiIdEntry : classMap.entrySet()) { - if (((Class<?>)classGuiIdEntry.getKey()).isAssignableFrom(guiHandlerClass)) - { - guiId = classGuiIdEntry.getValue(); - break; - } - } - } - if (guiId == null) { - throw new IllegalStateException("No gui ID for gui handler: " + guiHandler); - } - return guiId; - } - - public static MU_GuiId getGuiId(final int id) - { - return idMap.get(Integer.valueOf(id)); - } - -} diff --git a/src/Java/gtPlusPlus/core/gui/beta/Gui_Types.java b/src/Java/gtPlusPlus/core/gui/beta/Gui_Types.java deleted file mode 100644 index 9348f40c9c..0000000000 --- a/src/Java/gtPlusPlus/core/gui/beta/Gui_Types.java +++ /dev/null @@ -1,8 +0,0 @@ -package gtPlusPlus.core.gui.beta; - -public enum Gui_Types -{ - Item, Tile, Entity; - - private Gui_Types() {} -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/beta/MU_GuiId.java b/src/Java/gtPlusPlus/core/gui/beta/MU_GuiId.java deleted file mode 100644 index 116ad48480..0000000000 --- a/src/Java/gtPlusPlus/core/gui/beta/MU_GuiId.java +++ /dev/null @@ -1,32 +0,0 @@ -package gtPlusPlus.core.gui.beta; -import gtPlusPlus.core.interfaces.IGuiManagerMiscUtils; - -public class MU_GuiId -{ - private final int id; - private final Gui_Types MU_GuiType; - private final Class<? extends IGuiManagerMiscUtils> guiHandlerClass; - - MU_GuiId(final int id, final Gui_Types MU_GuiType, final Class<? extends IGuiManagerMiscUtils> guiHandlerClass) - { - this.id = id; - this.MU_GuiType = MU_GuiType; - this.guiHandlerClass = guiHandlerClass; - } - - public Gui_Types getGuiType() - { - return this.MU_GuiType; - } - - public Class<? extends IGuiManagerMiscUtils> getGuiHandlerClass() - { - return this.guiHandlerClass; - } - - public int getId() - { - return this.id; - } -} - diff --git a/src/Java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java b/src/Java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java deleted file mode 100644 index 0ad4b9b51f..0000000000 --- a/src/Java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java +++ /dev/null @@ -1,121 +0,0 @@ -package gtPlusPlus.core.gui.item; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.core.container.Container_BackpackBase; -import gtPlusPlus.core.inventories.BaseInventoryBackpack; -import gtPlusPlus.core.lib.CORE; - -public class GuiBaseBackpack extends GuiContainer -{ - /** x and y size of the inventory window in pixels. Defined as float, passed as int - * These are used for drawing the player model. */ - private float xSize_lo; - private float ySize_lo; - - /** The FontRenderer used by GuiScreen */ - protected FontRenderer fontRenderer; - - /** ResourceLocation takes 2 parameters: ModId, path to texture at the location: - * "src/minecraft/assets/modid/" - * - * I have provided a sample texture file that works with this tutorial. Download it - * from Forge_Tutorials/textures/gui/ - */ - private static final ResourceLocation iconLocation = new ResourceLocation(CORE.MODID, "textures/gui/itemBackpack.png"); - - /** The inventory to render on screen */ - private final BaseInventoryBackpack inventory; - - public GuiBaseBackpack(final Container_BackpackBase containerItem) - { - super(containerItem); - this.inventory = containerItem.inventory; - } - - /** - * Draws the screen and all the components in it. - */ - @Override - public void drawScreen(final int par1, final int par2, final float par3) - { - super.drawScreen(par1, par2, par3); - this.xSize_lo = par1; - this.ySize_lo = par2; - } - - /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) - */ - @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) - { - final String s = this.inventory.hasCustomInventoryName() ? this.inventory.getInventoryName() : this.inventory.getInventoryName(); - //this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 0, 4210752); - //this.fontRenderer.drawString(I18n.translate("container.inventory"), 26, this.ySize - 96 + 4, 4210752); - } - - /** - * Draw the background layer for the GuiContainer (everything behind the items) - */ - @Override - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(iconLocation); - final int k = (this.width - this.xSize) / 2; - final int l = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - final int i1; - drawPlayerModel(k + 51, l + 75, 30, k + 51 - this.xSize_lo, (l + 75) - 50 - this.ySize_lo, this.mc.thePlayer); - } - - /** - * This renders the player model in standard inventory position (in later versions of Minecraft / Forge, you can - * simply call GuiInventory.drawEntityOnScreen directly instead of copying this code) - */ - public static void drawPlayerModel(final int x, final int y, final int scale, final float yaw, final float pitch, final EntityLivingBase entity) { - GL11.glEnable(GL11.GL_COLOR_MATERIAL); - GL11.glPushMatrix(); - GL11.glTranslatef(x, y, 50.0F); - GL11.glScalef(-scale, scale, scale); - GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); - final float f2 = entity.renderYawOffset; - final float f3 = entity.rotationYaw; - final float f4 = entity.rotationPitch; - final float f5 = entity.prevRotationYawHead; - final float f6 = entity.rotationYawHead; - GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); - RenderHelper.enableStandardItemLighting(); - GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(-((float) Math.atan(pitch / 40.0F)) * 20.0F, 1.0F, 0.0F, 0.0F); - entity.renderYawOffset = (float) Math.atan(yaw / 40.0F) * 20.0F; - entity.rotationYaw = (float) Math.atan(yaw / 40.0F) * 40.0F; - entity.rotationPitch = -((float) Math.atan(pitch / 40.0F)) * 20.0F; - entity.rotationYawHead = entity.rotationYaw; - entity.prevRotationYawHead = entity.rotationYaw; - GL11.glTranslatef(0.0F, entity.yOffset, 0.0F); - RenderManager.instance.playerViewY = 180.0F; - RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); - entity.renderYawOffset = f2; - entity.rotationYaw = f3; - entity.rotationPitch = f4; - entity.prevRotationYawHead = f5; - entity.rotationYawHead = f6; - GL11.glPopMatrix(); - RenderHelper.disableStandardItemLighting(); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); - GL11.glDisable(GL11.GL_TEXTURE_2D); - OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); - } -} diff --git a/src/Java/gtPlusPlus/core/gui/item/GuiBaseGrindle.java b/src/Java/gtPlusPlus/core/gui/item/GuiBaseGrindle.java deleted file mode 100644 index ed347e8d30..0000000000 --- a/src/Java/gtPlusPlus/core/gui/item/GuiBaseGrindle.java +++ /dev/null @@ -1,564 +0,0 @@ -package gtPlusPlus.core.gui.item; - -import java.util.LinkedHashSet; -import java.util.Set; - -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreenBook; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ResourceLocation; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.container.Container_Grindle; -import gtPlusPlus.core.inventories.BaseInventoryGrindle; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class GuiBaseGrindle extends GuiContainer { - - /** The FontRenderer used by GuiScreen */ - protected FontRenderer fontRenderer; - - private GrindleGuiButton mButtonNextPage; - private GrindleGuiButton mButtonPreviousPage; - private String[][] mPageDataArray; - private short mCurrentPage = 0; - - private static final ResourceLocation iconLocation = new ResourceLocation(CORE.MODID, "textures/gui/itemGrindle.png"); - - /** The inventory to render on screen */ - private final BaseInventoryGrindle inventory; - - public GuiBaseGrindle(final Container_Grindle containerItem) { - super(containerItem); - this.inventory = containerItem.inventory; - } - - /** - * Draws the screen and all the components in it. - */ - @Override - public void drawScreen(final int par1, final int par2, final float par3) { - super.drawScreen(par1, par2, par3); - this.updateButtons(); - } - - /** - * Draw the foreground layer for the GuiContainer (everything in front of the - * items) - */ - @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - - try { - - // Title - this.fontRendererObj.drawStringWithShadow(I18n.format("Gregtech Information Transponder", new Object[0]), 0, - -12, Utils.rgbtoHexValue(255, 255, 255)); - ItemStack aStack = this.inventory.getStackInSlot(0); - - if (aStack != null) { - - GrindleData aDataCurrent = new GrindleData(aStack); - - if (aDataCurrent.mValid) { - - // Debug NBT Information - //NBTUtils.tryIterateNBTData(aStack); - - this.fontRendererObj.drawString(I18n.format(aDataCurrent.mTitle), 10, 8, Utils.rgbtoHexValue(125, 255, 125)); - - int tTier = aDataCurrent.mExtraInformation; - if (tTier >= 0) { - //Draw the GUI - // List prospection - this.fontRendererObj.drawString(I18n.format(aDataCurrent.mTierDim+" | Page: "+this.mCurrentPage, new Object[0]), 10, 18, Utils.rgbtoHexValue(125, 255, 125)); - // Divider - this.fontRendererObj.drawString(I18n.format("-------------------", new Object[0]), 10, 23, Utils.rgbtoHexValue(125, 125, 255)); - // Pos data - this.fontRendererObj.drawString(I18n.format(aDataCurrent.mPosInfo, new Object[0]), 10, 29, Utils.rgbtoHexValue(125, 125, 255)); - // Divider - this.fontRendererObj.drawString(I18n.format("-------------------", new Object[0]), 10, 35, Utils.rgbtoHexValue(125, 125, 255)); - int aLastYUsed = 41; - - int posOuter = 0; - int posInner = 0; - - mPageDataArray = new String[MathUtils.roundToClosestInt(Math.ceil(aDataCurrent.mListData.size() / 9.00))][9]; - for (String e : aDataCurrent.mListData) { - if (e != null) { - mPageDataArray[posInner][posOuter] = e; - if (posOuter < 8) { - posOuter++; - } - else { - posOuter = 0; - posInner++; - } - } - else { - continue; - } - } - - String[] aCurrentPage = mPageDataArray[this.mCurrentPage]; - - if (aCurrentPage != null) { - //Logger.INFO("valid Current page " + this.mCurrentPage); - if (aCurrentPage.length > 0) { - for (int i=0;i<aCurrentPage.length;i++) { - if ((aLastYUsed + 9) <= (68 + 56)) { - String aCP = aCurrentPage[i]; - //Logger.INFO("Printing "+aCP); - if (aCP != null && aCP.length() > 0) { - if (!aCP.toLowerCase().contains("empty") && !aCP.toLowerCase().contains("null")) { - this.fontRendererObj.drawString(I18n.format(aCP), 10, aLastYUsed, Utils.rgbtoHexValue(125, 255, 125)); - aLastYUsed += 9; - } - } - } - } - } - } - - - - - } - - //Non-Prospecting Data - else { - //Draw the GUI - // List prospection - this.fontRendererObj.drawString(I18n.format(aDataCurrent.mTierDim, new Object[0]), 10, 18, Utils.rgbtoHexValue(125, 255, 125)); - // Divider - this.fontRendererObj.drawString(I18n.format("-------------------", new Object[0]), 10, 23, Utils.rgbtoHexValue(125, 125, 255)); - // Pos data - this.fontRendererObj.drawString(I18n.format(aDataCurrent.mPosInfo, new Object[0]), 10, 29, Utils.rgbtoHexValue(125, 125, 255)); - // Divider - this.fontRendererObj.drawString(I18n.format("-------------------", new Object[0]), 10, 35, Utils.rgbtoHexValue(125, 125, 255)); - int aLastYUsed = 41; - /*for (int i=0;i<aDataCurrent.mListData.size();i++) { - if ((aLastYUsed + 9) <= (68 + 56)) { - this.fontRendererObj.drawString(I18n.format(aDataCurrent.mListData.get(i), new Object[0]), 10, aLastYUsed, Utils.rgbtoHexValue(125, 255, 125)); - aLastYUsed = aLastYUsed + 9; - } - } */ - } - } - else { - this.fontRendererObj.drawStringWithShadow(I18n.format("Invalid data item stored in slot.", new Object[0]), 10, 8, - Utils.rgbtoHexValue(255, 125, 125)); - } - } else { - // Valid Datastick? - this.fontRendererObj.drawStringWithShadow(I18n.format("Insert device into port.", new Object[0]), 10, 8, Utils.rgbtoHexValue(255, 125, 125)); - this.mPageDataArray = new String[][] {{}}; - this.mCurrentPage = 0; - } - - // Inventory Label - this.fontRendererObj.drawStringWithShadow(I18n.format("container.inventory", new Object[0]), 8, 131, - Utils.rgbtoHexValue(255, 255, 255)); - - } - catch (Throwable t) { - Logger.INFO("GUI CRASH - "+t); - t.printStackTrace(); - } - - } - - /** - * Draw the background layer for the GuiContainer (everything behind the items) - */ - @Override - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(iconLocation); - final int k = (this.width - this.xSize) / 2; - final int l = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - } - - /** - * Adds the buttons (and other controls) to the screen in question. - */ - @SuppressWarnings("unchecked") - @Override - public void initGui(){ - super.initGui(); - this.buttonList.clear(); - Keyboard.enableRepeatEvents(true); - final int k = (this.width - this.xSize) - (this.width/16); - this.mButtonNextPage = new GrindleGuiButton(1, k, 155, true); - this.mButtonPreviousPage = new GrindleGuiButton(2, k-20, 155, false); - this.buttonList.add(this.mButtonNextPage); - this.buttonList.add(this.mButtonPreviousPage); - this.mCurrentPage = 0; - this.updateButtons(); - } - - - /** - * Called when the screen is unloaded. Used to disable keyboard repeat events - */ - @Override - public void onGuiClosed() { - Keyboard.enableRepeatEvents(false); - this.mCurrentPage = 0; - super.onGuiClosed(); - } - - private void updateButtons(){ - if (this.mCurrentPage >= 0) { - if (this.mPageDataArray != null) { - if (this.mCurrentPage < (this.mPageDataArray.length - 1)) { - this.mButtonNextPage.visible = true; - } else { - this.mButtonNextPage.visible = false; - } - } else { - this.mButtonNextPage.visible = false; - } - } - if (this.mCurrentPage > 0) { - this.mButtonPreviousPage.visible = true; - } - else { - this.mButtonPreviousPage.visible = false; - } - } - - - /** - * Scrolling Related - */ - @Override - protected void actionPerformed(GuiButton aButton) { - if (aButton.enabled && aButton.visible) { - if (aButton.id == 1) { - if (this.mCurrentPage < this.mPageDataArray.length - 1) { - ++this.mCurrentPage; - } - } else if (aButton.id == 2) { - if (this.mCurrentPage > 0) { - --this.mCurrentPage; - } - } - this.updateButtons(); - } - } - - /** - * Handles mouse input. - */ - @Override - public void handleMouseInput() { - super.handleMouseInput(); - int i = Mouse.getEventDWheel(); - /* - * if (i != 0) { - * - * - * this.currentScroll = (float) ((double) this.currentScroll - (double) i / - * (double) j); - * - * if (this.currentScroll < 0.0F) { this.currentScroll = 0.0F; } - * - * if (this.currentScroll > 1.0F) { this.currentScroll = 1.0F; } - * - * this.scrollTo(this.currentScroll); } - */ - } - - /** - * Called when the mouse is moved or a mouse button is released. Signature: - * (mouseX, mouseY, which) which==-1 is mouseMove, which==0 or which==1 is - * mouseUp - */ - @Override - protected void mouseMovedOrUp(int p_146286_1_, int p_146286_2_, int p_146286_3_) { - /* - * if (p_146286_3_ == 0) { int l = p_146286_1_ - this.guiLeft; int i1 = - * p_146286_2_ - this.guiTop; CreativeTabs[] acreativetabs = - * CreativeTabs.creativeTabArray; int j1 = acreativetabs.length; - * - * for (int k1 = 0; k1 < j1; ++k1) { CreativeTabs creativetabs = - * acreativetabs[k1]; - * - * if (creativetabs != null && this.func_147049_a(creativetabs, l, i1)) { - * this.setCurrentCreativeTab(creativetabs); return; } } } - */ - - super.mouseMovedOrUp(p_146286_1_, p_146286_2_, p_146286_3_); - } - - /** - * Allows Mouseover Tooltips - */ - @Override - protected void renderToolTip(ItemStack aStack, int p_146285_2_, int p_146285_3_) { - super.renderToolTip(aStack, p_146285_2_, p_146285_3_); - } - - /** - * Custom Buttons - */ - - @SideOnly(Side.CLIENT) - static class GrindleGuiButton extends GuiButton { - - public static final ResourceLocation mBookTexture; - - static { - ResourceLocation r; - try { - r = (ResourceLocation) ReflectionUtils.getField(GuiScreenBook.class, "bookGuiTextures").get(null); - - } catch (IllegalArgumentException | IllegalAccessException e) { - r = new ResourceLocation("textures/gui/book.png"); - } - mBookTexture = r; - } - - private final boolean aPageForward; - - public GrindleGuiButton(int aID, int aX, int aY, boolean aForwards) { - this(aID, aX, aY, 20, 12, aForwards); - } - - public GrindleGuiButton(int aID, int aX, int aY, int aWidth, int aHeight, boolean aForwards) { - super(aID, aX, aY, aWidth, aHeight, ""); - this.aPageForward = aForwards; - } - - /** - * Draws this button to the screen. - */ - public void drawButton(Minecraft aGame, int aX, int aY) { - if (this.visible) { - boolean flag = aX >= this.xPosition && aY >= this.yPosition - && aX < this.xPosition + this.width && aY < this.yPosition + this.height; - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - aGame.getTextureManager().bindTexture(iconLocation); - int k = 0; - int l = 192; - - if (flag) { - k += 23; - } - - if (!this.aPageForward) { - l += 13; - } - - this.drawTexturedModalRect(this.xPosition, this.yPosition, k, l, 22, 12); - } - } - } - - - public static class GrindleData { - - public static enum GrindleMode { - PROSPECTING(0), - ELEMENT(1); - private final int aModeID; - private GrindleMode (final int aMode) - { - this.aModeID = aMode; - } - - public int getMode() { - return this.aModeID; - } - } - - final boolean mValid; - final ItemStack mStack; - final String mTitle, mPosInfo, mTierDim; - final AutoMap<String> mListData; - final GrindleMode mMode; - final int mExtraInformation; - - - public GrindleData(ItemStack iStack) { - - if (iStack == null) { - mValid = false; - mStack = null; - mTitle = null; - mListData = null; - mMode = null; - mExtraInformation = 0; - this.mTierDim = ""; - this.mPosInfo = ""; - } else { - - this.mStack = iStack; - - int aType = -1; - boolean isProspecting = false; - - // If Input stack is a Data stick/Orb, set a valid type. - if (GT_Utility.areStacksEqual(iStack, CI.getDataStick(), true)) { - aType = 0; - } else if (GT_Utility.areStacksEqual(iStack, CI.getDataOrb(), true)) { - aType = 1; - } - - NBTTagCompound tNBT = iStack.getTagCompound(); - if (tNBT == null) { - tNBT = new NBTTagCompound(); - } - - mTitle = tNBT.hasKey("title") ? tNBT.getString("title") - : (aType == 0 ? "Empty Data Stick" : (aType == 1 ? "Empty Data Orb" : "Unknown Item")); - if (mTitle.toLowerCase().contains("raw prospection data")) { - isProspecting = true; - } - - byte tTier = -1; - if (isProspecting) { - if (!tNBT.hasKey("prospection_tier") && tNBT.hasKey("prospection")) { - tTier = 0; - } else if (tNBT.hasKey("prospection_tier") && !tNBT.hasKey("prospection")) { - tTier = tNBT.getByte("prospection_tier"); - } - } - - mExtraInformation = isProspecting ? tTier : -1; - - if (tTier >= 0) { - String xPos, yPos, zPos, aDim; - String aPositionString, aInfoString; - Set<String> aOreTypes = new LinkedHashSet<String>(); - Set<String> aOilTypes = new LinkedHashSet<String>(); - - // Set variables that are shared between prospection types. - if (tTier == 0) { - String tData = tNBT.getString("prospection"); - String[] tDataArray = tData.split(","); - xPos = tDataArray[0]; - yPos = tDataArray[1]; - zPos = tDataArray[2]; - aDim = tDataArray[3]; - aOilTypes.add("Oil Type: " + tDataArray[5]); - aOilTypes.add("--------------------"); - aOreTypes.add("Ore Types: "); - for (int i = 6; tDataArray.length > i; i++) { - aOreTypes.add("-" + tDataArray[i]); - } - } else { - String tPos = tNBT.getString("prospection_pos"); - String[] tPosData = tPos.split(" "); - xPos = tPosData[1]; - yPos = tPosData[3]; - zPos = tPosData[5]; - aDim = tPosData[7]; - // Oil - String tOil = tNBT.getString("prospection_oils"); - String[] tOilData = tOil.split("\\|"); - if (tOilData.length > 0) { - aOilTypes.add("Oil Types:"); - for (String s : tOilData) { - if (s != null) { - aOilTypes.add(s); - } - } - aOilTypes.add("--------------------"); - } - - // Near - String tOresNear = tNBT.getString("prospection_near"); - String[] tOresNearData = tOresNear.split("\\|"); - // Middle - String tOresMid = tNBT.getString("prospection_middle"); - String[] tOresMidData = tOresMid.split("\\|"); - // Far - String tOresFar = tNBT.getString("prospection_far"); - String[] tOresFarData = tOresFar.split("\\|"); - - if ((tOresNearData.length + tOresMidData.length + tOresFarData.length) > 0) { - aOreTypes.add("Ore Types:"); - if (tOresNearData.length > 0) { - for (String s : tOresNearData) { - if (s != null) { - aOreTypes.add("-" + s + " - Near"); - } - } - } - if (tOresMidData.length > 0) { - for (String s : tOresMidData) { - if (s != null) { - aOreTypes.add("-" + s + " - Mid"); - } - } - } - if (tOresFarData.length > 0) { - for (String s : tOresFarData) { - if (s != null) { - aOreTypes.add("-" + s + " - Far"); - } - } - } - } - } - - mListData = new AutoMap<String>(); - if (aOilTypes.size() > 0) { - for (String aOils : aOilTypes) { - if (aOils != null && aOils.length() > 0) { - mListData.put(aOils); - } - } - } - - if (aOreTypes.size() > 0) { - for (String aOres : aOreTypes) { - if (aOres != null && aOres.length() > 0) { - mListData.put(aOres); - } - } - } - - // Set Types - mMode = GrindleMode.PROSPECTING; - this.mTierDim = (aInfoString = "Tier: " + tTier + " | Dim: " + aDim); - this.mPosInfo = (aPositionString = "X:" + xPos + ", Y:" + yPos + ", Z:" + zPos); - this.mValid = true; - } - - // Non-Prospectic Data - else { - mValid = true; - mListData = null; - mMode = GrindleMode.ELEMENT; - this.mTierDim = "PLACEHOLDER"; - this.mPosInfo = "PLACEHOLDER"; - } - - } - - } - - } - - -} diff --git a/src/Java/gtPlusPlus/core/gui/item/GuiScreenGrindle.java b/src/Java/gtPlusPlus/core/gui/item/GuiScreenGrindle.java deleted file mode 100644 index cf94fbbb84..0000000000 --- a/src/Java/gtPlusPlus/core/gui/item/GuiScreenGrindle.java +++ /dev/null @@ -1,490 +0,0 @@ -package gtPlusPlus.core.gui.item; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.nbt.NBTTagString; -import net.minecraft.network.PacketBuffer; -import net.minecraft.network.play.client.C17PacketCustomPayload; -import net.minecraft.util.ChatAllowedCharacters; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.core.container.Container_Grindle; -import gtPlusPlus.core.inventories.BaseInventoryGrindle; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; - -@SideOnly(Side.CLIENT) -public class GuiScreenGrindle extends GuiContainer { - private static final Logger logger = LogManager.getLogger(); - private static final ResourceLocation bookGuiTextures = new ResourceLocation("textures/gui/book.png"); - /** The player editing the book */ - private final EntityPlayer editingPlayer; - private final ItemStack bookObj; - /** Whether the book is signed or can still be edited */ - private final boolean bookIsUnsigned; - private boolean field_146481_r; - private boolean field_146480_s; - /** Update ticks since the gui was opened */ - private int updateCount; - private final int bookImageWidth = 192; - private final int bookImageHeight = 192; - private int bookTotalPages = 1; - private int currPage; - private NBTTagList bookPages; - private String bookTitle = ""; - private GuiScreenGrindle.NextPageButton buttonNextPage; - private GuiScreenGrindle.NextPageButton buttonPreviousPage; - private GuiButton buttonDone; - /** The GuiButton to sign this book. */ - private GuiButton buttonSign; - private GuiButton buttonFinalize; - private GuiButton buttonCancel; - - // Texture - private static final ResourceLocation iconLocation = new ResourceLocation(CORE.MODID, - "textures/gui/itemGrindle.png"); - - /** The inventory to render on screen */ - private final BaseInventoryGrindle inventory; - - public GuiScreenGrindle(final Container_Grindle containerItem, final EntityPlayer player) { - super(containerItem); - this.inventory = containerItem.inventory; - this.editingPlayer = player; - this.bookObj = this.inventory.getStackInSlot(0); - this.bookIsUnsigned = (this.bookObj == null ? true : false); - - if (this.bookObj != null) { - if (this.bookObj.hasTagCompound()) { - final NBTTagCompound nbttagcompound = this.bookObj.getTagCompound(); - this.bookPages = nbttagcompound.getTagList("pages", 8); - - if (this.bookPages != null) { - this.bookPages = (NBTTagList) this.bookPages.copy(); - this.bookTotalPages = this.bookPages.tagCount(); - - if (this.bookTotalPages < 1) { - this.bookTotalPages = 1; - } - } - } - - - if ((this.bookPages == null) && this.bookIsUnsigned) { this.bookPages = - new NBTTagList(); this.bookPages.appendTag(new NBTTagString("")); - this.bookTotalPages = 1; } - - } - } - - /** - * Called from the main game loop to update the screen. - */ - @Override - public void updateScreen() { - super.updateScreen(); - ++this.updateCount; - } - - /** - * Adds the buttons (and other controls) to the screen in question. - */ - @Override - @SuppressWarnings("unchecked") - public void initGui() { - this.buttonList.clear(); - Keyboard.enableRepeatEvents(true); - - if (this.bookIsUnsigned) { - this.buttonList.add(this.buttonSign = new GuiButton(3, (this.width / 2) - 100, 4 + this.bookImageHeight, 98, - 20, I18n.format("book.signButton", new Object[0]))); - this.buttonList.add(this.buttonDone = new GuiButton(0, (this.width / 2) + 2, this.bookImageHeight-4, 98, - 20, I18n.format("gui.close", new Object[0]))); - this.buttonList.add(this.buttonFinalize = new GuiButton(5, (this.width / 2) - 100, 4 + this.bookImageHeight, - 98, 20, I18n.format("book.finalizeButton", new Object[0]))); - this.buttonList.add(this.buttonCancel = new GuiButton(4, (this.width / 2) + 2, 4 + this.bookImageHeight, 98, - 20, I18n.format("gui.cancel", new Object[0]))); - } - else { - this.buttonList.add(this.buttonDone = new GuiButton(0, (this.width / 2) - 100, this.bookImageHeight+100, - 200, 20, I18n.format("gui.done", new Object[0]))); - } - - final int i = (this.width - this.bookImageWidth) / 2; - final byte b0 = 2; - this.buttonList.add(this.buttonNextPage = new GuiScreenGrindle.NextPageButton(1, i + 120, b0 + 154, true)); - this.buttonList.add(this.buttonPreviousPage = new GuiScreenGrindle.NextPageButton(2, i + 38, b0 + 154, false)); - this.updateButtons(); - } - - /** - * Called when the screen is unloaded. Used to disable keyboard repeat - * events - */ - @Override - public void onGuiClosed() { - Keyboard.enableRepeatEvents(false); - } - - private void updateButtons() { - this.buttonNextPage.visible = !this.field_146480_s - && ((this.currPage < (this.bookTotalPages - 1)) || this.bookIsUnsigned); - this.buttonPreviousPage.visible = !this.field_146480_s && (this.currPage > 0); - this.buttonDone.visible = !this.bookIsUnsigned || !this.field_146480_s; - - if (this.bookIsUnsigned) { - this.buttonSign.visible = !this.field_146480_s; - this.buttonCancel.visible = this.field_146480_s; - this.buttonFinalize.visible = this.field_146480_s; - this.buttonFinalize.enabled = this.bookTitle.trim().length() > 0; - } - } - - private void sendBookToServer(final boolean p_146462_1_) { - if (this.bookIsUnsigned && this.field_146481_r) { - if (this.bookPages != null) { - String s; - - while (this.bookPages.tagCount() > 1) { - s = this.bookPages.getStringTagAt(this.bookPages.tagCount() - 1); - - if (s.length() != 0) { - break; - } - - this.bookPages.removeTag(this.bookPages.tagCount() - 1); - } - - if (this.bookObj.hasTagCompound()) { - final NBTTagCompound nbttagcompound = this.bookObj.getTagCompound(); - nbttagcompound.setTag("pages", this.bookPages); - } - else { - this.bookObj.setTagInfo("pages", this.bookPages); - } - - s = "MC|BEdit"; - - if (p_146462_1_) { - s = "MC|BSign"; - this.bookObj.setTagInfo("author", new NBTTagString(this.editingPlayer.getCommandSenderName())); - this.bookObj.setTagInfo("title", new NBTTagString(this.bookTitle.trim())); - this.bookObj.func_150996_a(ModItems.itemGrindleTablet); - } - - final ByteBuf bytebuf = Unpooled.buffer(); - - try { - (new PacketBuffer(bytebuf)).writeItemStackToBuffer(this.bookObj); - this.mc.getNetHandler().addToSendQueue(new C17PacketCustomPayload(s, bytebuf)); - } - catch (final Exception exception) { - logger.error("Couldn\'t send book info", exception); - } - finally { - bytebuf.release(); - } - } - } - } - - @Override - protected void actionPerformed(final GuiButton button) { - if (button.enabled) { - if (button.id == 0) { - this.mc.displayGuiScreen((GuiScreen) null); - this.sendBookToServer(false); - } - else if ((button.id == 3) && this.bookIsUnsigned) { - this.field_146480_s = true; - } - else if (button.id == 1) { - if (this.currPage < (this.bookTotalPages - 1)) { - ++this.currPage; - } - else if (this.bookIsUnsigned) { - this.addNewPage(); - - if (this.currPage < (this.bookTotalPages - 1)) { - ++this.currPage; - } - } - } - else if (button.id == 2) { - if (this.currPage > 0) { - --this.currPage; - } - } - else if ((button.id == 5) && this.field_146480_s) { - this.sendBookToServer(true); - this.mc.displayGuiScreen((GuiScreen) null); - } - else if ((button.id == 4) && this.field_146480_s) { - this.field_146480_s = false; - } - - this.updateButtons(); - } - } - - private void addNewPage() { - if ((this.bookPages != null) && (this.bookPages.tagCount() < 50)) { - this.bookPages.appendTag(new NBTTagString("")); - ++this.bookTotalPages; - this.field_146481_r = true; - } - } - - /** - * Fired when a key is typed. This is the equivalent of - * KeyListener.keyTyped(KeyEvent e). - */ - @Override - protected void keyTyped(final char p_73869_1_, final int p_73869_2_) { - super.keyTyped(p_73869_1_, p_73869_2_); - - if (this.bookIsUnsigned) { - if (this.field_146480_s) { - this.func_146460_c(p_73869_1_, p_73869_2_); - } - else { - this.keyTypedInBook(p_73869_1_, p_73869_2_); - } - } - } - - /** - * Processes keystrokes when editing the text of a book - */ - private void keyTypedInBook(final char p_146463_1_, final int p_146463_2_) { - switch (p_146463_1_) { - case 22: - this.func_146459_b(GuiScreen.getClipboardString()); - return; - default: - switch (p_146463_2_) { - case 14: - final String s = this.func_146456_p(); - - if (s.length() > 0) { - this.func_146457_a(s.substring(0, s.length() - 1)); - } - - return; - case 28: - case 156: - this.func_146459_b("\n"); - return; - default: - if (ChatAllowedCharacters.isAllowedCharacter(p_146463_1_)) { - this.func_146459_b(Character.toString(p_146463_1_)); - } - } - } - } - - private void func_146460_c(final char p_146460_1_, final int p_146460_2_) { - switch (p_146460_2_) { - case 14: - if (!this.bookTitle.isEmpty()) { - this.bookTitle = this.bookTitle.substring(0, this.bookTitle.length() - 1); - this.updateButtons(); - } - - return; - case 28: - case 156: - if (!this.bookTitle.isEmpty()) { - this.sendBookToServer(true); - this.mc.displayGuiScreen((GuiScreen) null); - } - - return; - default: - if ((this.bookTitle.length() < 16) && ChatAllowedCharacters.isAllowedCharacter(p_146460_1_)) { - this.bookTitle = this.bookTitle + Character.toString(p_146460_1_); - this.updateButtons(); - this.field_146481_r = true; - } - } - } - - private String func_146456_p() { - return (this.bookPages != null) && (this.currPage >= 0) && (this.currPage < this.bookPages.tagCount()) - ? this.bookPages.getStringTagAt(this.currPage) : ""; - } - - private void func_146457_a(final String p_146457_1_) { - if ((this.bookPages != null) && (this.currPage >= 0) && (this.currPage < this.bookPages.tagCount())) { - this.bookPages.func_150304_a(this.currPage, new NBTTagString(p_146457_1_)); - this.field_146481_r = true; - } - } - - private void func_146459_b(final String p_146459_1_) { - final String s1 = this.func_146456_p(); - final String s2 = s1 + p_146459_1_; - final int i = this.fontRendererObj.splitStringWidth(s2 + "" + EnumChatFormatting.BLACK + "_", 118); - - if ((i <= 118) && (s2.length() < 256)) { - this.func_146457_a(s2); - } - } - - /** - * Draws the screen and all the components in it. - */ - @Override - public void drawScreen(final int p_73863_1_, final int p_73863_2_, final float p_73863_3_) { - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(iconLocation); - final int k = (this.width - this.xSize) / 2; - final int l2 = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(k, l2, 0, 0, this.xSize, this.ySize); - - //GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - //this.mc.getTextureManager().bindTexture(iconLocation); - //final int k = (this.width - this.bookImageWidth) / 2; - //this.drawTexturedModalRect(k, b0, 0, 0, this.bookImageWidth, - // this.bookImageHeight); - - String s; - String s1; - int l; - final byte b0 = 2; - - if (this.inventory.getStackInSlot(0) != null) { - this.fontRendererObj.drawString( - I18n.format("" + NBTUtils.getBookTitle(this.inventory.getStackInSlot(0)), new Object[0]), 10, 8, - Utils.rgbtoHexValue(125, 255, 125)); - } - - if (this.field_146480_s) { - s = this.bookTitle; - - if (this.bookIsUnsigned) { - if (((this.updateCount / 6) % 2) == 0) { - s = s + "" + EnumChatFormatting.BLACK + "_"; - } - else { - s = s + "" + EnumChatFormatting.GRAY + "_"; - } - } - - s1 = I18n.format("book.editTitle", new Object[0]); - l = this.fontRendererObj.getStringWidth(s1); - this.fontRendererObj.drawString(s1, k + 36 + ((116 - l) / 2), b0 + 16 + 16, 0); - final int i1 = this.fontRendererObj.getStringWidth(s); - this.fontRendererObj.drawString(s, k + 36 + ((116 - i1) / 2), b0 + 48, 0); - final String s2 = I18n.format("book.byAuthor", new Object[] { this.editingPlayer.getCommandSenderName() }); - final int j1 = this.fontRendererObj.getStringWidth(s2); - this.fontRendererObj.drawString(EnumChatFormatting.DARK_GRAY + s2, k + 36 + ((116 - j1) / 2), b0 + 48 + 10, - 0); - final String s3 = I18n.format("book.finalizeWarning", new Object[0]); - this.fontRendererObj.drawSplitString(s3, k + 36, b0 + 80, 116, 0); - } - else { - s = I18n.format("book.pageIndicator", - new Object[] { Integer.valueOf(this.currPage + 1), Integer.valueOf(this.bookTotalPages) }); - s1 = ""; - - if ((this.bookPages != null) && (this.currPage >= 0) && (this.currPage < this.bookPages.tagCount())) { - s1 = this.bookPages.getStringTagAt(this.currPage); - } - - if (this.bookIsUnsigned) { - if (this.fontRendererObj.getBidiFlag()) { - s1 = s1 + "_"; - } - else if (((this.updateCount / 6) % 2) == 0) { - s1 = s1 + "" + EnumChatFormatting.BLACK + "_"; - } - else { - s1 = s1 + "" + EnumChatFormatting.GRAY + "_"; - } - } - - l = this.fontRendererObj.getStringWidth(s); - this.fontRendererObj.drawString(s, ((k - l) + this.bookImageWidth) - 44, b0 + 16, 0); - //this.fontRendererObj.drawString(s, k+36, b0 + 16, 0); - this.fontRendererObj.drawSplitString(s1, k + 36, b0 + 16 + 16, 116, 0); - //this.fontRendererObj.drawSplitString(s1, k, b0 + 16 + 16, 116, 0); - } - - super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_); - } - - @SideOnly(Side.CLIENT) - static class NextPageButton extends GuiButton { - private final boolean field_146151_o; - - public NextPageButton(final int p_i1079_1_, final int p_i1079_2_, final int p_i1079_3_, - final boolean p_i1079_4_) { - super(p_i1079_1_, p_i1079_2_, p_i1079_3_, 23, 13, ""); - this.field_146151_o = p_i1079_4_; - } - - /** - * Draws this button to the screen. - */ - @Override - public void drawButton(final Minecraft p_146112_1_, final int p_146112_2_, final int p_146112_3_) { - if (this.visible) { - final boolean flag = (p_146112_2_ >= this.xPosition) && (p_146112_3_ >= this.yPosition) - && (p_146112_2_ < (this.xPosition + this.width)) - && (p_146112_3_ < (this.yPosition + this.height)); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - p_146112_1_.getTextureManager().bindTexture(GuiScreenGrindle.bookGuiTextures); - int k = 0; - int l = 192; - - if (flag) { - k += 23; - } - - if (!this.field_146151_o) { - l += 13; - } - - this.drawTexturedModalRect(this.xPosition, this.yPosition, k, l, 23, 13); - } - } - } - - /** - * Draw the background layer for the GuiContainer (everything behind the - * items) - */ - @Override - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(iconLocation); - final int k = (this.width - this.xSize) / 2; - final int l = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - final int i1; - // drawPlayerModel(k + 51, l + 75, 30, k + 51 - this.xSize_lo, (l + 75) - // - 50 - this.ySize_lo, this.mc.thePlayer); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java b/src/Java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java deleted file mode 100644 index 97ec58bfa4..0000000000 --- a/src/Java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java +++ /dev/null @@ -1,116 +0,0 @@ -package gtPlusPlus.core.gui.item.box; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; -import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.ResourceLocation; - -public class GuiBaseBox extends GuiContainer { - /** - * x and y size of the inventory window in pixels. Defined as float, passed as - * int These are used for drawing the player model. - */ - private float xSize_lo; - private float ySize_lo; - - /** - * ResourceLocation takes 2 parameters: ModId, path to texture at the location: - * "src/minecraft/assets/modid/" - * - * I have provided a sample texture file that works with this tutorial. Download - * it from Forge_Tutorials/textures/gui/ - */ - private final ResourceLocation iconLocation; - - /** The inventory to render on screen */ - private final CustomBoxInventory inventory; - - public GuiBaseBox(ContainerBoxBase containerItem, ResourceLocation aGuiTexture) { - super(containerItem); - this.inventory = containerItem.getInventoryObject(); - this.iconLocation = aGuiTexture; - } - - /** - * Draws the screen and all the components in it. - */ - public void drawScreen(int par1, int par2, float par3) { - super.drawScreen(par1, par2, par3); - this.xSize_lo = (float) par1; - this.ySize_lo = (float) par2; - } - - /** - * Draw the foreground layer for the GuiContainer (everything in front of the - * items) - */ - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - String s = this.inventory.hasCustomInventoryName() ? this.inventory.getInventoryName() - : I18n.format(this.inventory.getInventoryName()); - this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 0, 4210752); - this.fontRendererObj.drawString(I18n.format("container.inventory"), 26, this.ySize - 96 + 4, 4210752); - } - - /** - * Draw the background layer for the GuiContainer (everything behind the items) - */ - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(iconLocation); - int k = (this.width - this.xSize) / 2; - int l = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - int i1; - drawPlayerModel(k + 51, l + 75, 30, (float) (k + 51) - this.xSize_lo, (float) (l + 75 - 50) - this.ySize_lo, - this.mc.thePlayer); - } - - /** - * This renders the player model in standard inventory position (in later - * versions of Minecraft / Forge, you can simply call - * GuiInventory.drawEntityOnScreen directly instead of copying this code) - */ - public static void drawPlayerModel(int x, int y, int scale, float yaw, float pitch, EntityLivingBase entity) { - GL11.glEnable(GL11.GL_COLOR_MATERIAL); - GL11.glPushMatrix(); - GL11.glTranslatef(x, y, 50.0F); - GL11.glScalef(-scale, scale, scale); - GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); - float f2 = entity.renderYawOffset; - float f3 = entity.rotationYaw; - float f4 = entity.rotationPitch; - float f5 = entity.prevRotationYawHead; - float f6 = entity.rotationYawHead; - GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); - RenderHelper.enableStandardItemLighting(); - GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(-((float) Math.atan(pitch / 40.0F)) * 20.0F, 1.0F, 0.0F, 0.0F); - entity.renderYawOffset = (float) Math.atan(yaw / 40.0F) * 20.0F; - entity.rotationYaw = (float) Math.atan(yaw / 40.0F) * 40.0F; - entity.rotationPitch = -((float) Math.atan(pitch / 40.0F)) * 20.0F; - entity.rotationYawHead = entity.rotationYaw; - entity.prevRotationYawHead = entity.rotationYaw; - GL11.glTranslatef(0.0F, entity.yOffset, 0.0F); - RenderManager.instance.playerViewY = 180.0F; - RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); - entity.renderYawOffset = f2; - entity.rotationYaw = f3; - entity.rotationPitch = f4; - entity.prevRotationYawHead = f5; - entity.rotationYawHead = f6; - GL11.glPopMatrix(); - RenderHelper.disableStandardItemLighting(); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); - GL11.glDisable(GL11.GL_TEXTURE_2D); - OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java b/src/Java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java deleted file mode 100644 index 28e3913ac8..0000000000 --- a/src/Java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java +++ /dev/null @@ -1,11 +0,0 @@ -package gtPlusPlus.core.gui.item.box; - -import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.util.ResourceLocation; - -public class LunchBoxGui extends GuiBaseBox { - public LunchBoxGui(ContainerBoxBase containerItem) { - super(containerItem, new ResourceLocation(CORE.MODID, "textures/gui/schematic_rocket_GS1.png")); - } -} diff --git a/src/Java/gtPlusPlus/core/gui/item/box/MagicBagGui.java b/src/Java/gtPlusPlus/core/gui/item/box/MagicBagGui.java deleted file mode 100644 index 958cdd3c70..0000000000 --- a/src/Java/gtPlusPlus/core/gui/item/box/MagicBagGui.java +++ /dev/null @@ -1,11 +0,0 @@ -package gtPlusPlus.core.gui.item.box; - -import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.util.ResourceLocation; - -public class MagicBagGui extends GuiBaseBox { - public MagicBagGui(ContainerBoxBase containerItem) { - super(containerItem, new ResourceLocation(CORE.MODID, "textures/gui/schematic_rocket_GS1.png")); - } -} diff --git a/src/Java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java b/src/Java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java deleted file mode 100644 index c440c017e9..0000000000 --- a/src/Java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java +++ /dev/null @@ -1,11 +0,0 @@ -package gtPlusPlus.core.gui.item.box; - -import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.util.ResourceLocation; - -public class ToolBoxGui extends GuiBaseBox { - public ToolBoxGui(ContainerBoxBase containerItem) { - super(containerItem, new ResourceLocation(CORE.MODID, "textures/gui/schematic_rocket_GS1.png")); - } -} diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_CircuitProgrammer.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_CircuitProgrammer.java deleted file mode 100644 index 2ab5b58aa7..0000000000 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_CircuitProgrammer.java +++ /dev/null @@ -1,44 +0,0 @@ -package gtPlusPlus.core.gui.machine; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; -import gtPlusPlus.core.container.Container_CircuitProgrammer; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer; - -@SideOnly(Side.CLIENT) -public class GUI_CircuitProgrammer extends GuiContainer { - - private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/CircuitProgrammer.png"); - - public GUI_CircuitProgrammer(final InventoryPlayer player_inventory, final TileEntityCircuitProgrammer te){ - super(new Container_CircuitProgrammer(player_inventory, te)); - } - - @Override - protected void drawGuiContainerForegroundLayer(final int i, final int j){ - super.drawGuiContainerForegroundLayer(i, j); - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(craftingTableGuiTextures); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } - - //This method is called when the Gui is first called! - @Override - public void initGui(){ - super.initGui(); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_DecayablesChest.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_DecayablesChest.java deleted file mode 100644 index 094629ae48..0000000000 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_DecayablesChest.java +++ /dev/null @@ -1,59 +0,0 @@ -package gtPlusPlus.core.gui.machine; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.core.container.Container_DecayablesChest; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; - -@SideOnly(Side.CLIENT) -public class GUI_DecayablesChest extends GuiContainer { - - private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/FishTrap.png"); - - public GUI_DecayablesChest(final InventoryPlayer player_inventory, final TileEntityDecayablesChest te){ - super(new Container_DecayablesChest(player_inventory, te)); - } - - - @Override - protected void drawGuiContainerForegroundLayer(final int i, final int j){ - //this.fontRendererObj.drawString(I18n.format("Workbench", new Object[0]), 28, 6, 4210752); - //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); - - } - - - @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(craftingTableGuiTextures); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } - - - //This method is called when the Gui is first called! - @Override - public void initGui() - { - //You have to add this line for the Gui to function properly! - super.initGui(); - - //The parameters of GuiButton are(id, x, y, width, height, text); - //this.buttonList.add(new GuiButton( 1, 367, 132, 18, 18, "X")); - //this.buttonList.add(new GuiButton( 2, 385, 132, 18, 18, "Y")); - //NOTE: the id always has to be different or else it might get called twice or never! - - //Add any other buttons here too! - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_EggBox.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_EggBox.java deleted file mode 100644 index 49d9890d3a..0000000000 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_EggBox.java +++ /dev/null @@ -1,60 +0,0 @@ -package gtPlusPlus.core.gui.machine; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.core.container.Container_EggBox; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.TileEntityEggBox; - -@SideOnly(Side.CLIENT) -public class GUI_EggBox extends GuiContainer { - - private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/FishTrap.png"); - - public GUI_EggBox(final InventoryPlayer player_inventory, final TileEntityEggBox te){ - super(new Container_EggBox(player_inventory, te)); - } - - - @Override - protected void drawGuiContainerForegroundLayer(final int i, final int j){ - //this.fontRendererObj.drawString(I18n.format("Workbench", new Object[0]), 28, 6, 4210752); - this.fontRendererObj.drawString(I18n.format("container.EggBox", new Object[0]), 8, this.ySize - 96 + 2, 4210752); - - } - - - @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(craftingTableGuiTextures); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } - - - //This method is called when the Gui is first called! - @Override - public void initGui() - { - //You have to add this line for the Gui to function properly! - super.initGui(); - - //The parameters of GuiButton are(id, x, y, width, height, text); - //this.buttonList.add(new GuiButton( 1, 367, 132, 18, 18, "X")); - //this.buttonList.add(new GuiButton( 2, 385, 132, 18, 18, "Y")); - //NOTE: the id always has to be different or else it might get called twice or never! - - //Add any other buttons here too! - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_FishTrap.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_FishTrap.java deleted file mode 100644 index 3d3bad7ece..0000000000 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_FishTrap.java +++ /dev/null @@ -1,59 +0,0 @@ -package gtPlusPlus.core.gui.machine; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.core.container.Container_FishTrap; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; - -@SideOnly(Side.CLIENT) -public class GUI_FishTrap extends GuiContainer { - - private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/FishTrap.png"); - - public GUI_FishTrap(final InventoryPlayer player_inventory, final TileEntityFishTrap te){ - super(new Container_FishTrap(player_inventory, te)); - } - - - @Override - protected void drawGuiContainerForegroundLayer(final int i, final int j){ - //this.fontRendererObj.drawString(I18n.format("Workbench", new Object[0]), 28, 6, 4210752); - //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); - - } - - - @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(craftingTableGuiTextures); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } - - - //This method is called when the Gui is first called! - @Override - public void initGui() - { - //You have to add this line for the Gui to function properly! - super.initGui(); - - //The parameters of GuiButton are(id, x, y, width, height, text); - //this.buttonList.add(new GuiButton( 1, 367, 132, 18, 18, "X")); - //this.buttonList.add(new GuiButton( 2, 385, 132, 18, 18, "Y")); - //NOTE: the id always has to be different or else it might get called twice or never! - - //Add any other buttons here too! - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_HeliumGenerator.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_HeliumGenerator.java deleted file mode 100644 index 44d5c2ff9c..0000000000 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_HeliumGenerator.java +++ /dev/null @@ -1,39 +0,0 @@ -package gtPlusPlus.core.gui.machine; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.core.container.Container_HeliumGenerator; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.TileEntityHeliumGenerator; - -@SideOnly(Side.CLIENT) -public class GUI_HeliumGenerator extends GuiContainer { - - private static final ResourceLocation guiTexture = new ResourceLocation(CORE.MODID, "textures/gui/helium_collector_gui.png"); - - public GUI_HeliumGenerator(final InventoryPlayer player_inventory, final TileEntityHeliumGenerator te){ - super(new Container_HeliumGenerator(player_inventory, te)); - } - - @Override - protected void drawGuiContainerForegroundLayer(final int i, final int j){ - //this.fontRendererObj.drawString(I18n.format("", new Object[0]), 28, 6, 4210752); - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(guiTexture); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_ModularityTable.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_ModularityTable.java deleted file mode 100644 index bbd4dd0ad8..0000000000 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_ModularityTable.java +++ /dev/null @@ -1,83 +0,0 @@ -package gtPlusPlus.core.gui.machine; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.core.container.Container_ModularityTable; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; - -@SideOnly(Side.CLIENT) -public class GUI_ModularityTable extends GuiContainer { - - private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/ModularityTable.png"); - private Container_ModularityTable mThisContainer; - private TileEntityModularityTable mThisTile; - private int mRecipeTime = -1; - - public GUI_ModularityTable(final InventoryPlayer player_inventory, final TileEntityModularityTable tile){ - super(new Container_ModularityTable(player_inventory, tile)); - this.mThisContainer = tile.getContainer(); - this.mThisTile = tile; - if (this.mThisTile.getRecipeTime() > -1){ - this.mRecipeTime = this.mThisTile.getRecipeTime(); - } - } - - - @Override - protected void drawGuiContainerForegroundLayer(final int i, final int j){ - if (this.mThisTile.getRecipeTime() > -1){ - this.mRecipeTime = this.mThisTile.getRecipeTime(); - } - //Utils.LOG_INFO("Container: "+this.mRecipeTime); - this.fontRendererObj.drawString(I18n.format("Modularity Table", new Object[0]), 8, 6, 4210752); - if (mRecipeTime > -1){ - this.fontRendererObj.drawString(I18n.format("Time", new Object[0]), 84, 42, 4210752); - this.fontRendererObj.drawString(I18n.format("Remaining", new Object[0]), 84, 50, 4210752); - this.fontRendererObj.drawString(I18n.format(""+this.mRecipeTime+" Ticks", new Object[0]), 84, 58, 4210752); - } - this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); - - } - - - @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(craftingTableGuiTextures); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } - - - //This method is called when the Gui is first called! - @Override - public void initGui(){ - //You have to add this line for the Gui to function properly! - super.initGui(); - - //The parameters of GuiButton are(id, x, y, width, height, text); - //this.buttonList.add(new GuiButton( 1, 367, 132, 18, 18, "X")); - //this.buttonList.add(new GuiButton( 2, 385, 132, 18, 18, "Y")); - //NOTE: the id always has to be different or else it might get called twice or never! - - //Add any other buttons here too! - } - - @Override - protected void actionPerformed(final GuiButton B){ - - - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_PestKiller.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_PestKiller.java deleted file mode 100644 index 881c6c82a1..0000000000 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_PestKiller.java +++ /dev/null @@ -1,159 +0,0 @@ -package gtPlusPlus.core.gui.machine; - -import java.awt.Color; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.container.Container_PestKiller; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.MISC_MATERIALS; -import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller; -import gtPlusPlus.core.util.math.MathUtils; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.FluidTank; -import net.minecraftforge.fluids.IFluidTank; - -@SideOnly(Side.CLIENT) -public class GUI_PestKiller extends GuiContainer { - - private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/PestKiller.png"); - private final TileEntityPestKiller mTileKiller; - - public GUI_PestKiller(final InventoryPlayer player_inventory, final TileEntityPestKiller te) { - super(new Container_PestKiller(player_inventory, te)); - mTileKiller = te; - } - - @Override - protected void drawGuiContainerForegroundLayer(final int i, final int j) { - if (mTileKiller != null) { - this.fontRendererObj.drawString(I18n.format(mTileKiller.getInventoryName(), new Object[0]), 4, 6, 4210752); - drawFluidTank(mTileKiller.getTank(), 134, 35); - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j) { - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(craftingTableGuiTextures); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } - - // This method is called when the Gui is first called! - @Override - public void initGui() { - super.initGui(); - } - - private void drawFluidTank(IFluidTank tank, int x, int y) { - Color startGrad = new Color(50, 50, 50); - Color endGrad = new Color(20, 20, 20); - Container_PestKiller aCont = (Container_PestKiller) this.inventorySlots; - - double aPercentage = 0; - double aDivisor = (100/16); - int aFrameHeight = 16; - - boolean didRender = false; - if (aCont != null) { - TileEntityPestKiller aTile = mTileKiller; - if (aTile != null) { - FluidTank aTank = aTile.getTank(); - int aTier = aTile.getTier(); - drawGradientRect(x, y, x+16, y+16, startGrad.getRGB(), endGrad.getRGB()); - if (aTier <= 0 || aTier > 2) { - if (aTank != null && aTank.getFluidAmount() > 0) { - aPercentage = MathUtils.findPercentage(aTank.getFluidAmount(), aTank.getCapacity()); - //Logger.INFO("Percent = "+aPercentage); - aFrameHeight = (int) (aPercentage / aDivisor); - //Logger.INFO("Frame Height = "+aFrameHeight); - } - this.fontRendererObj.drawString("Tier: 0", 4, 18, 4210752); - this.fontRendererObj.drawString("Range: 1x1", 4, 30, 4210752); - this.fontRendererObj.drawString("Poison: None", 4, 42, 4210752); - this.fontRendererObj.drawString("Amount: 0", 4, 64, 4210752); - didRender = true; - } - else if (aTier == 1) { - if (aTank != null && aTank.getFluidAmount() > 0) { - aPercentage = MathUtils.findPercentage(aTank.getFluidAmount(), aTank.getCapacity()); - //Logger.INFO("Percent = "+aPercentage); - aFrameHeight = (int) (aPercentage / aDivisor); - //Logger.INFO("Frame Height = "+aFrameHeight); - } - startGrad = new Color(240, 50, 240); - endGrad = new Color(130, 30, 130); - drawGradientRect(x, y+(16-aFrameHeight), x+16, y+16, startGrad.getRGB(), endGrad.getRGB()); - this.fontRendererObj.drawString("Tier: 1", 4, 18, 4210752); - this.fontRendererObj.drawString("Range: 5x5", 4, 30, 4210752); - this.fontRendererObj.drawString("Poison: ", 4, 42, 4210752); - this.fontRendererObj.drawString(""+aTile.getTank().getFluid().getLocalizedName(), 4, 54, 4210752); - this.fontRendererObj.drawString("Amount: "+aTile.getTank().getFluidAmount(), 4, 64, 4210752); - didRender = true; - } - else if (aTier == 2) { - if (aTank != null && aTank.getFluidAmount() > 0) { - aPercentage = MathUtils.findPercentage(aTank.getFluidAmount(), aTank.getCapacity()); - //Logger.INFO("Percent = "+aPercentage); - aFrameHeight = (int) (aPercentage / aDivisor); - //Logger.INFO("Frame Height = "+aFrameHeight); - } - short[] aRGB = MISC_MATERIALS.HYDROGEN_CYANIDE.getRGB(); - startGrad = new Color(aRGB[0], aRGB[1], aRGB[2]); - endGrad = new Color(Math.max(aRGB[0], 0), Math.max(aRGB[1], 0), Math.max(aRGB[2], 0)); - drawGradientRect(x, y+(16-aFrameHeight), x+16, y+16, startGrad.getRGB(), endGrad.getRGB()); - this.fontRendererObj.drawString("Tier: 2", 4, 18, 4210752); - this.fontRendererObj.drawString("Range: 9x9", 4, 30, 4210752); - this.fontRendererObj.drawString("Poison: ", 4, 42, 4210752); - this.fontRendererObj.drawString(""+aTile.getTank().getFluid().getLocalizedName(), 4, 54, 4210752); - this.fontRendererObj.drawString("Amount: "+aTile.getTank().getFluidAmount(), 4, 64, 4210752); - didRender = true; - } - } - } - if (!didRender) { - startGrad = new Color(255, 30, 120); - endGrad = new Color(255, 0, 50); - drawGradientRect(x, y, x+16, y+16, startGrad.getRGB(), endGrad.getRGB()); - this.fontRendererObj.drawString("Tier: 0", 4, 18, 4210752); - } - - - - - - - /* - * FluidStack fluid = tank.getFluid(); TextureManager manager = - * mc.getTextureManager(); if (fluid != null) { - * manager.bindTexture(manager.getResourceLocation(0)); float amount = - * fluid.amount; float capacity = tank.getCapacity(); float scale = amount / - * capacity; int fluidTankHeight = 60; int fluidAmount = (int) (scale * - * fluidTankHeight); drawFluid(x, y + fluidTankHeight - fluidAmount, - * fluid.getFluid().getIcon(fluid), 16, fluidAmount); } - */ - } - - private void drawFluid(int x, int y, IIcon icon, int width, int height) { - int i = 0; - int j = 0; - int drawHeight = 0; - int drawWidth = 0; - for (i = 0; i < width; i += 16) { - for (j = 0; j < height; j += 16) { - drawWidth = Math.min(width - i, 16); - drawHeight = Math.min(height - j, 16); - drawTexturedModelRectFromIcon(x + i, y + j, icon, drawWidth, drawHeight); - } - } - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_ProjectTable.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_ProjectTable.java deleted file mode 100644 index 4870269080..0000000000 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_ProjectTable.java +++ /dev/null @@ -1,65 +0,0 @@ -package gtPlusPlus.core.gui.machine; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.core.container.Container_ProjectTable; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; - -@SideOnly(Side.CLIENT) -public class GUI_ProjectTable extends GuiContainer { - - private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/ProjectTable.png"); - - public GUI_ProjectTable(final InventoryPlayer player_inventory, final TileEntityProjectTable tile){ - super(new Container_ProjectTable(player_inventory, tile)); - } - - - @Override - protected void drawGuiContainerForegroundLayer(final int i, final int j){ - //this.fontRendererObj.drawString(I18n.format("Workbench", new Object[0]), 28, 6, 4210752); - //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); - - } - - - @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(craftingTableGuiTextures); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } - - - //This method is called when the Gui is first called! - @Override - public void initGui(){ - //You have to add this line for the Gui to function properly! - super.initGui(); - - //The parameters of GuiButton are(id, x, y, width, height, text); - //this.buttonList.add(new GuiButton( 1, 367, 132, 18, 18, "X")); - //this.buttonList.add(new GuiButton( 2, 385, 132, 18, 18, "Y")); - //NOTE: the id always has to be different or else it might get called twice or never! - - //Add any other buttons here too! - } - - @Override - protected void actionPerformed(final GuiButton B){ - - - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_RoundRobinator.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_RoundRobinator.java deleted file mode 100644 index edb53e8ec0..0000000000 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_RoundRobinator.java +++ /dev/null @@ -1,120 +0,0 @@ -package gtPlusPlus.core.gui.machine; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.container.Container_RoundRobinator; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - -@SideOnly(Side.CLIENT) -public class GUI_RoundRobinator extends GuiContainer { - - private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/RoundRobinator.png"); - private TileEntityRoundRobinator mTile; - private Container_RoundRobinator mContainer; - private static final Method mDrawItemStack; - - static { - mDrawItemStack = ReflectionUtils.getMethod(GuiContainer.class, "drawItemStack", new Class[] {ItemStack.class, int.class, int.class, String.class}); - } - - public GUI_RoundRobinator(final InventoryPlayer player_inventory, final TileEntityRoundRobinator te){ - this(new Container_RoundRobinator(player_inventory, te)); - mTile = te; - } - - private GUI_RoundRobinator(final Container_RoundRobinator aContainer){ - super(aContainer); - mContainer = aContainer; - } - - @Override - protected void drawGuiContainerForegroundLayer(final int i, final int j){ - super.drawGuiContainerForegroundLayer(i, j); - - int xStart = 134; - int yStart = 31; - mTile = this.mContainer.tile_entity; - - int tier = mContainer.mTier; - int aTickRate = mContainer.mTickRate; - - fontRendererObj.drawString("Round Robinator", 85, 4, Utils.rgbtoHexValue(50, 150, 50)); - fontRendererObj.drawString("Tier: "+tier, 85, 12, Utils.rgbtoHexValue(50, 150, 50)); - fontRendererObj.drawString("Rate: 1 Item/"+aTickRate+"t", 85, 20, Utils.rgbtoHexValue(50, 150, 50)); - - boolean[] aStates = new boolean[] {mContainer.mSide_1 == 0 ? false : true, mContainer.mSide_2 == 0 ? false : true, mContainer.mSide_3 == 0 ? false : true,mContainer.mSide_4 == 0 ? false : true}; - - fontRendererObj.drawString("West: "+(aStates[0] ? "Active" : "Disabled"), 5, 5, Utils.rgbtoHexValue(50, 50, 50)); - fontRendererObj.drawString("North: "+(aStates[1] ? "Active" : "Disabled"), 5, 15, Utils.rgbtoHexValue(50, 50, 50)); - fontRendererObj.drawString("South: "+(aStates[2] ? "Active" : "Disabled"), 5, 25, Utils.rgbtoHexValue(50, 50, 50)); - fontRendererObj.drawString("East: "+(aStates[3] ? "Active" : "Disabled"), 5, 35, Utils.rgbtoHexValue(50, 50, 50)); - fontRendererObj.drawString("Toggling South will visually", 5, 65, Utils.rgbtoHexValue(150, 50, 50)); - fontRendererObj.drawString("toggle East, This is a visual bug.", 5, 74, Utils.rgbtoHexValue(150, 50, 50)); - drawStatus(aStates[0], xStart, yStart); - drawStatus(aStates[1], xStart+18, yStart); - drawStatus(aStates[2], xStart, yStart+18); - drawStatus(aStates[3], xStart+18, yStart+18); - - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(craftingTableGuiTextures); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - - - - } - - private static ItemStack aGreenGlass; - private static ItemStack aRedGlass; - - private void drawStatus(boolean aStateActive, int x, int y) { - if (aGreenGlass == null) { - Item pane = ItemUtils.getSimpleStack(Blocks.stained_glass_pane).getItem(); - aGreenGlass = ItemUtils.simpleMetaStack(pane, 5, 1); - } - if (aRedGlass == null) { - Item pane = ItemUtils.getSimpleStack(Blocks.stained_glass_pane).getItem(); - aRedGlass = ItemUtils.simpleMetaStack(pane, 14, 1); - } - if (mDrawItemStack != null) { - try { - if (aStateActive) { - mDrawItemStack.invoke(this, new Object[]{aGreenGlass, x, y, ""}); - } - else { - mDrawItemStack.invoke(this, new Object[]{aRedGlass, x, y, ""}); - } - } - catch (Throwable t) { - t.printStackTrace(); - } - } - } - - //This method is called when the Gui is first called! - @Override - public void initGui(){ - super.initGui(); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_ScrollTest.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_ScrollTest.java deleted file mode 100644 index 8a1f7c3fe9..0000000000 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_ScrollTest.java +++ /dev/null @@ -1,229 +0,0 @@ -package gtPlusPlus.core.gui.machine; - -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.lwjgl.Sys; - -import com.google.common.collect.Lists; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiOptionButton; -import net.minecraft.client.gui.GuiResourcePackAvailable; -import net.minecraft.client.gui.GuiResourcePackSelected; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.resources.I18n; -import net.minecraft.client.resources.ResourcePackListEntry; -import net.minecraft.client.resources.ResourcePackListEntryFound; -import net.minecraft.client.resources.ResourcePackRepository; -import net.minecraft.client.resources.ResourcePackRepository.Entry; -import net.minecraft.util.Util; - -@SideOnly(Side.CLIENT) -public class GUI_ScrollTest extends GuiScreen -{ - private static final Logger logger = LogManager.getLogger(); - private GuiScreen aThisGUIScreen; - private List<?> field_146966_g; - private List<?> field_146969_h; - private GuiResourcePackAvailable MapOfFreeResourcePacks; - private GuiResourcePackSelected MapOfActiveResourcePacks; - private static final String __OBFID = "CL_00000820"; - - public GUI_ScrollTest(GuiScreen p_i45050_1_) - { - this.aThisGUIScreen = p_i45050_1_; - } - - /** - * Adds the buttons (and other controls) to the screen in question. - */ - @SuppressWarnings("unchecked") - public void initGui() - { - this.buttonList.add(new GuiOptionButton(2, this.width / 2 - 154, this.height - 48, I18n.format("resourcePack.openFolder", new Object[0]))); - this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 4, this.height - 48, I18n.format("gui.done", new Object[0]))); - this.field_146966_g = new ArrayList<Object>(); - this.field_146969_h = new ArrayList<Entry>(); - ResourcePackRepository resourcepackrepository = this.mc.getResourcePackRepository(); - resourcepackrepository.updateRepositoryEntriesAll(); - ArrayList<?> arraylist = Lists.newArrayList(resourcepackrepository.getRepositoryEntriesAll()); - arraylist.removeAll(resourcepackrepository.getRepositoryEntries()); - Iterator<?> iterator = arraylist.iterator(); - ResourcePackRepository.Entry entry; - - while (iterator.hasNext()) - { - entry = (ResourcePackRepository.Entry)iterator.next(); - //this.field_146966_g.add(new ResourcePackListEntryFound(this, entry)); - } - - iterator = Lists.reverse(resourcepackrepository.getRepositoryEntries()).iterator(); - - while (iterator.hasNext()) - { - entry = (ResourcePackRepository.Entry)iterator.next(); - //this.field_146969_h.add(new ResourcePackListEntryFound(this, entry)); - } - - //this.field_146969_h.add(new ResourcePackListEntryDefault(this)); - this.MapOfFreeResourcePacks = new GuiResourcePackAvailable(this.mc, 200, this.height, this.field_146966_g); - this.MapOfFreeResourcePacks.setSlotXBoundsFromLeft(this.width / 2 - 4 - 200); - this.MapOfFreeResourcePacks.registerScrollButtons(7, 8); - this.MapOfActiveResourcePacks = new GuiResourcePackSelected(this.mc, 200, this.height, this.field_146969_h); - this.MapOfActiveResourcePacks.setSlotXBoundsFromLeft(this.width / 2 + 4); - this.MapOfActiveResourcePacks.registerScrollButtons(7, 8); - } - - public boolean func_146961_a(ResourcePackListEntry p_146961_1_) - { - return this.field_146969_h.contains(p_146961_1_); - } - - public List<?> func_146962_b(ResourcePackListEntry p_146962_1_) - { - return this.func_146961_a(p_146962_1_) ? this.field_146969_h : this.field_146966_g; - } - - public List<?> func_146964_g() - { - return this.field_146966_g; - } - - public List<?> func_146963_h() - { - return this.field_146969_h; - } - - protected void actionPerformed(GuiButton p_146284_1_) - { - if (p_146284_1_.enabled) - { - if (p_146284_1_.id == 2) - { - File file1 = this.mc.getResourcePackRepository().getDirResourcepacks(); - String s = file1.getAbsolutePath(); - - if (Util.getOSType() == Util.EnumOS.OSX) - { - try - { - logger.info(s); - Runtime.getRuntime().exec(new String[] {"/usr/bin/open", s}); - return; - } - catch (IOException ioexception1) - { - logger.error("Couldn\'t open file", ioexception1); - } - } - else if (Util.getOSType() == Util.EnumOS.WINDOWS) - { - String s1 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[] {s}); - - try - { - Runtime.getRuntime().exec(s1); - return; - } - catch (IOException ioexception) - { - logger.error("Couldn\'t open file", ioexception); - } - } - - boolean flag = false; - - try - { - Class<?> oclass = ReflectionUtils.getClass("java.awt.Desktop"); - Object object = ReflectionUtils.getMethod(oclass, "getDesktop", new Class[0]).invoke((Object)null, new Object[0]); - ReflectionUtils.getMethod(oclass, "browse", new Class[] {URI.class}).invoke(object, new Object[] {file1.toURI()}); - } - catch (Throwable throwable) - { - logger.error("Couldn\'t open link", throwable); - flag = true; - } - - if (flag) - { - logger.info("Opening via system class!"); - Sys.openURL("file://" + s); - } - } - else if (p_146284_1_.id == 1) - { - ArrayList<Entry> arraylist = Lists.newArrayList(); - Iterator<?> iterator = this.field_146969_h.iterator(); - - while (iterator.hasNext()) - { - ResourcePackListEntry resourcepacklistentry = (ResourcePackListEntry)iterator.next(); - - if (resourcepacklistentry instanceof ResourcePackListEntryFound) - { - arraylist.add(((ResourcePackListEntryFound)resourcepacklistentry).func_148318_i()); - } - } - - Collections.reverse(arraylist); - this.mc.getResourcePackRepository().func_148527_a(arraylist); - this.mc.gameSettings.resourcePacks.clear(); - iterator = arraylist.iterator(); - - while (iterator.hasNext()) - { - ResourcePackRepository.Entry entry = (ResourcePackRepository.Entry)iterator.next(); - this.mc.gameSettings.resourcePacks.add(entry.getResourcePackName()); - } - - this.mc.gameSettings.saveOptions(); - this.mc.refreshResources(); - this.mc.displayGuiScreen(this.aThisGUIScreen); - } - } - } - - /** - * Called when the mouse is clicked. - */ - protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) - { - super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_); - this.MapOfFreeResourcePacks.func_148179_a(p_73864_1_, p_73864_2_, p_73864_3_); - this.MapOfActiveResourcePacks.func_148179_a(p_73864_1_, p_73864_2_, p_73864_3_); - } - - /** - * Called when the mouse is moved or a mouse button is released. Signature: (mouseX, mouseY, which) which==-1 is - * mouseMove, which==0 or which==1 is mouseUp - */ - protected void mouseMovedOrUp(int p_146286_1_, int p_146286_2_, int p_146286_3_) - { - super.mouseMovedOrUp(p_146286_1_, p_146286_2_, p_146286_3_); - } - - /** - * Draws the screen and all the components in it. - */ - public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) - { - this.drawBackground(0); - this.MapOfFreeResourcePacks.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_); - this.MapOfActiveResourcePacks.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_); - this.drawCenteredString(this.fontRendererObj, I18n.format("resourcePack.title", new Object[0]), this.width / 2, 16, 16777215); - this.drawCenteredString(this.fontRendererObj, I18n.format("resourcePack.folderInfo", new Object[0]), this.width / 2 - 77, this.height - 26, 8421504); - super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_SuperJukebox.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_SuperJukebox.java deleted file mode 100644 index d3d8f1e814..0000000000 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_SuperJukebox.java +++ /dev/null @@ -1,90 +0,0 @@ -package gtPlusPlus.core.gui.machine; - -import java.util.ArrayList; -import java.util.List; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox; -import gtPlusPlus.core.container.Container_SuperJukebox; -import gtPlusPlus.core.gui.GUI_Base_Tile_Entity; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.slots.SlotNoInput; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; - -@SideOnly(Side.CLIENT) -public class GUI_SuperJukebox extends GUI_Base_Tile_Entity { - - private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/SuperJukebox.png"); - private final Container_SuperJukebox mThisContainer; - - public GUI_SuperJukebox(final InventoryPlayer player_inventory, final TileEntitySuperJukebox te){ - super(new Container_SuperJukebox(player_inventory, te)); - mThisContainer = (Container_SuperJukebox) this.mContainer; - } - - //This method is called when the Gui is first called! - @Override - public void initGui(){ - super.initGui(); - } - - @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - super.drawGuiContainerForegroundLayer(par1, par2); - - boolean a = mThisContainer.isPlaying; - boolean b = mThisContainer.isLooping; - - if (a && b) { - this.fontRendererObj.drawString("[X] [X]", 72, 74, 4210752); - } - else if (a && !b) { - this.fontRendererObj.drawString("[X] [ ]", 72, 74, 4210752); - } - else if (!a && b) { - this.fontRendererObj.drawString("[ ] [X]", 72, 74, 4210752); - } - else { - this.fontRendererObj.drawString("[ ] [ ]", 72, 74, 4210752); - } - - this.drawTooltip(par1, par2); - } - - private void drawTooltip(final int x2, final int y2) { - final int xStart = (this.width - this.xSize) / 2; - final int yStart = (this.height - this.ySize) / 2; - final int x3 = x2 - xStart; - final int y3 = y2 - yStart + 5; - final List<String> list = new ArrayList<String>(); - - if (y3 >= 17 && y3 <= 33) { - if (x3 >= 80 && x3 <= 96) { - list.add("Play"); - } - } - if (y3 >= 35 && y3 <= 53) { - if (x3 >= 80 && x3 <= 96) { - list.add("Loop"); - } - } - if (!list.isEmpty()) { - this.drawHoveringText(list, x3, y3, this.fontRendererObj); - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(craftingTableGuiTextures); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_TradeTable.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_TradeTable.java deleted file mode 100644 index 7c71f09302..0000000000 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_TradeTable.java +++ /dev/null @@ -1,50 +0,0 @@ -package gtPlusPlus.core.gui.machine; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.container.Container_TradeTable; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; - -@SideOnly(Side.CLIENT) -public class GUI_TradeTable extends GuiContainer { - - TileEntityTradeTable mThisTable; - String mOwnerName; - - private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/ProjectTable.png"); - - public GUI_TradeTable(final InventoryPlayer player_inventory, final TileEntityTradeTable te, final String mOwnerName){ - super(new Container_TradeTable(player_inventory, te)); - if (te.isServerSide()){ - mThisTable = te; - this.mOwnerName = mOwnerName; - Logger.INFO("Set valid TE in GUI"); - } - } - - @Override - protected void drawGuiContainerForegroundLayer(final int i, final int j){ - this.fontRendererObj.drawString(I18n.format("Owner - "+this.mOwnerName, new Object[0]), 28, 66, 4210752); - //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(craftingTableGuiTextures); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_VolumetricFlaskSetter.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_VolumetricFlaskSetter.java deleted file mode 100644 index 0257e51d0c..0000000000 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_VolumetricFlaskSetter.java +++ /dev/null @@ -1,183 +0,0 @@ -package gtPlusPlus.core.gui.machine; - -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.container.Container_VolumetricFlaskSetter; -import gtPlusPlus.core.gui.widget.GuiValueField; -import gtPlusPlus.core.handler.PacketHandler; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.network.packet.Packet_VolumetricFlaskGui; -import gtPlusPlus.core.tileentities.general.TileEntityVolumetricFlaskSetter; -import net.minecraft.client.gui.GuiTextField; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.resources.I18n; -import net.minecraft.util.ResourceLocation; - -@SideOnly(Side.CLIENT) -public class GUI_VolumetricFlaskSetter extends GuiContainer { - - private GuiTextField mText; - private boolean mIsOpen = false; - private TileEntityVolumetricFlaskSetter mTile; - private Container_VolumetricFlaskSetter mContainer; - private static final ResourceLocation mGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/VolumetricFlaskSetter.png"); - - public GUI_VolumetricFlaskSetter(Container_VolumetricFlaskSetter aContainer){ - super(aContainer); - mContainer = aContainer; - mTile = mContainer.mTileEntity; - } - - public void initGui(){ - super.initGui(); - Keyboard.enableRepeatEvents(true); - mIsOpen = true; - this.mText = new GuiValueField(this.fontRendererObj, 26, 31, this.width / 2 - 62, this.height/2-52, 106, 14); - mText.setMaxStringLength(5); - mText.setEnableBackgroundDrawing(true); - mText.setText("0"); - mText.setFocused(true); - } - - protected void keyTyped(char par1, int par2){ - if (mIsOpen) { - if (mText.isFocused()) { - if (par2 == Keyboard.KEY_RETURN) { - if (mText.isFocused()) { - mText.setFocused(false); - } - } - else if (par2 == Keyboard.KEY_BACK) { - String aCurrentText = getText(); - if (aCurrentText.length() > 0) { - this.mText.setText(aCurrentText.substring(0, aCurrentText.length() - 1)); - if (getText().length() <= 0) { - this.mText.setText("0"); - } - sendUpdateToServer(); - } - } - else { - if (isNumber(par1)) { - if (this.mText.getText().equals("0")) { - this.mText.setText(""+par1); - sendUpdateToServer(); - } - else { - this.mText.textboxKeyTyped(par1, par2); - sendUpdateToServer(); - } - } - else { - super.keyTyped(par1, par2); - } - } - } - else { - super.keyTyped(par1, par2); - } - } - } - - @Override - public void onGuiClosed() { - mIsOpen = false; - mText.setEnabled(false); - mText.setVisible(false); - super.onGuiClosed(); - Keyboard.enableRepeatEvents(false); - } - - public void updateScreen(){ - super.updateScreen(); - // Update Textbox to 0 if Empty - if (getText().length() <= 0) { - this.mText.setText("0"); - sendUpdateToServer(); - } - this.mText.updateCursorCounter(); - - // Check TextBox Value is correct - short aCustomValue = 0; - if (getText().length() > 0) { - try { - aCustomValue = Short.parseShort(getText()); - short aTileValue = ((Container_VolumetricFlaskSetter) mContainer).mCustomValue; - if (mContainer != null) { - if (aTileValue != aCustomValue){ - this.mText.setText(""+aTileValue); - } - } - } catch (NumberFormatException ex) { - - } - } - } - - public void drawScreen(int par1, int par2, float par3){ - this.drawDefaultBackground(); - super.drawScreen(par1, par2, par3); - - - } - - protected void mouseClicked(int x, int y, int btn) { - if (mIsOpen) { - super.mouseClicked(x, y, btn); - this.mText.mouseClicked(x, y, btn); - } - } - - - - - @Override - protected void drawGuiContainerForegroundLayer(final int i, final int j){ - super.drawGuiContainerForegroundLayer(i, j); - this.mText.drawTextBox(); - this.fontRendererObj.drawString(I18n.format("container.VolumetricFlaskSetter", new Object[0]), 4, 3, 4210752); - int aYVal = 49; - this.fontRendererObj.drawString(I18n.format("0 = 16l", new Object[0]), 8, aYVal, 4210752); - this.fontRendererObj.drawString(I18n.format("4 = 576l", new Object[0]), 64, aYVal, 4210752); - this.fontRendererObj.drawString(I18n.format("1 = 36l", new Object[0]), 8, aYVal+=8, 4210752); - this.fontRendererObj.drawString(I18n.format("5 = 720l", new Object[0]), 64, aYVal, 4210752); - this.fontRendererObj.drawString(I18n.format("2 = 144l", new Object[0]), 8, aYVal+=8, 4210752); - this.fontRendererObj.drawString(I18n.format("6 = 864l", new Object[0]), 64, aYVal, 4210752); - this.fontRendererObj.drawString(I18n.format("3 = 432l", new Object[0]), 8, aYVal+=8, 4210752); - this.fontRendererObj.drawString(I18n.format("-> = Custom", new Object[0]), 59, aYVal, 4210752); - - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(mGuiTextures); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } - - public boolean isNumber(char c) { - return ((c >= 48 && c <= 57) || c == 45); - } - - protected String getText() { - return this.mText.getText(); - } - - protected void sendUpdateToServer() { - short aCustomValue = 0; - if (getText().length() > 0) { - try { - aCustomValue = Short.parseShort(getText()); - PacketHandler.sendToServer(new Packet_VolumetricFlaskGui(mTile, aCustomValue)); - } catch (NumberFormatException ex) { - - } - } - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java deleted file mode 100644 index 861c2ba6b6..0000000000 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java +++ /dev/null @@ -1,81 +0,0 @@ -package gtPlusPlus.core.gui.machine; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.core.container.Container_Workbench; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; - -@SideOnly(Side.CLIENT) -public class GUI_Workbench extends GuiContainer { - - private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/BronzeCraftingTable.png"); - - public boolean moveItemsToChest = false; - public boolean moveItemsToCrafting = false; - - public GUI_Workbench(final InventoryPlayer player_inventory, final TileEntityWorkbench tile){ - super(new Container_Workbench(player_inventory, tile)); - } - - - @Override - protected void drawGuiContainerForegroundLayer(final int i, final int j){ - //this.fontRendererObj.drawString(I18n.format("Workbench", new Object[0]), 28, 6, 4210752); - //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); - - } - - - @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(craftingTableGuiTextures); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } - - - //This method is called when the Gui is first called! - @Override - public void initGui() - { - //You have to add this line for the Gui to function properly! - super.initGui(); - - //The parameters of GuiButton are(id, x, y, width, height, text); - //this.buttonList.add(new GuiButton( 1, 367, 132, 18, 18, "X")); - //this.buttonList.add(new GuiButton( 2, 385, 132, 18, 18, "Y")); - //NOTE: the id always has to be different or else it might get called twice or never! - - //Add any other buttons here too! - } - - @Override - protected void actionPerformed(final GuiButton B) - { - //If the button id is different, or you have mrs buttons, create another if block for that too! - if(B.id == 1){ - System.out.println("Trying to empty crafting grid to the storage compartment."); - //moveItemsToChest = true; - ((Container_Workbench) this.inventorySlots).moveCraftingToChest(); - } - else if(B.id == 2){ - System.out.println("Trying to move items into the crafting grid."); - //moveItemsToCrafting = true; - ((Container_Workbench) this.inventorySlots).moveChestToCrafting(); - } - - - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java deleted file mode 100644 index 20183eb0b0..0000000000 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java +++ /dev/null @@ -1,42 +0,0 @@ -package gtPlusPlus.core.gui.machine; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.core.container.Container_WorkbenchAdvanced; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; - -@SideOnly(Side.CLIENT) -public class GUI_WorkbenchAdvanced extends GuiContainer { - - private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/AdvancedCraftingTable.png"); - - public GUI_WorkbenchAdvanced(final InventoryPlayer player_inventory, final TileEntityWorkbenchAdvanced tile){ - super(new Container_WorkbenchAdvanced(player_inventory, tile)); - } - - - @Override - protected void drawGuiContainerForegroundLayer(final int i, final int j){ - //this.fontRendererObj.drawString(I18n.format("Workbench", new Object[0]), 28, 6, 4210752); - //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); - } - - - @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(craftingTableGuiTextures); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/widget/GuiValueField.java b/src/Java/gtPlusPlus/core/gui/widget/GuiValueField.java deleted file mode 100644 index ac4c1a8aee..0000000000 --- a/src/Java/gtPlusPlus/core/gui/widget/GuiValueField.java +++ /dev/null @@ -1,86 +0,0 @@ -package gtPlusPlus.core.gui.widget; - -import java.lang.reflect.Field; - -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiTextField; - -public class GuiValueField extends GuiTextField { - - private final FontRenderer mFontRenderer; - private final int mScreenLocationX; - private final int mScreenLocationY; - - public GuiValueField(FontRenderer aFontRenderer, int aX, int aY, int aScreenLocationX, int aScreenLocationY, int aWidth, int aHeight) { - super(aFontRenderer, aX, aY, aWidth, aHeight); - mFontRenderer = aFontRenderer; - mScreenLocationX = aScreenLocationX; - mScreenLocationY = aScreenLocationY; - } - - public boolean canLoseFocus() { - Field canLoseFocus = ReflectionUtils.getField(GuiTextField.class, "canLoseFocus"); - if (canLoseFocus != null) { - return (boolean) ReflectionUtils.getFieldValue(canLoseFocus, this); - } - return true; - } - - public boolean isFocused() { - Field isFocused = ReflectionUtils.getField(GuiTextField.class, "isFocused"); - if (isFocused != null) { - return (boolean) ReflectionUtils.getFieldValue(isFocused, this); - } - return false; - } - - public boolean isBackgroundDrawingEnabled() { - Field enableBackgroundDrawing = ReflectionUtils.getField(GuiTextField.class, "enableBackgroundDrawing"); - if (enableBackgroundDrawing != null) { - return (boolean) ReflectionUtils.getFieldValue(enableBackgroundDrawing, this); - } - return true; - } - public int getLineScrollOffset() { - Field lineScrollOffset = ReflectionUtils.getField(GuiTextField.class, "lineScrollOffset"); - if (lineScrollOffset != null) { - return (int) ReflectionUtils.getFieldValue(lineScrollOffset, this); - } - return 0; - } - - /** - * Args: x, y, buttonClicked - */ - public void mouseClicked(int aX, int aY, int aButton){ - - boolean flag = aX >= this.mScreenLocationX && aX < this.mScreenLocationX + this.width && aY >= this.mScreenLocationY && aY < this.mScreenLocationY + this.height; - - //Logger.INFO("Clicked X:"+aX); - //Logger.INFO("Clicked Y:"+aY); - //Logger.INFO("ScreenPos X:"+mScreenLocationX); - //Logger.INFO("ScreenPos Y:"+mScreenLocationY); - //Logger.INFO("Render X:"+xPosition); - //Logger.INFO("Render Y:"+yPosition); - - if (canLoseFocus()) - { - this.setFocused(flag); - } - - if (isFocused() && aButton == 0) - { - int l = aX - this.mScreenLocationX; - - if (isBackgroundDrawingEnabled()) - { - l -= 4; - } - - String s = this.mFontRenderer.trimStringToWidth(this.getText().substring(getLineScrollOffset()), this.getWidth()); - this.setCursorPosition(this.mFontRenderer.trimStringToWidth(s, l).length() + getLineScrollOffset()); - } - } - -} diff --git a/src/Java/gtPlusPlus/core/handler/AchievementHandler.java b/src/Java/gtPlusPlus/core/handler/AchievementHandler.java deleted file mode 100644 index fa10f4def3..0000000000 --- a/src/Java/gtPlusPlus/core/handler/AchievementHandler.java +++ /dev/null @@ -1,421 +0,0 @@ -package gtPlusPlus.core.handler; - -import java.util.concurrent.ConcurrentHashMap; - -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; -import cpw.mods.fml.common.gameevent.PlayerEvent.ItemSmeltedEvent; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.api.util.GT_Log; -import gregtech.common.items.GT_MetaGenerated_Tool_01; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.stats.Achievement; -import net.minecraft.stats.StatBase; -import net.minecraftforge.common.AchievementPage; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.player.EntityItemPickupEvent; - -public class AchievementHandler { - - public ConcurrentHashMap<String, Achievement> achievementList = new ConcurrentHashMap<String, Achievement>(); - public ConcurrentHashMap<String, Boolean> issuedAchievements = new ConcurrentHashMap<String, Boolean>(); - - public int adjX = 5; - public int adjY = 9; - - private static final String aBaseAchievementName = "gtpp.start"; - - public AchievementHandler() { - - Logger.INFO("Initializing GT++ achievements"); - GT_Log.out.println("Initializing GT++ achievements"); - - //register first - this.registerAchievement(aBaseAchievementName, 0, 0, MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(MetaGeneratedGregtechTools.ANGLE_GRINDER, 1, Materials.Osmium, Materials.Osmium, null), "", true); - - //Useful Info - boolean cores = CORE.ConfigSwitches.requireControlCores; - if (cores || GregtechMeta_MultiBlockBase.DEBUG_DISABLE_CORES_TEMPORARILY) { - this.registerAchievement("hatch.control", -2, -2, GregtechItemList.Hatch_Control_Core.get(1), aBaseAchievementName, false); - } - this.registerAchievement("hatch.dynamo.buffered", 2, -2, GregtechItemList.Hatch_Buffer_Dynamo_IV.get(1), aBaseAchievementName, false); - //First multi anyone really needs - this.registerAchievement("multi.abs", -4, -2, GregtechItemList.Industrial_AlloyBlastSmelter.get(1), cores ? "hatch.control" : aBaseAchievementName, true); - - //Material Advancement - this.registerAchievement("dust.potin", 0, 2, ALLOY.POTIN.getDust(1), aBaseAchievementName, false); - this.registerAchievement("dust.eglin", 0, 4, ALLOY.EGLIN_STEEL.getDust(1), "dust.potin", false); - this.registerAchievement("dust.staballoy", 0, 6, ALLOY.STABALLOY.getDust(1), "dust.eglin", false); - this.registerAchievement("dust.quantum", 0, 8, ALLOY.QUANTUM.getDust(1), "dust.staballoy", true); - this.registerAchievement("dust.hypogen", 0, 10, ELEMENT.STANDALONE.HYPOGEN.getDust(1), "dust.quantum", true); - - - //Blocks - this.registerAchievement("block.fishtrap", -2, 2, ItemUtils.getSimpleStack(ModBlocks.blockFishTrap), "dust.potin", false); - this.registerAchievement("block.withercage", -2, 4, ItemUtils.getSimpleStack(ModBlocks.blockWitherGuard), "dust.eglin", false); - - - //Machines (-10/-8/-6) - this.registerAchievement("rtg", -16, -10, GregtechItemList.RTG.get(1), aBaseAchievementName, false); - this.registerAchievement("dehydrate", -15, -10, GregtechItemList.GT_Dehydrator_HV.get(1), aBaseAchievementName, false); - this.registerAchievement("semifluid", -14, -10, GregtechItemList.Generator_SemiFluid_HV.get(1), aBaseAchievementName, false); - this.registerAchievement("earlywasher", -13, -10, GregtechItemList.SimpleDustWasher_ULV.get(1), aBaseAchievementName, false); - this.registerAchievement("advancedsteam", -12, -10, GregtechItemList.Boiler_Advanced_MV.get(1), aBaseAchievementName, false); - if (PollutionUtils.isPollutionEnabled()) { - this.registerAchievement("pollutionremoval", -11, -10, GregtechItemList.Pollution_Cleaner_IV.get(1), aBaseAchievementName, false); - } - this.registerAchievement("hiampxform", -10, -10, GregtechItemList.Transformer_HA_HV_MV.get(1), aBaseAchievementName, false); - - - //Multis (-4/-2/0) - this.registerAchievement("multi.pss", -16, -7, GregtechItemList.PowerSubStation.get(1), "multi.abs", false); - this.registerAchievement("multi.cyclo", -15, -7, GregtechItemList.COMET_Cyclotron.get(1), "multi.abs", false); - this.registerAchievement("multi.sifter", -14, -7, GregtechItemList.Industrial_Sifter.get(1), "dust.eglin", false); - this.registerAchievement("multi.cokeoven", -13, -7, GregtechItemList.Industrial_CokeOven.get(1), "multi.abs", false); - this.registerAchievement("multi.boiler.thermal", -12, -7, GregtechItemList.GT4_Thermal_Boiler.get(1), "multi.abs", false); - this.registerAchievement("multi.zhuhai", -11, -7, GregtechItemList.Industrial_FishingPond.get(1), aBaseAchievementName, false); - //this.registerAchievement("rtg", -4, -4, GregtechItemList.RTG.get(1), aBaseAchievementName, false); - - //Casings - this.registerAchievement("casing.abs", 2, -10, GregtechItemList.Casing_Coil_BlastSmelter.get(1), aBaseAchievementName, false); - this.registerAchievement("casing.cyclotron.coil", 3, -10, GregtechItemList.Casing_Cyclotron_Coil.get(1), aBaseAchievementName, false); - this.registerAchievement("casing.multiuse", 4, -10, GregtechItemList.Casing_Multi_Use.get(1), aBaseAchievementName, false); - this.registerAchievement("casing.containment", 5, -10, GregtechItemList.Casing_Containment.get(1), aBaseAchievementName, false); - - - - - - - - - //Radioactive - this.registerAchievement("decay.neptunium238", 11, 8, ItemUtils.getSimpleStack(ModItems.dustNeptunium238), "multi.cyclo", false); - this.registerAchievement("decay.radium226", 12, 8, ItemUtils.getSimpleStack(ModItems.dustRadium226), "multi.cyclo", false); - this.registerAchievement("decay.molybdenum99", 13, 8, ItemUtils.getSimpleStack(ModItems.dustMolybdenum99), "multi.cyclo", false); - this.registerAchievement("decay.technetium99m", 14, 8, ItemUtils.getSimpleStack(ModItems.dustTechnetium99M), "multi.cyclo", false); - this.registerAchievement("decay.technetium99", 15, 8, ItemUtils.getSimpleStack(ModItems.dustTechnetium99), "multi.cyclo", false); - - - - - - - - - - - - - AchievementPage.registerAchievementPage( - new AchievementPage("GT++", (Achievement[]) ((Achievement[]) this.achievementList.values() - .toArray(new Achievement[this.achievementList.size()])))); - MinecraftForge.EVENT_BUS.register(this); - FMLCommonHandler.instance().bus().register(this); - - - } - - public Achievement registerAchievement(String textId, int x, int y, ItemStack icon, Achievement requirement, - boolean special) { - Achievement achievement = new Achievement(textId, textId, this.adjX + x, this.adjY + y, icon, requirement); - if (special) { - achievement.setSpecial(); - } - - achievement.registerStat(); - if (CORE.DEVENV) { - GT_Log.out.println("achievement." + textId + "="); - GT_Log.out.println("achievement." + textId + ".desc="); - } - - this.achievementList.put(textId, achievement); - return achievement; - } - - public Achievement registerAchievement(String textId, int x, int y, ItemStack icon, String requirement, - boolean special) { - Achievement achievement = new Achievement(textId, textId, this.adjX + x, this.adjY + y, icon, - this.getAchievement(requirement)); - if (special) { - achievement.setSpecial(); - } - - achievement.registerStat(); - if (CORE.DEVENV) { - GT_Log.out.println("achievement." + textId + "="); - GT_Log.out.println("achievement." + textId + ".desc="); - } - - this.achievementList.put(textId, achievement); - return achievement; - } - - public void issueAchievement(EntityPlayer entityplayer, String textId) { - if (entityplayer != null) { - entityplayer.triggerAchievement((StatBase) this.achievementList.get(textId)); - } - } - - public Achievement getAchievement(String textId) { - return this.achievementList.containsKey(textId) ? (Achievement) this.achievementList.get(textId) : null; - } - - - /** - * A generic handler that will give an achievement for an item. - * Useful to only write this once, then call it from all handlers. - * @param aStack - The Itemstack to check for achievements. - * @param aPlayer - The player to unlock for. - */ - private void handleAchivement(ItemStack aStack, EntityPlayer aPlayer) { - - if (aPlayer != null && aStack != null) { - /* - * Copy this to all events because I am lazy - Alk 2019 - */ - - //Safe name - String aUnlocalName = ItemUtils.getUnlocalizedItemName(aStack); - - - boolean isValid = false; - //Check if valid name // mod - String aModID = ItemUtils.getModId(aStack); - - if (aModID == null || aModID.length() <= 0 || aModID.isEmpty()) { - return; - } - - if (aModID != null && (ItemUtils.getModId(aStack).equals(CORE.MODID) || ItemUtils.getModId(aStack).equalsIgnoreCase("gregtech"))) { - isValid = true; - } - if (!isValid) { - return; - } - - //Should unlock base achievement from *ANY* GT++ item. (Too lazy to special case GT machineBlocks though) - if (ItemUtils.getModId(aStack).equals(CORE.MODID)) { - this.issueAchievement(aPlayer, aBaseAchievementName); - } - - if (aUnlocalName.contains("item.")) { - aUnlocalName = aUnlocalName.substring(5); - } - else if (aUnlocalName.contains("tile.")) { - aUnlocalName = aUnlocalName.substring(5); - } - - //Logger.INFO("Picked up "+aUnlocalName); - - - /** - * Misc Blocks - */ - - if (aUnlocalName.equals("blockFishTrap")) { - this.issueAchievement(aPlayer, "block.fishtrap"); - } - if (aUnlocalName.equals("blockBlackGate")) { - this.issueAchievement(aPlayer, "block.withercage"); - } - - - /** - * Decayables - */ - if (aUnlocalName.equals("dustNeptunium238")) { - this.issueAchievement(aPlayer, "decay.neptunium238"); - } - else if (aUnlocalName.equals("dustRadium226")) { - this.issueAchievement(aPlayer, "decay.radium226"); - } - else if (aUnlocalName.equals("dustMolybdenum99")) { - this.issueAchievement(aPlayer, "decay.molybdenum99"); - } - else if (aUnlocalName.equals("dustTechnetium99M")) { - this.issueAchievement(aPlayer, "decay.technetium99m"); - } - else if (aUnlocalName.equals("dustTechnetium99")) { - this.issueAchievement(aPlayer, "decay.technetium99"); - } - - /** - * Random Materials worthy of Achievements - */ - else if (aUnlocalName.equals("itemDustPotin")) { - this.issueAchievement(aPlayer, "dust.potin"); - } - else if (aUnlocalName.equals("itemDustEglinSteel")) { - this.issueAchievement(aPlayer, "dust.eglin"); - } - else if (aUnlocalName.equals("itemDustStaballoy")) { - this.issueAchievement(aPlayer, "dust.staballoy"); - } - else if (aUnlocalName.equals("itemDustQuantum")) { - this.issueAchievement(aPlayer, "dust.quantum"); - } - else if (aUnlocalName.equals("itemDustHypogen")) { - this.issueAchievement(aPlayer, "dust.hypogen"); - } - - - - /** - * Machines - */ - - else if (aUnlocalName.startsWith("gt.blockmachines.")) { - - //Readability - String aStartsWith = "gt.blockmachines."; - - /** - * Single Blocks - */ - - //RTG - if (aUnlocalName.startsWith(aStartsWith + "basicgenerator.rtg")) { - this.issueAchievement(aPlayer, "rtg"); - } - //Dehydrator - else if (aUnlocalName.startsWith(aStartsWith + "machine.dehydrator.tier.")) { - this.issueAchievement(aPlayer, "dehydrate"); - } - //SemiFluids - else if (aUnlocalName.startsWith(aStartsWith + "basicgenerator.semifluid.tier.")) { - this.issueAchievement(aPlayer, "semifluid"); - } - //Simple Washer - else if (aUnlocalName.startsWith(aStartsWith + "simplewasher.01.tier.")) { - this.issueAchievement(aPlayer, "earlywasher"); - } - //Advanced Boilers - else if (aUnlocalName.startsWith(aStartsWith + "electricboiler.")) { - this.issueAchievement(aPlayer, "advancedsteam"); - } - //Scrubers - else if (aUnlocalName.startsWith(aStartsWith + "pollutioncleaner.01.tier.")) { - this.issueAchievement(aPlayer, "pollutionremoval"); - } - //High-amp xformers - else if (aUnlocalName.startsWith(aStartsWith + "transformer.ha.tier.")) { - this.issueAchievement(aPlayer, "hiampxform"); - } - //Buffered Dynamos - else if (aUnlocalName.startsWith(aStartsWith + "hatch.dynamo.buffer.tier.")) { - this.issueAchievement(aPlayer, "hatch.dynamo.buffered"); - } - //Control Core Hatch - else if (aUnlocalName.startsWith(aStartsWith + "hatch.control.adv")) { - this.issueAchievement(aPlayer, "hatch.control"); - } - - - - /** - * Multis - */ - - //ABS - else if (aUnlocalName.equals(aStartsWith + "industrialsalloyamelter.controller.tier.single")) { - this.issueAchievement(aPlayer, "multi.abs"); - } - //PSS - else if (aUnlocalName.equals(aStartsWith + "substation.01.input.single")) { - this.issueAchievement(aPlayer, "multi.pss"); - } - //Cyclotron - else if (aUnlocalName.startsWith(aStartsWith + "cyclotron.tier.single")) { - this.issueAchievement(aPlayer, "multi.cyclo"); - } - //Sifter - else if (aUnlocalName.equals(aStartsWith + "industrialsifter.controller.tier.single")) { - this.issueAchievement(aPlayer, "multi.sifter"); - } - //Coke Oven - else if (aUnlocalName.equals(aStartsWith + "industrialcokeoven.controller.tier.single")) { - this.issueAchievement(aPlayer, "multi.cokeoven"); - } - //Thermal Boiler - else if (aUnlocalName.equals(aStartsWith + "gtplusplus.thermal.boiler")) { - this.issueAchievement(aPlayer, "multi.boiler.thermal"); - } - //Zhuhai - else if (aUnlocalName.equals(aStartsWith + "industrial.fishpond.controller.tier.single")) { - this.issueAchievement(aPlayer, "multi.zhuhai"); - } - - } - - /** - * Casings - */ - - else if (aUnlocalName.equals("gtplusplus.blockcasings.14")) { - this.issueAchievement(aPlayer, "casing.abs"); - } - - else if (aUnlocalName.equals("gtplusplus.blockcasings.2.9")) { - this.issueAchievement(aPlayer, "casing.cyclotron.coil"); - } - - else if (aUnlocalName.equals("gtplusplus.blockcasings.3.2")) { - this.issueAchievement(aPlayer, "casing.multiuse"); - } - else if (aUnlocalName.equals("gtplusplus.blockcasings.3.15")) { - this.issueAchievement(aPlayer, "casing.containment"); - } - } - } - - - - - /* - * Handle achievements for all vanilla types of obtianment. - */ - - - - @SubscribeEvent - public void onCrafting(ItemCraftedEvent event) { - EntityPlayer player = event.player; - ItemStack stack = event.crafting; - if (player != null && stack != null) { - handleAchivement(stack, player); - } - } - - @SubscribeEvent - public void onSmelting(ItemSmeltedEvent event) { - EntityPlayer player = event.player; - ItemStack stack = event.smelting; - if (player != null && stack != null) { - handleAchivement(stack, player); - } - } - - @SubscribeEvent - public void onItemPickup(EntityItemPickupEvent event) { - EntityPlayer player = event.entityPlayer; - ItemStack stack = event.item.getEntityItem(); - if (player != null && stack != null) { - handleAchivement(stack, player); - } - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/BookHandler.java b/src/Java/gtPlusPlus/core/handler/BookHandler.java deleted file mode 100644 index d85de925bf..0000000000 --- a/src/Java/gtPlusPlus/core/handler/BookHandler.java +++ /dev/null @@ -1,404 +0,0 @@ -package gtPlusPlus.core.handler; - -import java.util.HashMap; -import java.util.Map; - -import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; - -public class BookHandler { - - public static int mBookKeeperCount = 0; - - public static Map<Integer, BookTemplate> mBookMap = new HashMap<Integer, BookTemplate>(); - - public static BookTemplate book_ThermalBoiler; - public static BookTemplate book_MultiPowerStation; - public static BookTemplate book_ModularBauble; - public static BookTemplate book_MultiMachineManual; - public static BookTemplate book_NuclearManual; - public static BookTemplate book_MultiChemicalPlant; - - public static void run(){ - - Logger.INFO("Writing books."); - - //Thermal Boiler - book_ThermalBoiler = writeBookTemplate( - "Manual_Thermal_Boiler", "Thermal Boiler Manual", "GregoriusT", - new String[] { - "This Book explains how to set up and run your Thermal Boiler. We are not responsible for any Damage done by this Book itself nor its content.", - "First you need to craft the following things for a Thermal Boiler to Function: The Main Boiler Block, 20 Thermal Containment Casings, two Input Hatches, two Output Hatches, a bunch of different Tools and a Maintenance Hatch.", - "To begin the building, lay out the first 3x3 layer of Machine Casings on the ground (with a Hatch in the Middle), then place the Boiler Block facing outward in the middle of one of the 3m wide Sides.", - "Now grab 3 other Hatches and place them on the remaining three 3m wide Sides also facing outwards. And now the four corners of the Machine need also a Machine Casing. There should only be a Hole left in the middle of the Cube.", - "So, now place a 3x3 of Machine Casings ontop, at the 3rd Layer with the last Hatch in the middle facing outwards as well.", - "When accessing the Boiler Block, it should now stop telling you, that the structure is incomplete (bottom Line of that Screen). Now go with a bunch of different Tools (Metal Hammer, Rubber Hammer, Screwdriver, Wrench, Soldering Iron and Crowbar)", - "to the Maintenance Hatch and access it. After that you grab the 6 Tools and rightclick the Slot with each of them in your Hand in the Maintenance GUI. Note that you need Soldering Tin/Lead in your Inventory to use the Soldering Iron.", - "The Main Block should now tell you that you need to use the Rubber Hammer on it to (re)activate the Machine. The Rubber Hammer can enable and disable Machines. The Machine disables itself after something important broke.", - "If you want to use Lava with this Device, then you should add a Lava Filter to extract additional Resources from the Lava. If the Filter breaks, the Machine won't explode like a Turbine would. If you use molten Salt, then you won't need a Filter.", - "You will get Obsidian when processing Lava, however if a Filter is used, you will get sometimes an Ingot instead of a Block of Obsidian. When using molten Salt, you will get the Salt back.", - "So, now for the Maintenance. After a few Hours of running nonstop, your Boiler will get small Problems, which don't prevent it from running, these Problems just decrease Efficiency. Every Problem listed on the Screen does -10% Efficiency.", - "To fix these Problems, just go to the Maintenance Hatch and click with the problem corresponding Tool on the Slot to repair. If all six possible runtime Problems happen, the Machine will auto-shutdown no matter what. No Explosion, it's just stopping.", - "The Thermal Boiler will produce 800 Liters of Steam per tick for about 5 or 6 Liters of Water per tick at reaching 100% Efficiency. In case of Lava it consumes 1666 Liters every Second.", - "A Thermal Boiler is worth about 33 small Thermal Generators, and as the Boilers get much less Efficient, when not having enough Fuel, you should consider making a large Nether Pump for Lava, or a good Nuclear Reactor for molten Salt.", - "Input and Output Slots are fully optional, you can place multiple ones of them or even none on the Machine. A Machine without Input couldn't process any Recipes, while a Machine without Output just voids all outputted Items and Liquids.", - "It might be useful to use the Screwdriver on the Output Hatches to determine what is outputted where." }); - - - - //Test Novel - book_MultiPowerStation = writeBookTemplate( - "Manual_Multi_PowerStation", - "Power Storage & You [Version 0.64]", - "Alkalus", - new String[] { - //Page 1 - "So, when it comes to power storage you relaly have three seperate options:\n"+ - " \n"+ - "Battery Buffers,\n"+ - "Energy Buffers,\n"+ - "The Power Sub-Station\n", - //Page 2 - "Battery Buffer\n" + - " \n" + - "Is rather portable. Allowing you to throw set one up and insert batteries where ever you may need."+"\n"+ - "They output 1A for each battery stored inside, upto a maximum of 16A.", - //Page 3 - "Energy Buffer\n" + - " \n" + - "Is a more optimal choice for storage in your base. Once placed down, they cannot be moved without losing all stored power."+"\n"+ - "Energy Buffers can output 4A from the output side, however accept 16A as input.", - //Page 4 - "The Power Sub-Station"+ - " \n"+ - "Is used for storing Insane amounts of power later game."+"\n"+ - "Consumes 2% of the average voltage of all energy type hatches every tick."+"\n", - //Page 5 - "Allows Insertation/Removal of power from the rear face of the controller, swap with a screwdriver."+"\n"+ - "Variable Height Structure, between 4-16Y. Inserted Redox Cells dictate max energy tier of structure."+"\n", - //Page 6 - "Redox Cells cannot be placed into the Top or Bottom layer and only take up 3xhx3 internally."+"\n"+ - "Different Tier cells CANNOT be mixed together."+"\n", - //Page 7 - "All Hatches Must be HV at a Minimum, this minimum tier is in place to stop people abusing ULV/LV hatches to lower the avg/t."+"\n"+ - "Currently the GUI will NOT display anything at all until the structure forms, this is a known bug."+"\n", - //Page 8 - "Valid Hatches:\n"+ - "Energy Hatch,\n"+ - "Dynamo Hatch,\n"+ - "Charging Bus,\n"+ - "Discharging Bus,\n"+ - "Dynamo Buffer,\n"+ - "Multi-Amp Dynamo Hatch.\n\n\n"+ - "Structure MUST contain at least one energy input and one energy output hatch." - }); - - //Test Novel - book_ModularBauble = writeBookTemplate( - "Manual_Modular_Bauble", "How to: Modular Baubles", "Alkalus", - new String[] { - "Concept: This idea came from wanting flexibility. \n" + - "First step, Build a Modularity table to begin customisation of your Bauble. \n" - + " After this has been constructed, you can now combine the upgrades listed within this book to improve the baubles level/100.", - "Defence:\n" - + "Can be upgraded by combining metal plates with the bauble. \n" - + " | +1 | Aluminium \n" - + " | +2 | Stainless Steel \n" - + " | +3 | Tungsten \n" - + " | +4 | Tungsten Steel \n" - + " | +5 | Naquadah \n", - "There was once a sad and lonely oak tree. \n", - "There was once a sad and lonely oak tree. \n", - "There was once a sad and lonely oak tree. \n"}); - - //Test Novel - //20/21/22 - book_MultiMachineManual = writeBookTemplate( - "Manual_Multi_Machine", "Multi-Machine Manual", "Alkalus", - new String[] { - "This Multiblock, depending upon the mode used, can function as a variety of different machines. The idea behind this, was that most of these machines are rather niche compared to any others, as such, not used often.", - "To build, you need to construct a hollow 3x3x3 structure made from Multi-Use casings, With a minimum of 6. Any Casing position can be substituted out with an Input Hatch/Bus, an Output Hatch/Bus, Muffler, Maint. Hatch or Energy Injector Hatch.", - "The Mode can be set by using a Screwdriver on the controller block. Each mode allows the use of Numbered Circuits, to allow a different machine 'type' for each input bus.", - "[Metal Work] Mode A - Allows the multiblock to function as a Compressor, a Lathe or an Electro-Magnet. To allow a hatch to run in Compressor mode, insert a No. 20 circuit. For Lathe, use No. 21 and for Electro-Magnet use No. 22.", - "[Fluid Work] Mode B - Allows the multiblock to function as a Fermenter, a Fluid Extractor or an Extractor. To allow a hatch to run in Fermenter mode, insert a No. 20 circuit. For Fluid Extractor, use No. 21 and for Extractor use No. 22.", - "[Misc. Work] Mode C - Allows the multiblock to function as a Laser Engraver, an Autoclave or a Fluid Solidifier. To allow a hatch to run in Laser Engraver mode, insert a No. 20 circuit. For Autoclave, use No. 21 and for Solidifier use No. 22.", - }); - - book_NuclearManual = writeBookTemplate( - "Manual_NuclearStuff_1", "Nuclear Chemistry [FFPP]", "Alkalus", - new String[] { - //Page 1 - "Fission Fuel Processing Plant\n" - + "Size: 3x9x3 [LxHxW]\n" - + "Controller: Center, Bottom\n" - + "4x Input Hatch\n" - + "2x Output Hatch\n" - + "1x Output Bus\n" - + "1x ZPM+ Muffler\n" - + "1x Maintenance Hatch\n" - + "1x Energy Hatch\n", - //Page 2 - "[1] 7x Hastelloy-X or I/O\n" - + "[2] 5x Incoloy-DS Fluid Containment\n" - + "[3] 4x Zeron-100 Shielding\n" - + "[4] 17x Hastelloy-N Sealant Case" - + "\n" - + "Multiblock Construction\n" - + "Convention is [LxHxW]\n" - + "\n", - //Page 3 - "Layer 1/2:\n" - + "[1][1][1]\n" - + "[1][1][1]\n" - + "[1][1][1]\n" - + "\n" - + "Layer 3/5/6\n" - + "[ ][4][ ]\n" - + "[4][2][4]\n" - + "[ ][4][ ]\n" - + "\n", - //Page 4 - "Layer 4\n" - + "[ ][3][ ]\n" - + "[3][2][3]\n" - + "[ ][3][ ]\n" - + "\n" - + "Layer 7/8/9\n" - + "[ ][ ][ ]\n" - + "[ ][3][ ]\n" - + "[ ][ ][ ]\n" - , - //Page 5 - "Fission Fuel\n"+ - "Processing Plant"+ - "----------------------\n"+ - "This structure is used to produce the Molten Salts required to run a Liquid Fluorine Thorium Reactor [LFTR]." - - }); - - - book_MultiChemicalPlant = writeBookTemplate( - "book_Multi_ChemicalPlant", "Chemical Plant Manual", "Alkalus", - new String[] { - - // Intro - "This book will explain how the Chemical Plant is constructed, which blocks are valid to upgrade it and also how the upgrades work.", - - // Info - "Solid Casings = Plant tier" + "\n" + - "Machine Casings = Hatch tier" + "\n" + - "Higher tier coils More Speed" + "\n" + - "T1 50% , T2 100% , T3 150%, etc" + "\n", - - "Higher tier pipe casings boost parallel"+ "\n" + - "and reduce catalyst consumption" + "\n" + - "+2 parallel per tier, 20% extra chance of"+ "\n" + - "not damaging catalyst per tier" + "\n", - - - // Machine Casings - "Valid Solid Machine Casings:" + "\n" + - "0 - Strong Bronze" + "\n" + - "1 - Solid Steel" + "\n" + - "2 - Sturdy Aluminium" + "\n" + - "3 - Clean Stainless Steel" + "\n" + - "4 - Stable Titanium" + "\n" + - "5 - Robust Tungstensteel" + "\n" + - "6 - Vigorous Laurenium" + "\n" + - "7 - Rugged Botmium", - - // Machine Casings - "Valid Tiered Machine Casings:" + "\n" + "\n" + - "1 - " + GT_Values.VN[0] + "\n" + - "2 - " + GT_Values.VN[1] + "\n" + - "3 - " + GT_Values.VN[2] + "\n" + - "4 - " + GT_Values.VN[3] + "\n" + - "5 - " + GT_Values.VN[4] + "\n" + - "6 - " + GT_Values.VN[5] + "\n" + - "7 - " + GT_Values.VN[6] + "\n" + - "8 - " + GT_Values.VN[7] + "\n" + - "9 - " + GT_Values.VN[8] + "\n" + - "10 - " + GT_Values.VN[9], - - // Pipe Casings - "Valid Pipe Casings:" + "\n" + "\n" + - "1 - Bronze" + "\n" + - "2 - Steel" + "\n" + - "3 - Titanium" + "\n" + - "4 - Tungstensteel", - - //Coils - "Valid Coils:" + "\n" + "\n" + - "1 - Cupronickel" + "\n" + - "2 - Kanthal" + "\n" + - "3 - Nichrome" + "\n" + - "4 - Tungstensteel" + "\n" + - "5 - HSS-G" + "\n" + - "6 - Naquadah" + "\n" + - "7 - Naquadah Alloy", - - // Requirements - "Multiblock Requirements:" + "\n" + "\n" + - "27x Coils" + "\n" + - "18x Pipe Casings" + "\n" + - "57x Tiered Machine Casings" + "\n" + - "80+ Solid Casings" + "\n" + - "1x Catalyst Housing (Catalysts cannot go inside an Input Bus)", - - // Construction Guide - "Construction Guide Pt1:" + "\n" + "\n" + - "Controller is placed on a middle casing in the bottom layer" + "\n" + - "Hatches can only be placed on the bottom layer edges", - - "Construction Guide Pt2:" + "\n" + "\n" + - "7x7x7 Hollow frame of solid casings" + "\n" + - "5x1x5 layer of solid casings (fills in top layer)" + "\n" + - "5x1x5 layer of machine casings (fills in bottom layer)", - - "Construction Guide Pt3:" + "\n" + - "In the central 3x5x3:" + "\n" + - "3x1x3 layer of Coils, surrounded by ring of Machine Casings" + "\n" + - "3x1x3 layer of Pipe Casings" + "\n" + - "3x1x3 layer of Coils" + "\n" + - "3x1x3 layer of Pipe Casings" + "\n" + - "3x1x3 layer of Coils, surrounded by ring of Machine Casings", - - // Construction Guide Info - "Information:" + "\n" + "\n" + - "A = Air" + "\n" + - "X = Solid Casing" + "\n" + - "M = Machine Casing" + "\n" + - "P = Pipe Casing" + "\n" + - "C = Coil Casing", - - "Layer 1:" + "\n" + "\n" + - "XXXXXXX" + "\n" + - "XMMMMMX" + "\n" + - "XMMMMMX" + "\n" + - "XMMMMMX" + "\n" + - "XMMMMMX" + "\n" + - "XMMMMMX" + "\n" + - "XXXXXXX", - - "Layer 2:" + "\n" + "\n" + - "XAAAAAX" + "\n" + - "AMMMMMA" + "\n" + - "AMCCCMA" + "\n" + - "AMCCCMA" + "\n" + - "AMCCCMA" + "\n" + - "AMMMMMA" + "\n" + - "XAAAAAX", - - "Layer 3:" + "\n" + "\n" + - "XAAAAAX" + "\n" + - "AAAAAAA" + "\n" + - "AAPPPAA" + "\n" + - "AAPPPAA" + "\n" + - "AAPPPAA" + "\n" + - "AAAAAAA" + "\n" + - "XAAAAAX", - - "Layer 4:" + "\n" + "\n" + - "XAAAAAX" + "\n" + - "AAAAAAA" + "\n" + - "AACCCAA" + "\n" + - "AACCCAA" + "\n" + - "AACCCAA" + "\n" + - "AAAAAAA" + "\n" + - "XAAAAAX", - - "Layer 5:" + "\n" + "\n" + - "XAAAAAX" + "\n" + - "AAAAAAA" + "\n" + - "AAPPPAA" + "\n" + - "AAPPPAA" + "\n" + - "AAPPPAA" + "\n" + - "AAAAAAA" + "\n" + - "XAAAAAX", - - "Layer 6:" + "\n" + "\n" + - "XAAAAAX" + "\n" + - "AMMMMMA" + "\n" + - "AMCCCMA" + "\n" + - "AMCCCMA" + "\n" + - "AMCCCMA" + "\n" + - "AMMMMMA" + "\n" + - "XAAAAAX", - - "Layer 7:" + "\n" + "\n" + - "XXXXXXX" + "\n" + - "XXXXXXX" + "\n" + - "XXXXXXX" + "\n" + - "XXXXXXX" + "\n" + - "XXXXXXX" + "\n" + - "XXXXXXX" + "\n" + - "XXXXXXX", - }); - - } - - - - - public static ItemStack ItemBookWritten_ThermalBoiler; - public static ItemStack ItemBookWritten_NuclearManual; - public static ItemStack ItemBookWritten_ModularBaubles; - public static ItemStack ItemBookWritten_MultiPowerStorage; - public static ItemStack ItemBookWritten_MultiMachineManual; - public static ItemStack ItemBookWritten_MultiChemicalPlant; - - public static void runLater(){ - ItemBookWritten_ThermalBoiler = ItemUtils.simpleMetaStack(ModItems.itemCustomBook, 0, 1); - ItemBookWritten_MultiPowerStorage = ItemUtils.simpleMetaStack(ModItems.itemCustomBook, 1, 1); - ItemBookWritten_ModularBaubles = ItemUtils.simpleMetaStack(ModItems.itemCustomBook, 2, 1); - ItemBookWritten_MultiMachineManual = ItemUtils.simpleMetaStack(ModItems.itemCustomBook, 3, 1); - ItemBookWritten_NuclearManual = ItemUtils.simpleMetaStack(ModItems.itemCustomBook, 4, 1); - ItemBookWritten_MultiChemicalPlant = ItemUtils.simpleMetaStack(ModItems.itemCustomBook, 5, 1); - - //Multiblock Manuals - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[]{ItemUtils.getSimpleStack(Items.writable_book), ItemUtils.getSimpleStack(Items.lava_bucket)}, ItemBookWritten_ThermalBoiler); - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[]{ItemUtils.getSimpleStack(Items.writable_book), ItemUtils.getItemStackOfAmountFromOreDict(CI.craftingToolWrench, 1)}, ItemBookWritten_MultiMachineManual); - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[]{ItemUtils.getSimpleStack(Items.writable_book), ItemUtils.getItemStackOfAmountFromOreDict("wireGt01Tin", 1)}, ItemBookWritten_MultiPowerStorage); - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[]{ItemUtils.getSimpleStack(Items.writable_book), ItemUtils.getItemStackOfAmountFromOreDict("dustUranium", 1)}, ItemBookWritten_NuclearManual); - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[]{ItemUtils.getSimpleStack(Items.writable_book), ItemUtils.getItemStackOfAmountFromOreDict("wireGt01Copper", 1)}, ItemBookWritten_MultiChemicalPlant); - - for (int i=0;i<mBookKeeperCount;i++){ - ItemStack bookstack = ItemUtils.simpleMetaStack(ModItems.itemCustomBook, i, 1); - GT_OreDictUnificator.registerOre("bookWritten", bookstack); - GT_OreDictUnificator.registerOre("craftingBook", bookstack); - } - - } - - private static BookTemplate writeBookTemplate(String aMapping, String aTitle, String aAuthor, String[] aPages){ - mBookKeeperCount++; - BookTemplate mTemp = new BookTemplate(mBookKeeperCount, aMapping, aTitle, aAuthor, aPages); - mBookMap.put(mBookKeeperCount-1, mTemp); - return mTemp; - } - - public static class BookTemplate { - public final int mMeta; - public final String mMapping; - public final String mTitle; - public final String mAuthor; - public final String[] mPages; - - BookTemplate(int aMeta, String aMapping, String aTitle, String aAuthor, String[] aPages){ - this.mMeta = aMeta; - this.mMapping = aMapping; - this.mTitle = aTitle; - this.mAuthor = aAuthor; - this.mPages = aPages; - } - } -} - - diff --git a/src/Java/gtPlusPlus/core/handler/BurnableFuelHandler.java b/src/Java/gtPlusPlus/core/handler/BurnableFuelHandler.java deleted file mode 100644 index 82bcdc84e6..0000000000 --- a/src/Java/gtPlusPlus/core/handler/BurnableFuelHandler.java +++ /dev/null @@ -1,35 +0,0 @@ -package gtPlusPlus.core.handler; - -import cpw.mods.fml.common.IFuelHandler; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class BurnableFuelHandler implements IFuelHandler{ - - @Override - public int getBurnTime(ItemStack aStack) { - //Iterate over my burnables. - for (Pair<Integer, ItemStack> temp : CORE.burnables) { - int aStackID = Item.getIdFromItem(aStack.getItem()); - int burnID = Item.getIdFromItem(temp.getValue().getItem()); - if (aStackID == burnID){ - int burn = temp.getKey(); - ItemStack fuel = temp.getValue(); - ItemStack testItem = ItemUtils.getSimpleStack(fuel, aStack.stackSize); - - if (aStack.isItemEqual(testItem)){ - return burn; - } - } - } - - //If it's not my fuel, return 0. - return 0; - } - -} diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java deleted file mode 100644 index 53d63499a6..0000000000 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ /dev/null @@ -1,320 +0,0 @@ -package gtPlusPlus.core.handler; - -import static gtPlusPlus.core.lib.LoadedMods.Gregtech; - -import java.util.LinkedList; -import java.util.Queue; -import java.util.Set; - -import cpw.mods.fml.common.event.FMLLoadCompleteEvent; -import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.ItemPackage; -import gtPlusPlus.core.common.compat.COMPAT_BigReactors; -import gtPlusPlus.core.common.compat.COMPAT_CompactWindmills; -import gtPlusPlus.core.common.compat.COMPAT_EnderIO; -import gtPlusPlus.core.common.compat.COMPAT_ExtraUtils; -import gtPlusPlus.core.common.compat.COMPAT_HarvestCraft; -import gtPlusPlus.core.common.compat.COMPAT_IC2; -import gtPlusPlus.core.common.compat.COMPAT_MorePlanets; -import gtPlusPlus.core.common.compat.COMPAT_OpenBlocks; -import gtPlusPlus.core.common.compat.COMPAT_PneumaticCraft; -import gtPlusPlus.core.common.compat.COMPAT_RFTools; -import gtPlusPlus.core.common.compat.COMPAT_Railcraft; -import gtPlusPlus.core.common.compat.COMPAT_SimplyJetpacks; -import gtPlusPlus.core.common.compat.COMPAT_Thaumcraft; -import gtPlusPlus.core.common.compat.COMPAT_Witchery; -import gtPlusPlus.core.handler.Recipes.LateRegistrationHandler; -import gtPlusPlus.core.handler.Recipes.RegistrationHandler; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialGenerator; -import gtPlusPlus.core.recipe.RECIPES_Extruder; -import gtPlusPlus.core.recipe.RECIPES_GREGTECH; -import gtPlusPlus.core.recipe.RECIPES_LaserEngraver; -import gtPlusPlus.core.recipe.ShapedRecipeObject; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaGarbageCollector; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_FluidCanning; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Recycling; -import gtPlusPlus.xmod.gregtech.loaders.recipe.RecipeLoader_GTNH; -import gtPlusPlus.xmod.gregtech.loaders.recipe.RecipeLoader_Nuclear; -import gtPlusPlus.xmod.gregtech.registration.gregtech.*; -import net.minecraft.item.ItemStack; - -public class COMPAT_HANDLER { - - public static Queue<Object> RemoveRecipeQueue = new LinkedList<>(); - public static Queue<ShapedRecipeObject> AddRecipeQueue = new LinkedList<>(); - public static Boolean areInitItemsLoaded = false; - - - public static void registerMyModsOreDictEntries(){ - - Logger.INFO("Registering Materials with OreDict."); - //In-house - - //tools - GT_OreDictUnificator.registerOre("craftingToolSandHammer", new ItemStack(ModItems.itemSandstoneHammer)); - - for(int i=1; i<=10; i++){ - GT_OreDictUnificator.registerOre("bufferCore_"+GT_Values.VN[i-1], new ItemStack(ItemUtils.getItemFromFQRN("miscutils:item.itemBufferCore"+i))); - } - } - - public static void registerGregtechMachines() { - if (Gregtech) { - - //Debug - GregtechItemList.Garbage_Collector_Debug_Machine.set( - new GregtechMetaGarbageCollector( - "garbagecollector.01.tier.single", - "JVM Garbage Collector", - "Useful for debugging or smoother performance on local servers").getStackForm(1L)); - - - //Free IDs - /* - --- - 859 - to - 868 - --- - 911 - to - 940 - */ - - new RECIPES_LaserEngraver(); - new RECIPES_Extruder(); - GregtechGeneratorsULV.run(); - GregtechEnergyBuffer.run(); - GregtechLFTR.run(); - GregtechSteamCondenser.run(); - GregtechSafeBlock.run(); - //GregtechSuperConductionPoint.run(); - GregtechIronBlastFurnace.run(); - GregtechIndustrialCentrifuge.run(); - GregtechIndustrialCokeOven.run(); - GregtechIndustrialPlatePress.run(); - GregtechRocketFuelGenerator.run(); - GregtechIndustrialElectrolyzer.run(); - GregtechIndustrialMacerator.run(); - GregtechIndustrialWiremill.run(); - GregtechIndustrialMassFabricator.run(); - GregtechIndustrialBlastSmelter.run(); - GregtechSolarGenerators.run(); - GregtechPowerSubStation.run(); - GregtechDehydrator.run(); - GregtechAdvancedBoilers.run(); - GregtechPollutionDevices.run(); - GregtechTieredFluidTanks.run(); - //GregtechIndustrialMultiTank.run(); - GregtechGeothermalThermalGenerator.run(); - Gregtech4Content.run(); - GregtechIndustrialFuelRefinery.run(); - GregtechTreeFarmerTE.run(); - GregtechIndustrialTreeFarm.run(); - GregtechIndustrialSifter.run(); - GregtechSimpleWasher.run(); - GregtechRTG.run(); - GregtechCyclotron.run(); - GregtechHiAmpTransformer.run(); - GregtechIndustrialThermalCentrifuge.run(); - GregtechIndustrialWashPlant.run(); - GregtechSemiFluidgenerators.run(); - GregtechAdvancedMixer.run(); - GregtechWirelessChargers.run(); - GregtechIndustrialGeneratorArray.run(); - GregtechIndustrialCuttingFactory.run(); - //GregtechMiniRaFusion.run(); - GregtechComponentAssembler.run(); - //GregtechTeslaTower.run(); - GregtechSuperChests.run(); - GregtechIndustrialFishPond.run(); - GregtechTieredChunkloaders.run(); - GregtechIndustrialExtruder.run(); - GregtechIndustrialMultiMachine.run(); - //GregtechBedrockPlatforms.run(); - GregtechBufferDynamos.run(); - GregtechAmazonWarehouse.run(); - GregtechFactoryGradeReplacementMultis.run(); - GregtechThaumcraftDevices.run(); - GregtechThreadedBuffers.run(); - GregtechIndustrialMixer.run(); - GregtechCustomHatches.run(); - //GregtechNaqReactor.run(); - GregtechIndustrialArcFurnace.run(); - //GregtechSolarTower.run(); - GregtechLargeTurbinesAndHeatExchanger.run(); - GregtechPowerBreakers.run(); - GregtechFluidReactor.run(); - GregtechAlgaeContent.run(); - GregtechIndustrialAlloySmelter.run(); - GregtechIsaMill.run(); - GregtechSteamMultis.run(); - //GregtechIndustrialElementDuplicator.run(); - - //New Horizons Content - NewHorizonsAccelerator.run(); - } - - } - - //InterMod - public static void intermodOreDictionarySupport(){ - - if (LoadedMods.Big_Reactors){ - COMPAT_BigReactors.OreDict(); - } - if (LoadedMods.EnderIO){ - COMPAT_EnderIO.OreDict(); - } - if (LoadedMods.MorePlanets){ - COMPAT_MorePlanets.OreDict(); - } - if (LoadedMods.OpenBlocks){ - COMPAT_OpenBlocks.OreDict(); - } - if (LoadedMods.Railcraft){ - COMPAT_Railcraft.OreDict(); - } - if (LoadedMods.Simply_Jetpacks){ - COMPAT_SimplyJetpacks.OreDict(); - } - if (LoadedMods.RFTools){ - COMPAT_RFTools.OreDict(); - } - if (LoadedMods.Thaumcraft){ - COMPAT_Thaumcraft.OreDict(); - } - if (LoadedMods.Extra_Utils){ - COMPAT_ExtraUtils.OreDict(); - } - if (LoadedMods.PneumaticCraft){ - COMPAT_PneumaticCraft.OreDict(); - } - if (LoadedMods.CompactWindmills){ - COMPAT_CompactWindmills.OreDict(); - } - if (LoadedMods.IndustrialCraft2){ - COMPAT_IC2.OreDict(); - } - if (LoadedMods.PamsHarvestcraft){ - COMPAT_HarvestCraft.OreDict(); - } - if (LoadedMods.Witchery) { - COMPAT_Witchery.OreDict(); - } - } - - public static void RemoveRecipesFromOtherMods(){ - //Removal of Recipes - for(final Object item : RemoveRecipeQueue){ - RecipeUtils.removeCraftingRecipe(item); - } - } - - public static void InitialiseHandlerThenAddRecipes(){ - RegistrationHandler.run(); - } - public static void InitialiseLateHandlerThenAddRecipes(){ - LateRegistrationHandler.run(); - } - - public static void startLoadingGregAPIBasedRecipes(){ - //Add hand-made recipes - RECIPES_GREGTECH.run(); - RecipeLoader_GTNH.generate(); - RecipeLoader_Nuclear.generate(); - //Add autogenerated Recipes from Item Components - for (Set<RunnableWithInfo<Material>> m : MaterialGenerator.mRecipeMapsToGenerate) { - for (RunnableWithInfo<Material> r : m) { - try { - r.run(); - Logger.INFO("[FIND] "+r.getInfoData().getLocalizedName()+" recipes generated."); - } - catch (Throwable t) { - t.printStackTrace(); - Logger.INFO("[ERROR] "+r.getInfoData().getLocalizedName()+" recipes failed to generated."); - } - } - } - RecipeGen_Recycling.executeGenerators(); - runQueuedMisc(); - - // Do Fluid Canning Last, because they're not executed on demand, but rather queued. - RecipeGen_FluidCanning.init(); - } - - - - public static void onLoadComplete(FMLLoadCompleteEvent event) { - runQueuedOnLoadComplete(event); - } - - public static final AutoMap<RunnableWithInfo<String>> mRecipesToGenerate = new AutoMap<RunnableWithInfo<String>>(); - public static final AutoMap<RunnableWithInfo<String>> mGtRecipesToGenerate = new AutoMap<RunnableWithInfo<String>>(); - - public static final AutoMap<RunnableWithInfo<String>> mObjectsToRunInPostInit = new AutoMap<RunnableWithInfo<String>>(); - public static final AutoMap<ItemPackage> mObjectsToRunInOnLoadComplete = new AutoMap<ItemPackage>(); - - public static void runQueuedRecipes() { - //Add autogenerated Recipes from Item Components - for (RunnableWithInfo<String> m : mRecipesToGenerate) { - try { - m.run(); - } - catch (Throwable t) { - t.printStackTrace(); - Logger.INFO("[ERROR] "+m.getInfoData()+" recipe failed to generated."); - } - - } - for (RunnableWithInfo<String> m : mGtRecipesToGenerate) { - try { - m.run(); - } - catch (Throwable t) { - t.printStackTrace(); - Logger.INFO("[ERROR] "+m.getInfoData()+" recipe failed to generated."); - } - - } - } - - public static void runQueuedMisc() { - for (RunnableWithInfo<String> m : mObjectsToRunInPostInit) { - try { - m.run(); - } - catch (Throwable t) { - t.printStackTrace(); - Logger.INFO("[ERROR] "+m.getInfoData()); - } - - } - } - - /** - * Generally used to register GT recipe map changes after they've been populated. - */ - public static void runQueuedOnLoadComplete(FMLLoadCompleteEvent event) { - for (ItemPackage m : mObjectsToRunInOnLoadComplete) { - try { - m.onLoadComplete(event); - } - catch (Throwable t) { - t.printStackTrace(); - Logger.INFO("[ERROR] "+m.getInfoData()); - } - - } - } -} diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java deleted file mode 100644 index 9a1b551d30..0000000000 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java +++ /dev/null @@ -1,91 +0,0 @@ -package gtPlusPlus.core.handler; - -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLLoadCompleteEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import gtPlusPlus.xmod.bartcrops.HANDLER_CropsPlusPlus; -import gtPlusPlus.xmod.bop.HANDLER_BiomesOPlenty; -import gtPlusPlus.xmod.computronics.HANDLER_Computronics; -import gtPlusPlus.xmod.forestry.HANDLER_FR; -import gtPlusPlus.xmod.galacticraft.HANDLER_GalactiCraft; -import gtPlusPlus.xmod.gregtech.HANDLER_GT; -import gtPlusPlus.xmod.growthcraft.HANDLER_GC; -import gtPlusPlus.xmod.ic2.HANDLER_IC2; -import gtPlusPlus.xmod.ob.HANDLER_OpenBlocks; -import gtPlusPlus.xmod.railcraft.HANDLER_Railcraft; -import gtPlusPlus.xmod.reliquary.HANDLER_Reliquary; -import gtPlusPlus.xmod.sc2.HANDLER_SC2; -import gtPlusPlus.xmod.sol.HANDLER_SpiceOfLife; -import gtPlusPlus.xmod.thaumcraft.HANDLER_Thaumcraft; -import gtPlusPlus.xmod.thermalfoundation.HANDLER_TF; -import gtPlusPlus.xmod.tinkers.HANDLER_Tinkers; - -public class COMPAT_IntermodStaging { - - public static void preInit(FMLPreInitializationEvent preinit){ - HANDLER_GT.preInit(); - HANDLER_GC.preInit(); - HANDLER_TF.preInit(); - HANDLER_FR.preInit(); - HANDLER_IC2.preInit(); - HANDLER_Computronics.preInit(); - HANDLER_BiomesOPlenty.preInit(); - //HANDLER_Mekanism.preInit(); - HANDLER_Thaumcraft.preInit(); - HANDLER_Tinkers.preInit(); - HANDLER_SC2.preInit(); - HANDLER_GalactiCraft.preInit(); - HANDLER_CropsPlusPlus.preInit(preinit); - HANDLER_Railcraft.preInit(); - HANDLER_Reliquary.preInit(); - HANDLER_OpenBlocks.preInit(); - HANDLER_SpiceOfLife.preInit(); - } - - public static void init(FMLInitializationEvent init){ - HANDLER_GT.init(); - HANDLER_GC.init(); - HANDLER_TF.init(); - HANDLER_FR.Init(); - HANDLER_IC2.init(); - HANDLER_Computronics.init(); - HANDLER_BiomesOPlenty.init(); - //HANDLER_Mekanism.init(); - HANDLER_Thaumcraft.init(); - HANDLER_Tinkers.init(); - HANDLER_SC2.init(); - HANDLER_GalactiCraft.init(); - HANDLER_CropsPlusPlus.init(init); - HANDLER_Railcraft.init(); - HANDLER_Reliquary.init(); - HANDLER_OpenBlocks.init(); - HANDLER_SpiceOfLife.init(); - } - - public static void postInit(FMLPostInitializationEvent postinit){ - HANDLER_GT.postInit(); - HANDLER_GC.postInit(); - HANDLER_TF.postInit(); - HANDLER_FR.postInit(); - HANDLER_IC2.postInit(); - HANDLER_Computronics.postInit(); - HANDLER_BiomesOPlenty.postInit(); - //HANDLER_Mekanism.postInit(); - HANDLER_Thaumcraft.postInit(); - HANDLER_Tinkers.postInit(); - HANDLER_SC2.postInit(); - HANDLER_GalactiCraft.postInit(); - HANDLER_CropsPlusPlus.postInit(postinit); - HANDLER_Railcraft.postInit(); - HANDLER_Reliquary.postInit(); - HANDLER_OpenBlocks.postInit(); - HANDLER_SpiceOfLife.postInit(); - } - - public static void onLoadComplete(FMLLoadCompleteEvent event) { - HANDLER_GT.onLoadComplete(event); - } - - -} diff --git a/src/Java/gtPlusPlus/core/handler/CraftingManager.java b/src/Java/gtPlusPlus/core/handler/CraftingManager.java deleted file mode 100644 index 6fb580cc32..0000000000 --- a/src/Java/gtPlusPlus/core/handler/CraftingManager.java +++ /dev/null @@ -1,17 +0,0 @@ -package gtPlusPlus.core.handler; - -public class CraftingManager { - - public static void mainRegistry() { - addCraftingRecipies(); - addSmeltingRecipies(); - } - - public static void addCraftingRecipies() { - - } - - public static void addSmeltingRecipies() { - - } -} diff --git a/src/Java/gtPlusPlus/core/handler/EnumHelperHandler.java b/src/Java/gtPlusPlus/core/handler/EnumHelperHandler.java deleted file mode 100644 index d164efa3d7..0000000000 --- a/src/Java/gtPlusPlus/core/handler/EnumHelperHandler.java +++ /dev/null @@ -1,21 +0,0 @@ -package gtPlusPlus.core.handler; - -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.xmod.gregtech.HANDLER_GT; -import gtPlusPlus.xmod.ic2.CustomInternalName; - -public class EnumHelperHandler { - - public static void init() { - - if (LoadedMods.IndustrialCraft2) { - CustomInternalName.init(); - } - - if (LoadedMods.Gregtech) { - HANDLER_GT.addNewOrePrefixes(); - } - - } - -} diff --git a/src/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java deleted file mode 100644 index 0567d6c5dd..0000000000 --- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java +++ /dev/null @@ -1,231 +0,0 @@ -package gtPlusPlus.core.handler; - -import cpw.mods.fml.common.network.IGuiHandler; -import cpw.mods.fml.common.network.NetworkRegistry; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox; -import gtPlusPlus.core.container.*; -import gtPlusPlus.core.container.box.LunchBoxContainer; -import gtPlusPlus.core.container.box.MagicBagContainer; -import gtPlusPlus.core.container.box.ToolBoxContainer; -import gtPlusPlus.core.gui.beta.Gui_ID_Registry; -import gtPlusPlus.core.gui.beta.MU_GuiId; -import gtPlusPlus.core.gui.item.GuiBaseBackpack; -import gtPlusPlus.core.gui.item.GuiBaseGrindle; -import gtPlusPlus.core.gui.item.box.LunchBoxGui; -import gtPlusPlus.core.gui.item.box.MagicBagGui; -import gtPlusPlus.core.gui.item.box.ToolBoxGui; -import gtPlusPlus.core.gui.machine.*; -import gtPlusPlus.core.interfaces.IGuiManager; -import gtPlusPlus.core.inventories.BaseInventoryBackpack; -import gtPlusPlus.core.inventories.BaseInventoryGrindle; -import gtPlusPlus.core.inventories.box.LunchBoxInventory; -import gtPlusPlus.core.inventories.box.MagicBagInventory; -import gtPlusPlus.core.inventories.box.ToolBoxInventory; -import gtPlusPlus.core.tileentities.base.TileEntityBase; -import gtPlusPlus.core.tileentities.general.*; -import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; -import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller; -import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; -import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; -import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.world.World; - -public class GuiHandler implements IGuiHandler { - - public static final int GUI1 = 0; // Project Table - public static final int GUI2 = 1; // Helium Generator - public static final int GUI3 = 2; // BackpackHandler - public static final int GUI4 = 3; // Workbench - public static final int GUI5 = 4; // Workbench Adv - public static final int GUI6 = 5; // Fish trap - public static final int GUI7 = 6; // Trade table - public static final int GUI8 = 7; // Circuit Programmer - public static final int GUI9 = 8; // Grindle - public static final int GUI10 = 9; // Universal Toolbox - public static final int GUI11 = 10; // Auto Lunchbox - public static final int GUI12 = 11; // Bag for Magic Tools - public static final int GUI13 = 12; // Decayables Chest - public static final int GUI14 = 13; // Super Jukebox - public static final int GUI15 = 14; // Pest Killer - public static final int GUI16 = 15; // Round-Robinator - public static final int GUI17 = 16; // Egg Box - public static final int GUI18 = 17; // Volumetric Flask Setter - - public static void init() { - - Logger.INFO("Registering GUIs."); - NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new GuiHandler()); - // Register GuiHandler - // NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new - // GuiHandler()); - } - - @Override // ContainerModTileEntity - public Object getServerGuiElement(final int ID, final EntityPlayer player, final World world, final int x, - final int y, final int z) { - final TileEntity te = world.getTileEntity(x, y, z); - - if (te != null) { - if (ID == GUI1) { - return new Container_ProjectTable(player.inventory, (TileEntityProjectTable) te); - } else if (ID == GUI2) { - return new Container_ModularityTable(player.inventory, (TileEntityModularityTable) te); - } - } - - if (ID == GUI3) { - // Use the player's held item to create the inventory - return new Container_BackpackBase(player, player.inventory, - new BaseInventoryBackpack(player.getHeldItem())); - } - - if (te != null) { - if (ID == GUI4) { - return new Container_Workbench(player.inventory, (TileEntityWorkbench) te); - } else if (ID == GUI5) { - Logger.INFO("sad"); - return new Container_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced) te); - - } else if (ID == GUI6) { - return new Container_FishTrap(player.inventory, (TileEntityFishTrap) te); - } else if (ID == GUI7) { - return new Container_TradeTable(player.inventory, (TileEntityTradeTable) te); - } else if (ID == GUI8) { - return new Container_CircuitProgrammer(player.inventory, (TileEntityCircuitProgrammer) te); - } else if (ID == GUI13) { - return new Container_DecayablesChest(player.inventory, (TileEntityDecayablesChest) te); - } else if (ID == GUI14) { - return new Container_SuperJukebox(player.inventory, (TileEntitySuperJukebox) te); - } else if (ID == GUI15) { - return new Container_PestKiller(player.inventory, (TileEntityPestKiller) te); - } else if (ID == GUI16) { - return new Container_RoundRobinator(player.inventory, (TileEntityRoundRobinator) te); - } else if (ID == GUI17) { - return new Container_EggBox(player.inventory, (TileEntityEggBox) te); - } else if (ID == GUI18) { - return new Container_VolumetricFlaskSetter(player.inventory, (TileEntityVolumetricFlaskSetter) te); - } - } - - if (ID == GUI9) { - return new Container_Grindle(player, player.inventory, new BaseInventoryGrindle(player.getHeldItem())); - } - // Tool, lunch, magic - if (ID == GUI10) { - return new ToolBoxContainer(player, player.inventory, new ToolBoxInventory(player.getHeldItem())); - } - if (ID == GUI11) { - return new LunchBoxContainer(player, player.inventory, new LunchBoxInventory(player.getHeldItem())); - } - if (ID == GUI12) { - return new MagicBagContainer(player, player.inventory, new MagicBagInventory(player.getHeldItem())); - } - - return null; - } - - @Override // GuiModTileEntity - public Object getClientGuiElement(final int ID, final EntityPlayer player, final World world, final int x, - final int y, final int z) { - Logger.WARNING("getClientGuiElement Called by: " + player + ", in world: " + player.dimension + " at x:" + x - + ", y:" + y + ", z:" + z + "."); - final TileEntity te = world.getTileEntity(x, y, z); - if (te != null) { - if (ID == GUI1) { - return new GUI_ProjectTable(player.inventory, (TileEntityProjectTable) te); - } else if (ID == GUI2) { - return new GUI_ModularityTable(player.inventory, (TileEntityModularityTable) te); - } - } - - if (ID == GUI3) { - // We have to cast the new container as our custom class - // and pass in currently held item for the inventory - return new GuiBaseBackpack(new Container_BackpackBase(player, player.inventory, - new BaseInventoryBackpack(player.getHeldItem()))); - } - - if (te != null) { - if (ID == GUI4) { - return new GUI_Workbench(player.inventory, (TileEntityWorkbench) te); - } else if (ID == GUI5) { - Logger.INFO("sad"); - return new GUI_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced) te); - } else if (ID == GUI6) { - return new GUI_FishTrap(player.inventory, (TileEntityFishTrap) te); - } else if (ID == GUI7) { - return new GUI_TradeTable(player.inventory, (TileEntityTradeTable) te, - ((TileEntityBase) te).getOwner()); - } else if (ID == GUI8) { - return new GUI_CircuitProgrammer(player.inventory, (TileEntityCircuitProgrammer) te); - } else if (ID == GUI13) { - return new GUI_DecayablesChest(player.inventory, (TileEntityDecayablesChest) te); - } else if (ID == GUI14) { - return new GUI_SuperJukebox(player.inventory, (TileEntitySuperJukebox) te); - } else if (ID == GUI15) { - return new GUI_PestKiller(player.inventory, (TileEntityPestKiller) te); - } else if (ID == GUI16) { - return new GUI_RoundRobinator(player.inventory, (TileEntityRoundRobinator) te); - } else if (ID == GUI17) { - return new GUI_EggBox(player.inventory, (TileEntityEggBox) te); - } else if (ID == GUI18) { - return new GUI_VolumetricFlaskSetter(new Container_VolumetricFlaskSetter(player.inventory, (TileEntityVolumetricFlaskSetter) te)); - } - } - - if (ID == GUI9) { - return new GuiBaseGrindle( - new Container_Grindle(player, player.inventory, new BaseInventoryGrindle(player.getHeldItem()))); - } - - // Tool, lunch, magic - if (ID == GUI10) { - return new ToolBoxGui( - new ToolBoxContainer(player, player.inventory, new ToolBoxInventory(player.getHeldItem()))); - } - if (ID == GUI11) { - return new LunchBoxGui( - new LunchBoxContainer(player, player.inventory, new LunchBoxInventory(player.getHeldItem()))); - } - if (ID == GUI12) { - return new MagicBagGui( - new MagicBagContainer(player, player.inventory, new MagicBagInventory(player.getHeldItem()))); - } - - return null; - } - - // New Methods - public static void openGui(final EntityPlayer entityplayer, final IGuiManager guiHandler) { - openGui(entityplayer, guiHandler, (short) 0); - } - - public static void openGui(final EntityPlayer entityplayer, final IGuiManager guiHandler, final short data) { - final int guiData = encodeGuiData(guiHandler, data); - final ChunkCoordinates coordinates = guiHandler.getCoordinates(); - entityplayer.openGui(GTplusplus.instance, guiData, entityplayer.worldObj, coordinates.posX, coordinates.posY, - coordinates.posZ); - } - - private static int encodeGuiData(final IGuiManager guiHandler, final short data) { - final MU_GuiId guiId = Gui_ID_Registry.getGuiIdForGuiHandler(guiHandler); - return (data << 16) | guiId.getId(); - } - - private static MU_GuiId decodeGuiID(final int guiData) { - final int guiId = guiData & 0xFF; - return Gui_ID_Registry.getGuiId(guiId); - } - - private static short decodeGuiData(final int guiId) { - return (short) (guiId >> 16); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/OldCircuitHandler.java b/src/Java/gtPlusPlus/core/handler/OldCircuitHandler.java deleted file mode 100644 index e20e13a337..0000000000 --- a/src/Java/gtPlusPlus/core/handler/OldCircuitHandler.java +++ /dev/null @@ -1,66 +0,0 @@ -package gtPlusPlus.core.handler; - -import static gtPlusPlus.core.lib.CORE.ConfigSwitches.enableOldGTcircuits; - -import java.lang.reflect.Field; -import java.util.HashSet; - -import org.apache.commons.lang3.reflect.FieldUtils; - -import gregtech.api.enums.GT_Values; -import gregtech.api.util.EmptyRecipeMap; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.RECIPES_Old_Circuits; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechItems; - -public class OldCircuitHandler { - - public static void preInit(){ - if (enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && !CORE.GTNH){ - removeCircuitRecipeMap(); //Bye shitty recipes. - } - } - - public static void init(){ - - } - - public static void postInit(){ - if (enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && !CORE.GTNH){ - RECIPES_Old_Circuits.handleCircuits(); - new RECIPES_Old_Circuits(); - } - } - - public static boolean addCircuitItems() { - if (enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && !CORE.GTNH){ - return MetaGeneratedGregtechItems.INSTANCE.registerOldCircuits(); - } - return false; - } - - private static boolean removeCircuitRecipeMap(){ - if (enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && !CORE.GTNH){ - try { - Logger.INFO("[Old Feature - Circuits] Trying to override the Circuit Assembler Recipe map, so that no recipes for new circuits get added."); - ReflectionUtils.setFinalStatic(GT_Recipe_Map.class.getDeclaredField("sCircuitAssemblerRecipes"), new EmptyRecipeMap(new HashSet<GT_Recipe>(0), "gt.recipe.removed", "Removed", null, GT_Values.RES_PATH_GUI + "basicmachines/Default", 0, 0, 0, 0, 0, GT_Values.E, 0, GT_Values.E, true, false)); - Field jaffar = GT_Recipe_Map.class.getDeclaredField("sCircuitAssemblerRecipes"); - FieldUtils.removeFinalModifier(jaffar, true); - jaffar.set(null, new EmptyRecipeMap(new HashSet<GT_Recipe>(0), "gt.recipe.removed", "Removed", null, GT_Values.RES_PATH_GUI + "basicmachines/Default", 0, 0, 0, 0, 0, GT_Values.E, 0, GT_Values.E, true, false)); - Logger.INFO("[Old Feature - Circuits] Successfully replaced circuit assembler recipe map with one that cannot hold recipes."); - } - catch (Exception e) { - Logger.INFO("[Old Feature - Circuits] Failed removing circuit assembler recipe map."); - return false; - } - return true; - } - return false; - } - -} diff --git a/src/Java/gtPlusPlus/core/handler/PacketHandler.java b/src/Java/gtPlusPlus/core/handler/PacketHandler.java deleted file mode 100644 index 382b82df29..0000000000 --- a/src/Java/gtPlusPlus/core/handler/PacketHandler.java +++ /dev/null @@ -1,91 +0,0 @@ -package gtPlusPlus.core.handler; - -import cpw.mods.fml.common.network.NetworkRegistry; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; -import cpw.mods.fml.relauncher.Side; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.network.handler.AbstractClientMessageHandler; -import gtPlusPlus.core.network.packet.AbstractPacket; -import gtPlusPlus.core.network.packet.Packet_VolumetricFlaskGui; -import gtPlusPlus.core.network.packet.Packet_VolumetricFlaskGui2; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; - -public class PacketHandler { - - private static byte packetId = 0; - - private static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(CORE.MODID); - - public static final void init() { - registerMessage(Packet_VolumetricFlaskGui.class, Packet_VolumetricFlaskGui.class); - registerMessage(Packet_VolumetricFlaskGui2.class, Packet_VolumetricFlaskGui2.class); - } - - /** - * Registers a message and message handler - */ - private static final void registerMessage(Class handlerClass, Class messageClass) { - Side side = AbstractClientMessageHandler.class.isAssignableFrom(handlerClass) ? Side.CLIENT : Side.SERVER; - registerMessage(handlerClass, messageClass, side); - } - - private static final void registerMessage(Class handlerClass, Class messageClass, Side side) { - INSTANCE.registerMessage(handlerClass, messageClass, packetId++, side); - if (AbstractPacket.class.isInstance(messageClass.getClass())) { - AbstractPacket aPacket = ReflectionUtils.createNewInstanceFromConstructor(ReflectionUtils.getConstructor(messageClass, new Class[] {}), new Object[] {}); - if (aPacket != null) { - Logger.INFO("Registered Packet: "+aPacket.getPacketName()); - } - } - } - - /** - * Send this message to the specified player. - * See {@link SimpleNetworkWrapper#sendTo(IMessage, EntityPlayerMP)} - */ - public static final void sendTo(IMessage message, EntityPlayerMP player) { - INSTANCE.sendTo(message, player); - } - - /** - * Send this message to everyone within a certain range of a point. - * See {@link SimpleNetworkWrapper#sendToDimension(IMessage, NetworkRegistry.TargetPoint)} - */ - public static final void sendToAllAround(IMessage message, NetworkRegistry.TargetPoint point) { - INSTANCE.sendToAllAround(message, point); - } - - /** - * Sends a message to everyone within a certain range of the coordinates in the same dimension. - */ - public static final void sendToAllAround(IMessage message, int dimension, double x, double y, double z, double range) { - sendToAllAround(message, new NetworkRegistry.TargetPoint(dimension, x, y, z, range)); - } - - /** - * Sends a message to everyone within a certain range of the player provided. - */ - public static final void sendToAllAround(IMessage message, EntityPlayer player, double range) { - sendToAllAround(message, player.worldObj.provider.dimensionId, player.posX, player.posY, player.posZ, range); - } - - /** - * Send this message to everyone within the supplied dimension. - * See {@link SimpleNetworkWrapper#sendToDimension(IMessage, int)} - */ - public static final void sendToDimension(IMessage message, int dimensionId) { - INSTANCE.sendToDimension(message, dimensionId); - } - - /** - * Send this message to the server. - * See {@link SimpleNetworkWrapper#sendToServer(IMessage)} - */ - public static final void sendToServer(IMessage message) { - INSTANCE.sendToServer(message); - } -} diff --git a/src/Java/gtPlusPlus/core/handler/Recipes/DecayableRecipe.java b/src/Java/gtPlusPlus/core/handler/Recipes/DecayableRecipe.java deleted file mode 100644 index 360b0440a2..0000000000 --- a/src/Java/gtPlusPlus/core/handler/Recipes/DecayableRecipe.java +++ /dev/null @@ -1,39 +0,0 @@ -package gtPlusPlus.core.handler.Recipes; - -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.item.ItemStack; - -public class DecayableRecipe { - - public static final AutoMap<DecayableRecipe> mRecipes = new AutoMap<DecayableRecipe>(); - - - public final int mTime; - public final ItemStack mInput; - public final ItemStack mOutput; - - public DecayableRecipe(int time, ItemStack input, ItemStack output) { - mTime = time; - mInput = input; - mOutput = output; - mRecipes.put(this); - } - - @Override - public boolean equals(Object o) { - if (o instanceof DecayableRecipe) { - DecayableRecipe i = (DecayableRecipe) o; - if (i.mTime == this.mTime && GT_Utility.areStacksEqual(mInput, i.mInput) && GT_Utility.areStacksEqual(mOutput, i.mOutput)) { - return true; - } - } - return false; - } - - public boolean isValid() { - return (mTime > 0 && ItemUtils.checkForInvalidItems(mInput) && ItemUtils.checkForInvalidItems(mOutput)); - } - -} diff --git a/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java b/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java deleted file mode 100644 index 5bf6374725..0000000000 --- a/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java +++ /dev/null @@ -1,28 +0,0 @@ -package gtPlusPlus.core.handler.Recipes; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.handler.COMPAT_HANDLER; -import gtPlusPlus.core.recipe.ShapedRecipeObject; - -public class LateRegistrationHandler { - - public static int recipesSuccess = 0; - public static int recipesFailed = 0; - - public static void run(){ - init(); - } - - private final static void init(){ - for(final ShapedRecipeObject item : COMPAT_HANDLER.AddRecipeQueue){ - item.buildRecipe(); - } - try { - Thread.sleep(10); - } catch (final InterruptedException e) { - Logger.INFO(e.toString()); - } - Logger.INFO("Late Recipes Loaded: "+recipesSuccess+" Failed: "+recipesFailed); - } - -} diff --git a/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java b/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java deleted file mode 100644 index 4192e71091..0000000000 --- a/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java +++ /dev/null @@ -1,27 +0,0 @@ -package gtPlusPlus.core.handler.Recipes; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.handler.COMPAT_HANDLER; -import gtPlusPlus.core.recipe.*; - -public class RegistrationHandler { - - public static int recipesSuccess = 0; - public static int recipesFailed = 0; - - public static void run(){ - init(); - } - - private final static void init(){ - RECIPES_Tools.loadRecipes(); - RECIPES_General.loadRecipes(); - RECIPES_Machines.loadRecipes(); - RECIPES_Shapeless.loadRecipes(); - RECIPES_MachineComponents.loadRecipes(); - RECIPE_Batteries.loadRecipes(); - Logger.INFO("Loaded: "+recipesSuccess+" Failed: "+recipesFailed); - COMPAT_HANDLER.areInitItemsLoaded = true; - } - -} diff --git a/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java b/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java deleted file mode 100644 index 8499f98525..0000000000 --- a/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java +++ /dev/null @@ -1,49 +0,0 @@ -package gtPlusPlus.core.handler; - -import java.lang.reflect.Field; - -import cpw.mods.fml.common.eventhandler.EventPriority; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.stats.AchievementList; -import net.minecraftforge.event.entity.player.AchievementEvent; - -public class StopAnnoyingFuckingAchievements { - - /** - * Stops me getting fireworks every fucking time I open my inventory upon first loading a dev client. - * @param event - */ - @SubscribeEvent(priority=EventPriority.HIGHEST) - public void FUCK_OFF(AchievementEvent event) { - if (Utils.isClient()) { - doClientStuff(); - } - if (event.achievement.equals(AchievementList.openInventory)) { - event.setCanceled(true); - } - } - - @SideOnly(Side.CLIENT) - private final void doClientStuff() { - Class aMC = ReflectionUtils.getClass("net.minecraft.client.Minecraft"); - if (aMC != null) { - Field aInstanceMC = ReflectionUtils.getField(aMC, "theMinecraft"); - Object aMcObj = ReflectionUtils.getFieldValue(null, aInstanceMC); - Class aClazz2 = aMcObj.getClass(); - if (aClazz2 != null) { - Field aGameSettings = ReflectionUtils.getField(aClazz2, "gameSettings"); - Object aGameSettingsObj = ReflectionUtils.getFieldValue(aInstanceMC, aGameSettings); - Class aClazz3 = aGameSettingsObj.getClass(); - if (aClazz3 != null) { - Field ainvHint = ReflectionUtils.getField(aClazz3, "showInventoryAchievementHint"); - ReflectionUtils.setField(aGameSettingsObj, ainvHint, false); - } - } - } - } - -} diff --git a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java deleted file mode 100644 index 03bb99bb2a..0000000000 --- a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java +++ /dev/null @@ -1,229 +0,0 @@ -package gtPlusPlus.core.handler.events; - -import static gtPlusPlus.core.lib.CORE.ConfigSwitches.chanceToDropDrainedShard; -import static gtPlusPlus.core.lib.CORE.ConfigSwitches.chanceToDropFluoriteOre; - -import java.util.ArrayList; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.nuclear.FLUORIDES; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.event.entity.living.LivingDropsEvent; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.event.world.BlockEvent; -import net.minecraftforge.oredict.OreDictionary; - -public class BlockEventHandler { - public static ArrayList<ItemStack> oreLimestone; - public static ArrayList<ItemStack> blockLimestone; - public static ItemStack fluoriteOre; - - public static void init() { - //Set Variables for Fluorite Block handling - Logger.INFO("Setting some Variables for the block break event handler."); - BlockEventHandler.oreLimestone = OreDictionary.getOres("oreLimestone"); - BlockEventHandler.blockLimestone = OreDictionary.getOres("limestone"); - BlockEventHandler.fluoriteOre = FLUORIDES.FLUORITE.getOre(1); - } - - @SubscribeEvent - public void onBlockLeftClicked(final PlayerInteractEvent event) { - /* - * if (event.action != PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) return; - * - * ItemStack heldItem = event.entityPlayer.getHeldItem(); Block block = - * event.world.getBlock(event.x, event.y, event.z); - * - * // If the block clicked was Stone, the player was holding an Iron Pickaxe and - * a random integer from 0 (inclusive) to 2 (exclusive) is 0 (50% chance) if - * (block == Blocks.stone && heldItem != null && heldItem.getItem() == - * Items.iron_pickaxe && random.nextInt(2) == 0) { ForgeDirection direction = - * ForgeDirection.getOrientation(event.face); // Convert the numeric face to a - * ForgeDirection int fireX = event.x + direction.offsetX, fireY = event.y + - * direction.offsetY, fireZ = event.z + direction.offsetZ; // Offset the block's - * coordinates according to the direction - * - * if (event.world.isAirBlock(fireX, fireY, fireZ)) { // If the block at the new - * coordinates is Air event.world.setBlock(fireX, fireY, fireZ, Blocks.fire); // - * Replace it with Fire event.useBlock = Event.Result.DENY; // Prevent the Fire - * from being extinguished (also prevents Block#onBlockClicked from being - * called) } } - */ - } - - @SubscribeEvent - public void onEntityDrop(final LivingDropsEvent event) { - /* - * if (event.entityLiving instanceof EntityPig && event.source instanceof - * EntityDamageSource) { // getEntity will return the Entity that caused the - * damage,even for indirect damage sources like arrows/fireballs // (where it - * will return the Entity that shot the projectile rather than the projectile - * itself) Entity sourceEntity = event.source.getEntity(); ItemStack heldItem = - * sourceEntity instanceof EntityLiving ? ((EntityLiving) - * sourceEntity).getHeldItem() : sourceEntity instanceof EntityPlayer ? - * ((EntityPlayer) sourceEntity).getHeldItem() : null; - * - * if (heldItem != null && heldItem.getItem() == Items.iron_pickaxe) { - * System.out.println("EntityPig drops event"); event.drops.clear(); - * event.entityLiving.dropItem(Items.diamond, 64); } } - */ - } - - @SubscribeEvent - public void onBlockBreak(final BlockEvent.BreakEvent event) { - - } - - - // Used to handle Thaumcraft Shards when TC is not installed. - @SubscribeEvent - public void harvestDrops(final BlockEvent.HarvestDropsEvent event) { - try { - - if (event != null && event.harvester != null && event.harvester.worldObj != null) { - if (!event.harvester.worldObj.isRemote) { - - EntityPlayer p = event.harvester; - - if (PlayerUtils.isRealPlayer(p)) { - // Spawns Fluorite from Lime Stone - if (chanceToDropFluoriteOre != 0) { - if (!oreLimestone.isEmpty() || !blockLimestone.isEmpty()) { - - ArrayList<Block> mBlockTypes = new ArrayList<Block>(); - if (!oreLimestone.isEmpty()) { - for (int i = 0; i < oreLimestone.size(); i++) { - if (ItemUtils.getModId(oreLimestone.get(i)) != null - && !ItemUtils.getModId(oreLimestone.get(i)).toLowerCase() - .contains("biomesoplenty")) { - if (!mBlockTypes - .contains(Block.getBlockFromItem(oreLimestone.get(i).getItem()))) { - mBlockTypes.add(Block.getBlockFromItem(oreLimestone.get(i).getItem())); - } - } - } - } - if (!blockLimestone.isEmpty()) { - for (int i = 0; i < blockLimestone.size(); i++) { - if (ItemUtils.getModId(blockLimestone.get(i)) != null - && !ItemUtils.getModId(blockLimestone.get(i)).toLowerCase() - .contains("biomesoplenty")) { - if (!mBlockTypes.contains( - Block.getBlockFromItem(blockLimestone.get(i).getItem()))) { - mBlockTypes - .add(Block.getBlockFromItem(blockLimestone.get(i).getItem())); - } - } - } - } - - Logger.WARNING("Found Limestone in OreDict."); - if (!mBlockTypes.isEmpty()) { - Logger.WARNING("1a | " + event.block.getUnlocalizedName()); - for (final Block temp : mBlockTypes) { - Logger.WARNING("2a - " + temp.getUnlocalizedName()); - if (event.block == temp) { - Logger.WARNING("3a - found " + temp.getUnlocalizedName()); - if (MathUtils.randInt(1, chanceToDropFluoriteOre) == 1) { - Logger.WARNING("4a"); - event.drops.clear(); - event.drops.add(fluoriteOre.copy()); - } - } - } - } - } - - if (event.block.getUnlocalizedName().toLowerCase().contains("limestone")) { - Logger.WARNING("1c"); - if (MathUtils.randInt(1, chanceToDropFluoriteOre) == 1) { - Logger.WARNING("2c"); - event.drops.clear(); - event.drops.add(fluoriteOre.copy()); - } - } - - if (event.block == Blocks.sandstone) { - if (MathUtils.randInt(1, chanceToDropFluoriteOre * 20) == 1) { - event.drops.clear(); - event.drops.add(fluoriteOre.copy()); - } - } - } - } - - // Do things that can occur for fake players and real players - - // Spawn Dull Shards (Can spawn from Tree Logs, Grass or Stone. Stone going to - // be the most common source.) - if (((event.block == Blocks.stone) || (event.block == Blocks.sandstone) - || (event.block == Blocks.log) || (event.block == Blocks.log2) - || (event.block == Blocks.grass)) && !LoadedMods.Thaumcraft - && (chanceToDropDrainedShard != 0)) { - // small chance for one to spawn per stone mined. 1 per 3 stacks~ - if (MathUtils.randInt(1, chanceToDropDrainedShard) == 1) { - // Let's sort out a lucky charm for the player. - final int FancyChance = MathUtils.randInt(1, 4); - if (MathUtils.randInt(1, 100) < 90) { - event.drops.add(new ItemStack(ModItems.shardDull)); - } - // Make a Fire Shard - else if (FancyChance == 1) { - event.drops.add(new ItemStack(ModItems.shardIgnis)); - } - // Make a Water Shard. - else if (FancyChance == 2) { - event.drops.add(new ItemStack(ModItems.shardAqua)); - } - // Make an Earth Shard. - else if (FancyChance == 3) { - event.drops.add(new ItemStack(ModItems.shardTerra)); - } - // Make an Air Shard. - else if (FancyChance == 4) { - event.drops.add(new ItemStack(ModItems.shardAer)); - } - } else { - Logger.WARNING("invalid chance"); - } - } - - } - } - } catch (Throwable r) { - Logger.INFO("Block Event Handler Failed. Please Report this to Alkalus."); - r.printStackTrace(); - } - } - - @SubscribeEvent - public void logsHarvest(final BlockEvent.HarvestDropsEvent event) { - /* - * if (event.block instanceof BlockLog) { // - * http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/ - * modification-development/2444501-harvestdropevent-changing-drops-of-vanilla- - * blocks - * - * // Utils.sendServerMessage("Logs! Harvester: %s Drops: %s", event.harvester - * != null ? event.harvester.getCommandSenderName() : "<none>", - * event.drops.stream().map(ItemStack.toString()).collect(Collectors. - * joining(", "))); if (event.harvester != null) { ItemStack heldItem = - * event.harvester.getHeldItem(); if (heldItem == null || - * heldItem.getItem().getHarvestLevel(heldItem, "axe") < 1) { - * event.drops.clear(); - * Utils.sendServerMessage("Harvester had wrong tool, clearing drops"); } else { - * Utils.sendServerMessage("Harvester had correct tool, not clearing drops"); } - * } else { event.drops.clear(); - * Utils.sendServerMessage("No harvester, clearing drops"); } } - */ - } -} diff --git a/src/Java/gtPlusPlus/core/handler/events/CustomMovementHandler.java b/src/Java/gtPlusPlus/core/handler/events/CustomMovementHandler.java deleted file mode 100644 index b70e58d009..0000000000 --- a/src/Java/gtPlusPlus/core/handler/events/CustomMovementHandler.java +++ /dev/null @@ -1,163 +0,0 @@ -package gtPlusPlus.core.handler.events; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.util.MovementInputFromOptions; - -/* - * Replacement for MovementInputFromOptions - Built from the source of ToggleSneak 3.0.3 - */ - -public class CustomMovementHandler { - - public boolean isDisabled; - public boolean canDoubleTap; - - public boolean sprint = false; - public boolean sprintHeldAndReleased = false; - public boolean sprintDoubleTapped = false; - - private long lastPressed; - private long lastSprintPressed; - private boolean handledSneakPress; - private boolean handledSprintPress; - private boolean wasRiding; - - /* - * MovementInputFromOptions.updatePlayerMoveState() - */ - public void update(final Minecraft mc, final MovementInputFromOptions options, final EntityPlayerSP thisPlayer) - { - options.moveStrafe = 0.0F; - options.moveForward = 0.0F; - - final GameSettings settings = mc.gameSettings; - - if(settings.keyBindForward.getIsKeyPressed()) - { - ++options.moveForward; - } - - if(settings.keyBindBack.getIsKeyPressed()) - { - --options.moveForward; - } - - if(settings.keyBindLeft.getIsKeyPressed()) - { - ++options.moveStrafe; - } - - if(settings.keyBindRight.getIsKeyPressed()) - { - --options.moveStrafe; - } - - options.jump = settings.keyBindJump.getIsKeyPressed(); - - // - // Sneak Toggle - Essentially the same as old ToggleSneak - // - - // Check to see if Enabled - Added 6/17/14 to provide option to disable Sneak Toggle - final boolean isSneaking = SneakManager.get(thisPlayer).Sneaking(); - //Utils.LOG_INFO("Can sneak: "+isSneaking); - //Utils.LOG_INFO("Can sprint: "+SneakManager.Sprinting()); - if (isSneaking) - { - // Key Pressed - if (settings.keyBindSneak.getIsKeyPressed() && !this.handledSneakPress) - { - // Descend if we are flying, note if we were riding (so we can unsneak once dismounted) - if(thisPlayer.isRiding() || thisPlayer.capabilities.isFlying) - { - options.sneak = true; - this.wasRiding = thisPlayer.isRiding(); - } - else - { - options.sneak = !options.sneak; - } - - this.lastPressed = System.currentTimeMillis(); - this.handledSneakPress = true; - } - - // Key Released - if (!settings.keyBindSneak.getIsKeyPressed() && this.handledSneakPress) - { - // If we are flying or riding, stop sneaking after descent/dismount. - if(thisPlayer.capabilities.isFlying || this.wasRiding) - { - options.sneak = false; - this.wasRiding = false; - } - // If the key was held down for more than 300ms, stop sneaking upon release. - else if((System.currentTimeMillis() - this.lastPressed) > 300L) - { - options.sneak = false; - } - - this.handledSneakPress = false; - } - } - else - { - options.sneak = settings.keyBindSneak.getIsKeyPressed(); - } - - if(options.sneak || SneakManager.get(thisPlayer).Sneaking()) - { - options.moveStrafe = (float)(options.moveStrafe * 0.3D); - options.moveForward = (float)(options.moveForward * 0.3D); - } - - // - // Sprint Toggle - Updated 6/18/2014 - // - - // Establish conditions where we don't want to start a sprint - sneaking, riding, flying, hungry - final boolean enoughHunger = (thisPlayer.getFoodStats().getFoodLevel() > 6.0F) || thisPlayer.capabilities.isFlying; - final boolean canSprint = !options.sneak && !thisPlayer.isRiding() && !thisPlayer.capabilities.isFlying && enoughHunger; - - this.isDisabled = !SneakManager.get(thisPlayer).Sprinting(); - this.canDoubleTap = SneakManager.get(thisPlayer).optionDoubleTap; - - // Key Pressed - if((canSprint || this.isDisabled) && settings.keyBindSprint.getIsKeyPressed() && !this.handledSprintPress) - { - if(!this.isDisabled) - { - this.sprint = !this.sprint; - this.lastSprintPressed = System.currentTimeMillis(); - this.handledSprintPress = true; - this.sprintHeldAndReleased = false; - } - } - - // Key Released - if((canSprint || this.isDisabled) && !settings.keyBindSprint.getIsKeyPressed() && this.handledSprintPress) - { - // Was key held for longer than 300ms? If so, mark it so we can resume vanilla behavior - if((System.currentTimeMillis() - this.lastSprintPressed) > 300L) - { - this.sprintHeldAndReleased = true; - } - this.handledSprintPress = false; - } - - } - - public void UpdateSprint(final boolean newValue, final boolean doubleTapped, SneakManager aSneak){ - if (!aSneak.Sprinting()){ - this.sprint = false; - this.sprintDoubleTapped = doubleTapped; - } - else{ - this.sprint = newValue; - this.sprintDoubleTapped = doubleTapped; - } - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/events/EnderDragonDeathHandler.java b/src/Java/gtPlusPlus/core/handler/events/EnderDragonDeathHandler.java deleted file mode 100644 index 884f14386d..0000000000 --- a/src/Java/gtPlusPlus/core/handler/events/EnderDragonDeathHandler.java +++ /dev/null @@ -1,59 +0,0 @@ -package gtPlusPlus.core.handler.events; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.entity.boss.EntityDragon; -import net.minecraftforge.event.entity.living.LivingDropsEvent; - -public class EnderDragonDeathHandler { - - private static final String mDragonClassName = "chylex.hee.entity.boss.EntityBossDragon"; - private static final boolean mHEE; - private static final Class mHardcoreDragonClass; - - static { - mHEE = ReflectionUtils.doesClassExist(mDragonClassName); - mHardcoreDragonClass = (mHEE ? ReflectionUtils.getClass(mDragonClassName) : null); - } - - @SubscribeEvent - public void onEntityDrop(LivingDropsEvent event) { - - boolean aDidDrop = false; - int aCountTotal = 0; - - //HEE Dragon - if (mHEE) { - if (mHardcoreDragonClass != null) { - if (mHardcoreDragonClass.isInstance(event.entityLiving)) { - for (int y = 0; y < MathUtils.randInt(100, 250); y++) { - int aAmount = MathUtils.randInt(5, 25); - event.entityLiving.entityDropItem(ELEMENT.STANDALONE.DRAGON_METAL.getNugget(aAmount), MathUtils.randFloat(0, 1)); - aDidDrop = true; - aCountTotal =+ aAmount; - } - } - } - } - //Vanilla Dragon or any other dragon that extends it - else { - if (event.entityLiving instanceof EntityDragon) { - for (int y = 0; y < MathUtils.randInt(25, 50); y++) { - int aAmount = MathUtils.randInt(1, 10); - event.entityLiving.entityDropItem(ELEMENT.STANDALONE.DRAGON_METAL.getNugget(aAmount), MathUtils.randFloat(0, 1)); - aDidDrop = true; - aCountTotal =+ aAmount; - } - } - } - - if (aDidDrop) { - PlayerUtils.messageAllPlayers(aCountTotal+" Shards of Dragons Blood have crystalized into a metallic form."); - } - - } - -} diff --git a/src/Java/gtPlusPlus/core/handler/events/EntityDeathHandler.java b/src/Java/gtPlusPlus/core/handler/events/EntityDeathHandler.java deleted file mode 100644 index 391672e028..0000000000 --- a/src/Java/gtPlusPlus/core/handler/events/EntityDeathHandler.java +++ /dev/null @@ -1,124 +0,0 @@ -package gtPlusPlus.core.handler.events; - -import java.util.HashMap; -import java.util.HashSet; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Triplet; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.event.entity.living.LivingDropsEvent; - -public class EntityDeathHandler { - - - private static final HashMap<Class, AutoMap<Triplet<ItemStack, Integer, Integer>>> mMobDropMap = new HashMap<Class, AutoMap<Triplet<ItemStack, Integer, Integer>>>(); - private static final HashSet<Class> mInternalClassKeyCache = new HashSet<Class>(); - - /** - * Provides the ability to provide custom drops upon the death of EntityLivingBase objects. - * @param aMobClass - The Base Class you want to drop this item. - * @param aStack - The ItemStack, stack size is not respected. - * @param aMaxAmount - The maximum size of the ItemStack which drops. - * @param aChance - Chance out of 10000, where 100 is 1%. (1 = 0.01% - this is ok) - */ - public static void registerDropsForMob(Class aMobClass, ItemStack aStack, int aMaxAmount, int aChance) { - Triplet<ItemStack, Integer, Integer> aData = new Triplet<ItemStack, Integer, Integer>(aStack, aMaxAmount, aChance); - AutoMap<Triplet<ItemStack, Integer, Integer>> aDataMap = mMobDropMap.get(aMobClass); - if (aDataMap == null) { - aDataMap = new AutoMap<Triplet<ItemStack, Integer, Integer>>(); - } - aDataMap.put(aData); - mMobDropMap.put(aMobClass, aDataMap); - - Logger.INFO("[Loot] Registered "+aStack.getDisplayName()+" (1-"+aMaxAmount+") as a valid drop for "+aMobClass.getCanonicalName()); - - if (!mInternalClassKeyCache.contains(aMobClass)) { - mInternalClassKeyCache.add(aMobClass); - } - - } - - private static ItemStack processItemDropTriplet(Triplet<ItemStack, Integer, Integer> aData) { - ItemStack aLoot = aData.getValue_1(); - int aMaxDrop = aData.getValue_2(); - int aChanceOutOf10000 = aData.getValue_3(); - if (MathUtils.randInt(0, 10000) <= aChanceOutOf10000) { - aLoot = ItemUtils.getSimpleStack(aLoot, MathUtils.randInt(1, aMaxDrop)); - if (ItemUtils.checkForInvalidItems(aLoot)) { - return aLoot; - } - } - return null; - } - - private static boolean processDropsForMob(EntityLivingBase entityLiving) { - AutoMap<Triplet<ItemStack, Integer, Integer>> aMobData = mMobDropMap.get(entityLiving.getClass()); - boolean aDidDrop = false; - if (aMobData != null) { - if (!aMobData.isEmpty()) { - ItemStack aPossibleDrop; - for (Triplet<ItemStack, Integer, Integer> g : aMobData) { - aPossibleDrop = processItemDropTriplet(g); - if (aPossibleDrop != null) { - if (entityLiving.entityDropItem(aPossibleDrop, MathUtils.randFloat(0, 1)) != null) { - aDidDrop = true; - } - } - } - } - } - return aDidDrop; - } - - - - private static void dropMeatFromPlayer(EntityPlayer aPlayer) { - - // always drop some meat. - int aBigMeatStackSize1 = MathUtils.randInt(4, 8); - aPlayer.entityDropItem(ItemUtils.simpleMetaStack(ModItems.itemMetaFood, 0, aBigMeatStackSize1), MathUtils.randInt(0, 1)); - - // additional chances for more meat. - if (MathUtils.randInt(0, 10) < 7) { - int aBigMeatStackSize2 = MathUtils.randInt(4, 8); - aPlayer.entityDropItem(ItemUtils.simpleMetaStack(ModItems.itemMetaFood, 0, aBigMeatStackSize2), MathUtils.randInt(0, 1)); - } - if (MathUtils.randInt(0, 10) < 4) { - int aBigMeatStackSize3 = MathUtils.randInt(4, 8); - aPlayer.entityDropItem(ItemUtils.simpleMetaStack(ModItems.itemMetaFood, 0, aBigMeatStackSize3), MathUtils.randInt(0, 1)); - } - if (MathUtils.randInt(0, 10) < 2) { - int aBigMeatStackSize4 = MathUtils.randInt(4, 8); - aPlayer.entityDropItem(ItemUtils.simpleMetaStack(ModItems.itemMetaFood, 0, aBigMeatStackSize4), MathUtils.randInt(0, 1)); - } - - } - - @SubscribeEvent - public void onEntityDrop(LivingDropsEvent event) { - boolean aDidDrop = false; - if (event == null || event.entityLiving == null) { - return; - } - if (PlayerUtils.isRealPlayer(event.entityLiving)) { - EntityPlayer aPlayer = (EntityPlayer) event.entityLiving; - dropMeatFromPlayer(aPlayer); - } - else { - for (Class c : mInternalClassKeyCache) { - if (c.isInstance(event.entityLiving)) { - aDidDrop = processDropsForMob(event.entityLiving); - } - } - } - } - -} diff --git a/src/Java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java deleted file mode 100644 index 10dea8a7bf..0000000000 --- a/src/Java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java +++ /dev/null @@ -1,117 +0,0 @@ -package gtPlusPlus.core.handler.events; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gregtech.api.enums.ItemList; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.GTplusplus.INIT_PHASE; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.sys.KeyboardUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; - -public class GeneralTooltipEventHandler { - - ItemStack[] mGregtechTurbines = new ItemStack[6]; - String mTurbine; - String mExtra; - - @SubscribeEvent - public void onItemTooltip(ItemTooltipEvent event){ - - - if (GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.STARTED && GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.SERVER_START) { - return; - } - if (event.itemStack == null) { - return; - } - if (CORE.ConfigSwitches.chanceToDropFluoriteOre > 0) { - if (BlockEventHandler.blockLimestone != null && !BlockEventHandler.blockLimestone.isEmpty()) { - for (ItemStack h : BlockEventHandler.blockLimestone) { - if (h != null && Block.getBlockFromItem(h.getItem()) == Block.getBlockFromItem(event.itemStack.getItem())) { - if (ItemUtils.getModId(h) != null && !ItemUtils.getModId(h).toLowerCase().contains("biomesoplenty")) { - event.toolTip.add("May contain Fluorite Ore"); - } - } - } - } - if (BlockEventHandler.oreLimestone != null && !BlockEventHandler.oreLimestone.isEmpty()) { - for (ItemStack h : BlockEventHandler.oreLimestone) { - if (h != null && Block.getBlockFromItem(h.getItem()) == Block.getBlockFromItem(event.itemStack.getItem())) { - if (ItemUtils.getModId(h) != null && !ItemUtils.getModId(h).toLowerCase().contains("biomesoplenty")) { - event.toolTip.add("May contain Fluorite Ore"); - } - } - } - } - } - - //Material Collector Tooltips - if (ModBlocks.blockPooCollector != null && Block.getBlockFromItem(event.itemStack.getItem()) == ModBlocks.blockPooCollector) { - //Normal - if (event.itemStack.getItemDamage() == 0) { - event.toolTip.add("Used to collect animal waste"); - event.toolTip.add("Collects in a 5x4x5 area starting at Y+1"); - event.toolTip.add("Use Hoppers/Pipes to empty"); - event.toolTip.add(EnumChatFormatting.GOLD+"Capacity: "+EnumChatFormatting.AQUA+"8000L"); - } - //Advanced - else { - event.toolTip.add("Used to collect waste (Works on more than animals)"); - event.toolTip.add("Significantly faster than the simple version"); - event.toolTip.add("Collects in a 5x4x5 area starting at Y+1"); - event.toolTip.add("Use Hoppers/Pipes to empty"); - event.toolTip.add(EnumChatFormatting.GOLD+"Capacity: "+EnumChatFormatting.AQUA+"128000L"); - } - } - - // Custom Flasks - - if (GregtechItemList.VOLUMETRIC_FLASK_8k.hasBeenSet() && event.itemStack.getItem() == GregtechItemList.VOLUMETRIC_FLASK_8k.getItem()) { - event.toolTip.add("Max Capacity: "+MathUtils.formatNumbers(8000)+"L"); - } - if (GregtechItemList.VOLUMETRIC_FLASK_32k.hasBeenSet() && event.itemStack.getItem() == GregtechItemList.VOLUMETRIC_FLASK_32k.getItem()) { - event.toolTip.add("Max Capacity: "+MathUtils.formatNumbers(32000)+"L"); - } - - - if (CORE.ConfigSwitches.enableAnimatedTurbines) { - boolean shift = false; - try { - - if (KeyboardUtils.isShiftKeyDown()) { - shift = true; - mTurbine = "Animated Turbines can be disabled in the GT++ config"; - } - else { - mTurbine = EnumChatFormatting.ITALIC+"<Hold Shift>"+EnumChatFormatting.RESET; - } - for (int t=0;t<6;t++) { - if (mGregtechTurbines[t] != null) { - if (ItemStack.areItemStacksEqual(event.itemStack, mGregtechTurbines[t])){ - event.toolTip.add(mTurbine); - if (shift) { - if (mExtra == null) { - mExtra = CORE.GT_Tooltip; - } - event.toolTip.add(mExtra); - } - } - } - else { - mGregtechTurbines[t] = (t == 0 ? ItemList.Generator_Steam_Turbine_LV.get(1) : (t == 1 ? ItemList.Generator_Steam_Turbine_MV.get(1) : (t == 2 ? ItemList.Generator_Steam_Turbine_HV.get(1) : (t == 3 ? ItemList.Generator_Gas_Turbine_LV.get(1) : (t == 4 ? ItemList.Generator_Gas_Turbine_MV.get(1) : (ItemList.Generator_Gas_Turbine_HV.get(1))))))); - } - } - } - catch (Throwable t) {} - } - - } - -} diff --git a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java deleted file mode 100644 index 1a8d87882e..0000000000 --- a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java +++ /dev/null @@ -1,128 +0,0 @@ -package gtPlusPlus.core.handler.events; - -import java.util.Timer; -import java.util.TimerTask; -import java.util.UUID; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.PlayerEvent; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.proxy.ClientProxy; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.player.PlayerCache; - -public class LoginEventHandler { - - public String localPlayersName; - public UUID localPlayersUUID; - private EntityPlayer localPlayerRef; - - @SubscribeEvent - public void onPlayerLogin(final PlayerEvent.PlayerLoggedInEvent event) { - - this.localPlayerRef = event.player; - this.localPlayersName = event.player.getDisplayName(); - this.localPlayersUUID = event.player.getUniqueID(); - - //Set this for easier use elsewhere. - if (event.player.getEntityWorld().isRemote){ - ClientProxy.playerName = this.localPlayersName; - } - - try { - //new SegmentAnalytics(event.player); - } - catch (Throwable t){ - //SegmentAnalytics.LOG("Failed to create Analytics submission during log in process."); - } - - try { - - - if (this.localPlayerRef instanceof EntityPlayerMP){ - - //Populates player cache - if (!this.localPlayerRef.worldObj.isRemote){ - PlayerCache.appendParamChanges(this.localPlayersName, this.localPlayersUUID.toString()); - } - - - /*if (localPlayerRef.getCommandSenderName().toLowerCase().equalsIgnoreCase("ImQ009") || localPlayerRef.getCommandSenderName().toLowerCase().contains("player")){ - Utils.LOG_INFO("Spawning a new Santa Thread."); - Thread t = new Thread() { - UUID threadHandlerIDthing = localPlayersUUID; - @Override - public void run() { - while(true && Minecraft.getMinecraft().getIntegratedServer() != null) { - try { - if(localPlayerRef == null){ - localPlayerRef = Utils.getPlayerOnServerFromUUID(threadHandlerIDthing); - } - - - //ImQ009 is a legend. - if (localPlayerRef.getCommandSenderName().toLowerCase().equalsIgnoreCase("ImQ009")){ - Utils.messagePlayer(localPlayerRef, "Enjoy some complimentary Raisin Bread."); - localPlayerRef.inventory.addItemStackToInventory(UtilsItems.getSimpleStack(ModItems.itemIngotRaisinBread, MathUtils.randInt(1, 5))); - } - - - if (localPlayerRef.getCommandSenderName().toLowerCase().contains("player")){ - Utils.messagePlayer(localPlayerRef, "Enjoy some complimentary Raisin Bread."); - localPlayerRef.inventory.addItemStackToInventory(UtilsItems.getSimpleStack(ModItems.itemIngotRaisinBread, MathUtils.randInt(1, 5))); - } - Thread.sleep(1000*60*MathUtils.randInt(15, 90)); - } catch (InterruptedException ie) { - Utils.LOG_INFO("Santa Mode Disabled."); - } - } - - Utils.LOG_INFO("Thread Stopped. Handler Closed."); - - } - }; - //t.start(); - - - }*/ - - - } - } catch (final Throwable errr){ - Logger.INFO("Login Handler encountered an error."); - - } - } - - //Handles notifying the player about a version update. - public Timer ShortTimer(EntityPlayer localPlayer, final int seconds) { - Timer timer; - timer = new Timer(); - timer.schedule(new NotifyPlayer(localPlayer), seconds * 1000); - return timer; - } - - //Timer Task for notifying the player. - class NotifyPlayer extends TimerTask { - final EntityPlayer toMessage; - public NotifyPlayer(EntityPlayer localPlayer) { - toMessage = localPlayer; - } - - @Override - public void run() { - if (toMessage != null){ - if (toMessage instanceof EntityPlayerMP){ - PlayerUtils.messagePlayer(toMessage, "You're not using the latest recommended version of GT++, consider updating."); - } - } - } - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/events/MissingMappingsEvent.java b/src/Java/gtPlusPlus/core/handler/events/MissingMappingsEvent.java deleted file mode 100644 index 31600a36c3..0000000000 --- a/src/Java/gtPlusPlus/core/handler/events/MissingMappingsEvent.java +++ /dev/null @@ -1,56 +0,0 @@ -package gtPlusPlus.core.handler.events; - -import static gtPlusPlus.core.item.base.dusts.BaseItemDustEx.mCachedPileLinkages; - -import org.apache.commons.lang3.StringUtils; - -import cpw.mods.fml.common.Mod.EventHandler; -import cpw.mods.fml.common.event.FMLMissingMappingsEvent; -import cpw.mods.fml.common.event.FMLMissingMappingsEvent.MissingMapping; - -import net.minecraft.item.ItemStack; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; - -public class MissingMappingsEvent { - - @EventHandler - public void onMissingMapping(FMLMissingMappingsEvent event){ - for(MissingMapping mapping : event.get()) { - boolean bool1 = mapping.name.contains(CORE.MODID); - //Missing Blocks - if(mapping.type == cpw.mods.fml.common.registry.GameRegistry.Type.BLOCK && bool1) { - - //Example - //if(mapping.name.equals("PneumaticCraft:etchingAcid")) { - // mapping.remap(Fluids.etchingAcid.getBlock()); - //} - - - } - - //Missing Items - if(mapping.type == cpw.mods.fml.common.registry.GameRegistry.Type.ITEM && bool1) { - - //Example - //if(mapping.name.equals("PneumaticCraft:etchingAcidBucket")) { - // mapping.remap(Fluids.getBucket(Fluids.etchingAcid)); - //} - - if(mapping.name.contains("miscutils:itemDustTiny")) { - ItemStack stack = null; - String missingItemString = StringUtils.remove(mapping.name, "miscutils:itemDustTiny"); - missingItemString = StringUtils.prependIfMissing(missingItemString, "item.itemDust"); - if (mCachedPileLinkages.containsKey(missingItemString)) { - //stack = ItemUtils.getSimpleStack(Item.itemRegistry.) - Logger.REFLECTION("Mapping Event Found Missing Item in the Pile Linkage Cache."); - } - - //mapping.remap(stack.getItem()); - } - - } - } - } -} diff --git a/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java deleted file mode 100644 index 956d045b3e..0000000000 --- a/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java +++ /dev/null @@ -1,80 +0,0 @@ -package gtPlusPlus.core.handler.events; - -import java.util.List; -import java.util.UUID; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.ChunkPosition; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.metatileentity.BaseMetaTileEntity; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines.GregtechMetaSafeBlockBase; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.event.world.BlockEvent.BreakEvent; -import net.minecraftforge.event.world.ExplosionEvent; - -public class PickaxeBlockBreakEventHandler { - @SubscribeEvent - public void onBreakBlock(final BreakEvent event) { - try{ - final TileEntity entity = event.world.getTileEntity(event.x, event.y, event.z); - if (entity != null){ - if (entity instanceof BaseMetaTileEntity) { - final EntityPlayer playerInternal = event.getPlayer(); - final IMetaTileEntity X = ((BaseMetaTileEntity)entity).getMetaTileEntity(); - if(X instanceof GregtechMetaSafeBlockBase) { - final UUID ownerUUID = ((GregtechMetaSafeBlockBase)X).ownerUUID; - final UUID accessorUUID = playerInternal.getUniqueID(); - if (((GregtechMetaSafeBlockBase)X).bUnbreakable){ - if (accessorUUID == ownerUUID){ - PlayerUtils.messagePlayer(playerInternal, "Since you own this block, it has been destroyed."); - } - else { - PlayerUtils.messagePlayer(playerInternal, "Since you do not own this block, it has not been destroyed."); - event.setCanceled(true); - } - } - } - } - - } - } - catch (final NullPointerException e) { - //System.out.print("Caught a NullPointerException involving Safe Blocks. Cause: "+e.getCause()); - } - } - - @SubscribeEvent - public void onExplode(ExplosionEvent.Detonate event) { - try { - @SuppressWarnings("unchecked") - List<ChunkPosition> pos = event.explosion.affectedBlockPositions; - for(int i = 0;i<pos.size();i++) { - ChunkPosition blockpos = (ChunkPosition) pos.get(i); - TileEntity entity = event.world.getTileEntity(blockpos.chunkPosX, blockpos.chunkPosY, blockpos.chunkPosZ); - if (entity != null){ - if (entity instanceof BaseMetaTileEntity) { - final IMetaTileEntity X = ((BaseMetaTileEntity)entity).getMetaTileEntity(); - if (X instanceof GregtechMetaSafeBlockBase) { - pos.remove(i); - } - } - } - } - } - catch (final NullPointerException e) { - - } - - } - - - @SubscribeEvent - public void onPlayerInteraction(final PlayerInteractEvent aEvent) { - if ((aEvent.entityPlayer != null) && (aEvent.entityPlayer.worldObj != null) && (aEvent.action != null) && (aEvent.world.provider != null) && !aEvent.entityPlayer.worldObj.isRemote && (aEvent.action != null) && (aEvent.action != PlayerInteractEvent.Action.RIGHT_CLICK_AIR)) { - //Utils.LOG_ERROR("Test"); - } - } -} diff --git a/src/Java/gtPlusPlus/core/handler/events/PlayerTickHandler.java b/src/Java/gtPlusPlus/core/handler/events/PlayerTickHandler.java deleted file mode 100644 index dc7ccb3e72..0000000000 --- a/src/Java/gtPlusPlus/core/handler/events/PlayerTickHandler.java +++ /dev/null @@ -1,18 +0,0 @@ -package gtPlusPlus.core.handler.events; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; - -import net.minecraft.entity.player.EntityPlayer; - -public class PlayerTickHandler { - - @SubscribeEvent - public void onPlayerTick(net.minecraftforge.event.entity.player.PlayerOpenContainerEvent e){ - if (e.entity instanceof EntityPlayer){ - if (e.entityPlayer.openContainer != null) { - - } - } - } - -} diff --git a/src/Java/gtPlusPlus/core/handler/events/SneakManager.java b/src/Java/gtPlusPlus/core/handler/events/SneakManager.java deleted file mode 100644 index 3e51c6488a..0000000000 --- a/src/Java/gtPlusPlus/core/handler/events/SneakManager.java +++ /dev/null @@ -1,131 +0,0 @@ -package gtPlusPlus.core.handler.events; - -import java.util.concurrent.ConcurrentHashMap; - -import gtPlusPlus.api.objects.Logger; -import net.minecraft.entity.player.EntityPlayer; - -public class SneakManager { - - //We make this a singleton for clientside data storage. - - public static ConcurrentHashMap<String, SneakManager> mPlayerCache = new ConcurrentHashMap<String, SneakManager>(); - - private static void addPlayer(EntityPlayer aPlayer) { - String aKey = getKey(aPlayer); - if (!mPlayerCache.containsKey(aKey)) { - mPlayerCache.put(aKey, new SneakManager(aPlayer)); - } - } - - public static SneakManager get(EntityPlayer aPlayer) { - - String aKey = getKey(aPlayer); - if (!mPlayerCache.containsKey(aKey)) { - addPlayer(aPlayer); - } - return mPlayerCache.get(aKey); - } - - private static String getKey(EntityPlayer aPlayer) { - return ""+aPlayer.getGameProfile().getId().toString(); - } - - - public SneakManager instance; - public EntityPlayer owner; - public boolean canSprint = true; - public boolean isSneaking = true; - public boolean optionDoubleTap = true; - public boolean wasSprintDisabled = false; - public boolean mIsWearingRing = false; - - private State Sprinting = State.ON; - private State Crouching = State.OFF; - - public SneakManager(EntityPlayer aPlayer) { - owner = aPlayer; - } - - public boolean Sneaking(){ - return Crouching.getState(); - } - - public boolean Sprinting(){ - return Sprinting.getState(); - } - - public State getSneakingState(){ - return Crouching; - } - - public State getSprintingDisabledState(){ - return Sprinting; - } - - public void toggleSneaking(){ - toggleState(Crouching); - } - - public void toggleSprinting(){ - toggleState(Sprinting); - } - - private State toggleState(final State state){ - Logger.INFO("State Toggle"); - if (state == State.ON) { - return State.OFF; - } - return State.ON; - } - - private State setCrouchingStateON(){ - return Crouching = State.ON; - } - - private State setCrouchingStateOFF(){ - return Crouching = State.OFF; - } - - private State setSprintingStateON(){ - return Sprinting = State.ON; - } - - private State setSprintingStateOFF(){ - return Sprinting = State.OFF; - } - - public void putRingOn() { - mIsWearingRing = true; - setSprintingStateOFF(); - setCrouchingStateON(); - } - - public void takeRingOff() { - mIsWearingRing = false; - setSprintingStateON(); - setCrouchingStateOFF(); - } - - public boolean isWearingRing() { - return mIsWearingRing; - } - - public static enum State { - ON(true), - OFF(false); - - private final boolean STATE; - private State (final boolean State) - { - this.STATE = State; - } - - public boolean getState() { - return this.STATE; - } - - } - -} - diff --git a/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java b/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java deleted file mode 100644 index b653c6ffb6..0000000000 --- a/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java +++ /dev/null @@ -1,138 +0,0 @@ -package gtPlusPlus.core.handler.events; - -import net.minecraft.block.Block; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.metatileentity.BaseMetaPipeEntity; -import gregtech.api.metatileentity.BaseMetaTileEntity; -import gregtech.api.metatileentity.BaseTileEntity; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GregtechMetaSafeBlock; - -public class UnbreakableBlockManager{ - - private static boolean hasRun = false; - - public final BaseMetaTileEntity getmTileEntity() { - return mTileEntity; - } - - - public final void setmTileEntity(final BaseMetaTileEntity mTileEntity/*, EntityPlayer aPlayer*/) { - UnbreakableBlockManager.mTileEntity = mTileEntity; - if (!hasRun){ - hasRun = true; - this.makeIndestructible(/*aPlayer*/); - } - else { - Logger.WARNING("Why do you run twice?"); - } - } - - - //BaseMetaTileEntity - //GregtechMetaSafeBlock - private static BaseMetaTileEntity mTileEntity = null; - - - private void makeIndestructible(/*EntityPlayer aPlayer*/){ - - - Logger.WARNING("Initializing the code to set this TE to -1 hardness and make it indestructible."); - final int X = mTileEntity.xCoord; //(GregtechMetaSafeBlock) this.mTileEntity.getXCoord(); - final int Y = mTileEntity.yCoord; - final int Z = mTileEntity.zCoord; - Logger.WARNING("Grabbing TileEntity @ [x,y,z] |"+X+"|"+Y+"|"+Z+"|"); - - try{ - final GregtechMetaSafeBlock MetaSafeBlock = ((GregtechMetaSafeBlock) UnbreakableBlockManager.mTileEntity.getMetaTileEntity()); - final TileEntity BaseMetaTileEntity = mTileEntity.getTileEntity(X, Y, Z); - //MetaSafeBlockBase. - final World TE_WORLD = MetaSafeBlock.getBaseMetaTileEntity().getWorld(); - Logger.WARNING("Checking new State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); - final TileEntity entity = BaseMetaTileEntity; - innerInvincible(MetaSafeBlock, entity, TE_WORLD, /*aPlayer,*/ X, Y, Z); - } - catch (final NullPointerException e) { - System.out.print("Caught a NullPointerException involving Safe Blocks. Cause: "); - e.printStackTrace(); - } - } - - - private static void innerInvincible(final GregtechMetaSafeBlock MetaSafeBlock, final TileEntity entity, final World TE_WORLD, /*EntityPlayer aPlayer,*/ final int X, final int Y, final int Z){ - if (entity != null){ - Logger.WARNING("Checking new State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); - Logger.WARNING("Grabbed TE: "+entity.toString()); - - - - - if ((entity instanceof BaseTileEntity) && !(entity instanceof BaseMetaPipeEntity)){ - final IMetaTileEntity I = ((BaseMetaTileEntity)entity).getMetaTileEntity(); - Logger.WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); - Logger.WARNING("I Details: "+I.getMetaName()+" | "+I.getTileEntityBaseType()+" | "+I.toString()); - - - - - - if (I instanceof GregtechMetaSafeBlock){ - Logger.WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); - - final Block ThisBlock = I.getBaseMetaTileEntity().getBlock(X, Y, Z); - Logger.WARNING("Block Details: "+ThisBlock.toString()); - - - if (((GregtechMetaSafeBlock)I).bUnbreakable){ - ThisBlock.setHardness(Integer.MAX_VALUE); - //ThisBlock.setResistance(18000000.0F); - ThisBlock.setResistance(-1); - ThisBlock.setBlockUnbreakable(); - Logger.WARNING("Changing State of Flag. Old Value="+MetaSafeBlock.bUnbreakable+" Expected Value=true"); - MetaSafeBlock.bUnbreakable = true; - //entity.markDirty(); - Logger.WARNING("Checking new State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); - Logger.ERROR("New Indestructible Flag enabled."); - //GT_Utility.sendChatToPlayer(aPlayer, "Block is now unbreakable."); - } - - - - - else { - ThisBlock.setHardness(1); - ThisBlock.setResistance(1.0F); - Logger.WARNING("Changing State of Flag. Old Value="+MetaSafeBlock.bUnbreakable+" Expected Value=false"); - MetaSafeBlock.bUnbreakable = false; - //entity.markDirty(); - Logger.WARNING("Checking new State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); - Logger.ERROR("New Indestructible Flag disabled."); - //GT_Utility.sendChatToPlayer(aPlayer, "Block is now breakable."); - } - - //entity.markDirty(); - - Logger.WARNING("Block Hardness: "+ThisBlock.getBlockHardness(TE_WORLD, X, Y, Z)); - Logger.WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); - hasRun = false; - - } - else { - Logger.WARNING("I is not an instanceof MetaSafeBlockBase"); - Logger.WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); - } - } else { - Logger.WARNING("TE is not an instanceof BaseTileEntity or may be a pipe."); - Logger.WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); - } - }else { - Logger.WARNING("Did not grab a TE instance to make a block instance from."); - Logger.WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); - } - } - -} diff --git a/src/Java/gtPlusPlus/core/handler/events/ZombieBackupSpawnEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/ZombieBackupSpawnEventHandler.java deleted file mode 100644 index 68df68aa2a..0000000000 --- a/src/Java/gtPlusPlus/core/handler/events/ZombieBackupSpawnEventHandler.java +++ /dev/null @@ -1,55 +0,0 @@ -package gtPlusPlus.core.handler.events; - -import java.lang.reflect.Field; - -import org.apache.commons.lang3.reflect.FieldUtils; - -import cpw.mods.fml.common.eventhandler.Event.Result; -import cpw.mods.fml.common.eventhandler.EventPriority; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; - -import gtPlusPlus.api.objects.Logger; -import net.minecraftforge.event.entity.living.ZombieEvent; - -public class ZombieBackupSpawnEventHandler { - - /** - * - * Do we really need this pathetic mechanic to exist when it doesn't work properly at all? - * Or , well, maybe you enjoy Zombies spawning IN YOUR FUCKING FACE?! - * - */ - - @SubscribeEvent(priority = EventPriority.HIGHEST) - public void onZombieReinforcement(final ZombieEvent.SummonAidEvent event) { - try { - try { - Field mChance = FieldUtils.getDeclaredField(this.getClass(), "summonChance", true); - FieldUtils.removeFinalModifier(mChance, true); - mChance.set(this, 0); - } - catch(Throwable t){} - if (event.attacker != null){ - //SegmentHelper.getInstance().trackUser(event.attacker.getUniqueID().toString(), "Zombie Backup"); - } - Logger.WARNING("[Zombie] ZombieEvent.SummonAidEvent."); - event.setResult(Result.DENY); - } - catch(Throwable t){} - } - - @SubscribeEvent(priority = EventPriority.HIGHEST) - public void onZombieReinforcement(final ZombieEvent event) { - try { - Logger.WARNING("[Zombie] ZombieEvent."); - if (event.entity != null){ - Logger.WARNING("Event Entity: "+event.entity.getCommandSenderName()); - } - event.setResult(Result.DENY); - } - catch(Throwable t){ - - } - } - -} diff --git a/src/Java/gtPlusPlus/core/handler/render/CapeHandler.java b/src/Java/gtPlusPlus/core/handler/render/CapeHandler.java deleted file mode 100644 index 491d9a2aba..0000000000 --- a/src/Java/gtPlusPlus/core/handler/render/CapeHandler.java +++ /dev/null @@ -1,122 +0,0 @@ -package gtPlusPlus.core.handler.render; - -import java.util.Collection; - -import org.lwjgl.opengl.GL11; - -import net.minecraft.client.entity.AbstractClientPlayer; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.entity.RenderPlayer; -import net.minecraft.potion.Potion; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; - -import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Utility; - -import gtPlusPlus.core.lib.CORE; -import net.minecraftforge.client.event.RenderPlayerEvent; - -public class CapeHandler extends RenderPlayer { - private final ResourceLocation[] mCapes = { - new ResourceLocation(CORE.MODID+":textures/TesterCape.png"), - new ResourceLocation(CORE.MODID+":textures/Draknyte1.png"), - new ResourceLocation("gregtech:textures/GregoriusCape.png") }; - private final Collection<String> mCapeList; - - public CapeHandler(final Collection<String> aCapeList) { - this.mCapeList = aCapeList; - this.setRenderManager(RenderManager.instance); - } - - public void receiveRenderSpecialsEvent(final RenderPlayerEvent.Specials.Pre aEvent) { - final AbstractClientPlayer aPlayer = (AbstractClientPlayer) aEvent.entityPlayer; - if (GT_Utility.getFullInvisibility(aPlayer)) { - aEvent.setCanceled(true); - return; - } - final float aPartialTicks = aEvent.partialRenderTick; - if (aPlayer.isInvisible()) { - return; - } - if (GT_Utility.getPotion(aPlayer, - Integer.valueOf(Potion.invisibility.id).intValue())) { - return; - } - try { - ResourceLocation tResource = null; - if (aPlayer.getDisplayName().equalsIgnoreCase("XW3B")) { - tResource = this.mCapes[0]; - } - if (this.mCapeList.contains(aPlayer.getDisplayName().toLowerCase())) { - tResource = this.mCapes[0]; - } - if (aPlayer.getDisplayName().equalsIgnoreCase("Draknyte1")) { - tResource = this.mCapes[1]; - } - if (aPlayer.getDisplayName().equalsIgnoreCase("GregoriusT")) { - tResource = this.mCapes[2]; - } - if ((tResource != null) && (!(aPlayer.getHideCape()))) { - this.bindTexture(tResource); - GL11.glPushMatrix(); - GL11.glTranslatef(0.0F, 0.0F, 0.125F); - final double d0 = (aPlayer.field_71091_bM - + ((aPlayer.field_71094_bP - aPlayer.field_71091_bM) - * aPartialTicks)) - - (aPlayer.prevPosX + ((aPlayer.posX - aPlayer.prevPosX) - * aPartialTicks)); - final double d1 = (aPlayer.field_71096_bN - + ((aPlayer.field_71095_bQ - aPlayer.field_71096_bN) - * aPartialTicks)) - - (aPlayer.prevPosY + ((aPlayer.posY - aPlayer.prevPosY) - * aPartialTicks)); - final double d2 = (aPlayer.field_71097_bO - + ((aPlayer.field_71085_bR - aPlayer.field_71097_bO) - * aPartialTicks)) - - (aPlayer.prevPosZ + ((aPlayer.posZ - aPlayer.prevPosZ) - * aPartialTicks)); - final float f6 = aPlayer.prevRenderYawOffset - + ((aPlayer.renderYawOffset - aPlayer.prevRenderYawOffset) - * aPartialTicks); - final double d3 = MathHelper.sin((f6 * CORE.PI) / 180.0F); - final double d4 = -MathHelper.cos((f6 * CORE.PI) / 180.0F); - float f7 = (float) d1 * 10.0F; - float f8 = (float) ((d0 * d3) + (d2 * d4)) * 100.0F; - final float f9 = (float) ((d0 * d4) - (d2 * d3)) * 100.0F; - if (f7 < -6.0F) { - f7 = -6.0F; - } - if (f7 > 32.0F) { - f7 = 32.0F; - } - if (f8 < 0.0F) { - f8 = 0.0F; - } - final float f10 = aPlayer.prevCameraYaw - + ((aPlayer.cameraYaw - aPlayer.prevCameraYaw) - * aPartialTicks); - f7 += MathHelper - .sin((aPlayer.prevDistanceWalkedModified + ((aPlayer.distanceWalkedModified - aPlayer.prevDistanceWalkedModified) - * aPartialTicks)) * 6.0F) - * 32.0F * f10; - if (aPlayer.isSneaking()) { - f7 += 25.0F; - } - GL11.glRotatef(6.0F + (f8 / 2.0F) + f7, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(f9 / 2.0F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(-f9 / 2.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); - ((ModelBiped) this.mainModel).renderCloak(0.0625F); - GL11.glPopMatrix(); - } - } catch (final Throwable e) { - if (GT_Values.D1) { - e.printStackTrace(GT_Log.err); - } - } - } - -} diff --git a/src/Java/gtPlusPlus/core/handler/render/FirepitModel.java b/src/Java/gtPlusPlus/core/handler/render/FirepitModel.java deleted file mode 100644 index 029d961bff..0000000000 --- a/src/Java/gtPlusPlus/core/handler/render/FirepitModel.java +++ /dev/null @@ -1,121 +0,0 @@ -// Date: 20/12/2016 5:51:14 PM -// Template version 1.1 -// Java generated by Techne -// Keep in mind that you still need to fill in some blanks -// - ZeuX - -package gtPlusPlus.core.handler.render; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; - -import gtPlusPlus.core.lib.CORE; - -public class FirepitModel extends ModelBase -{ - //fields - ModelRenderer Side_A; - ModelRenderer Side_B; - ModelRenderer Side_C; - ModelRenderer Side_D; - ModelRenderer Log1; - ModelRenderer Log2; - ModelRenderer Log3; - ModelRenderer Log4; - - public FirepitModel() - { - this.textureWidth = 16; - this.textureHeight = 16; - - this.Side_A = new ModelRenderer(this, 0, 0); - this.Side_A.addBox(0F, 0F, 0F, 12, 6, 1); - this.Side_A.setRotationPoint(-6F, 18F, -6F); - this.Side_A.setTextureSize(16, 16); - this.Side_A.mirror = true; - setRotation(this.Side_A, -0.3148822F, 0F, 0F); - //Side_A.mirror = false; - - this.Side_B = new ModelRenderer(this, 0, 0); - this.Side_B.addBox(0F, 0F, 0F, 12, 6, 1); - this.Side_B.setRotationPoint(-6F, 18F, 6F); - this.Side_B.setTextureSize(16, 16); - this.Side_B.mirror = true; - setRotation(this.Side_B, -0.3148822F, (CORE.PI/2), 0F); - - this.Side_C = new ModelRenderer(this, 0, 0); - this.Side_C.addBox(0F, 0F, 0F, 12, 6, 1); - this.Side_C.setRotationPoint(6F, 18F, 6F); - this.Side_C.setTextureSize(16, 16); - this.Side_C.mirror = true; - setRotation(this.Side_C, -0.3148822F, CORE.PI, 0F); - //Side_C.mirror = false; - - this.Side_D = new ModelRenderer(this, 0, 0); - this.Side_D.addBox(0F, 0F, 0F, 12, 6, 1); - this.Side_D.setRotationPoint(6F, 18F, -6F); - this.Side_D.setTextureSize(16, 16); - this.Side_D.mirror = true; - setRotation(this.Side_D, -0.3148822F, 4.712389F, 0F); - - this.Log1 = new ModelRenderer(this, 0, 10); - this.Log1.addBox(0F, 0F, 0F, 14, 2, 2); - this.Log1.setRotationPoint(4F, 10F, -4F); - this.Log1.setTextureSize(16, 16); - this.Log1.mirror = true; - setRotation(this.Log1, 0F, 0F, (CORE.PI/2)); - - this.Log2 = new ModelRenderer(this, -2, 10); - this.Log2.addBox(0F, 0F, 0F, 14, 2, 2); - this.Log2.setRotationPoint(-4F, 10F, -4F); - this.Log2.setTextureSize(16, 16); - this.Log2.mirror = true; - setRotation(this.Log2, (CORE.PI/2), 0F, (CORE.PI/2)); - //Log2.mirror = false; - - this.Log3 = new ModelRenderer(this, 0, 10); - this.Log3.addBox(0F, 0F, 0F, 14, 2, 2); - this.Log3.setRotationPoint(-4F, 10F, 4F); - this.Log3.setTextureSize(16, 16); - this.Log3.mirror = true; - setRotation(this.Log3, CORE.PI, 0F, (CORE.PI/2)); - - this.Log4 = new ModelRenderer(this, -2, 10); - this.Log4.addBox(0F, 0F, 0F, 14, 2, 2); - this.Log4.setRotationPoint(4F, 10F, 4F); - this.Log4.setTextureSize(16, 16); - this.Log4.mirror = true; - setRotation(this.Log4, 4.712389F, 0F, (CORE.PI/2)); - //Log4.mirror = false; - } - - @Override - public void render(final Entity entity, final float f, final float f1, final float f2, final float f3, final float f4, final float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); - this.Side_A.render(f5); - this.Side_B.render(f5); - this.Side_C.render(f5); - this.Side_D.render(f5); - this.Log1.render(f5); - this.Log2.render(f5); - this.Log3.render(f5); - this.Log4.render(f5); - } - - private static void setRotation(final ModelRenderer model, final float x, final float y, final float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - @Override - public void setRotationAngles(final float f, final float f1, final float f2, final float f3, final float f4, final float f5, final Entity entity) - { - super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); - } - -} diff --git a/src/Java/gtPlusPlus/core/handler/render/FirepitRender.java b/src/Java/gtPlusPlus/core/handler/render/FirepitRender.java deleted file mode 100644 index 7b8d23e25b..0000000000 --- a/src/Java/gtPlusPlus/core/handler/render/FirepitRender.java +++ /dev/null @@ -1,55 +0,0 @@ -package gtPlusPlus.core.handler.render; - -import org.lwjgl.opengl.GL11; - -import net.minecraft.block.Block; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; -public class FirepitRender extends TileEntitySpecialRenderer{ - ResourceLocation texture = new ResourceLocation("miscutils" + ":"+ "textures/blocks/FirePit/mossyFirepit.png"); - - private final FirepitModel model; - - public FirepitRender(){ - this.model = new FirepitModel(); - } - - private void adjustRotatePivotViaMeta(final World world, final int x, final int y, final int z) { - final int meta = world.getBlockMetadata(x, y, z); - GL11.glPushMatrix(); - GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F); - GL11.glPopMatrix(); - } - - @Override - public void renderTileEntityAt(final TileEntity entity, final double x, final double y, final double z, final float i) { - GL11.glPushMatrix(); - GL11.glTranslatef((float)x + 0.1F, (float)y + 1.0F, (float)z + 0.5F); - GL11.glRotatef(180, 0F, 0F, 1F); - - this.bindTexture(this.texture); - GL11.glPushMatrix(); - this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); - GL11.glTranslatef(1.0f, 1.0f, 1.0f); - GL11.glPopMatrix(); - GL11.glPopMatrix(); - } - - //Set the lighting stuff, so it changes it's brightness properly. - private void adjustLightFixture(final World world, final int i, final int j, final int k, final Block block) { - final Tessellator tess = Tessellator.instance; - //float brightness = block.getBlockBrightness(world, i, j, k); - //As of MC 1.7+ block.getBlockBrightness() has become block.getLightValue(): - final float brightness = block.getLightValue(world, i, j, k); - final int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0); - final int modulousModifier = skyLight % 65536; - final int divModifier = skyLight / 65536; - tess.setColorOpaque_F(brightness, brightness, brightness); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, modulousModifier, divModifier); - } -} diff --git a/src/Java/gtPlusPlus/core/handler/workbench/Workbench_CraftingHandler.java b/src/Java/gtPlusPlus/core/handler/workbench/Workbench_CraftingHandler.java deleted file mode 100644 index d6a73512e2..0000000000 --- a/src/Java/gtPlusPlus/core/handler/workbench/Workbench_CraftingHandler.java +++ /dev/null @@ -1,208 +0,0 @@ -package gtPlusPlus.core.handler.workbench; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.item.crafting.ShapelessRecipes; -import net.minecraft.world.World; - -public class Workbench_CraftingHandler { - - private static final Workbench_CraftingHandler instance = new Workbench_CraftingHandler(); - private final List<IRecipe> recipes = new ArrayList<IRecipe>(); - - public static final Workbench_CraftingHandler getInstance() { - return instance; - } - public Workbench_CraftingHandler() { - - //just a example recipe so you know how to add them - this.addRecipe(new ItemStack(Blocks.iron_block), new Object[] - { - "###", - "###", - "###", - Character.valueOf('#'), Items.iron_ingot - }); - - //another example Recipe, but shapeless - this.addShapelessRecipe(new ItemStack(Items.cake),new Object[]{Items.stick}); - - - } - - void addRecipe(final ItemStack par1ItemStack, final Object par2ArrayOfObj[]) - { - String s = ""; - int i = 0; - int j = 0; - int k = 0; - - if (par2ArrayOfObj[i] instanceof String[]) - { - final String as[] = (String[])par2ArrayOfObj[i++]; - - for (int l = 0; l < as.length; l++) - { - final String s2 = as[l]; - k++; - j = s2.length(); - s = (new StringBuilder()).append(s).append(s2).toString(); - } - } - else - { - while (par2ArrayOfObj[i] instanceof String) - { - final String s1 = (String)par2ArrayOfObj[i++]; - k++; - j = s1.length(); - s = (new StringBuilder()).append(s).append(s1).toString(); - } - } - - final HashMap<Character, ItemStack> hashmap = new HashMap<Character, ItemStack>(); - - for (; i < par2ArrayOfObj.length; i += 2) - { - final Character character = (Character)par2ArrayOfObj[i]; - ItemStack itemstack = null; - - if (par2ArrayOfObj[i + 1] instanceof Item) - { - itemstack = new ItemStack((Item)par2ArrayOfObj[i + 1]); - } - else if (par2ArrayOfObj[i + 1] instanceof Block) - { - itemstack = new ItemStack((Block)par2ArrayOfObj[i + 1], 1, -1); - } - else if (par2ArrayOfObj[i + 1] instanceof ItemStack) - { - itemstack = (ItemStack)par2ArrayOfObj[i + 1]; - } - - hashmap.put(character, itemstack); - } - - final ItemStack aitemstack[] = new ItemStack[j * k]; - - for (int i1 = 0; i1 < (j * k); i1++) - { - final char c = s.charAt(i1); - - if (hashmap.containsKey(Character.valueOf(c))) - { - aitemstack[i1] = hashmap.get(Character.valueOf(c)).copy(); - } - else - { - aitemstack[i1] = null; - } - } - - this.recipes.add(new ShapedRecipes(j, k, aitemstack, par1ItemStack)); - } - - public void addShapelessRecipe(final ItemStack par1ItemStack, final Object par2ArrayOfObj[]) - { - final ArrayList<ItemStack> arraylist = new ArrayList<ItemStack>(); - final Object aobj[] = par2ArrayOfObj; - final int i = aobj.length; - - for (int j = 0; j < i; j++) - { - final Object obj = aobj[j]; - - if (obj instanceof ItemStack) - { - arraylist.add(((ItemStack)obj).copy()); - continue; - } - - if (obj instanceof Item) - { - arraylist.add(new ItemStack((Item)obj)); - continue; - } - - if (obj instanceof Block) - { - arraylist.add(new ItemStack((Block)obj)); - } - else - { - throw new RuntimeException("Invalid shapeless recipe!"); - } - } - - this.recipes.add(new ShapelessRecipes(par1ItemStack, arraylist)); - } - - public ItemStack findMatchingRecipe(final InventoryCrafting par1InventoryCrafting, final World par2World) - { - int i = 0; - for (int j = 0; j < par1InventoryCrafting.getSizeInventory(); j++) - { - final ItemStack itemstack2 = par1InventoryCrafting.getStackInSlot(j); - - if (itemstack2 == null) - { - continue; - } - - if (i == 0) - { - } - - if (i == 1) - { - } - - i++; - } - - //TODO - Update from itemIDs - /*if (i == 2 && itemstack.itemID == itemstack1.itemID && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && Item.itemsList[itemstack.itemID].isDamageable()) - { - Item item = Item.itemsList[itemstack.itemID]; - int l = item.getMaxDamage() - itemstack.getItemDamageForDisplay(); - int i1 = item.getMaxDamage() - itemstack1.getItemDamageForDisplay(); - int j1 = l + i1 + (item.getMaxDamage() * 10) / 100; - int k1 = item.getMaxDamage() - j1; - - if (k1 < 0) - { - k1 = 0; - } - - return new ItemStack(itemstack.itemID, 1, k1); - }*/ - - for (int k = 0; k < this.recipes.size(); k++) - { - final IRecipe irecipe = this.recipes.get(k); - - if (irecipe.matches(par1InventoryCrafting, par2World)) - { - return irecipe.getCraftingResult(par1InventoryCrafting); - } - } - - return null; - } - - - public List<IRecipe> getRecipeList() - { - return this.recipes; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/workbench/Workbench_RecipeSorter.java b/src/Java/gtPlusPlus/core/handler/workbench/Workbench_RecipeSorter.java deleted file mode 100644 index 9d5f7d03ed..0000000000 --- a/src/Java/gtPlusPlus/core/handler/workbench/Workbench_RecipeSorter.java +++ /dev/null @@ -1,44 +0,0 @@ -package gtPlusPlus.core.handler.workbench; - -import java.util.Comparator; - -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.item.crafting.ShapelessRecipes; - -public class Workbench_RecipeSorter implements Comparator<Object> -{ - final Workbench_CraftingHandler CraftingManagerCrafter; - - Workbench_RecipeSorter(final Workbench_CraftingHandler par1CraftingManager) - { - this.CraftingManagerCrafter = par1CraftingManager; - } - - public int compareRecipes(final IRecipe par1IRecipe, final IRecipe par2IRecipe) - { - if ((par1IRecipe instanceof ShapelessRecipes) && (par2IRecipe instanceof ShapedRecipes)) - { - return 1; - } - - if ((par2IRecipe instanceof ShapelessRecipes) && (par1IRecipe instanceof ShapedRecipes)) - { - return -1; - } - - if (par2IRecipe.getRecipeSize() < par1IRecipe.getRecipeSize()) - { - return -1; - } - - return par2IRecipe.getRecipeSize() <= par1IRecipe.getRecipeSize() ? 0 : 1; - } - - @Override - public int compare(final Object par1Obj, final Object par2Obj) - { - return this.compareRecipes((IRecipe)par1Obj, (IRecipe)par2Obj); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/interfaces/IGuiManager.java b/src/Java/gtPlusPlus/core/interfaces/IGuiManager.java deleted file mode 100644 index 1d0ad9ed87..0000000000 --- a/src/Java/gtPlusPlus/core/interfaces/IGuiManager.java +++ /dev/null @@ -1,16 +0,0 @@ -package gtPlusPlus.core.interfaces; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.world.World; - -public abstract interface IGuiManager extends IGuiManagerMiscUtils{ - - public abstract ChunkCoordinates getCoordinates(); - - public abstract World getWorld(); - - public abstract Object getGui(EntityPlayer paramEntityPlayer, int paramInt); - - public abstract Object getContainer(EntityPlayer paramEntityPlayer, int paramInt); -} diff --git a/src/Java/gtPlusPlus/core/interfaces/IGuiManagerMiscUtils.java b/src/Java/gtPlusPlus/core/interfaces/IGuiManagerMiscUtils.java deleted file mode 100644 index cf46c67a54..0000000000 --- a/src/Java/gtPlusPlus/core/interfaces/IGuiManagerMiscUtils.java +++ /dev/null @@ -1,3 +0,0 @@ -package gtPlusPlus.core.interfaces; - -public abstract interface IGuiManagerMiscUtils {}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/interfaces/IItemBlueprint.java b/src/Java/gtPlusPlus/core/interfaces/IItemBlueprint.java deleted file mode 100644 index 473aa827b6..0000000000 --- a/src/Java/gtPlusPlus/core/interfaces/IItemBlueprint.java +++ /dev/null @@ -1,48 +0,0 @@ -package gtPlusPlus.core.interfaces; - -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; - -public interface IItemBlueprint { - - /** - * The inventory size for the blueprint~ - */ - public int INV_SIZE = 9; - - /** - * Meta Compatible function to allow meta items to be blueprints - * @param stack yourMetaItem - * @return true if it is a Blueprint - */ - public boolean isBlueprint(ItemStack stack); - - /** - * Sets the blueprint for this itemstack. - * @param stack yourMetaItem - * @return true if blueprint is set successfully - */ - public boolean setBlueprint(ItemStack stack, IInventory craftingTable, ItemStack output); - - /** - * Sets the name of the recipe/blueprint - * @param String Blueprint Name - * @return N/A - */ - public void setBlueprintName(ItemStack stack, String name); - - /** - * Does this itemstack hold a blueprint? - * @param stack yourMetaItem - * @return true if is holding a Blueprint - */ - public boolean hasBlueprint(ItemStack stack); - - /** - * Gets the recipe held by the item - * @param stack yourMetaItem - * @return the blueprints contents - */ - public ItemStack[] getBlueprint(ItemStack stack); - -} diff --git a/src/Java/gtPlusPlus/core/inventories/BaseInventoryBackpack.java b/src/Java/gtPlusPlus/core/inventories/BaseInventoryBackpack.java deleted file mode 100644 index 256fedb13c..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/BaseInventoryBackpack.java +++ /dev/null @@ -1,241 +0,0 @@ -package gtPlusPlus.core.inventories; - -import java.util.UUID; - -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 gtPlusPlus.core.item.base.BaseItemBackpack; -import net.minecraftforge.common.util.Constants; - -public class BaseInventoryBackpack implements IInventory{ - - private final String name = "Inventory Item"; - - /** Provides NBT Tag Compound to reference */ - private final ItemStack invItem; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 8; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private final ItemStack[] inventory = new ItemStack[INV_SIZE]; - - // declaration of variable: - protected String uniqueID; - - /** - * @param itemstack - the ItemStack to which this inventory belongs - */ - public BaseInventoryBackpack(final ItemStack stack) - { - this.invItem = stack; - - /** initialize variable within the constructor: */ - this.uniqueID = ""; - - if (!stack.hasTagCompound()) - { - stack.setTagCompound(new NBTTagCompound()); - // no tag compound means the itemstack does not yet have a UUID, so assign one: - this.uniqueID = UUID.randomUUID().toString(); - } - - // Create a new NBT Tag Compound if one doesn't already exist, or you will crash - if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); - } - // note that it's okay to use stack instead of invItem right there - // both reference the same memory location, so whatever you change using - // either reference will change in the other - - // Read the inventory contents from NBT - this.readFromNBT(stack.getTagCompound()); - } - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - if ((this.getStackInSlot(i) != null) && (this.getStackInSlot(i).stackSize == 0)) { - this.inventory[i] = null; - } - } - - // This line here does the work: - this.writeToNBT(this.invItem.getTagCompound()); - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) - { - // Don't want to be able to store the inventory item within itself - // Bad things will happen, like losing your inventory - // Actually, this needs a custom Slot to work - return !(itemstack.getItem() instanceof BaseItemBackpack); - } - - /** - * A custom method to read our inventory from an ItemStack's NBT compound - */ - public void readFromNBT(final NBTTagCompound compound) - { - // Gets the custom taglist we wrote to this compound, if any - // 1.7.2+ change to compound.getTagList("ItemInventory", Constants.NBT.TAG_COMPOUND); - final NBTTagList items = compound.getTagList("ItemInventory", Constants.NBT.TAG_COMPOUND); - - if ("".equals(this.uniqueID)) - { - // try to read unique ID from NBT - this.uniqueID = compound.getString("uniqueID"); - // if it's still "", assign a new one: - if ("".equals(this.uniqueID)) - { - this.uniqueID = UUID.randomUUID().toString(); - } - } - - for (int i = 0; i < items.tagCount(); ++i) - { - // 1.7.2+ change to items.getCompoundTagAt(i) - final NBTTagCompound item = items.getCompoundTagAt(i); - final int slot = item.getInteger("Slot"); - - // Just double-checking that the saved slot index is within our inventory array bounds - if ((slot >= 0) && (slot < this.getSizeInventory())) { - this.inventory[slot] = ItemStack.loadItemStackFromNBT(item); - } - } - } - - /** - * A custom method to write our inventory to an ItemStack's NBT compound - */ - public void writeToNBT(final NBTTagCompound tagcompound) - { - // Create a new NBT Tag List to store itemstacks as NBT Tags - final NBTTagList items = new NBTTagList(); - - for (int i = 0; i < this.getSizeInventory(); ++i) - { - // Only write stacks that contain items - if (this.getStackInSlot(i) != null) - { - // Make a new NBT Tag Compound to write the itemstack and slot index to - final NBTTagCompound item = new NBTTagCompound(); - item.setInteger("Slot", i); - // Writes the itemstack in slot(i) to the Tag Compound we just made - this.getStackInSlot(i).writeToNBT(item); - - // add the tag compound to our tag list - items.appendTag(item); - } - } - tagcompound.setString("uniqueID", this.uniqueID); - // Add the TagList to the ItemStack's Tag Compound with the name "ItemInventory" - tagcompound.setTag("ItemInventory", items); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/BaseInventoryGrindle.java b/src/Java/gtPlusPlus/core/inventories/BaseInventoryGrindle.java deleted file mode 100644 index 823398bd57..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/BaseInventoryGrindle.java +++ /dev/null @@ -1,224 +0,0 @@ -package gtPlusPlus.core.inventories; - -import java.util.UUID; - -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 gtPlusPlus.core.item.base.BaseItemBackpack; -import net.minecraftforge.common.util.Constants; - -public class BaseInventoryGrindle implements IInventory { - - private final String name = "Inventory Item"; - - /** Provides NBT Tag Compound to reference */ - private final ItemStack invItem; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 6; - - /** - * Inventory's size must be same as number of slots you add to the Container - * class - */ - private final ItemStack[] inventory = new ItemStack[INV_SIZE]; - - // declaration of variable: - protected String uniqueID; - - /** - * @param itemstack - * - the ItemStack to which this inventory belongs - */ - public BaseInventoryGrindle(final ItemStack stack) { - this.invItem = stack; - - /** initialize variable within the constructor: */ - this.uniqueID = ""; - - if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); - // no tag compound means the itemstack does not yet have a UUID, so assign one: - this.uniqueID = UUID.randomUUID().toString(); - } - - // Create a new NBT Tag Compound if one doesn't already exist, or you will crash - if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); - } - // note that it's okay to use stack instead of invItem right there - // both reference the same memory location, so whatever you change using - // either reference will change in the other - - // Read the inventory contents from NBT - this.readFromNBT(stack.getTagCompound()); - } - - @Override - public int getSizeInventory() { - return this.inventory.length; - } - - @Override - public ItemStack getStackInSlot(final int slot) { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) { - ItemStack stack = this.getStackInSlot(slot); - if (stack != null) { - if (stack.stackSize > amount) { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } else { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() { - return 1; - } - - /** - * This is the method that will handle saving the inventory contents, as it is - * called (or should be called!) anytime the inventory changes. Perfect. Much - * better than using onUpdate in an Item, as this will also let you change - * things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() { - for (int i = 0; i < this.getSizeInventory(); ++i) { - if ((this.getStackInSlot(i) != null) && (this.getStackInSlot(i).stackSize == 0)) { - this.inventory[i] = null; - } - } - - // This line here does the work: - this.writeToNBT(this.invItem.getTagCompound()); - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() { - } - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() { - } - - /** - * This method doesn't seem to do what it claims to do, as items can still be - * left-clicked and placed in the inventory even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - // Don't want to be able to store the inventory item within itself - // Bad things will happen, like losing your inventory - // Actually, this needs a custom Slot to work - return !(itemstack.getItem() instanceof BaseItemBackpack); - } - - /** - * A custom method to read our inventory from an ItemStack's NBT compound - */ - public void readFromNBT(final NBTTagCompound compound) { - // Gets the custom taglist we wrote to this compound, if any - // 1.7.2+ change to compound.getTagList("ItemInventory", - // Constants.NBT.TAG_COMPOUND); - final NBTTagList items = compound.getTagList("ItemInventory", Constants.NBT.TAG_COMPOUND); - - if ("".equals(this.uniqueID)) { - // try to read unique ID from NBT - this.uniqueID = compound.getString("uniqueID"); - // if it's still "", assign a new one: - if ("".equals(this.uniqueID)) { - this.uniqueID = UUID.randomUUID().toString(); - } - } - - for (int i = 0; i < items.tagCount(); ++i) { - // 1.7.2+ change to items.getCompoundTagAt(i) - final NBTTagCompound item = items.getCompoundTagAt(i); - final int slot = item.getInteger("Slot"); - - // Just double-checking that the saved slot index is within our inventory array - // bounds - if ((slot >= 0) && (slot < this.getSizeInventory())) { - this.inventory[slot] = ItemStack.loadItemStackFromNBT(item); - } - } - } - - /** - * A custom method to write our inventory to an ItemStack's NBT compound - */ - public void writeToNBT(final NBTTagCompound tagcompound) { - // Create a new NBT Tag List to store itemstacks as NBT Tags - final NBTTagList items = new NBTTagList(); - - for (int i = 0; i < this.getSizeInventory(); ++i) { - // Only write stacks that contain items - if (this.getStackInSlot(i) != null) { - // Make a new NBT Tag Compound to write the itemstack and slot index to - final NBTTagCompound item = new NBTTagCompound(); - item.setInteger("Slot", i); - // Writes the itemstack in slot(i) to the Tag Compound we just made - this.getStackInSlot(i).writeToNBT(item); - - // add the tag compound to our tag list - items.appendTag(item); - } - } - tagcompound.setString("uniqueID", this.uniqueID); - // Add the TagList to the ItemStack's Tag Compound with the name "ItemInventory" - tagcompound.setTag("ItemInventory", items); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryCircuitProgrammer.java b/src/Java/gtPlusPlus/core/inventories/InventoryCircuitProgrammer.java deleted file mode 100644 index da45b5a988..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/InventoryCircuitProgrammer.java +++ /dev/null @@ -1,173 +0,0 @@ -package gtPlusPlus.core.inventories; - -import gtPlusPlus.core.slots.SlotIntegratedCircuit; -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; - -public class InventoryCircuitProgrammer implements IInventory{ - - private final String name = "Circuit Programmer"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 26; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - public void readFromNBT(final NBTTagCompound nbt){ - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++){ - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)){ - //Utils.LOG_INFO("Trying to read NBT data from inventory."); - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt){ - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++){ - final ItemStack stack = this.inventory[i]; - if(stack != null){ - //Utils.LOG_INFO("Trying to write NBT data to inventory."); - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - final ItemStack temp = this.getStackInSlot(i); - if (temp != null){ - //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); - } - - if ((temp != null) && (temp.stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - return SlotIntegratedCircuit.isItemValidForSlot(itemstack); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryFishTrap.java b/src/Java/gtPlusPlus/core/inventories/InventoryFishTrap.java deleted file mode 100644 index 429ff517c1..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/InventoryFishTrap.java +++ /dev/null @@ -1,176 +0,0 @@ -package gtPlusPlus.core.inventories; - -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; - -public class InventoryFishTrap implements IInventory{ - - private final String name = "Fishtrap"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 15; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - public void readFromNBT(final NBTTagCompound nbt){ - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++){ - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)){ - //Utils.LOG_INFO("Trying to read NBT data from inventory."); - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt){ - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++){ - final ItemStack stack = this.inventory[i]; - if(stack != null){ - //Utils.LOG_INFO("Trying to write NBT data to inventory."); - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - final ItemStack temp = this.getStackInSlot(i); - if (temp != null){ - //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); - } - - if ((temp != null) && (temp.stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) - { - // Don't want to be able to store the inventory item within itself - // Bad things will happen, like losing your inventory - // Actually, this needs a custom Slot to work - return true; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryHeliumGenerator.java b/src/Java/gtPlusPlus/core/inventories/InventoryHeliumGenerator.java deleted file mode 100644 index 0288aa4d29..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/InventoryHeliumGenerator.java +++ /dev/null @@ -1,176 +0,0 @@ -package gtPlusPlus.core.inventories; - -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; - -public class InventoryHeliumGenerator implements IInventory{ - - private final String name = "Helium"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 19; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - public void readFromNBT(final NBTTagCompound nbt){ - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++){ - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)){ - //Utils.LOG_INFO("Trying to read NBT data from inventory."); - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt){ - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++){ - final ItemStack stack = this.inventory[i]; - if(stack != null){ - //Utils.LOG_INFO("Trying to write NBT data to inventory."); - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - final ItemStack temp = this.getStackInSlot(i); - if (temp != null){ - //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); - } - - if ((temp != null) && (temp.stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) - { - // Don't want to be able to store the inventory item within itself - // Bad things will happen, like losing your inventory - // Actually, this needs a custom Slot to work - return true; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryPestKiller.java b/src/Java/gtPlusPlus/core/inventories/InventoryPestKiller.java deleted file mode 100644 index 1c5d98f7d2..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/InventoryPestKiller.java +++ /dev/null @@ -1,176 +0,0 @@ -package gtPlusPlus.core.inventories; - -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; - -public class InventoryPestKiller implements IInventory{ - - private final String name = "Pest Killer"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 3; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - public void readFromNBT(final NBTTagCompound nbt){ - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++){ - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)){ - //Utils.LOG_INFO("Trying to read NBT data from inventory."); - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt){ - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++){ - final ItemStack stack = this.inventory[i]; - if(stack != null){ - //Utils.LOG_INFO("Trying to write NBT data to inventory."); - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - final ItemStack temp = this.getStackInSlot(i); - if (temp != null){ - //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); - } - - if ((temp != null) && (temp.stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) - { - // Don't want to be able to store the inventory item within itself - // Bad things will happen, like losing your inventory - // Actually, this needs a custom Slot to work - return true; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java deleted file mode 100644 index 3ea5675ba2..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java +++ /dev/null @@ -1,188 +0,0 @@ -package gtPlusPlus.core.inventories; - -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; - -public class InventoryWorkbenchChest implements IInventory{ - - private final String name = "Inventory Chest"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 16; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - /** - * @param itemstack - the ItemStack to which this inventory belongs - */ - public InventoryWorkbenchChest() - { - - } - - public void readFromNBT(final NBTTagCompound nbt) - { - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++) - { - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)) - { - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt) - { - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++) - { - final ItemStack stack = this.inventory[i]; - if(stack != null) - { - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - final ItemStack temp = this.getStackInSlot(i); - if (temp != null){ - //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); - } - - if ((temp != null) && (temp.stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) - { - // Don't want to be able to store the inventory item within itself - // Bad things will happen, like losing your inventory - // Actually, this needs a custom Slot to work - return true; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java deleted file mode 100644 index f49540b5e2..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java +++ /dev/null @@ -1,201 +0,0 @@ -package gtPlusPlus.core.inventories; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; - -public class InventoryWorkbenchCrafting implements IInventory{ - - private final String name = "Inventory Crafting"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 9; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - public final InventoryCrafting craftMatrix; - public final Container parentContainer; - - public InventoryCrafting getCrafting(){ - return this.craftMatrix; - } - - /** - * @param itemstack - the ItemStack to which this inventory belongs - */ - public InventoryWorkbenchCrafting(final Container containerR) - { - this.parentContainer = containerR; - this.craftMatrix = new InventoryCrafting(this.parentContainer, 3, 3); - } - - private ItemStack[] getArrayOfCraftingItems(){ - final ItemStack[] array = new ItemStack[9]; - for (int i=0; i<this.craftMatrix.getSizeInventory();i++){ - if(this.craftMatrix.getStackInSlot(i) != null){ - array[i] = this.craftMatrix.getStackInSlot(i); - } - } - return array; - } - - public void readFromNBT(final NBTTagCompound nbt) - { - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++) - { - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)) - { - this.getInventory()[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt) - { - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++) - { - final ItemStack stack = this.getInventory()[i]; - if(stack != null) - { - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.getInventory().length; - } - - public ItemStack[] getInventory(){ - return this.getArrayOfCraftingItems(); - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return this.getInventory()[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - this.getInventory()[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - if ((this.getStackInSlot(i) != null) && (this.getStackInSlot(i).stackSize == 0)) { - this.getInventory()[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) - { - // Don't want to be able to store the inventory item within itself - // Bad things will happen, like losing your inventory - // Actually, this needs a custom Slot to work - return true; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloCrafting.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloCrafting.java deleted file mode 100644 index 432a425a9b..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloCrafting.java +++ /dev/null @@ -1,164 +0,0 @@ -package gtPlusPlus.core.inventories; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; - -public class InventoryWorkbenchHoloCrafting implements IInventory{ - - private final String name = "Inventory Crafting"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 9; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private final ItemStack[] inventory = new ItemStack[INV_SIZE]; - - /** - * @param itemstack - the ItemStack to which this inventory belongs - */ - public InventoryWorkbenchHoloCrafting() - { - - } - - /*public void readFromNBT(NBTTagCompound nbt) - { - NBTTagList list = nbt.getTagList("Items", 10); - inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++) - { - NBTTagCompound data = list.getCompoundTagAt(i); - int slot = data.getInteger("Slot"); - if(slot >= 0 && slot < INV_SIZE) - { - inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(NBTTagCompound nbt) - { - NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++) - { - ItemStack stack = inventory[i]; - if(stack != null) - { - NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - }*/ - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - this.markDirty(); - } - else - { - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - this.inventory[slot] = stack; - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - this.markDirty(); - } - - @Override - public String getInventoryName() - { - return this.name; - } - - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - final ItemStack temp = this.getStackInSlot(i); - if (temp != null){ - //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); - } - - if ((temp != null) && (temp.stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - @Override - public void openInventory() {} - - @Override - public void closeInventory() {} - - - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) - { - return true; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java deleted file mode 100644 index 1966e8fdca..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java +++ /dev/null @@ -1,269 +0,0 @@ -package gtPlusPlus.core.inventories; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.InventoryCraftResult; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; - -import gtPlusPlus.api.objects.Logger; - -public class InventoryWorkbenchHoloSlots implements IInventory{ - - private final String name = "Inventory Holo"; - - //Output Slot - public IInventory craftResult = new InventoryCraftResult(); - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 6; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - /** - * @param itemstack - the ItemStack to which this inventory belongs - */ - public InventoryWorkbenchHoloSlots() - { - - } - - public void readFromNBT(final NBTTagCompound nbt) - { - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++) - { - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 1) && (slot < INV_SIZE)) - { - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt) - { - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++) - { - final ItemStack stack = this.inventory[i]; - if((stack != null) && (i != 0)) - { - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return this.inventory[slot]; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 1; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - if ((this.getStackInSlot(i) != null) && (this.getStackInSlot(i).stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) - { - return false; - } - - /** A list of one item containing the result of the crafting formula */ - private final ItemStack[] stackResult = new ItemStack[1]; - - /** - * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a - * new stack. - */ - /*@Override - public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) - { - ItemStack stack = getStackInSlot(0); - if (this.stackResult[0] != null) - { - ItemStack itemstack = this.stackResult[0]; - this.stackResult[0] = null; - return itemstack; - } - if(stack != null) - { - if(stack.stackSize > p_70298_2_) - { - stack = stack.splitStack(p_70298_2_); - // Don't forget this line or your inventory will not be saved! - markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - setInventorySlotContents(p_70298_1_, null); - } - } - return stack; - }*/ - @Override - public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_) - { - if (this.getStackInSlot(0) != null){ - Logger.INFO("getStackInSlot(0) contains "+this.getStackInSlot(0).getDisplayName()); - if (this.stackResult[0] == null){ - Logger.INFO("this.stackResult[0] == null"); - this.stackResult[0] = this.getStackInSlot(0); - } - else if (this.stackResult[0] != null){ - Logger.INFO("this.stackResult[0] != null"); - if (this.stackResult[0].getDisplayName().toLowerCase().equals(this.getStackInSlot(0).getDisplayName().toLowerCase())){ - Logger.INFO("Items are the same?"); - } - else { - Logger.INFO("Items are not the same."); - } - } - } - - if (this.stackResult[0] != null) - { - Logger.INFO("this.stackResult[0] != null - Really never should be though. - Returning "+this.stackResult[0].getDisplayName()); - final ItemStack itemstack = this.stackResult[0]; - this.stackResult[0] = null; - return itemstack; - } - return null; - } - - /** - * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - - * like when you close a workbench GUI. - */ - @Override - public ItemStack getStackInSlotOnClosing(final int p_70304_1_) - { - if (this.stackResult[0] != null) - { - final ItemStack itemstack = this.stackResult[0]; - this.stackResult[0] = null; - return itemstack; - } - return null; - } - -} - - - -//Default Behaviour -/*@Override -public ItemStack decrStackSize(int slot, int amount) -{ - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - setInventorySlotContents(slot, null); - } - } - return stack; -}*/ - -//Default Behaviour -/*@Override -public ItemStack getStackInSlotOnClosing(int slot) -{ - ItemStack stack = getStackInSlot(slot); - setInventorySlotContents(slot, null); - return stack; -}*/ - diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java deleted file mode 100644 index 6543f6e9ea..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java +++ /dev/null @@ -1,188 +0,0 @@ -package gtPlusPlus.core.inventories; - -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 gregtech.api.items.GT_MetaGenerated_Tool; - -public class InventoryWorkbenchTools implements IInventory{ - - private final String name = "Inventory Tools"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 5; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - /** - * @param itemstack - the ItemStack to which this inventory belongs - */ - public InventoryWorkbenchTools() - { - - } - - public void readFromNBT(final NBTTagCompound nbt) - { - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++) - { - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)) - { - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt) - { - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++) - { - final ItemStack stack = this.inventory[i]; - if(stack != null) - { - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 1; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - if ((this.getStackInSlot(i) != null) && (this.getStackInSlot(i).stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) - { - // Don't want to be able to store the inventory item within itself - // Bad things will happen, like losing your inventory - // Actually, this needs a custom Slot to work - if (itemstack.getItem() instanceof GT_MetaGenerated_Tool){ - return true; - } - return false; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java deleted file mode 100644 index 29bf306b08..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java +++ /dev/null @@ -1,193 +0,0 @@ -package gtPlusPlus.core.inventories; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; - -import gregtech.api.items.GT_MetaGenerated_Tool; - -import gtPlusPlus.core.slots.SlotGtToolElectric; -import ic2.api.item.IElectricItem; - -public class InventoryWorkbenchToolsElectric implements IInventory{ - - private final String name = "Inventory Tools"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 5; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - private final Slot[] toolSlots = new SlotGtToolElectric[INV_SIZE]; //TODO - - /** - * @param itemstack - the ItemStack to which this inventory belongs - */ - public InventoryWorkbenchToolsElectric() - { - - } - - public void readFromNBT(final NBTTagCompound nbt) - { - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++) - { - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)) - { - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt) - { - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++) - { - final ItemStack stack = this.inventory[i]; - if(stack != null) - { - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 1; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - if ((this.getStackInSlot(i) != null) && (this.getStackInSlot(i).stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) - { - // Don't want to be able to store the inventory item within itself - // Bad things will happen, like losing your inventory - // Actually, this needs a custom Slot to work - if ((itemstack.getItem() instanceof GT_MetaGenerated_Tool) || (itemstack.getItem() instanceof IElectricItem)){ - return true; - } - return false; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/Inventory_DecayablesChest.java b/src/Java/gtPlusPlus/core/inventories/Inventory_DecayablesChest.java deleted file mode 100644 index 666f4aac53..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/Inventory_DecayablesChest.java +++ /dev/null @@ -1,176 +0,0 @@ -package gtPlusPlus.core.inventories; - -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; - -public class Inventory_DecayablesChest implements IInventory{ - - private final String name = "DecayablesChest"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 15; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - public void readFromNBT(final NBTTagCompound nbt){ - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++){ - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)){ - //Utils.LOG_INFO("Trying to read NBT data from inventory."); - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt){ - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++){ - final ItemStack stack = this.inventory[i]; - if(stack != null){ - //Utils.LOG_INFO("Trying to write NBT data to inventory."); - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - final ItemStack temp = this.getStackInSlot(i); - if (temp != null){ - //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); - } - - if ((temp != null) && (temp.stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) - { - // Don't want to be able to store the inventory item within itself - // Bad things will happen, like losing your inventory - // Actually, this needs a custom Slot to work - return true; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/Inventory_EggBox.java b/src/Java/gtPlusPlus/core/inventories/Inventory_EggBox.java deleted file mode 100644 index 334afc3300..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/Inventory_EggBox.java +++ /dev/null @@ -1,176 +0,0 @@ -package gtPlusPlus.core.inventories; - -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; - -public class Inventory_EggBox implements IInventory{ - - private final String name = "EggBox"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 15; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - public void readFromNBT(final NBTTagCompound nbt){ - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++){ - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)){ - //Utils.LOG_INFO("Trying to read NBT data from inventory."); - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt){ - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++){ - final ItemStack stack = this.inventory[i]; - if(stack != null){ - //Utils.LOG_INFO("Trying to write NBT data to inventory."); - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - final ItemStack temp = this.getStackInSlot(i); - if (temp != null){ - //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); - } - - if ((temp != null) && (temp.stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) - { - // Don't want to be able to store the inventory item within itself - // Bad things will happen, like losing your inventory - // Actually, this needs a custom Slot to work - return true; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/Inventory_RoundRobinator.java b/src/Java/gtPlusPlus/core/inventories/Inventory_RoundRobinator.java deleted file mode 100644 index a47f250c39..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/Inventory_RoundRobinator.java +++ /dev/null @@ -1,172 +0,0 @@ -package gtPlusPlus.core.inventories; - -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; - -public class Inventory_RoundRobinator implements IInventory{ - - private final String name = "Round Robinator"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 4; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - public void readFromNBT(final NBTTagCompound nbt){ - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++){ - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)){ - //Utils.LOG_INFO("Trying to read NBT data from inventory."); - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt){ - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++){ - final ItemStack stack = this.inventory[i]; - if(stack != null){ - //Utils.LOG_INFO("Trying to write NBT data to inventory."); - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - final ItemStack temp = this.getStackInSlot(i); - if (temp != null){ - //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); - } - - if ((temp != null) && (temp.stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - return true; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/Inventory_SuperJukebox.java b/src/Java/gtPlusPlus/core/inventories/Inventory_SuperJukebox.java deleted file mode 100644 index 681c67a988..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/Inventory_SuperJukebox.java +++ /dev/null @@ -1,172 +0,0 @@ -package gtPlusPlus.core.inventories; - -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; - -public class Inventory_SuperJukebox implements IInventory{ - - private final String name = "Sir Mixalot"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 21; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - public void readFromNBT(final NBTTagCompound nbt){ - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++){ - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)){ - //Utils.LOG_INFO("Trying to read NBT data from inventory."); - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt){ - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++){ - final ItemStack stack = this.inventory[i]; - if(stack != null){ - //Utils.LOG_INFO("Trying to write NBT data to inventory."); - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 1; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - final ItemStack temp = this.getStackInSlot(i); - if (temp != null){ - //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); - } - - if ((temp != null) && (temp.stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - return true; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/Inventory_VolumetricFlaskSetter.java b/src/Java/gtPlusPlus/core/inventories/Inventory_VolumetricFlaskSetter.java deleted file mode 100644 index e2dc91a413..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/Inventory_VolumetricFlaskSetter.java +++ /dev/null @@ -1,173 +0,0 @@ -package gtPlusPlus.core.inventories; - -import gtPlusPlus.xmod.gregtech.common.helpers.VolumetricFlaskHelper; -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; - -public class Inventory_VolumetricFlaskSetter implements IInventory{ - - private final String name = "Volumetric Flask Setter"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 9; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - public void readFromNBT(final NBTTagCompound nbt){ - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++){ - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)){ - //Utils.LOG_INFO("Trying to read NBT data from inventory."); - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt){ - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++){ - final ItemStack stack = this.inventory[i]; - if(stack != null){ - //Utils.LOG_INFO("Trying to write NBT data to inventory."); - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 16; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - final ItemStack temp = this.getStackInSlot(i); - if (temp != null){ - //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); - } - - if ((temp != null) && (temp.stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - return VolumetricFlaskHelper.isVolumetricFlask(itemstack); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/box/LunchBoxInventory.java b/src/Java/gtPlusPlus/core/inventories/box/LunchBoxInventory.java deleted file mode 100644 index 03350a3c18..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/box/LunchBoxInventory.java +++ /dev/null @@ -1,15 +0,0 @@ -package gtPlusPlus.core.inventories.box; - -import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory; -import gtPlusPlus.core.slots.SlotLunchBox; -import net.minecraft.item.ItemStack; - -public class LunchBoxInventory extends CustomBoxInventory { - public LunchBoxInventory(ItemStack stack) { - super(stack, "Lunch Box", gtPlusPlus.core.item.tool.misc.box.AutoLunchBox.SLOTS); - } - @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) { - return SlotLunchBox.isItemValid_STATIC(itemstack); - } -} diff --git a/src/Java/gtPlusPlus/core/inventories/box/MagicBagInventory.java b/src/Java/gtPlusPlus/core/inventories/box/MagicBagInventory.java deleted file mode 100644 index 56b1835113..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/box/MagicBagInventory.java +++ /dev/null @@ -1,15 +0,0 @@ -package gtPlusPlus.core.inventories.box; - -import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory; -import gtPlusPlus.core.slots.SlotMagicToolBag; -import net.minecraft.item.ItemStack; - -public class MagicBagInventory extends CustomBoxInventory { - public MagicBagInventory(ItemStack stack) { - super(stack, "Mystic Bag", gtPlusPlus.core.item.tool.misc.box.MagicToolBag.SLOTS); - } - @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) { - return SlotMagicToolBag.isItemValid_STATIC(itemstack); - } -} diff --git a/src/Java/gtPlusPlus/core/inventories/box/ToolBoxInventory.java b/src/Java/gtPlusPlus/core/inventories/box/ToolBoxInventory.java deleted file mode 100644 index 30893aeb4b..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/box/ToolBoxInventory.java +++ /dev/null @@ -1,16 +0,0 @@ -package gtPlusPlus.core.inventories.box; - -import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory; -import gtPlusPlus.core.item.tool.misc.box.UniversalToolBox; -import gtPlusPlus.core.slots.SlotToolBox; -import net.minecraft.item.ItemStack; - -public class ToolBoxInventory extends CustomBoxInventory { - public ToolBoxInventory(ItemStack stack) { - super(stack, "Tool Box", UniversalToolBox.SLOTS); - } - @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) { - return SlotToolBox.isItemValid_STATIC(itemstack); - } -} diff --git a/src/Java/gtPlusPlus/core/inventories/modulartable/InventoryModularMain.java b/src/Java/gtPlusPlus/core/inventories/modulartable/InventoryModularMain.java deleted file mode 100644 index 825a9a8851..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/modulartable/InventoryModularMain.java +++ /dev/null @@ -1,202 +0,0 @@ -package gtPlusPlus.core.inventories.modulartable; - -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 gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; - -public class InventoryModularMain implements IInventory{ - - private final String name = "Inventory Grid"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 9; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - /** - * @param itemstack - the ItemStack to which this inventory belongs - */ - public InventoryModularMain() - { - - } - - public void readFromNBT(final NBTTagCompound nbt) - { - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++) - { - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)) - { - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt) - { - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++) - { - final ItemStack stack = this.inventory[i]; - if(stack != null) - { - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - //Utils.LOG_INFO("getStackInSlot["+slot+"]"); - try { - if (slot>= this.inventory.length){ - //Utils.LOG_INFO("Returning invalid slot item."); - return null; - } - return this.inventory[slot]; - } catch (Throwable t){ - t.printStackTrace(); - return null; - } - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - if (slot >= this.inventory.length){ - return; - } - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - final ItemStack temp = this.getStackInSlot(i); - if (temp != null){ - //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); - } - - if ((temp != null) && (temp.stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack){ - // Don't want to be able to store the inventory item within itself - // Bad things will happen, like losing your inventory - // Actually, this needs a custom Slot to work - return TileEntityModularityTable.isValidUpgrade(itemstack); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/modulartable/InventoryModularOutput.java b/src/Java/gtPlusPlus/core/inventories/modulartable/InventoryModularOutput.java deleted file mode 100644 index d3c59ee2a4..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/modulartable/InventoryModularOutput.java +++ /dev/null @@ -1,192 +0,0 @@ -package gtPlusPlus.core.inventories.modulartable; - -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 gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; - -public class InventoryModularOutput implements IInventory { - - private final String name = "Inventory Output"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 3; - private int mRecpeTime = -1; - - /** - * Inventory's size must be same as number of slots you add to the Container - * class - */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - /** - * @param itemstack - * - the ItemStack to which this inventory belongs - */ - public InventoryModularOutput() { - - } - - public void readFromNBT(final NBTTagCompound nbt) { - if (this.mRecpeTime > -1) { - nbt.setInteger("mRecipeTime", this.mRecpeTime); - } - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for (int i = 0; i < list.tagCount(); i++) { - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if ((slot >= 0) && (slot < INV_SIZE)) { - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt) { - final NBTTagList list = new NBTTagList(); - if (nbt.hasKey("mRecipeTime")) { - this.mRecpeTime = nbt.getInteger("mRecipeTime"); - } - for (int i = 0; i < INV_SIZE; i++) { - final ItemStack stack = this.inventory[i]; - if (stack != null) { - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - public int setRecipeTime(int mTime) { - return (this.mRecpeTime = mTime); - } - - public int getRecipeTime() { - return this.mRecpeTime; - } - - @Override - public int getSizeInventory() { - return this.inventory.length; - } - - public ItemStack[] getInventory() { - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) { - ItemStack stack = this.getStackInSlot(slot); - if (stack != null) { - if (stack.stackSize > amount) { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } else { - // this method also calls markDirty, so we don't need to call it - // again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it - * is called (or should be called!) anytime the inventory changes. Perfect. - * Much better than using onUpdate in an Item, as this will also let you - * change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() { - for (int i = 0; i < this.getSizeInventory(); ++i) { - final ItemStack temp = this.getStackInSlot(i); - if (temp != null) { - // Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" - // x"+temp.stackSize); - } - - if ((temp != null) && (temp.stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() { - } - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() { - } - - /** - * This method doesn't seem to do what it claims to do, as items can still - * be left-clicked and placed in the inventory even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - // Don't want to be able to store the inventory item within itself - // Bad things will happen, like losing your inventory - // Actually, this needs a custom Slot to work - if (slot == 0){ - return TileEntityModularityTable.isValidUpgrade(itemstack); - } - return TileEntityModularityTable.isValidModularPiece(itemstack); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/projecttable/InventoryProjectMain.java b/src/Java/gtPlusPlus/core/inventories/projecttable/InventoryProjectMain.java deleted file mode 100644 index 2d91869027..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/projecttable/InventoryProjectMain.java +++ /dev/null @@ -1,201 +0,0 @@ -package gtPlusPlus.core.inventories.projecttable; - -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; - -public class InventoryProjectMain implements IInventory{ - - private final String name = "Inventory Grid"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 9; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - /** - * @param itemstack - the ItemStack to which this inventory belongs - */ - public InventoryProjectMain() - { - - } - - public void readFromNBT(final NBTTagCompound nbt) - { - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++) - { - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)) - { - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt) - { - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++) - { - final ItemStack stack = this.inventory[i]; - if(stack != null) - { - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - //Utils.LOG_INFO("getStackInSlot["+slot+"]"); - try { - if (slot>= this.inventory.length){ - //Utils.LOG_INFO("Returning invalid slot item."); - return null; - } - return this.inventory[slot]; - } catch (Throwable t){ - t.printStackTrace(); - return null; - } - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - if (slot >= this.inventory.length){ - return; - } - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - final ItemStack temp = this.getStackInSlot(i); - if (temp != null){ - //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); - } - - if ((temp != null) && (temp.stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) - { - // Don't want to be able to store the inventory item within itself - // Bad things will happen, like losing your inventory - // Actually, this needs a custom Slot to work - return true; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/projecttable/InventoryProjectOutput.java b/src/Java/gtPlusPlus/core/inventories/projecttable/InventoryProjectOutput.java deleted file mode 100644 index 41ddd06ef1..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/projecttable/InventoryProjectOutput.java +++ /dev/null @@ -1,188 +0,0 @@ -package gtPlusPlus.core.inventories.projecttable; - -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; - -public class InventoryProjectOutput implements IInventory{ - - private final String name = "Inventory Output"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 2; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - /** - * @param itemstack - the ItemStack to which this inventory belongs - */ - public InventoryProjectOutput() - { - - } - - public void readFromNBT(final NBTTagCompound nbt) - { - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++) - { - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)) - { - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt) - { - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++) - { - final ItemStack stack = this.inventory[i]; - if(stack != null) - { - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - final ItemStack temp = this.getStackInSlot(i); - if (temp != null){ - //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); - } - - if ((temp != null) && (temp.stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) - { - // Don't want to be able to store the inventory item within itself - // Bad things will happen, like losing your inventory - // Actually, this needs a custom Slot to work - return true; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/tradetable/InventoryTradeMain.java b/src/Java/gtPlusPlus/core/inventories/tradetable/InventoryTradeMain.java deleted file mode 100644 index aa7e8b1866..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/tradetable/InventoryTradeMain.java +++ /dev/null @@ -1,201 +0,0 @@ -package gtPlusPlus.core.inventories.tradetable; - -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; - -public class InventoryTradeMain implements IInventory{ - - private final String name = "Inventory Grid"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 9; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - /** - * @param itemstack - the ItemStack to which this inventory belongs - */ - public InventoryTradeMain() - { - - } - - public void readFromNBT(final NBTTagCompound nbt) - { - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++) - { - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)) - { - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt) - { - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++) - { - final ItemStack stack = this.inventory[i]; - if(stack != null) - { - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - //Utils.LOG_INFO("getStackInSlot["+slot+"]"); - try { - if (slot>= this.inventory.length){ - //Utils.LOG_INFO("Returning invalid slot item."); - return null; - } - return this.inventory[slot]; - } catch (Throwable t){ - t.printStackTrace(); - return null; - } - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - if (slot >= this.inventory.length){ - return; - } - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - final ItemStack temp = this.getStackInSlot(i); - if (temp != null){ - //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); - } - - if ((temp != null) && (temp.stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) - { - // Don't want to be able to store the inventory item within itself - // Bad things will happen, like losing your inventory - // Actually, this needs a custom Slot to work - return true; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/tradetable/InventoryTradeOutput.java b/src/Java/gtPlusPlus/core/inventories/tradetable/InventoryTradeOutput.java deleted file mode 100644 index fb4329e11a..0000000000 --- a/src/Java/gtPlusPlus/core/inventories/tradetable/InventoryTradeOutput.java +++ /dev/null @@ -1,188 +0,0 @@ -package gtPlusPlus.core.inventories.tradetable; - -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; - -public class InventoryTradeOutput implements IInventory{ - - private final String name = "Inventory Output"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 2; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - /** - * @param itemstack - the ItemStack to which this inventory belongs - */ - public InventoryTradeOutput() - { - - } - - public void readFromNBT(final NBTTagCompound nbt) - { - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++) - { - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)) - { - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt) - { - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++) - { - final ItemStack stack = this.inventory[i]; - if(stack != null) - { - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() - { - return this.inventory.length; - } - - public ItemStack[] getInventory(){ - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) - { - ItemStack stack = this.getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - else - { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) - { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) - { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) - { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return this.name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < this.getSizeInventory(); ++i) - { - final ItemStack temp = this.getStackInSlot(i); - if (temp != null){ - //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); - } - - if ((temp != null) && (temp.stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) - { - // Don't want to be able to store the inventory item within itself - // Bad things will happen, like losing your inventory - // Actually, this needs a custom Slot to work - return true; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java deleted file mode 100644 index 47278c559d..0000000000 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ /dev/null @@ -1,1232 +0,0 @@ -package gtPlusPlus.core.item; -import static gtPlusPlus.core.creative.AddToCreativeTab.tabMachines; -import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc; -import static gtPlusPlus.core.lib.CORE.LOAD_ALL_CONTENT; - -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.base.BasicBlock.BlockTypes; -import gtPlusPlus.core.block.base.BlockBaseModular; -import gtPlusPlus.core.common.compat.COMPAT_Baubles; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.*; -import gtPlusPlus.core.item.base.BaseItemComponent.ComponentTypes; -import gtPlusPlus.core.item.base.dusts.BaseItemDust; -import gtPlusPlus.core.item.base.foil.BaseItemFoil; -import gtPlusPlus.core.item.base.foods.BaseItemFood; -import gtPlusPlus.core.item.base.foods.BaseItemHotFood; -import gtPlusPlus.core.item.base.gears.BaseItemSmallGear; -import gtPlusPlus.core.item.base.ingots.BaseItemIngot; -import gtPlusPlus.core.item.base.ingots.BaseItemIngot_OLD; -import gtPlusPlus.core.item.base.misc.BaseItemMisc; -import gtPlusPlus.core.item.base.misc.BaseItemMisc.MiscTypes; -import gtPlusPlus.core.item.base.plates.BaseItemPlate; -import gtPlusPlus.core.item.base.plates.BaseItemPlateDouble; -import gtPlusPlus.core.item.bauble.*; -import gtPlusPlus.core.item.chemistry.*; -import gtPlusPlus.core.item.crafting.ItemDummyResearch; -import gtPlusPlus.core.item.effects.RarityUncommon; -import gtPlusPlus.core.item.food.BaseItemMetaFood; -import gtPlusPlus.core.item.general.*; -import gtPlusPlus.core.item.general.books.ItemBaseBook; -import gtPlusPlus.core.item.general.capture.ItemEntityCatcher; -import gtPlusPlus.core.item.general.chassis.ItemBoilerChassis; -import gtPlusPlus.core.item.general.chassis.ItemDehydratorCoil; -import gtPlusPlus.core.item.general.chassis.ItemDehydratorCoilWire; -import gtPlusPlus.core.item.general.spawn.ItemCustomSpawnEgg; -import gtPlusPlus.core.item.general.throwables.ItemHydrofluoricAcidPotion; -import gtPlusPlus.core.item.general.throwables.ItemSulfuricAcidPotion; -import gtPlusPlus.core.item.general.throwables.ItemThrowableBomb; -import gtPlusPlus.core.item.init.ItemsFoods; -import gtPlusPlus.core.item.materials.DustDecayable; -import gtPlusPlus.core.item.tool.misc.DebugScanner; -import gtPlusPlus.core.item.tool.misc.GregtechPump; -import gtPlusPlus.core.item.tool.misc.SandstoneHammer; -import gtPlusPlus.core.item.tool.misc.box.AutoLunchBox; -import gtPlusPlus.core.item.tool.misc.box.MagicToolBag; -import gtPlusPlus.core.item.tool.misc.box.UniversalToolBox; -import gtPlusPlus.core.item.tool.staballoy.*; -import gtPlusPlus.core.item.wearable.WearableLoader; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.CORE.ConfigSwitches; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.*; -import gtPlusPlus.core.material.nuclear.FLUORIDES; -import gtPlusPlus.core.material.nuclear.NUCLIDE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.data.StringUtils; -import gtPlusPlus.core.util.debug.DEBUG_INIT; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.everglades.GTplusplus_Everglades; -import gtPlusPlus.preloader.CORE_Preloader; -import gtPlusPlus.xmod.cofh.HANDLER_COFH; -import gtPlusPlus.xmod.eio.material.MaterialEIO; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; -import gtPlusPlus.xmod.gregtech.common.helpers.VolumetricFlaskHelper; -import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechItems; -import net.minecraft.item.*; -import net.minecraft.item.Item.ToolMaterial; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.EnumHelper; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -public final class ModItems { - - public static ToolMaterial STABALLOY = EnumHelper.addToolMaterial("Staballoy", 3, 2500, 7, 1.0F, 18); - - public static Item ZZZ_Empty; - public static Item AAA_Broken; - - - public static Item itemAlkalusDisk; - public static Item itemDebugShapeSpawner; - public static ItemCustomSpawnEgg itemCustomSpawnEgg; - - //EnderIO - public static Item itemPlateSoularium; - public static Item itemPlateRedstoneAlloy; - public static Item itemPlateElectricalSteel; - public static Item itemPlatePulsatingIron; - public static Item itemPlateEnergeticAlloy; - public static Item itemPlateVibrantAlloy; - public static Item itemPlateConductiveIron; - public static Item itemPlateDarkSteel; - public static Item itemDustSoularium; - public static Item itemDustRedstoneAlloy; - public static Item itemDustElectricalSteel; - public static Item itemDustPulsatingIron; - public static Item itemDustEnergeticAlloy; - public static Item itemDustVibrantAlloy; - public static Item itemDustConductiveIron; - //Big Reactors - public static Item itemPlateBlutonium; - public static Item itemPlateCyanite; - public static Item itemPlateLudicrite; - //Thaumcraft - public static Item itemPlateVoidMetal; - //Pneumaticraft - public static Item itemPlateCompressedIron; - //SimplyJetpacks - public static Item itemPlateEnrichedSoularium; - //rfTools - public static Item itemPlateDimensionShard; - //Staballoy - public static Item itemStaballoyPickaxe; - public static Item itemStaballoyAxe; - //Tools - public static Item itemSandstoneHammer; - //Machine Related - public static Item itemBufferCore0; - //Material related - public static Item itemStickyRubber; - public static Item itemIngotBatteryAlloy; - public static Item itemPlateBatteryAlloy; - public static Item itemHeliumBlob; - public static Item itemHydrogenBlob; - public static Item itemPLACEHOLDER_Circuit; - - public static Item FuelRod_Empty; - public static Item FuelRod_Thorium; - public static Item FuelRod_Uranium; - public static Item FuelRod_Plutonium; - - public static Item itemBedLocator_Base; - public static Item itemBaseItemWithCharge; - - public static Item itemIngotRaisinBread; - public static Item itemHotIngotRaisinBread; - - public static ItemFood itemFoodRaisinToast; - public static BaseItemHotFood itemHotFoodRaisinToast; - public static BaseItemFood itemFoodCurriedSausages; - public static BaseItemHotFood itemHotFoodCurriedSausages; - - public static Item RfEuBattery; - public static Item itemPersonalCloakingDevice; - public static Item itemPersonalCloakingDeviceCharged; - public static Item itemPersonalHealingDevice; - public static Item itemPersonalFireProofDevice; - public static Item itemSlowBuildingRing; - - public static MultiPickaxeBase MP_GTMATERIAL; - public static MultiSpadeBase MS_GTMATERIAL; - - public static ItemStack FluidCell; - - public static BaseItemBackpack backpack_Red; - public static BaseItemBackpack backpack_Green; - public static BaseItemBackpack backpack_Blue; - public static BaseItemBackpack backpack_Yellow; - public static BaseItemBackpack backpack_Purple; - public static BaseItemBackpack backpack_Cyan; - public static BaseItemBackpack backpack_Maroon; - public static BaseItemBackpack backpack_Olive; - public static BaseItemBackpack backpack_DarkGreen; - public static BaseItemBackpack backpack_DarkPurple; - public static BaseItemBackpack backpack_Teal; - public static BaseItemBackpack backpack_Navy; - public static BaseItemBackpack backpack_Silver; - public static BaseItemBackpack backpack_Gray; - public static BaseItemBackpack backpack_Black; - public static BaseItemBackpack backpack_White; - - public static ItemBlueprint itemBlueprintBase; - - public static Item dustLithiumCarbonate; - public static Item dustLithiumHydroxide; - public static Item dustLithiumPeroxide; - public static Item dustLithiumFluoride; - - public static Item dustUranium232; - public static Item dustUraniumTetraFluoride; - public static Item dustUraniumHexaFluoride; - - public static Item dustBerylliumFluoride; - - public static Item dustQuicklime; - public static Item dustCalciumHydroxide; - public static Item dustCalciumCarbonate; - public static Item dustLi2CO3CaOH2; - public static Item dustLi2BeF4; - - public static Item dustTumbagaMix; - - public static Item dustAer; - public static Item dustIgnis; - public static Item dustTerra; - public static Item dustAqua; - - public static BaseEuItem metaItem2; - - public static Item shardAer; - public static Item shardIgnis; - public static Item shardTerra; - public static Item shardAqua; - - //Tc Compat for energy crystal recipes - public static Item shardDull; - - //Lighter - public static Item itemBasicFireMaker; - - //Zirconium - public static Item itemZirconiumChlorideCinterPellet; - public static Item dustZrCl4; - public static Item dustCookedZrCl4; - public static Item dustZrF4; - - public static Item dustNaBF4NaF; - public static Item dustLiFBeF2ZrF4UF4; - public static Item dustLiFBeF2ZrF4U235; - public static Item dustLiFBeF2ThF4UF4; - - public static Item dustCalciumSulfate; - - public static Item dustFertUN18; - public static Item dustFertUN32; - - //public static Fluid fluidFLiBeSalt; - //public static Fluid fluidFLiBeSaltBurnt; - - public static Fluid fluidLftrCore1; - public static Fluid fluidLftrCore2; - public static Fluid fluidLftrCore3; - public static Fluid fluidLftrCore4; - public static Fluid fluidLftrBlanket1; - public static Fluid fluidLftrBlanket2; - public static Fluid fluidLftrBlanket3; - public static Fluid fluidNuclearWaste; - - - //Possibly missing base items that GT may be missing. - - public static Item itemSmallWroughtIronGear; - public static Item itemPlateRawMeat; - public static Item itemPlateClay; - public static Item itemPlateLithium; - public static Item itemPlateEuropium; - public static Item itemPlateVanadium; - public static Item itemDoublePlateClay; - public static Item itemDoublePlateEuropium; - public static Item itemFoilUranium235; - public static Item itemDustIndium; - public static BlockBaseModular blockRawMeat; - - public static Item itemBoilerChassis; - public static Item itemDehydratorCoilWire; - public static Item itemDehydratorCoil; - - public static Item itemLavaFilter; - public static Item itemAirFilter; - - public static Item itemCoalCoke; - public static Item itemCactusCharcoal; - public static Item itemSugarCharcoal; - public static Item itemCactusCoke; - public static Item itemSugarCoke; - - public static Item itemCircuitLFTR; - public static Item itemBasicTurbine; - - public static Item itemDebugAreaClear; - - public static Item itemGemShards; - public static Item itemHalfCompleteCasings; - - public static Item itemSulfuricPotion; - public static Item itemHydrofluoricPotion; - - public static Item itemModularBauble; - public static Item itemCustomBook; - - public static Item itemGrindleTablet; - public static Item itemRope; - public static Item itemFiber; - public static Item itemDragonJar; - - //Unstable Elements & Related Content - public static Item dustNeptunium238; - public static Item dustDecayedRadium226; - public static Item dustRadium226; - public static Item dustProtactinium233; - - public static ItemGiantEgg itemBigEgg; - - public static GregtechPump toolGregtechPump; - - public static ItemGenericToken itemGenericToken; - - public static Item itemControlCore; - - public static ItemStack itemHotTitaniumIngot; - - public static Fluid fluidZrF4; - - public static Item boxTools; - public static Item boxFood; - public static Item boxMagic; - - public static DustDecayable dustMolybdenum99; - public static DustDecayable dustTechnetium99; - public static DustDecayable dustTechnetium99M; - - public static IonParticles itemIonParticleBase; - public static StandardBaseParticles itemStandarParticleBase; - - public static BatteryPackBaseBauble itemChargePack_Low_1; - public static BatteryPackBaseBauble itemChargePack_Low_2; - public static BatteryPackBaseBauble itemChargePack_Low_3; - public static BatteryPackBaseBauble itemChargePack_Low_4; - public static BatteryPackBaseBauble itemChargePack_Low_5; - public static BatteryPackBaseBauble itemChargePack_High_1; - public static BatteryPackBaseBauble itemChargePack_High_2; - public static BatteryPackBaseBauble itemChargePack_High_3; - public static BatteryPackBaseBauble itemChargePack_High_4; - - public static DebugScanner itemDebugScanner; - - public static ItemDummyResearch itemDummyResearch; - - public static CoreItem itemBombCasing; - public static CoreItem itemBombUnf; - public static CoreItem itemDetCable; - public static ItemThrowableBomb itemBomb; - - public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Zombie; - public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Skeleton; - public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Spider; - public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Creeper; - public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Enderman; - - public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Nether; - public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Infernal; - - public static CoreItem itemExquisiteIndustrialDiamond; - - public static BaseItemMetaFood itemMetaFood; - - static { - Logger.INFO("Items!"); - //Default item used when recipes fail, handy for debugging. Let's make sure they exist when this class is called upon. - AAA_Broken = new BaseItemIngot_OLD("AAA_Broken", "Errors - Tell Alkalus", Utils.rgbtoHexValue(128, 128, 128), 0); - ZZZ_Empty = new ItemEmpty(); - } - - public static final void init(){ - - itemDebugScanner = new DebugScanner(); - - itemAlkalusDisk = new BaseItemDamageable("itemAlkalusDisk", AddToCreativeTab.tabMisc, 1, 0, "Unknown Use", EnumRarity.rare, EnumChatFormatting.AQUA, false, null); - itemBigEgg = new ItemGiantEgg(); - itemGenericToken = new ItemGenericToken(); - itemDummyResearch = new ItemDummyResearch(); - itemCustomSpawnEgg = new ItemCustomSpawnEgg(); - - //Debug Loading - if (CORE_Preloader.DEBUG_MODE){ - DEBUG_INIT.registerItems(); - } - - itemDebugAreaClear = new ItemAreaClear(); - - //Register meta item, because we need them for everything. - MetaGeneratedGregtechItems.INSTANCE.generateMetaItems(); - - //Some Simple forms of materials - itemStickyRubber = new Item().setUnlocalizedName("itemStickyRubber").setCreativeTab(tabMachines).setTextureName(CORE.MODID + ":itemStickyRubber"); - GameRegistry.registerItem(itemStickyRubber, "itemStickyRubber"); - GT_OreDictUnificator.registerOre("ingotRubber", ItemUtils.getItemStackFromFQRN(CORE.MODID+":itemStickyRubber", 1)); - - //Register Hydrogen Blobs first, so we can replace old helium blobs. - itemHydrogenBlob = new CoreItem("itemHydrogenBlob", "Mysterious Hydrogen Blob", tabMisc).setTextureName(CORE.MODID + ":itemHeliumBlob"); - //Register Old Helium Blob, this will be replaced when held by a player. - itemHeliumBlob = new CoreItem("itemHeliumBlob", tabMisc, ItemUtils.getSimpleStack(itemHydrogenBlob)).setTextureName(CORE.MODID + ":itemHydrogenBlob"); - - //Register this neato device, for making some fires. - itemBasicFireMaker = new ItemBasicFirestarter(); - - //Register Rope - itemFiber = new CoreItem("itemFiber", "Plant Fiber", tabMisc); - itemRope = new CoreItem("itemRope", "Rope", tabMisc); - - //Load Wearable Items - WearableLoader.run(); - - //Make some backpacks - //Primary colours - backpack_Red = new BaseItemBackpack("backpackRed", Utils.rgbtoHexValue(200, 0, 0)); - backpack_Green = new BaseItemBackpack("backpackGreen", Utils.rgbtoHexValue(0, 200, 0)); - backpack_Blue = new BaseItemBackpack("backpackBlue", Utils.rgbtoHexValue(0, 0, 200)); - //Secondary Colours - backpack_Yellow = new BaseItemBackpack("backpackYellow", Utils.rgbtoHexValue(200, 200, 0)); - backpack_Purple = new BaseItemBackpack("backpackPurple", Utils.rgbtoHexValue(200, 0, 200)); - backpack_Cyan = new BaseItemBackpack("backpackCyan", Utils.rgbtoHexValue(0, 200, 200)); - //Tertiary Colours - backpack_Maroon = new BaseItemBackpack("backpackMaroon", Utils.rgbtoHexValue(128, 0, 0)); - backpack_Olive = new BaseItemBackpack("backpackOlive", Utils.rgbtoHexValue(128, 128, 0)); - backpack_DarkGreen = new BaseItemBackpack("backpackDarkGreen", Utils.rgbtoHexValue(0, 128, 0)); - backpack_DarkPurple = new BaseItemBackpack("backpackDarkPurple", Utils.rgbtoHexValue(128, 0, 128)); - backpack_Teal = new BaseItemBackpack("backpackTeal", Utils.rgbtoHexValue(0, 128, 128)); - backpack_Navy = new BaseItemBackpack("backpackNavy", Utils.rgbtoHexValue(0, 0, 128)); - //Shades - backpack_Silver = new BaseItemBackpack("backpackSilver", Utils.rgbtoHexValue(192, 192, 192)); - backpack_Gray = new BaseItemBackpack("backpackGray", Utils.rgbtoHexValue(128, 128, 128)); - backpack_Black = new BaseItemBackpack("backpackBlack", Utils.rgbtoHexValue(20, 20, 20)); - backpack_White = new BaseItemBackpack("backpackWhite", Utils.rgbtoHexValue(240, 240, 240)); - - - //Load Custom Box/bags - boxTools = new UniversalToolBox("Tool Box"); - boxFood = new AutoLunchBox("Eatotron-9000"); - boxMagic = new MagicToolBag("Mystic Bag"); - - itemBlueprintBase = new ItemBlueprint("itemBlueprint"); - - itemGemShards = new ItemGemShards("itemGemShards", "Gem Shards", AddToCreativeTab.tabMisc, 32, 0, "They glitter in the light", EnumRarity.rare, EnumChatFormatting.GRAY, false, Utils.rgbtoHexValue(182, 114, 18)).setTextureName(CORE.MODID + ":itemHeliumBlob"); - itemHalfCompleteCasings = new ItemHalfCompleteCasings("itemHalfCompleteCasings", AddToCreativeTab.tabMisc, 32, 0, "This isn't quite finished yet.", EnumRarity.common, EnumChatFormatting.GRAY, false, Utils.rgbtoHexValue(255, 255, 255)).setTextureName("gregtech" + ":" + "gt.metaitem.01/" + "761"); - itemSulfuricPotion = new ItemSulfuricAcidPotion("itemSulfuricPotion", "Throwable Vial of Sulfuric Acid", "Burn your foes alive!").setTextureName(CORE.MODID + ":itemSulfuricAcidPotion"); - itemHydrofluoricPotion = new ItemHydrofluoricAcidPotion("itemHydrofluoricPotion", "Throwable Vial of Hydrofluoric Acid", "They won't see this coming, nor anything after!").setTextureName(CORE.MODID + ":itemPotion"); - //Start meta Item Generation - ItemsFoods.load(); - - - try{ - - /** - * Try generate dusts for missing rare earth materials if they don't exist - */ - - if (!ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustGadolinium", 1))){ - ItemUtils.generateSpecialUseDusts("Gadolinium", "Gadolinium", Materials.Gadolinium.mElement.name(), Utils.rgbtoHexValue(226, 172, 9)); - } - if (!ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustYtterbium", 1))){ - ItemUtils.generateSpecialUseDusts("Ytterbium", "Ytterbium", Materials.Ytterbium.mElement.name(), Utils.rgbtoHexValue(Materials.Yttrium.mRGBa[0]-60, Materials.Yttrium.mRGBa[1]-60, Materials.Yttrium.mRGBa[2]-60)); - } - if (!ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustSamarium", 1))){ - ItemUtils.generateSpecialUseDusts("Samarium", "Samarium", Materials.Samarium.mElement.name(), Utils.rgbtoHexValue(161, 168, 114)); - } - if (!ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustLanthanum", 1))){ - ItemUtils.generateSpecialUseDusts("Lanthanum", "Lanthanum", Materials.Lanthanum.mElement.name(), Utils.rgbtoHexValue(106, 127, 163)); - } - if (!ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustGermanium", 1))){ - ItemUtils.generateSpecialUseDusts("Germanium", "Germanium", "Ge", ELEMENT.getInstance().GERMANIUM.getRgbAsHex()); - } - - - //Elements generate first so they can be used in compounds. - //Missing Elements - MaterialGenerator.generate(ELEMENT.getInstance().SELENIUM); //LFTR byproduct - MaterialGenerator.generate(ELEMENT.getInstance().BROMINE); - MaterialGenerator.generate(ELEMENT.getInstance().KRYPTON); //LFTR byproduct - MaterialGenerator.generate(ELEMENT.getInstance().STRONTIUM); - MaterialGenerator.generate(ELEMENT.getInstance().ZIRCONIUM); - MaterialGenerator.generate(ELEMENT.getInstance().RUTHENIUM); - MaterialGenerator.generate(ELEMENT.getInstance().IODINE); //LFTR byproduct - MaterialGenerator.generate(ELEMENT.getInstance().HAFNIUM); - MaterialGenerator.generate(ELEMENT.getInstance().DYSPROSIUM); - MaterialGenerator.generate(ELEMENT.getInstance().ERBIUM); - MaterialGenerator.generate(ELEMENT.getInstance().PRASEODYMIUM); - MaterialGenerator.generate(ELEMENT.getInstance().TELLURIUM); //LFTR byproduct - MaterialGenerator.generate(ELEMENT.getInstance().RHODIUM); - MaterialGenerator.generate(ELEMENT.getInstance().RHENIUM); - MaterialGenerator.generate(ELEMENT.getInstance().THALLIUM); - - //RADIOACTIVE ELEMENTS - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().TECHNETIUM, false); //LFTR byproduct - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().POLONIUM, false); - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().ASTATINE, false); - //MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().RADON, false); - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().FRANCIUM, false); - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().RADIUM, false); - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().PROMETHIUM, false); - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().ACTINIUM, false); - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().PROTACTINIUM, false); - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().NEPTUNIUM, false); //LFTR byproduct - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().CURIUM, false); - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().BERKELIUM, false); - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().CALIFORNIUM, false); - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().EINSTEINIUM, false); - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().FERMIUM, false); - - - //Nuclear Isotopes - - //Lithium-7 is used as a part of the molten lithium fluoride in molten salt reactors: liquid-fluoride nuclear reactors. - //The large neutron-absorption cross-section of lithium-6 (about 940 barns[5]) as compared with the very small - //neutron cross-section of lithium-7 (about 45 millibarns) makes high separation of lithium-7 from natural lithium a - //strong requirement for the possible use in lithium fluoride reactors. - MaterialGenerator.generate(ELEMENT.getInstance().LITHIUM7, false); - //Thorium-232 is the most stable isotope of Thorium, purified for nuclear fuel use in this case. - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().THORIUM232); - //Production of 233U (through the neutron irradiation of 232Th) invariably produces small amounts of 232U as an impurity - //because of parasitic (n,2n) reactions on uranium-233 itself, or on protactinium-233, or on thorium-232: - MaterialGenerator.generate(ELEMENT.getInstance().URANIUM232); - //Uranium-233 is a fissile isotope of uranium that is bred from thorium-232 as part of the thorium fuel cycle. - MaterialGenerator.generate(ELEMENT.getInstance().URANIUM233); - //Plutonium-238 is a very powerful alpha emitter. This makes the plutonium-238 isotope suitable for usage in radioisotope thermoelectric generators (RTGs) - //and radioisotope heater units - one gram of plutonium-238 generates approximately 0.5 W of thermal power. - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().PLUTONIUM238, false); - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustPlutonium239", 1) == null || Utils.getGregtechVersionAsInt() < 50931) { - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().PLUTONIUM239, false); - } - - //RTG Fuel Materials - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().STRONTIUM90, false); - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().POLONIUM210, false); - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().AMERICIUM241, false); - - if (!CORE.GTNH) { - MaterialGenerator.generateOreMaterialWithAllExcessComponents(ELEMENT.getInstance().TRINIUM); - } - - //Custom Materials that will have standalone refinery processes - MaterialGenerator.generate(ELEMENT.STANDALONE.ADVANCED_NITINOL, false); - MaterialGenerator.generate(ELEMENT.STANDALONE.ASTRAL_TITANIUM); - MaterialGenerator.generate(ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN); - MaterialGenerator.generate(ELEMENT.STANDALONE.HYPOGEN); - MaterialGenerator.generate(ELEMENT.STANDALONE.CHRONOMATIC_GLASS); - - //Custom Materials that are from Runescape - MaterialGenerator.generate(ELEMENT.STANDALONE.BLACK_METAL); - MaterialGenerator.generate(ELEMENT.STANDALONE.WHITE_METAL); - MaterialGenerator.generateOreMaterialWithAllExcessComponents(ELEMENT.STANDALONE.GRANITE); - MaterialGenerator.generateOreMaterialWithAllExcessComponents(ELEMENT.STANDALONE.RUNITE); - MaterialGenerator.generate(ELEMENT.STANDALONE.DRAGON_METAL, false); - - MISC_MATERIALS.run(); - - - //Carbides - Tungsten Carbide exists in .09 so don't generate it. - Should still come before alloys though - if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - MaterialGenerator.generate(ALLOY.TUNGSTEN_CARBIDE); - } - MaterialGenerator.generate(ALLOY.SILICON_CARBIDE); - MaterialGenerator.generate(ALLOY.ZIRCONIUM_CARBIDE); - MaterialGenerator.generate(ALLOY.TANTALUM_CARBIDE); - MaterialGenerator.generate(ALLOY.NIOBIUM_CARBIDE); - MaterialGenerator.generate(ALLOY.TUNGSTEN_TITANIUM_CARBIDE); - - //LFTR Fuel components - //MaterialGenerator.generate(MISC_MATERIALS.HYDROXIDE); //LFTR fuel component - //MaterialGenerator.generate(MISC_MATERIALS.AMMONIA); //LFTR fuel component - //MaterialGenerator.generate(MISC_MATERIALS.AMMONIUM); //LFTR fuel component - MaterialGenerator.generateNuclearDusts(FLUORIDES.AMMONIUM_BIFLUORIDE); //LFTR fuel component - MaterialGenerator.generateNuclearDusts(FLUORIDES.BERYLLIUM_HYDROXIDE); //LFTR fuel component - MaterialGenerator.generateNuclearDusts(FLUORIDES.AMMONIUM_TETRAFLUOROBERYLLATE); //LFTR fuel component - - //Generate Fluorides - MaterialGenerator.generateNuclearDusts(FLUORIDES.BERYLLIUM_FLUORIDE); - MaterialGenerator.generateNuclearDusts(FLUORIDES.LITHIUM_FLUORIDE); - MaterialGenerator.generateNuclearDusts(FLUORIDES.THORIUM_TETRAFLUORIDE); - MaterialGenerator.generateNuclearDusts(FLUORIDES.THORIUM_HEXAFLUORIDE); - MaterialGenerator.generateNuclearDusts(FLUORIDES.URANIUM_TETRAFLUORIDE, false); - MaterialGenerator.generateNuclearDusts(FLUORIDES.URANIUM_HEXAFLUORIDE, false); - MaterialGenerator.generateNuclearDusts(FLUORIDES.ZIRCONIUM_TETRAFLUORIDE); - //LFTR Fluoride outputs - MaterialGenerator.generateNuclearDusts(FLUORIDES.NEPTUNIUM_HEXAFLUORIDE); - MaterialGenerator.generateNuclearDusts(FLUORIDES.TECHNETIUM_HEXAFLUORIDE); - MaterialGenerator.generateNuclearDusts(FLUORIDES.SELENIUM_HEXAFLUORIDE); - - //Generate Reactor Fuel Salts - MaterialGenerator.generateNuclearDusts(NUCLIDE.LiFBeF2ZrF4U235); - MaterialGenerator.generateNuclearDusts(NUCLIDE.LiFBeF2ZrF4UF4); - MaterialGenerator.generateNuclearDusts(NUCLIDE.LiFBeF2ThF4UF4); - //MaterialGenerator.generateNuclearMaterial(NUCLIDE.Li2BeF4, false); - - //Generate some Alloys - - //Misc Alloys - MaterialGenerator.generate(ALLOY.ENERGYCRYSTAL); - MaterialGenerator.generate(ALLOY.BLOODSTEEL); - - MaterialGenerator.generate(ALLOY.ZERON_100); - //Tumbaga was the name given by Spaniards to a non-specific alloy of gold and copper - MaterialGenerator.generate(ALLOY.TUMBAGA); - //Potin is traditionally an alloy of bronze, tin and lead, with varying quantities of each possible - MaterialGenerator.generate(ALLOY.POTIN); - - //Staballoy & Tantalloy - MaterialGenerator.generate(ALLOY.STABALLOY); - MaterialGenerator.generate(ALLOY.TANTALLOY_60); - MaterialGenerator.generate(ALLOY.TANTALLOY_61); - - //Inconel - MaterialGenerator.generate(ALLOY.INCONEL_625); - MaterialGenerator.generate(ALLOY.INCONEL_690); - MaterialGenerator.generate(ALLOY.INCONEL_792); - - - //Steels - MaterialGenerator.generateDusts(ALLOY.EGLIN_STEEL_BASE); - MaterialGenerator.generate(ALLOY.EGLIN_STEEL); - MaterialGenerator.generate(ALLOY.MARAGING250); - MaterialGenerator.generate(ALLOY.MARAGING300); - MaterialGenerator.generate(ALLOY.MARAGING350); - MaterialGenerator.generate(ALLOY.AQUATIC_STEEL); - - MaterialGenerator.generate(ALLOY.NITINOL_60,true,false); - - //Composite Alloys - MaterialGenerator.generate(ALLOY.STELLITE); - MaterialGenerator.generate(ALLOY.TALONITE); - - //Hastelloy - MaterialGenerator.generate(ALLOY.HASTELLOY_W); - MaterialGenerator.generate(ALLOY.HASTELLOY_X); - MaterialGenerator.generate(ALLOY.HASTELLOY_C276); - MaterialGenerator.generate(ALLOY.HASTELLOY_N); - - //Incoloy - MaterialGenerator.generate(ALLOY.INCOLOY_020); - MaterialGenerator.generate(ALLOY.INCOLOY_DS); - MaterialGenerator.generate(ALLOY.INCOLOY_MA956); - - //Leagrisium - MaterialGenerator.generate(ALLOY.LEAGRISIUM); - - //Super Conductor - MaterialGenerator.generate(ALLOY.HG1223, false, false); - - //Generate Fictional Materials - if (!CORE.GTNH) { - MaterialGenerator.generate(ELEMENT.getInstance().TRINIUM, false); - MaterialGenerator.generate(ELEMENT.getInstance().TRINIUM_REFINED, false); - } - MaterialGenerator.generate(ALLOY.TRINIUM_TITANIUM); - MaterialGenerator.generate(ALLOY.TRINIUM_NAQUADAH, false); - MaterialGenerator.generate(ALLOY.TRINIUM_NAQUADAH_CARBON); - MaterialGenerator.generate(ALLOY.TRINIUM_REINFORCED_STEEL); - - //Top Tier Alloys - MaterialGenerator.generate(ALLOY.HELICOPTER); - MaterialGenerator.generate(ALLOY.LAFIUM); - MaterialGenerator.generate(ALLOY.CINOBITE); - MaterialGenerator.generate(ALLOY.PIKYONIUM); - MaterialGenerator.generate(ALLOY.ABYSSAL); - MaterialGenerator.generate(ALLOY.LAURENIUM); - MaterialGenerator.generate(ALLOY.BOTMIUM); - MaterialGenerator.generate(ALLOY.HS188A); - - - MaterialGenerator.generate(ALLOY.TITANSTEEL); - MaterialGenerator.generate(ALLOY.ARCANITE); - MaterialGenerator.generate(ALLOY.OCTIRON); - - MaterialGenerator.generate(ALLOY.BABBIT_ALLOY, false); - MaterialGenerator.generate(ALLOY.BLACK_TITANIUM, false); - - // High Level Bioplastic - MaterialGenerator.generate(ELEMENT.STANDALONE.RHUGNOR, false, false); - - - - - - - - - //Must be the final Alloy to Generate - MaterialGenerator.generate(ALLOY.QUANTUM); - - //Ores - MaterialGenerator.generateOreMaterial(FLUORIDES.FLUORITE); - MaterialGenerator.generateOreMaterial(ALLOY.KOBOLDITE); - GTplusplus_Everglades.GenerateOreMaterials(); - - - } catch (final Throwable r){ - Logger.INFO("Failed to Generated a Material. "+r.getMessage()); - //Utils.LOG_INFO("Failed to Generated a Material. "+r.getCause().getMessage()); - //Utils.LOG_INFO("Failed to Generated a Material. "+r.getStackTrace()[0].getMethodName()); - //Utils.LOG_INFO("Failed to Generated a Material. "+r.getStackTrace()[1].getMethodName()); - r.printStackTrace(); - //System.exit(1); - } - - //TC Style Shards, for use in making energy crystal mix. - //A dull shard, able to be infused with an element. - shardDull = new BaseItemTCShard("Drained", Utils.rgbtoHexValue(75, 75, 75), "Can be infused to create a magical shard.", "Obtained from Mining Stone/SandStone, Chopping Logs or Shovelling Dirt."); - - //Generates four elemental shards when TC is not installed. - if (!LoadedMods.Thaumcraft){ - shardAer = new BaseItemTCShard("Aer", Utils.rgbtoHexValue(225, 225, 5)); - shardIgnis = new BaseItemTCShard("Ignis", Utils.rgbtoHexValue(255, 5, 5)); - shardTerra = new BaseItemTCShard("Terra", Utils.rgbtoHexValue(5, 255, 5)); - shardAqua = new BaseItemTCShard("Aqua", Utils.rgbtoHexValue(5, 5, 255)); - } - else { - shardAer = ItemUtils.getItemStackWithMeta(LoadedMods.Thaumcraft, "Thaumcraft:ItemShard", "Air Shard", 0, 1).getItem(); - shardIgnis = ItemUtils.getItemStackWithMeta(LoadedMods.Thaumcraft, "Thaumcraft:ItemShard", "Fire Shard", 1, 1).getItem(); - shardAqua = ItemUtils.getItemStackWithMeta(LoadedMods.Thaumcraft, "Thaumcraft:ItemShard", "Warer Shard", 2, 1).getItem(); - shardTerra = ItemUtils.getItemStackWithMeta(LoadedMods.Thaumcraft, "Thaumcraft:ItemShard", "Earth Shard", 3, 1).getItem(); - } - //Generates a set of four special dusts to be used in my recipes. - dustAer = ItemUtils.generateSpecialUseDusts(ELEMENT.getInstance().AER, true)[0]; - dustIgnis = ItemUtils.generateSpecialUseDusts(ELEMENT.getInstance().IGNIS, true)[0]; - dustTerra = ItemUtils.generateSpecialUseDusts(ELEMENT.getInstance().TERRA, true)[0]; - dustAqua = ItemUtils.generateSpecialUseDusts(ELEMENT.getInstance().AQUA, true)[0]; - - //Nuclear Fuel Dusts - dustLithiumCarbonate = ItemUtils.generateSpecialUseDusts("LithiumCarbonate", "Lithium Carbonate", "Li2CO3", Utils.rgbtoHexValue(240, 240, 240))[0]; //https://en.wikipedia.org/wiki/Lithium_carbonate - dustLithiumPeroxide = ItemUtils.generateSpecialUseDusts("LithiumPeroxide", "Lithium Peroxide", "Li2O2", Utils.rgbtoHexValue(250, 250, 250))[0]; //https://en.wikipedia.org/wiki/Lithium_peroxide - dustLithiumHydroxide = ItemUtils.generateSpecialUseDusts("LithiumHydroxide", "Lithium Hydroxide", "LiOH", Utils.rgbtoHexValue(250, 250, 250))[0]; //https://en.wikipedia.org/wiki/Lithium_hydroxide - - if (!ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 1)) && !LoadedMods.IHL){ - dustQuicklime = ItemUtils.generateSpecialUseDusts("Quicklime", "Quicklime", "CaO", Utils.rgbtoHexValue(255, 255, 175))[0]; //https://en.wikipedia.org/wiki/Calcium_oxide - } - dustCalciumHydroxide = ItemUtils.generateSpecialUseDusts("CalciumHydroxide", "Hydrated Lime", "Ca(OH)2", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/Calcium_hydroxide - dustCalciumCarbonate = ItemUtils.generateSpecialUseDusts("CalciumCarbonate", "Calcium Carbonate", "CaCO3", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/Calcium_carbonate - if ((ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustGypsum", 1) == null) || (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustCalciumSulfate", 1) == null)){ - dustCalciumSulfate = ItemUtils.generateSpecialUseDusts("Gypsum", "Calcium Sulfate (Gypsum)", "CaSO4", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/Calcium_sulfate - GT_OreDictUnificator.registerOre("dustCalciumSulfate", ItemUtils.getSimpleStack(dustCalciumSulfate)); - } - else { - GT_OreDictUnificator.registerOre("dustCalciumSulfate", ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustGypsum", 1)); - } - dustLi2CO3CaOH2 = ItemUtils.generateSpecialUseDusts("Li2CO3CaOH2", "Li2CO3 + Ca(OH)2 Compound", "Li2CO3CaOH2", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/Calcium_carbonate - MaterialUtils.generateSpecialDustAndAssignToAMaterial(FLUORIDES.SODIUM_FLUORIDE, false); - //FLiBe Fuel Compounds - dustLi2BeF4 = ItemUtils.generateSpecialUseDusts("Li2BeF4", "Lithium Tetrafluoroberyllate Fuel Compound", "Li2BeF4", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/FLiBe - Material.registerComponentForMaterial(NUCLIDE.Li2BeF4, OrePrefixes.dust, ItemUtils.getSimpleStack(dustLi2BeF4)); - //fluidFLiBeSalt = ("Li2BeF4", "Li2BeF4", 7430, new short[]{255, 255, 255, 100}, 0); - //fluidFLiBeSalt = FluidUtils.addGTFluidNoPrefix("Li2BeF4", "Lithium Tetrafluoroberyllate", new short[]{255, 255, 255, 100}, 0, 743, null, CI.emptyCells(1), 1000, true); - //fluidFLiBeSaltBurnt = FluidUtils.addGTFluidNoPrefix("Li2BeF2UF4", "Li2BeF2UF4", new short[]{50, 255, 50, 100}, 0, 743, null, CI.emptyCells(1), 1000, true); - - // LFTR Core Fluid Processing - //fluidLftrCore1 = FluidUtils.addGTFluidNoPrefix("LiBeF2UF4FP", "LiBeF2UF4FP", new short[]{110, 255, 110, 100}, 0, 800, null, CI.emptyCells(1), 1000, true); - //fluidLftrCore2 = FluidUtils.addGTFluidNoPrefix("UF6F2FP", "UF6F2FP", new short[]{150, 255, 150, 100}, 0, 800, null, CI.emptyCells(1), 1000, true); - //fluidLftrCore3 = FluidUtils.addGTFluidNoPrefix("LiFBeF2", "LiFBeF2", new short[]{100, 255, 50, 100}, 0, 800, null, CI.emptyCells(1), 1000, true); - //fluidLftrCore4 = FluidUtils.addGTFluidNoPrefix("LiFBeF2UF4", "LiFBeF2UF4", new short[]{50, 255, 100, 100}, 0, 800, null, CI.emptyCells(1), 1000, true); - // LFTR Blanket Fluid Processing - //fluidLftrBlanket1 = FluidUtils.addGTFluidNoPrefix("LiFThF4", "LiFThF4", new short[]{50, 150, 255, 50}, 0, 500, null, CI.emptyCells(1), 1000, true); - //fluidLftrBlanket2 = FluidUtils.addGTFluidNoPrefix("LiFBeF2ThF4", "LiFBeF2ThF4", new short[]{100, 150, 100, 100}, 0, 500, null, CI.emptyCells(1), 1000, true); - //fluidLftrBlanket3 = FluidUtils.addGTFluidNoPrefix("UF6F2", "UF6F2", new short[]{10, 150, 10, 100}, 0, 500, null, CI.emptyCells(1), 1000, true); - fluidNuclearWaste = FluidUtils.addGTFluidNoPrefix("nuclear.waste", "Nuclear Waste", new short[]{10, 250, 10, 100}, 0, 1000, null, CI.emptyCells(1), 1000, true); - - - //LFTR Control Circuit - itemCircuitLFTR = new CoreItem("itemCircuitLFTR", ""+EnumChatFormatting.GREEN+"Control Circuit", AddToCreativeTab.tabMisc, 1, 0, new String[] {"Keeps Multiblocks Stable"}, EnumRarity.epic, EnumChatFormatting.DARK_GREEN, false, null); - - if (CORE.ConfigSwitches.enableMachine_Pollution) { - itemBasicTurbine = new ItemBasicScrubberTurbine(); - } - - //Zirconium - //Cinter Pellet. - itemZirconiumChlorideCinterPellet = new CoreItem("itemZirconiumPellet", "Zirconium Pellet ["+StringUtils.subscript("ZrCl4")+"]", tabMisc).setTextureName(CORE.MODID + ":itemShard"); - GT_OreDictUnificator.registerOre("pelletZirconium", new ItemStack(itemZirconiumChlorideCinterPellet)); - //Zirconium Chloride - dustZrCl4 = ItemUtils.generateSpecialUseDusts("ZrCl4", "ZrCl4", "ZrCl4", Utils.rgbtoHexValue(180, 180, 180))[0]; //http://www.iaea.org/inis/collection/NCLCollectionStore/_Public/39/036/39036750.pdf - dustCookedZrCl4 = ItemUtils.generateSpecialUseDusts("CookedZrCl4", "Cooked ZrCl4", "ZrCl4", Utils.rgbtoHexValue(180, 180, 180))[0]; //http://www.iaea.org/inis/collection/NCLCollectionStore/_Public/39/036/39036750.pdf - - //Zirconium Tetrafluoride - /*GT_OreDictUnificator.registerOre("cellZrF4", ItemUtils.getItemStackOfAmountFromOreDict("cellZirconiumTetrafluoride", 1)); - GT_OreDictUnificator.registerOre("dustZrF4", ItemUtils.getItemStackOfAmountFromOreDict("dustZirconiumTetrafluoride", 1));*/ - //GT_OreDictUnificator.registerOre("cellZrF4", ItemUtils.getItemStackOfAmountFromOreDict("cellZirconiumTetrafluoride", 1)); - //GT_OreDictUnificator.registerOre("dustZrF4", ItemUtils.getItemStackOfAmountFromOreDict("dustZirconiumTetrafluoride", 1)); - fluidZrF4 = FluidUtils.generateFluidNoPrefix("ZirconiumTetrafluoride", "Zirconium Tetrafluoride", 500, new short[]{170, 170, 140, 100}); //https://en.wikipedia.org/wiki/Zirconium_tetrafluoride - FLUORIDES.ZIRCONIUM_TETRAFLUORIDE.setFluid(fluidZrF4); - - //Coolant Salt - //NaBF4 - NaF - 621C - //dustNaBF4NaF = ItemUtils.generateSpecialUseDusts("NaBF4NaF", "NaBF4NaF", Utils.rgbtoHexValue(45, 45, 90))[0]; //https://en.wikipedia.org/wiki/Zirconium_tetrafluoride - - - //Load Tree Farmer - if (CORE.ConfigSwitches.enableMultiblock_TreeFarmer){ //https://en.wikipedia.org/wiki/UAN - dustFertUN18 = ItemUtils.generateSpecialUseDusts("UN18Fertiliser", "UN-18 Fertiliser", Utils.rgbtoHexValue(60, 155, 60))[0]; - dustFertUN32 = ItemUtils.generateSpecialUseDusts("UN32Fertiliser", "UN-32 Fertiliser", Utils.rgbtoHexValue(55, 190, 55))[0]; - - ItemStack temp1 = null; - ItemStack temp2 = null; - - if (LoadedMods.IndustrialCraft2){ - temp1 = ItemUtils.getCorrectStacktype("IC2:itemFertilizer", 1); - } - if (LoadedMods.Forestry){ - temp2 = ItemUtils.getCorrectStacktype("Forestry:fertilizerCompound", 1); - } - if (temp1 != null){ - FluidUtils.generateFluidNonMolten("Fertiliser", "Fertiliser", 32, new short[]{45, 170, 45, 100}, temp1, temp2, true); - } - FluidUtils.generateFluidNonMolten("UN32Fertiliser", "UN-32 Fertiliser", 24, new short[]{55, 190, 55, 100}, null, null, true); - FluidUtils.generateFluidNonMolten("UN18Fertiliser", "UN-18 Fertiliser", 22, new short[]{60, 155, 60, 100}, null, null, true); - - /*GT_Values.RA.addMixerRecipe( - arg0, //Item In - arg1, - arg2, - arg3, - arg4, //Fluid in - arg5, //Fluid Out - arg6, //Item out - arg7, //Eu - arg8); //Time - */ - - } - - //Juice - FluidUtils.generateFluidNonMolten("RaisinJuice", "Raisin Juice", 2, new short[]{51, 0, 51, 100}, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foodRaisins", 1), ItemUtils.getItemStackOfAmountFromOreDictNoBroken("fruitRaisins", 1), 50, true); - - - //Test items - metaItem2 = new BaseEuItem(); - metaItem2.registerItem(0, EnumChatFormatting.BLACK+"Test Item 0", 0, 0, "I am 0."); - metaItem2.registerItem(1, EnumChatFormatting.GREEN+"Test Item 1", 1006346000, 1, "I Hold EU 1.", 500); - metaItem2.registerItem(2, EnumChatFormatting.GOLD+"Test Item 2", 1004630000, 2, "I Hold EU 2.", 8000); - metaItem2.registerItem(3, "Test Item 3", 1000765000, 4, "I Hold EU 3.", 32000); - metaItem2.registerItem(4, "Whirlygig", 1043644000, (short) 5, "Spin me right round.", EnumRarity.rare, EnumChatFormatting.DARK_GREEN, true); - metaItem2.registerItem(5, "Whirlygig 2", 2124867000, (short) 7, "Spin me right round.", EnumRarity.uncommon, EnumChatFormatting.RED, true); - - toolGregtechPump = new GregtechPump(); - toolGregtechPump.registerPumpType(0, "Simple Hand Pump", 0, 0); - toolGregtechPump.registerPumpType(1, "Advanced Hand Pump", 32000, 1); - toolGregtechPump.registerPumpType(2, "Super Hand Pump", 128000, 2); - toolGregtechPump.registerPumpType(3, "Ultimate Hand Pump", 512000, 3); - - //Create Multi-tools - //ItemsMultiTools.load(); - - //Xp Fluids - Dev - if (!FluidRegistry.isFluidRegistered("mobessence")){ - FluidUtils.generateFluidNoPrefix("mobessence", "mobessence", 0, new short[]{125, 175, 125, 100}); - } - if (!FluidRegistry.isFluidRegistered("xpjuice")){ - FluidUtils.generateFluidNoPrefix("xpjuice", "xpjuice", 0, new short[]{50, 150, 50, 100}); - } - - //Just an unusual plate needed for some black magic. - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateClay", 1) == null){ - itemPlateClay = new BaseItemPlate(NONMATERIAL.CLAY); - } - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateDoubleClay", 1) == null){ - itemDoublePlateClay = new BaseItemPlateDouble(NONMATERIAL.CLAY); - } - - //Need this for Mutagenic Frames - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foilUranium235", 1) == null){ - itemFoilUranium235 = new BaseItemFoil(ELEMENT.getInstance().URANIUM235); - } - - //A small gear needed for wizardry. - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("gearGtSmallWroughtIron", 1) == null){ - itemSmallWroughtIronGear = new BaseItemSmallGear(NONMATERIAL.WROUGHT_IRON); - } - //Krypton Processing - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotHotTitanium", 1) == null){ - itemHotTitaniumIngot = ItemUtils.getSimpleStack(new BaseItemIngot(ELEMENT.getInstance().TITANIUM, ComponentTypes.HOTINGOT)); - } - else { - itemHotTitaniumIngot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotHotTitanium", 1); - } - - //Need this for Laurenium - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustIndium", 1) == null){ - itemDustIndium = new BaseItemDust(ELEMENT.getInstance().INDIUM); - } - - //Industrial Diamonds - itemExquisiteIndustrialDiamond = new CoreItem("IndustrialDiamondExquisite", "High Quality Industrial Diamond", tabMisc); - ItemStack tempStack = itemExquisiteIndustrialDiamond.getStack(); - ItemUtils.addItemToOreDictionary(tempStack, "gemDiamond"); - ItemUtils.addItemToOreDictionary(tempStack, "craftingIndustrialDiamond"); - ItemUtils.addItemToOreDictionary(tempStack, "gemExquisiteDiamond"); - ItemUtils.addItemToOreDictionary(tempStack, "craftingExquisiteIndustrialDiamond"); - - //Custom GT++ Crafting Components - - //Springs - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SPRING, ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SPRING, ELEMENT.STANDALONE.WHITE_METAL); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SPRING, ALLOY.NITINOL_60); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SPRING, ALLOY.AQUATIC_STEEL); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SPRING, ALLOY.EGLIN_STEEL); - - //Small Springs - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SMALLSPRING, ALLOY.MARAGING250); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SMALLSPRING, ALLOY.NICHROME); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SMALLSPRING, ALLOY.STABALLOY); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SMALLSPRING, ALLOY.STEEL_BLACK); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SMALLSPRING, ALLOY.BLACK_TITANIUM); - - //Fine Wire - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.FINEWIRE, ELEMENT.STANDALONE.WHITE_METAL); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.FINEWIRE, ELEMENT.getInstance().PALLADIUM); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.FINEWIRE, ELEMENT.getInstance().ZIRCONIUM); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.FINEWIRE, ALLOY.LEAGRISIUM); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.FINEWIRE, ALLOY.BABBIT_ALLOY); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.FINEWIRE, ALLOY.KOBOLDITE); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.FINEWIRE, ALLOY.HG1223); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.FINEWIRE, ALLOY.QUANTUM); - - //Dense Plates - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.POTIN); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.AQUATIC_STEEL); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.BRONZE); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.OSMIRIDIUM); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.QUANTUM); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.STEEL_BLACK); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.STAINLESS_STEEL); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.EGLIN_STEEL); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.MARAGING300); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.TALONITE); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ELEMENT.STANDALONE.HYPOGEN); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ELEMENT.STANDALONE.RHUGNOR); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ELEMENT.STANDALONE.ADVANCED_NITINOL); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ELEMENT.STANDALONE.ASTRAL_TITANIUM); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ELEMENT.STANDALONE.WHITE_METAL); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ELEMENT.STANDALONE.BLACK_METAL); - MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ELEMENT.STANDALONE.GRANITE); - - - - - //Special Sillyness - if (true) { - - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateSodium", 1) == null){ - new BaseItemPlate(ELEMENT.getInstance().SODIUM); - } - - Material meatRaw = NONMATERIAL.MEAT; - // A plate of Meat. - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateMeatRaw", 1) == null){ - itemPlateRawMeat = new BaseItemPlate(meatRaw); - ItemUtils.registerFuel(ItemUtils.getSimpleStack(itemPlateRawMeat), 100); - } - // A Block of Meat. - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("blockMeatRaw", 1) == null){ - blockRawMeat = new BlockBaseModular(meatRaw, BlockTypes.STANDARD); - ItemUtils.registerFuel(ItemUtils.getSimpleStack(blockRawMeat), 900); - } - } - - - // A plate of Vanadium. - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateVanadium", 1) == null){ - itemPlateVanadium = new BaseItemPlate(ELEMENT.getInstance().VANADIUM); - } - - //A plate of Lithium. - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateLithium", 1) == null){ - itemPlateLithium = new BaseItemPlate(ELEMENT.getInstance().LITHIUM); - } - - //A plate of Europium. - if ((ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateEuropium", 1) == null) && CORE.ConfigSwitches.enableCustom_Pipes){ - itemPlateEuropium = new BaseItemPlate(ELEMENT.getInstance().EUROPIUM); - } - if ((ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateDoubleEuropium", 1) == null) && CORE.ConfigSwitches.enableCustom_Pipes){ - itemDoublePlateEuropium = new BaseItemPlateDouble(ELEMENT.getInstance().EUROPIUM); - } - - //Tumbaga Mix (For Simple Crafting) - dustTumbagaMix = ItemUtils.generateSpecialUseDusts("MixTumbaga", "Tumbaga Mix", "Au2Cu", Utils.rgbtoHexValue(255, 150, 80))[0]; - - /* - * Decayable Materials - */ - - dustNeptunium238 = new DustDecayable("dustNeptunium238", Utils.rgbtoHexValue(175, 240, 75), 50640, new String[] {""+StringUtils.superscript("238Np"), "Result: Plutonium 238 ("+StringUtils.superscript("238Pu")+")"}, ELEMENT.getInstance().PLUTONIUM238.getDust(1).getItem(), 5); - dustDecayedRadium226 = ItemUtils.generateSpecialUseDusts("DecayedRadium226", "Decayed Radium-226", "Contains Radon ("+StringUtils.superscript("222Rn")+")", ELEMENT.getInstance().RADIUM.getRgbAsHex())[0]; - dustRadium226 = new DustDecayable("dustRadium226", ELEMENT.getInstance().RADIUM.getRgbAsHex(), 90000, new String[] {""+StringUtils.superscript("226Ra"), "Result: Radon ("+StringUtils.superscript("222Rn")+")"}, ItemUtils.getSimpleStack(dustDecayedRadium226).getItem(), 5); - dustProtactinium233 = new DustDecayable("dustProtactinium233", ELEMENT.getInstance().PROTACTINIUM.getRgbAsHex(), 32000, new String[] {""+StringUtils.superscript("233Pa"), "Result: Uranium 233("+StringUtils.superscript("233U")+")"}, ELEMENT.getInstance().URANIUM233.getDust(1).getItem(), 6); - dustTechnetium99 = new DustDecayable("dustTechnetium99", ELEMENT.getInstance().TECHNETIUM.getRgbAsHex(), 164500, new String[] {""+StringUtils.superscript("99Mo"), "Result: Ruthenium 99("+StringUtils.superscript("99Ru")+")"}, ELEMENT.getInstance().RUTHENIUM.getDust(1).getItem(), 4); - dustTechnetium99M = new DustDecayable("dustTechnetium99M", ELEMENT.getInstance().TECHNETIUM.getRgbAsHex(), 8570, new String[] {""+StringUtils.superscript("99ᵐTc"), "Result: Technicium 99 ("+StringUtils.superscript("99Tc")+")"}, dustTechnetium99, 4); - dustMolybdenum99 = new DustDecayable("dustMolybdenum99", ELEMENT.getInstance().MOLYBDENUM.getRgbAsHex(), 16450, new String[] {""+StringUtils.superscript("99Mo"), "Result: Technicium 99ᵐ ("+StringUtils.superscript("99ᵐTc")+")"}, dustTechnetium99M, 4); - - itemIonParticleBase = new IonParticles(); - itemStandarParticleBase = new StandardBaseParticles(); - - if (Meta_GT_Proxy.sDoesVolumetricFlaskExist) { - Item a8kFlask = VolumetricFlaskHelper.generateNewFlask("Volumetric_Flask_8k", "Large Volumetric Flask", 8000); - Item a64kFlask = VolumetricFlaskHelper.generateNewFlask("Volumetric_Flask_32k", "Gigantic Volumetric Flask", 32000); - GregtechItemList.VOLUMETRIC_FLASK_8k.set(a8kFlask); - GregtechItemList.VOLUMETRIC_FLASK_32k.set(a64kFlask); - } - - itemBoilerChassis = new ItemBoilerChassis(); - itemDehydratorCoilWire = new ItemDehydratorCoilWire(); - itemDehydratorCoil = new ItemDehydratorCoil(); - - itemAirFilter = new ItemAirFilter(); - itemLavaFilter = new ItemLavaFilter(); - - itemGrindleTablet = new BaseItemGrindle(); - itemDragonJar = new ItemEntityCatcher(); - - itemControlCore = new ItemControlCore(); - - //Chemistry - new CoalTar(); - new RocketFuels(); - - //Nuclear Processing - new NuclearChem(); - - //Farm Animal Fun - new AgriculturalChem(); - - //General Chemistry - new GenericChem(); - - // Milled Ore Processing - new MilledOreProcessing(); - - //Bombs - itemBombCasing = new CoreItem("itemBombCasing", "Bomb Casing", tabMisc); - itemBombCasing.setTextureName(CORE.MODID + ":bomb_casing"); - itemBombUnf = new CoreItem("itemBombUnf", "Bomb (unf)", tabMisc); - itemBombUnf.setTextureName(CORE.MODID + ":bomb_casing"); - itemDetCable = new CoreItem("itemDetCable", "Det. Cable", tabMisc); - itemDetCable.setTextureName("string"); - itemBomb = new ItemThrowableBomb(); - - //Only used for debugging. - /*if (CORE.DEVENV) { - new ConnectedBlockFinder(); - }*/ - - //Misc Items - @SuppressWarnings("unused") - Item tI; - tI = new BaseItemMisc("Chilly", new short[]{0,64,196}, 32, MiscTypes.POTION, new String[]{"It's Blue"}); - tI = new BaseItemMisc("4000DC's", new short[]{180,100,30}, 1, MiscTypes.BIGKEY, new String[]{"It opens things."}); - tI = new BaseItemMisc("Dull", new short[]{64,64,64}, 64, MiscTypes.GEM, null); - tI = new BaseItemMisc("Forest", new short[]{130,164,96}, 64, MiscTypes.MUSHROOM, new String[]{"You Found this on the ground.", "Definitely not sure if it's worth eating."}); - - //Baubles - if (LoadedMods.Baubles){ - tI = new HealthBoostBauble(); - itemModularBauble = new ModularBauble(); - } - - //EnderIO Resources - if ((LoadedMods.EnderIO || LOAD_ALL_CONTENT)){ - Logger.INFO("EnderIO Found - Loading Resources."); - //Enderio Dusts - itemDustSoularium = ItemUtils.generateSpecialUseDusts("Soularium", "Soularium", MaterialEIO.SOULARIUM.vChemicalFormula, MaterialEIO.SOULARIUM.getRgbAsHex())[0]; - itemDustRedstoneAlloy = ItemUtils.generateSpecialUseDusts("RedstoneAlloy", "Redstone Alloy", MaterialEIO.REDSTONE_ALLOY.vChemicalFormula, MaterialEIO.REDSTONE_ALLOY.getRgbAsHex())[0]; - itemDustElectricalSteel = ItemUtils.generateSpecialUseDusts("ElectricalSteel", "Electrical Steel", MaterialEIO.ELECTRICAL_STEEL.vChemicalFormula, MaterialEIO.ELECTRICAL_STEEL.getRgbAsHex())[0]; - itemDustPulsatingIron = ItemUtils.generateSpecialUseDusts("PulsatingIron", "Pulsating Iron", MaterialEIO.PULSATING_IRON.vChemicalFormula, MaterialEIO.PULSATING_IRON.getRgbAsHex())[0]; - itemDustEnergeticAlloy = ItemUtils.generateSpecialUseDusts("EnergeticAlloy", "Energetic Alloy", MaterialEIO.ENERGETIC_ALLOY.vChemicalFormula, MaterialEIO.ENERGETIC_ALLOY.getRgbAsHex())[0]; - itemDustVibrantAlloy = ItemUtils.generateSpecialUseDusts("VibrantAlloy", "Vibrant Alloy", MaterialEIO.VIBRANT_ALLOY.vChemicalFormula, MaterialEIO.VIBRANT_ALLOY.getRgbAsHex())[0]; - itemDustConductiveIron = ItemUtils.generateSpecialUseDusts("ConductiveIron", "Conductive Iron", MaterialEIO.CONDUCTIVE_IRON.vChemicalFormula, MaterialEIO.CONDUCTIVE_IRON.getRgbAsHex())[0]; - - //EnderIO Plates - itemPlateSoularium = ItemUtils.generateSpecialUsePlate("Soularium", "Soularium", MaterialEIO.SOULARIUM.vChemicalFormula, MaterialEIO.SOULARIUM.getRgbAsHex(), 0); - itemPlateRedstoneAlloy = ItemUtils.generateSpecialUsePlate("RedstoneAlloy", "Redstone Alloy", MaterialEIO.REDSTONE_ALLOY.vChemicalFormula, MaterialEIO.REDSTONE_ALLOY.getRgbAsHex(), 0); - itemPlateElectricalSteel = ItemUtils.generateSpecialUsePlate("ElectricalSteel", "Electrical Steel", MaterialEIO.ELECTRICAL_STEEL.vChemicalFormula, MaterialEIO.ELECTRICAL_STEEL.getRgbAsHex(), 0); - itemPlatePulsatingIron = ItemUtils.generateSpecialUsePlate("PhasedIron", "Phased Iron", MaterialEIO.PULSATING_IRON.vChemicalFormula, MaterialEIO.PULSATING_IRON.getRgbAsHex(), 0); - itemPlateEnergeticAlloy = ItemUtils.generateSpecialUsePlate("EnergeticAlloy", "Energetic Alloy", MaterialEIO.ENERGETIC_ALLOY.vChemicalFormula, MaterialEIO.ENERGETIC_ALLOY.getRgbAsHex(), 0); - itemPlateVibrantAlloy = ItemUtils.generateSpecialUsePlate("VibrantAlloy", "Vibrant Alloy", MaterialEIO.VIBRANT_ALLOY.vChemicalFormula, MaterialEIO.VIBRANT_ALLOY.getRgbAsHex(), 0); - itemPlateConductiveIron = ItemUtils.generateSpecialUsePlate("ConductiveIron", "Conductive Iron", MaterialEIO.CONDUCTIVE_IRON.vChemicalFormula, MaterialEIO.CONDUCTIVE_IRON.getRgbAsHex(), 0); - - //Register dumb naming conventions - Who chose fucking phased Iron/Gold? - GT_OreDictUnificator.registerOre("dustPhasedGold", ItemUtils.getSimpleStack(itemDustVibrantAlloy)); - GT_OreDictUnificator.registerOre("platePhasedGold", ItemUtils.getSimpleStack(itemPlateVibrantAlloy)); - GT_OreDictUnificator.registerOre("dustPhasedIron", ItemUtils.getSimpleStack(itemDustPulsatingIron)); - GT_OreDictUnificator.registerOre("platePhasedIron", ItemUtils.getSimpleStack(itemPlatePulsatingIron)); - GT_OreDictUnificator.registerOre("blockVibrantAlloy", ItemUtils.getItemStackOfAmountFromOreDict("blockPhasedGold", 1)); - - CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getPlate(1), MaterialEIO.REDSTONE_ALLOY.getFluidStack(144), 16, 4*9); - CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getIngot(1), MaterialEIO.REDSTONE_ALLOY.getFluidStack(144), 16, 4*9); - CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getNugget(1), MaterialEIO.REDSTONE_ALLOY.getFluidStack(16), 16, 4); - CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getBlock(1), MaterialEIO.REDSTONE_ALLOY.getFluidStack(1294), 16, 4*9*9); - - } - else { - /*Logger.WARNING("EnderIO not Found - Generating our own Resources."); - MaterialGenerator.generate(MaterialEIO.CONDUCTIVE_IRON); - MaterialGenerator.generate(MaterialEIO.PULSATING_IRON); - MaterialGenerator.generate(MaterialEIO.REDSTONE_ALLOY); - MaterialGenerator.generate(MaterialEIO.SOULARIUM); - MaterialGenerator.generate(MaterialEIO.ELECTRICAL_STEEL); - MaterialGenerator.generate(MaterialEIO.ENERGETIC_ALLOY); - MaterialGenerator.generate(MaterialEIO.VIBRANT_ALLOY); */ - } - - //Big Reactors - if (LoadedMods.Big_Reactors|| LOAD_ALL_CONTENT){ - Logger.INFO("BigReactors Found - Loading Resources."); - //Item Init - itemPlateBlutonium = ItemUtils.generateSpecialUsePlate("Blutonium", "Blutonium", new short[]{0, 0, 255}, 0); - itemPlateCyanite = ItemUtils.generateSpecialUsePlate("Cyanite", "Cyanite", new short[]{0, 191, 255}, 0); - itemPlateLudicrite = ItemUtils.generateSpecialUsePlate("Ludicrite", "Ludicrite", new short[]{167, 5, 179}, 0); - } - else { - Logger.WARNING("BigReactors not Found - Skipping Resources."); - } - - //Thaumcraft - if ((LoadedMods.Thaumcraft|| LOAD_ALL_CONTENT) && !CORE.GTNH){ - Logger.INFO("Thaumcraft Found - Loading Resources."); - //Item Init - try { - ItemUtils.getItemForOreDict("Thaumcraft:ItemResource", "ingotVoidMetal", "Void Metal Ingot", 16); - itemPlateVoidMetal = ItemUtils.generateSpecialUsePlate("Void", "Void", new short[]{82, 17, 82}, 0); - GT_OreDictUnificator.registerOre("plateVoidMetal", new ItemStack(ModItems.itemPlateVoidMetal)); - } catch (final NullPointerException e){} - - } - else { - Logger.WARNING("Thaumcraft not Found - Skipping Resources."); - } - - //Pneumaticraft - if (LoadedMods.PneumaticCraft|| LOAD_ALL_CONTENT){ - Logger.INFO("PneumaticCraft Found - Loading Resources."); - //Item Init - itemPlateCompressedIron = ItemUtils.generateSpecialUsePlate("CompressedIron", "Compressed Iron", new short[]{128, 128, 128}, 0); - } - else { - Logger.WARNING("PneumaticCraft not Found - Skipping Resources."); - } - - //Simply Jetpacks - if (LoadedMods.Simply_Jetpacks|| LOAD_ALL_CONTENT){ - Logger.INFO("SimplyJetpacks Found - Loading Resources."); - //Item Init - itemPlateEnrichedSoularium = new RarityUncommon().setUnlocalizedName("itemPlateEnrichedSoularium").setCreativeTab(AddToCreativeTab.tabMisc).setTextureName(CORE.MODID + ":itemPlateSoularium"); - //Registry - GameRegistry.registerItem(itemPlateEnrichedSoularium, "itemPlateEnrichedSoularium"); - } - else { - Logger.WARNING("SimplyJetpacks not Found - Skipping Resources."); - } - - //rfTools - if (LoadedMods.RFTools|| LOAD_ALL_CONTENT){ - Logger.INFO("rfTools Found - Loading Resources."); - //Item Init - itemPlateDimensionShard = ItemUtils.generateSpecialUsePlate("DimensionShard", "Dimensional Shard", new short[]{170, 230, 230}, 0); - } - else { - Logger.WARNING("rfTools not Found - Skipping Resources."); - } - - //IC2 Exp - if (LoadedMods.IndustrialCraft2|| LOAD_ALL_CONTENT){ - Logger.INFO("IndustrialCraft2 Found - Loading Resources."); - - //Baubles Mod Test - try { - final Class<?> baublesTest = ReflectionUtils.getClass("baubles.api.IBauble"); - if (baublesTest != null){ - COMPAT_Baubles.run(); - } - else { - Logger.INFO("Baubles Not Found - Skipping Resources."); - } - } catch(final Throwable T){ - Logger.INFO("Baubles Not Found - Skipping Resources."); - } - } - else { - Logger.WARNING("IndustrialCraft2 not Found - Skipping Resources."); - } - - - //Special Item Handling Case - if (ConfigSwitches.enableAlternativeBatteryAlloy) { - //ModItems.itemIngotBatteryAlloy = new BaseItemIngot("itemIngotBatteryAlloy", "Battery Alloy", new short[]{35, 228, 141}, 0); TODO - ModItems.itemPlateBatteryAlloy = ItemUtils.generateSpecialUsePlate("BatteryAlloy", "Battery Alloy", new short[]{35, 228, 141}, 0); - - } - - - //UtilsItems.generateSpawnEgg("ic2", "boatcarbon", Utils.generateSingularRandomHexValue(), Utils.generateSingularRandomHexValue()); - - HANDLER_COFH.initItems(); - - /* - * Misc Items - */ - - //Staballoy Equipment - itemStaballoyPickaxe = new StaballoyPickaxe("itemStaballoyPickaxe", STABALLOY).setCreativeTab(AddToCreativeTab.tabTools); - GameRegistry.registerItem(itemStaballoyPickaxe, itemStaballoyPickaxe.getUnlocalizedName()); - itemStaballoyAxe = new StaballoyAxe("itemStaballoyAxe", STABALLOY).setCreativeTab(AddToCreativeTab.tabTools); - GameRegistry.registerItem(itemStaballoyAxe, itemStaballoyAxe.getUnlocalizedName()); - - //Sandstone Hammer - itemSandstoneHammer = new SandstoneHammer("itemSandstoneHammer").setCreativeTab(AddToCreativeTab.tabTools); - GameRegistry.registerItem(itemSandstoneHammer, itemSandstoneHammer.getUnlocalizedName()); - - //Buffer Cores! - Item itemBufferCore; - for(int i=1; i<=10; i++){ - //Utils.LOG_INFO(""+i); - itemBufferCore = new BufferCore("itemBufferCore", i).setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerItem(itemBufferCore, itemBufferCore.getUnlocalizedName()); - //System.out.println("Buffer Core registration count is: "+i); - } - - itemPLACEHOLDER_Circuit = new Item().setUnlocalizedName("itemPLACEHOLDER_Circuit").setTextureName(CORE.MODID + ":itemPLACEHOLDER_Circuit"); - GameRegistry.registerItem(itemPLACEHOLDER_Circuit, "itemPLACEHOLDER_Circuit"); - - //ItemBlockGtFrameBox = new ItemBlockGtFrameBox(ModBlocks.blockGtFrameSet1); - //GameRegistry.registerItem(ItemBlockGtFrameBox, "itemGtFrameBoxSet1"); - - itemCustomBook = new ItemBaseBook(); - registerCustomTokens(); - } - - public static void registerCustomTokens() { - itemGenericToken.register(0, "BitCoin", 16, "Can be used on the dark web"); - itemGenericToken.register(1, "Hand Pump Trade Token I", 1, "Craft into a Tier I Hand pump"); - itemGenericToken.register(2, "Hand Pump Trade Token II", 1, "Craft into a Tier II Hand pump"); - itemGenericToken.register(3, "Hand Pump Trade Token III", 1, "Craft into a Tier III Hand pump"); - itemGenericToken.register(4, "Hand Pump Trade Token IV", 1, "Craft into a Tier IV Hand pump"); - } -} diff --git a/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java b/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java deleted file mode 100644 index b4988136c0..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java +++ /dev/null @@ -1,582 +0,0 @@ -package gtPlusPlus.core.item.base; - -import static gregtech.api.enums.GT_Values.*; - -import java.util.*; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.SubTag; -import gregtech.api.enums.TC_Aspects.TC_AspectStack; -import gregtech.api.interfaces.IItemBehaviour; -import gregtech.api.interfaces.IItemContainer; -import gregtech.api.objects.ItemData; -import gregtech.api.util.*; - -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import ic2.api.item.*; - -public class BaseEuItem extends Item implements ISpecialElectricItem, IElectricItemManager { - - /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ - private final HashMap<Short, ArrayList<IItemBehaviour<BaseEuItem>>> mItemBehaviors = new HashMap<>(); - public final short mOffset, mItemAmount; - public final BitSet mEnabledItems; - public final BitSet mVisibleItems; - public final IIcon[][] mIconList; - /** The unlocalized name of this item. */ - private String unlocalizedName; - - private final ArrayList<Pair<Integer, EnumRarity>> rarity = new ArrayList<>(); - private final ArrayList<Pair<Integer, EnumChatFormatting>> descColour = new ArrayList<>(); - private final ArrayList<Pair<Integer, String>> itemName = new ArrayList<>(); - private final ArrayList<Pair<Integer, String>> itemDescription = new ArrayList<>(); - private final ArrayList<Pair<Integer, Boolean>> hasEffect = new ArrayList<>(); - - public final HashMap<Short, Long[]> mElectricStats = new HashMap<>(); - public final HashMap<Short, Short> mBurnValues = new HashMap<>(); - - public BaseEuItem() { - this("MU-metaitem.02", AddToCreativeTab.tabOther, (short) 1000, (short) 31766); - } - - public BaseEuItem(final String unlocalizedName, final CreativeTabs creativeTab, final short aOffset, final short aItemAmount) { - this.mEnabledItems = new BitSet(aItemAmount); - this.mVisibleItems = new BitSet(aItemAmount); - this.mOffset = (short) Math.min(32766, aOffset); - this.mItemAmount = (short) Math.min(aItemAmount, 32766 - this.mOffset); - this.mIconList = new IIcon[aItemAmount][1]; - this.setHasSubtypes(true); - this.setMaxDamage(0); - this.setUnlocalizedName(unlocalizedName); - this.setCreativeTab(creativeTab); - this.setMaxStackSize(1); - GameRegistry.registerItem(this, unlocalizedName); - } - - - public void registerItem(final int id, final String localizedName, final long euStorage, final int tier, final String description) { - this.registerItem(id, localizedName, euStorage, (short) tier, description, EnumRarity.common, EnumChatFormatting.GRAY, false); - } - - public void registerItem(final int id, final String localizedName, final long euStorage, final int tier, final String description, final int burnTime) { - this.registerItem(id, localizedName, euStorage, (short) tier, description, EnumRarity.common, EnumChatFormatting.GRAY, false); - this.setBurnValue(id, burnTime); - } - - - public void registerItem(final int id, final String localizedName, final long euStorage, final short tier, final String description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect) { - this.addItem(id, localizedName, EnumChatFormatting.YELLOW+"Electric", new Object[]{}); - this.setElectricStats(this.mOffset + id, euStorage, GT_Values.V[tier], tier, -3L, true); - this.rarity.add(new Pair<>(id, regRarity)); - this.itemName.add(new Pair<>(id, localizedName)); - this.itemDescription.add(new Pair<>(id, description)); - this.descColour.add(new Pair<>(id, colour)); - this.hasEffect.add(new Pair<>(id, Effect)); - } - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack){ - if (this.rarity.get(par1ItemStack.getItemDamage()-this.mOffset) != null) { - return this.rarity.get(par1ItemStack.getItemDamage()-this.mOffset).getValue(); - } - return EnumRarity.common; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack){ - if (this.hasEffect.get(par1ItemStack.getItemDamage()-this.mOffset) != null) { - return this.hasEffect.get(par1ItemStack.getItemDamage()-this.mOffset).getValue(); - } - return false; - } - - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, List aList, final boolean aF3_H) { - //aList.add("Meta: "+(aStack.getItemDamage()-mOffset)); - if ((this.descColour.get(aStack.getItemDamage()-this.mOffset) != null) && (this.itemDescription.get(aStack.getItemDamage()-this.mOffset) != null)) { - aList.add(this.descColour.get(aStack.getItemDamage()-this.mOffset).getValue()+this.itemDescription.get(aStack.getItemDamage()-this.mOffset).getValue()); - } - final String tKey = this.getUnlocalizedName(aStack) + ".tooltip", tString = GT_LanguageManager.getTranslation(tKey); - if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) { - aList.add(tString); - } - final Long[] tStats = this.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 { - final long tCharge = this.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); - } - } - } - final ArrayList<IItemBehaviour<BaseEuItem>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); - if (tList != null) { - for (final IItemBehaviour<BaseEuItem> tBehavior : tList) { - aList = tBehavior.getAdditionalToolTips(this, aList, aStack); - } - } - } - - - @Override - public final Item getChargedItem(final ItemStack itemStack) { - return this; - } - - @Override - public final Item getEmptyItem(final ItemStack itemStack) { - return this; - } - - @Override - public final double getMaxCharge(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - if (tStats == null) { - return 0; - } - return Math.abs(tStats[0]); - } - - @Override - public final double getTransferLimit(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - if (tStats == null) { - return 0; - } - return Math.max(tStats[1], tStats[3]); - } - - @Override - public final int getTier(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - return (int) (tStats == null ? Integer.MAX_VALUE : tStats[2]); - } - - @Override - public final double charge(final ItemStack aStack, final double aCharge, final int aTier, final boolean aIgnoreTransferLimit, final boolean aSimulate) { - final Long[] tStats = this.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; - } - final long tChargeBefore = this.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) { - this.setCharge(aStack, tNewCharge); - } - return tNewCharge - tChargeBefore; - } - - @Override - public final double discharge(final ItemStack aStack, final double aCharge, final int aTier, final boolean aIgnoreTransferLimit, final boolean aBatteryAlike, final boolean aSimulate) { - final Long[] tStats = this.getElectricStats(aStack); - if ((tStats == null) || (tStats[2] > aTier)) { - return 0; - } - if (aBatteryAlike && !this.canProvideEnergy(aStack)) { - return 0; - } - if (tStats[3] > 0) { - if ((aCharge < tStats[3]) || (aStack.stackSize < 1)) { - return 0; - } - if (!aSimulate) { - aStack.stackSize--; - } - return tStats[3]; - } - final long tChargeBefore = this.getRealCharge(aStack), tNewCharge = Math.max(0, tChargeBefore - (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); - if (!aSimulate) { - this.setCharge(aStack, tNewCharge); - } - return tChargeBefore - tNewCharge; - } - - @Override - public final double getCharge(final ItemStack aStack) { - return this.getRealCharge(aStack); - } - - @Override - public final boolean canUse(final ItemStack aStack, final double aAmount) { - return this.getRealCharge(aStack) >= aAmount; - } - - @Override - public final boolean use(final ItemStack aStack, final double aAmount, final EntityLivingBase aPlayer) { - this.chargeFromArmor(aStack, aPlayer); - if ((aPlayer instanceof EntityPlayer) && ((EntityPlayer) aPlayer).capabilities.isCreativeMode) { - return true; - } - final double tTransfer = this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, true); - if (tTransfer == aAmount) { - this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); - this.chargeFromArmor(aStack, aPlayer); - return true; - } - this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); - this.chargeFromArmor(aStack, aPlayer); - return false; - } - - @Override - public final boolean canProvideEnergy(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - if (tStats == null) { - return false; - } - return (tStats[3] > 0) || ((aStack.stackSize == 1) && ((tStats[3] == -2) || (tStats[3] == -3))); - } - - @Override - public final void chargeFromArmor(final ItemStack aStack, final EntityLivingBase aPlayer) { - if ((aPlayer == null) || aPlayer.worldObj.isRemote) { - return; - } - for (int i = 1; i < 5; i++) { - final ItemStack tArmor = aPlayer.getEquipmentInSlot(i); - if (GT_ModHandler.isElectricItem(tArmor)) { - final IElectricItem tArmorItem = (IElectricItem) tArmor.getItem(); - if (tArmorItem.canProvideEnergy(tArmor) && (tArmorItem.getTier(tArmor) >= this.getTier(aStack))) { - final double tCharge = ElectricItem.manager.discharge(tArmor, this.charge(aStack, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, true, true), Integer.MAX_VALUE, true, true, false); - if (tCharge > 0) { - this.charge(aStack, tCharge, Integer.MAX_VALUE, true, false); - if (aPlayer instanceof EntityPlayer) { - final Container tContainer = ((EntityPlayer) aPlayer).openContainer; - if (tContainer != null) { - tContainer.detectAndSendChanges(); - } - } - } - } - } - } - } - - public final long getRealCharge(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - if (tStats == null) { - return 0; - } - if (tStats[3] > 0) { - return (int) (long) tStats[3]; - } - final NBTTagCompound tNBT = aStack.getTagCompound(); - return tNBT == null ? 0 : tNBT.getLong("GT.ItemCharge"); - } - - public final boolean setCharge(final ItemStack aStack, long aCharge) { - final Long[] tStats = this.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(this.getChargedMetaData(aStack)); - tNBT.setLong("GT.ItemCharge", aCharge); - } else { - aStack.setItemDamage(this.getEmptyMetaData(aStack)); - } - if (tNBT.hasNoTags()) { - aStack.setTagCompound(null); - } else { - aStack.setTagCompound(tNBT); - } - this.isItemStackUsable(aStack); - return true; - } - - public short getChargedMetaData(final ItemStack aStack) { - return (short) aStack.getItemDamage(); - } - - public short getEmptyMetaData(final ItemStack aStack) { - return (short) aStack.getItemDamage(); - } - - - public boolean isItemStackUsable(final ItemStack aStack) { - final ArrayList<IItemBehaviour<BaseEuItem>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); - if (tList != null) { - for (final IItemBehaviour<BaseEuItem> tBehavior : tList) { - if (!tBehavior.isItemStackUsable(this, aStack)) { - return false; - } - } - } - return true; - } - - @Override - public final String getToolTip(final 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(final ItemStack aStack) { - return this; - } // We are our own Manager - - /** - * 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 BaseEuItem setBurnValue(final int aMetaValue, final int aValue) { - if ((aMetaValue < 0) || (aValue < 0)) { - return this; - } - if (aValue == 0) { - this.mBurnValues.remove((short) aMetaValue); - } else { - this.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 BaseEuItem setElectricStats(final int aMetaValue, final long aMaxCharge, final long aTransferLimit, final long aTier, final long aSpecialData, final boolean aUseAnimations) { - if (aMetaValue < 0) { - return this; - } - if (aMaxCharge == 0) { - this.mElectricStats.remove((short) aMetaValue); - } else { - this.mElectricStats.put((short) aMetaValue, new Long[]{aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData}); - } - return this; - } - - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(final Item var1, final CreativeTabs aCreativeTab, final List aList) { - for (int i = 0, j = this.mEnabledItems.length(); i < j; i++) { - if (this.mVisibleItems.get(i) || (D1 && this.mEnabledItems.get(i))) { - final Long[] tStats = this.mElectricStats.get((short) (this.mOffset + i)); - if ((tStats != null) && (tStats[3] < 0)) { - final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i); - this.setCharge(tStack, Math.abs(tStats[0])); - this.isItemStackUsable(tStack); - aList.add(tStack); - } - if ((tStats == null) || (tStats[3] != -2)) { - final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i); - this.isItemStackUsable(tStack); - aList.add(tStack); - } - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public final void registerIcons(final IIconRegister aIconRegister) { - for (short i = 0, j = (short) this.mEnabledItems.length(); i < j; i++) { - if (this.mEnabledItems.get(i)) { - for (byte k = 1; k < this.mIconList[i].length; k++) { - this.mIconList[i][k] = aIconRegister.registerIcon(CORE.MODID+":" + (this.getUnlocalizedName() + "/" + i + "/" + k)); - } - this.mIconList[i][0] = aIconRegister.registerIcon(CORE.MODID+":" + (this.getUnlocalizedName() + "/" + i)); - } - } - } - - - @Override - public final IIcon getIconFromDamage(final int aMetaData) { - if (aMetaData < 0) { - return null; - } - return (aMetaData - this.mOffset) < this.mIconList.length ? this.mIconList[aMetaData - this.mOffset][0] : null; - } - - /** - * Sets the unlocalized name of this item to the string passed as the parameter" - */ - @Override - public Item setUnlocalizedName(final String p_77655_1_){ - this.unlocalizedName = p_77655_1_; - super.setUnlocalizedName(p_77655_1_); - return this; - } - - /** - * Returns the unlocalized name of this item. - */ - @Override - public String getUnlocalizedName() - { - return this.unlocalizedName; - } - - public final Long[] getElectricStats(final ItemStack aStack) { - return this.mElectricStats.get((short) aStack.getItemDamage()); - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public boolean isBookEnchantable(final ItemStack aStack, final ItemStack aBook) { - return false; - } - - @Override - public boolean getIsRepairable(final ItemStack aStack, final ItemStack aMaterial) { - return false; - } - - - /** - * Adds a special Item Behaviour to the Item. - * <p/> - * 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 BaseEuItem addItemBehavior(final int aMetaValue, final IItemBehaviour<BaseEuItem> aBehavior) { - if ((aMetaValue < 0) || (aMetaValue >= 32766) || (aBehavior == null)) { - return this; - } - ArrayList<IItemBehaviour<BaseEuItem>> tList = this.mItemBehaviors.get((short) aMetaValue); - if (tList == null) { - tList = new ArrayList<>(1); - this.mItemBehaviors.put((short) aMetaValue, tList); - } - tList.add(aBehavior); - return 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. - */ - @SuppressWarnings("unchecked") - public final ItemStack addItem(final int aID, final String aEnglish, String aToolTip, final Object... aRandomData) { - if (aToolTip == null) { - aToolTip = ""; - } - if ((aID >= 0) && (aID < this.mItemAmount)) { - final ItemStack rStack = new ItemStack(this, 1, this.mOffset + aID); - this.mEnabledItems.set(aID); - this.mVisibleItems.set(aID); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".name", aEnglish); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".tooltip", aToolTip); - final List<TC_AspectStack> tAspects = new ArrayList<>(); - // Important Stuff to do first - for (final Object tRandomData : aRandomData) { - if (tRandomData instanceof SubTag) { - if (tRandomData == SubTag.INVISIBLE) { - this.mVisibleItems.set(aID, false); - continue; - } - if (tRandomData == SubTag.NO_UNIFICATION) { - GT_OreDictUnificator.addToBlacklist(rStack); - continue; - } - } - } - // now check for the rest - for (final Object tRandomData : aRandomData) { - if (tRandomData != null) { - boolean tUseOreDict = true; - if (tRandomData instanceof IItemBehaviour) { - this.addItemBehavior(this.mOffset + aID, (IItemBehaviour<BaseEuItem>) 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; - } - - @Override - public String getItemStackDisplayName(final ItemStack par1ItemStack) { - int keyValue = (par1ItemStack.getItemDamage() - this.mOffset); - if (keyValue < 0 || keyValue > 3) { - keyValue = 0; - } - return this.itemName.get(keyValue).getValue(); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java b/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java deleted file mode 100644 index 246620344a..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java +++ /dev/null @@ -1,92 +0,0 @@ -package gtPlusPlus.core.item.base; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import gregtech.api.util.GT_OreDictUnificator; - -import gtPlusPlus.GTplusplus; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.handler.GuiHandler; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class BaseItemBackpack extends Item{ - - protected final int colourValue; - protected final String unlocalName; - - - public BaseItemBackpack(final String unlocalizedName, final int colour){ - this.unlocalName = unlocalizedName; - this.setUnlocalizedName(unlocalizedName); - this.setTextureName(CORE.MODID + ":" + "itemBackpack"); - this.colourValue = colour; - GameRegistry.registerItem(this, unlocalizedName); - GT_OreDictUnificator.registerOre("storageBackpack", ItemUtils.getSimpleStack(this)); - this.setMaxStackSize(1); - this.setCreativeTab(AddToCreativeTab.tabOther); - } - - // Without this method, your inventory will NOT work!!! - @Override - public int getMaxItemUseDuration(final ItemStack stack) { - return 1; // return any value greater than zero - } - - @Override - public ItemStack onItemRightClick(final ItemStack itemstack, final World world, final EntityPlayer player) - { - if (!world.isRemote) - { - // If player not sneaking, open the inventory gui - if (!player.isSneaking()) { - player.openGui(GTplusplus.instance, GuiHandler.GUI3, world, 0, 0, 0); - } - - // Otherwise, stealthily place some diamonds in there for a nice surprise next time you open it up :) - else { - // Utils.LOG_INFO("Player is Sneaking, giving them sneaky diamonds."); - // new BaseInventoryBackpack(player.getHeldItem()).setInventorySlotContents(0, new ItemStack(Items.diamond,4)); - } - } - - return itemstack; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - if (this.colourValue == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return this.colourValue; - - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - //Name Formatting. - String temp = this.unlocalName.replace("backpack", ""); - //Lets find the colour. - if (temp.toLowerCase().contains("dark")){ - temp = this.unlocalName.substring(12, this.unlocalName.length()); - temp = "Dark "+ temp; - } - return (temp+" Backpack"); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(final IIconRegister iconRegister) - { - this.itemIcon = iconRegister.registerIcon(CORE.MODID + ":" + "itemBackpack"); - } -} diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java b/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java deleted file mode 100644 index 73ed4afb42..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java +++ /dev/null @@ -1,109 +0,0 @@ -package gtPlusPlus.core.item.base; - -import java.util.List; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.creativetab.CreativeTabs; -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.StatCollector; - -/* - * - * - Key Point: You can access the NBT compound data from the Item class (in those methods that pass an ItemStack), but the NBT compound can only be set on an ItemStack. - - The steps to add NBT data to an ItemStack: - Create or otherwise get an ItemStack of the desired item - Create an NBTTagCompound and fill it with the appropriate data - Call ItemStack#setTagCompound() method to set it. - - * - */ - -public class BaseItemBrain extends Item{ - // This is an array of all the types I am going to be adding. - String[] brainTypes = { "dead", "preserved", "fresh", "tasty" }; - - // This method allows us to have different language translation keys for - // each item we add. - @Override - public String getUnlocalizedName(final ItemStack stack) - { - // This makes sure that the stack has a tag compound. This is how data - // is stored on items. - if (stack.hasTagCompound()) - { - // This is the object holding all of the item data. - final NBTTagCompound itemData = stack.getTagCompound(); - // This checks to see if the item has data stored under the - // brainType key. - if (itemData.hasKey("brainType")) - { - // This retrieves data from the brainType key and uses it in - // the return value - return "item." + itemData.getString("brainType"); - } - } - // This will be used if the item is obtained without nbt data on it. - return "item.nullBrain"; - } - - - // This is a fun method which allows us to run some code when our item is - // shown in a creative tab. I am going to use it to add all the brain - // types. - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(final Item item, final CreativeTabs tab, final List itemList) - { - // This creates a loop with a counter. It will go through once for - // every listing in brainTypes, and gives us a number associated - // with each listing. - for (int pos = 0; pos < this.brainTypes.length; pos++) - { - // This creates a new ItemStack instance. The item parameter - // supplied is this item. - final ItemStack brainStack = new ItemStack(item); - // By default, a new ItemStack does not have any nbt compound data. - // We need to give it some. - brainStack.setTagCompound(new NBTTagCompound()); - // Now we set the type of the item, brainType is the key, and - // brainTypes[pos] is grabbing a - // entry from the brainTypes array. - brainStack.getTagCompound().setString("brainType", - this.brainTypes[pos]); - // And this adds it to the itemList, which is a list of all items - // in the creative tab. - itemList.add(brainStack); - } - } - - // This code will allow us to tell the items apart in game. You can change - @SuppressWarnings({ "rawtypes", "unchecked" }) - // texture based on nbt data, but I won't be covering that. - @Override - @SideOnly(Side.CLIENT) - public void addInformation(final ItemStack stack, final EntityPlayer player, final List tooltip, final boolean isAdvanced){ - if ( stack.hasTagCompound() - && stack.getTagCompound().hasKey("brainType")) - { - // StatCollector is a class which allows us to handle string - // language translation. This requires that you fill out the - // translation in you language class. - tooltip.add(StatCollector.translateToLocal("tooltip.yourmod." - + stack.getTagCompound().getString("brainType") + ".desc")); - } - else // If the brain does not have valid tag data, a default message - { - tooltip.add(StatCollector.translateToLocal( - "tooltip.yourmod.nullbrain.desc")); - } - } -} - diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemBurnable.java b/src/Java/gtPlusPlus/core/item/base/BaseItemBurnable.java deleted file mode 100644 index a5db714822..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemBurnable.java +++ /dev/null @@ -1,44 +0,0 @@ -package gtPlusPlus.core.item.base; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class BaseItemBurnable extends CoreItem { - - protected final int meta; - - public BaseItemBurnable(String unlocalizedName, String displayName, CreativeTabs creativeTab, - int stackSize, int maxDmg, String description, String oredictName, int burnTime, int meta) { - super(unlocalizedName, creativeTab, stackSize, maxDmg, description); - this.itemName = displayName; - this.meta = meta; - if (oredictName != null && !oredictName.equals("")){ - registerOrdictionary(oredictName); - } - registerFuel(burnTime); - - } - - public void registerFuel(int burn){ - CORE.burnables.add(new Pair<Integer, ItemStack>(burn, ItemUtils.getSimpleStack(this, 1))); - } - - public final void registerOrdictionary(String name){ - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), name); - } - - @Override - public int getDamage(ItemStack stack) { - return this.meta; - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return false; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemColourable.java b/src/Java/gtPlusPlus/core/item/base/BaseItemColourable.java deleted file mode 100644 index ca7041617d..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemColourable.java +++ /dev/null @@ -1,98 +0,0 @@ -package gtPlusPlus.core.item.base; - -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import gtPlusPlus.core.lib.CORE; - -public class BaseItemColourable extends Item -{ - - private final EnumRarity rarity; - private final EnumChatFormatting descColour; - private final String itemDescription; - protected String itemName; - private final boolean hasEffect; - public final int componentColour; - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - return this.componentColour; - } - - //5 - /* - * Name, Tab, Stack, Dmg, Description, Rarity, Text Colour, Effect - */ - public BaseItemColourable(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect, int rgb) - { - this.setUnlocalizedName(unlocalizedName); - this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setCreativeTab(creativeTab); - this.setMaxStackSize(stackSize); - this.setMaxDamage(maxDmg); - this.setHasSubtypes(true); - this.rarity = regRarity; - this.itemDescription = description; - this.descColour = colour; - this.hasEffect = Effect; - this.componentColour = rgb; - GameRegistry.registerItem(this, unlocalizedName); - } - - //6 - /* - * Name, Tab, Stack, Dmg, Description, Rarity, Text Colour, Effect - */ - public BaseItemColourable(final String unlocalizedName, final String displayName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect, int rgb) - { - this.setUnlocalizedName(unlocalizedName); - this.itemName = displayName; - this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setCreativeTab(creativeTab); - this.setMaxStackSize(stackSize); - this.setMaxDamage(maxDmg); - this.rarity = regRarity; - this.itemDescription = description; - this.descColour = colour; - this.hasEffect = Effect; - this.componentColour = rgb; - GameRegistry.registerItem(this, unlocalizedName); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(this.descColour+this.itemDescription); - //super.addInformation(stack, aPlayer, list, bool); - } - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack){ - return this.rarity; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack){ - return this.hasEffect; - } - - @Override - public String getItemStackDisplayName(final ItemStack tItem) { - if ((this.itemName == null) || this.itemName.equals("")) { - return super.getItemStackDisplayName(tItem); - } - return this.itemName; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java deleted file mode 100644 index 9ad8ea3feb..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java +++ /dev/null @@ -1,566 +0,0 @@ -package gtPlusPlus.core.item.base; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.TextureSet; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.state.MaterialState; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.data.StringUtils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.sys.KeyboardUtils; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -public class BaseItemComponent extends Item{ - - private final static Class<TextureSet> mTextureSetPreload; - - static { - mTextureSetPreload = TextureSet.class; - } - - public final Material componentMaterial; - public final String materialName; - public final String unlocalName; - public final ComponentTypes componentType; - public final int componentColour; - public Object extraData; - - protected IIcon base; - protected IIcon overlay; - - public BaseItemComponent(final Material material, final ComponentTypes componentType) { - this.componentMaterial = material; - this.unlocalName = "item"+componentType.COMPONENT_NAME+material.getUnlocalizedName(); - this.materialName = material.getLocalizedName(); - this.componentType = componentType; - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(this.unlocalName); - this.setMaxStackSize(64); - //this.setTextureName(this.getCorrectTextures()); - this.componentColour = material.getRgbAsHex(); - GameRegistry.registerItem(this, this.unlocalName); - - //if (componentType != ComponentTypes.DUST) - - GT_OreDictUnificator.registerOre(componentType.getOreDictName()+material.getUnlocalizedName(), ItemUtils.getSimpleStack(this)); - if (LoadedMods.Thaumcraft) { - //ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), TC_Aspect_Wrapper.generate(TC_Aspects.METALLUM.mAspect), 1); - if (componentMaterial.isRadioactive) { - //ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), TC_Aspect_Wrapper.generate(TC_Aspects.RADIO.mAspect), componentMaterial.vRadiationLevel); - } - } - registerComponent(); - } - - //For Cell Generation - public BaseItemComponent(final String unlocalName, final String localName, final short[] RGBA) { - - // Handles .'s from fluid internal names. - String aFormattedNameForFluids; - if (unlocalName.contains(".")) { - aFormattedNameForFluids = StringUtils.splitAndUppercase(unlocalName, "."); - } - else { - aFormattedNameForFluids = unlocalName; - } - Material aTempMaterial = Material.mMaterialCache.get(localName.toLowerCase()); - Logger.INFO("Attempted to get "+localName+" cell material from cache. Valid? "+(aTempMaterial != null)); - this.componentMaterial = aTempMaterial; - this.unlocalName = "itemCell"+aFormattedNameForFluids; - this.materialName = localName; - this.componentType = ComponentTypes.CELL; - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(aFormattedNameForFluids); - this.setMaxStackSize(64); - this.componentColour = MathUtils.getRgbAsHex(RGBA); - this.extraData = RGBA; - - this.setTextureName(CORE.MODID + ":" + "item"+ComponentTypes.CELL.COMPONENT_NAME); - GameRegistry.registerItem(this, aFormattedNameForFluids); - GT_OreDictUnificator.registerOre(ComponentTypes.CELL.getOreDictName()+Utils.sanitizeStringKeepBrackets(localName), ItemUtils.getSimpleStack(this)); - registerComponent(); - } - - public boolean registerComponent() { - if (this.componentMaterial == null) { - return false; - } - //Register Component - Map<String, ItemStack> aMap = Material.mComponentMap.get(componentMaterial.getUnlocalizedName()); - if (aMap == null) { - aMap = new HashMap<String, ItemStack>(); - } - String aKey = componentType.getGtOrePrefix().name(); - ItemStack x = aMap.get(aKey); - if (x == null) { - aMap.put(aKey, ItemUtils.getSimpleStack(this)); - Logger.MATERIALS("Registering a material component. Item: ["+componentMaterial.getUnlocalizedName()+"] Map: ["+aKey+"]"); - Material.mComponentMap.put(componentMaterial.getUnlocalizedName(), aMap); - return true; - } - else { - //Bad - Logger.MATERIALS("Tried to double register a material component. "); - return false; - } - } - - public String getCorrectTextures(){ - if (!CORE.ConfigSwitches.useGregtechTextures){ - return CORE.MODID + ":" + "item"+this.componentType.COMPONENT_NAME; - } - String metType = "9j4852jyo3rjmh3owlhw9oe"; - if (this.componentMaterial != null) { - TextureSet u = this.componentMaterial.getTextureSet(); - if (u != null) { - metType = u.mSetName; - } - } - metType = (metType.equals("9j4852jyo3rjmh3owlhw9oe") ? "METALLIC" : metType); - return "gregtech" + ":" + "materialicons/"+metType+"/" + this.componentType.getOreDictName(); - - - - //return "gregtech" + ":" + "materialicons/"+metType+"/" + this.componentType.COMPONENT_NAME.toLowerCase(); - } - - /*@Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - - if (this.componentType == ComponentTypes.SMALLGEAR){ - return "Small " + this.materialName+" Gear"; - } - - if (this.componentMaterial != null) { - return (this.componentMaterial.getLocalizedName()+this.componentType.DISPLAY_NAME); - } - return this.materialName+" Cell"; - }*/ - - public final String getMaterialName() { - return this.materialName; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public final void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - - try { - - - if (this.componentMaterial == null){ - if (this.materialName != null){ - //list.add(Utils.sanitizeStringKeepBrackets(materialName)); - } - } - - if ((this.materialName != null) && (this.materialName != "") && !this.materialName.equals("") && (this.componentMaterial != null)){ - - - if (this.componentMaterial != null){ - if (!this.componentMaterial.vChemicalFormula.contains("?")) { - list.add(Utils.sanitizeStringKeepBrackets(this.componentMaterial.vChemicalFormula)); - } - else if (this.componentMaterial.vChemicalFormula.contains("?")) { - String temp = componentMaterial.vChemicalFormula; - temp = temp.replace(" ", ""); - temp = temp.replace("-", ""); - temp = temp.replace("_", ""); - temp = temp.replace("!", ""); - temp = temp.replace("@", ""); - temp = temp.replace("#", ""); - temp = temp.replace(" ", ""); - list.add(temp); - } - - if (this.componentMaterial.isRadioactive){ - list.add(CORE.GT_Tooltip_Radioactive); - } - - if (this.componentType == ComponentTypes.INGOT || this.componentType == ComponentTypes.HOTINGOT){ - if ((this.materialName != null) && (this.materialName != "") && !this.materialName.equals("") && this.unlocalName.toLowerCase().contains("hot")){ - list.add(EnumChatFormatting.GRAY+"Warning: "+EnumChatFormatting.RED+"Very hot! "+EnumChatFormatting.GRAY+" Avoid direct handling.."); - } - } - } - else { - String aChemicalFormula = Material.sChemicalFormula.get(materialName.toLowerCase()); - if (aChemicalFormula != null && aChemicalFormula.length() > 0) { - list.add(Utils.sanitizeStringKeepBrackets(aChemicalFormula)); - } - } - - //Hidden Tooltip - if (KeyboardUtils.isCtrlKeyDown()) { - if (this.componentMaterial != null) { - String type = this.componentMaterial.getTextureSet().mSetName; - String output = type.substring(0, 1).toUpperCase() + type.substring(1); - list.add(EnumChatFormatting.GRAY+"Material Type: "+output+"."); - list.add(EnumChatFormatting.GRAY+"Material State: "+this.componentMaterial.getState().name()+"."); - list.add(EnumChatFormatting.GRAY+"Radioactivity Level: "+this.componentMaterial.vRadiationLevel+"."); - } - } - else { - list.add(EnumChatFormatting.DARK_GRAY+"Hold Ctrl to show additional info."); - } - - } - } - catch (Throwable t) {} - - super.addInformation(stack, aPlayer, list, bool); - } - - @SuppressWarnings("unchecked") - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - if (this.componentMaterial != null){ - if (entityHolding instanceof EntityPlayer){ - if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){ - EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.componentMaterial.vRadiationLevel, world, entityHolding); - } - } - } - - if (extraData != null) { - if (componentMaterial != null && componentMaterial.getRGBA()[3] > 1) { - if (((Map<Integer, Short[]>) extraData).get(9999) == null) { - ((Map<Integer, Short[]>) extraData).put(9999, new Short[] {0}); - } - Short aCurrentFrame = ((Map<Integer, Short[]>) extraData).get(9999)[0]; - short fC = (short) (aCurrentFrame >= Short.MAX_VALUE ? 0 : aCurrentFrame+1); - ((Map<Integer, Short[]>) extraData).put((int) 9999, new Short[] {(short) (fC), 0}); - ((Map<Integer, Short[]>) extraData).put((int) 9998, new Short[] {aCurrentFrame, 0}); - - } - } - } - - - /** - * - * Handle Custom Rendering - * - */ - - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses(){ - return (CORE.ConfigSwitches.useGregtechTextures ? true : false); - } - - @SuppressWarnings("unchecked") - @Override - public int getColorFromItemStack(final ItemStack stack, final int renderPass) { - - - if (this.componentType == ComponentTypes.CELL || this.componentType == ComponentTypes.PLASMACELL) { - if (renderPass == 0 && !CORE.ConfigSwitches.useGregtechTextures){ - return Utils.rgbtoHexValue(255, 255, 255); - } - if (renderPass == 1 && CORE.ConfigSwitches.useGregtechTextures){ - return Utils.rgbtoHexValue(255, 255, 255); - } - } - if (this.componentType == ComponentTypes.PLATEHEAVY) { - - } - - - - try { - if (this.componentMaterial == null) { - if (extraData != null) { - if (short.class.isInstance(extraData)){ - short[] abc = (short[]) extraData; - return Utils.rgbtoHexValue(abc[0], abc[1], abc[2]); - } - } - return this.componentColour; - } - - if (this.componentMaterial.getRGBA()[3] <= 1) { - return this.componentColour; - } - else { - - //Mild Glow Effect - if (this.componentMaterial.getRGBA()[3] == 2) { - if (extraData == null) { - extraData = new HashMap<Integer, Short[]>(); - ((Map<Integer, Short[]>) extraData).put((int) Short.MAX_VALUE, new Short[] {0}); - ((Map<Integer, Short[]>) extraData).put((int) Short.MAX_VALUE-1, new Short[] {0}); - short[] er = this.componentMaterial.getRGBA(); - short value = 1; - Short[] ht = new Short[] {er[0], er[1], er[2]}; - for (int y = 0; y < 40; y++) { - if (y < 20) { - value = 1; - } - else { - value = -1; - } - short r = (short) (ht[0] + value); - short g = (short) (ht[1] + value); - short b = (short) (ht[2] + value); - Short[] qq = new Short[] {(short) Math.min(255, r), (short) Math.min(255, g), (short) Math.min(255, b)}; - ht = qq; - ((Map<Integer, Short[]>) extraData).put(y, qq); - } - } - if (extraData != null) { - - Short aCurrentFrame = ((Map<Integer, Short[]>) extraData).get((int) Short.MAX_VALUE)[0]; - Short aSize = 40; - short nextFrame = (short) ((aCurrentFrame < aSize) ? (aCurrentFrame+1) : 0); - Short[] aCurrentFrameRGB = ((Map<Integer, Short[]>) extraData).get(aCurrentFrame < aSize ? (int) aCurrentFrame : 0); - ((Map<Integer, Short[]>) extraData).put((int) Short.MAX_VALUE, new Short[] {nextFrame}); - return Utils.rgbtoHexValue(aCurrentFrameRGB[0], aCurrentFrameRGB[1], aCurrentFrameRGB[2]); - - - /*Short aCurrentFrame = ((Map<Integer, Short[]>) extraData).get((int) Short.MAX_VALUE)[0]; - Short[] aCurrentFrameRGB = ((Map<Integer, Short[]>) extraData).get((int) aCurrentFrame); - short nextFrame = aCurrentFrame < 40 ? aCurrentFrame++ : 0; - ((Map<Integer, Short[]>) extraData).put((int) Short.MAX_VALUE, new Short[] {nextFrame}); - return Utils.rgbtoHexValue(aCurrentFrameRGB[0], aCurrentFrameRGB[1], aCurrentFrameRGB[2]);*/ - } - } - - //Rainbow Hue Cycle - else if (this.componentMaterial.getRGBA()[3] == 3) { - if (extraData == null) { - extraData = new HashMap<Integer, Short[]>(); - ((Map<Integer, Short[]>) extraData).put((int) Short.MAX_VALUE, new Short[] {0}); - ((Map<Integer, Short[]>) extraData).put((int) Short.MAX_VALUE-1, new Short[] {0}); - int aSlot = 0; - - //Let's say you're starting with green: - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 0}); - //Slowly start adding in some red to get to yellow: - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 51, 255, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 51, 255, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 51, 255, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {102, 255, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {102, 255, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {102, 255, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {153, 255, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {153, 255, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {153, 255, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {204, 255, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {204, 255, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {204, 255, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 255, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 255, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 255, 0}); - //Then, take out the green to get to red: - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 204, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 204, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 204, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 153, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 153, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 153, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 102, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 102, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 102, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 51, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 51, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 51, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 0}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 0}); - //Now, add blue to get to purple: - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 51}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 51}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 51}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 102}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 102}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 102}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 153}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 153}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 153}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 204}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 204}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 204}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 255}); - //Then, remove red to get to blue: - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {204, 0, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {204, 0, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {204, 0, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {153, 0, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {153, 0, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {153, 0, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {102, 0, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {102, 0, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {102, 0, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 51, 0, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 51, 0, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 51, 0, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 0, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 0, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 0, 255}); - //Add the green back in to get to cyan: - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 51, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 51, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 51, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 102, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 102, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 102, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 153, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 153, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 153, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 204, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 204, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 204, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 255}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 255}); - //And finally remove the blue to get back to green: - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 204}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 204}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 204}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 153}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 153}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 153}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 102}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 102}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 102}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 51}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 51}); - ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 51}); - ((Map<Integer, Short[]>) extraData).put((int) Byte.MAX_VALUE, new Short[] {(short) (((Map<Integer, Short[]>) extraData).size()-1)}); - - - } - if (extraData != null) { - Short aCurrentFrame = ((Map<Integer, Short[]>) extraData).get((int) Short.MAX_VALUE)[0]; - Short aSize = (short) (((Map<Integer, Short[]>) extraData).size() - 3); - short nextFrame = (short) ((aCurrentFrame < aSize) ? (aCurrentFrame+1) : 0); - Short[] aCurrentFrameRGB = ((Map<Integer, Short[]>) extraData).get(aCurrentFrame < aSize ? (int) aCurrentFrame : 0); - ((Map<Integer, Short[]>) extraData).put((int) Short.MAX_VALUE, new Short[] {nextFrame}); - return Utils.rgbtoHexValue(aCurrentFrameRGB[0], aCurrentFrameRGB[1], aCurrentFrameRGB[2]); - } - } - } - - - } - catch (Throwable t) { - - } - return this.componentColour; - - - - - - } - - @Override - public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { - if (CORE.ConfigSwitches.useGregtechTextures) { - if(pass == 0) { - return this.base; - } - return this.overlay; - } - return this.base; - } - - @Override - public void registerIcons(final IIconRegister i) { - - if (CORE.ConfigSwitches.useGregtechTextures){ - this.base = i.registerIcon(getCorrectTextures()); - this.overlay = i.registerIcon(getCorrectTextures() + "_OVERLAY"); - } - else { - this.base = i.registerIcon(getCorrectTextures()); - //this.overlay = i.registerIcon(getCorrectTextures() + "_OVERLAY"); - } - } - - - - - public static enum ComponentTypes { - DUST("Dust", " Dust", "dust", OrePrefixes.dust), - DUSTSMALL("DustSmall", " Dust", "dustSmall", OrePrefixes.dustSmall), - DUSTTINY("DustTiny", " Dust", "dustTiny", OrePrefixes.dustTiny), - INGOT("Ingot", " Ingot", "ingot", OrePrefixes.ingot), - HOTINGOT("HotIngot", " Hot Ingot", "ingotHot", OrePrefixes.ingotHot), - PLATE("Plate", " Plate", "plate", OrePrefixes.plate), - PLATEDOUBLE("PlateDouble", " Double Plate", "plateDouble", OrePrefixes.plateDouble), - ROD("Rod", " Rod", "stick", OrePrefixes.stick), - RODLONG("RodLong", " Long Rod", "stickLong", OrePrefixes.stickLong), - GEAR("Gear", " Gear", "gearGt", OrePrefixes.gearGt), - SMALLGEAR("SmallGear", " Gear", "gearGtSmall", OrePrefixes.gearGtSmall), //TODO - SCREW("Screw", " Screw", "screw", OrePrefixes.screw), - BOLT("Bolt", " Bolt", "bolt", OrePrefixes.bolt), - ROTOR("Rotor", " Rotor", "rotor", OrePrefixes.rotor), - RING("Ring", " Ring", "ring", OrePrefixes.ring), - FOIL("Foil", " Foil", "foil", OrePrefixes.foil), - PLASMACELL("CellPlasma", " Plasma Cell", "cellPlasma", OrePrefixes.cellPlasma), - CELL("Cell", " Cell", "cell", OrePrefixes.cell), - NUGGET("Nugget", " Nugget", "nugget", OrePrefixes.nugget), - PLATEHEAVY("HeavyPlate", "Heavy@Plate", "plateHeavy", OrePrefixes.plateDense), - SPRING("Spring", " Spring", "spring", OrePrefixes.spring), - SMALLSPRING("SmallSpring", "Small@Spring", "springSmall", OrePrefixes.springSmall), - FINEWIRE("FineWire", "Fine@Wire", "wireFine", OrePrefixes.wireFine),; - - private String COMPONENT_NAME; - private String DISPLAY_NAME; - private String OREDICT_NAME; - private OrePrefixes a_GT_EQUAL; - private ComponentTypes (final String LocalName, final String DisplayName, final String OreDictName, final OrePrefixes aPrefix){ - this.COMPONENT_NAME = LocalName; - this.DISPLAY_NAME = DisplayName; - this.OREDICT_NAME = OreDictName; - this.a_GT_EQUAL = aPrefix; - } - - public String getComponent(){ - return this.COMPONENT_NAME; - } - - public String getName(){ - return this.DISPLAY_NAME; - } - - public String getOreDictName(){ - return this.OREDICT_NAME; - } - - public OrePrefixes getGtOrePrefix() { - return this.a_GT_EQUAL; - } - - } - -} - - diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemDamageable.java b/src/Java/gtPlusPlus/core/item/base/BaseItemDamageable.java deleted file mode 100644 index 4209ec0a59..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemDamageable.java +++ /dev/null @@ -1,201 +0,0 @@ -package gtPlusPlus.core.item.base; - -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; - -public class BaseItemDamageable extends Item { - - private final EnumRarity rarity; - private final String itemDescription; - protected String itemName; - private final boolean hasEffect; - - public BaseItemDamageable(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect, final ItemStack OverrideItem) - { - this.setUnlocalizedName(unlocalizedName); - this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setCreativeTab(creativeTab); - this.setMaxStackSize(1); - this.setMaxDamage(251); - this.setNoRepair(); - this.rarity = regRarity; - this.itemDescription = description; - this.hasEffect = Effect; - GameRegistry.registerItem(this, unlocalizedName); - } - - public String getItemDescription(){ - return this.itemDescription; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - int dmg = (int) getItemDamage(stack); - if (dmg <= 3){ - list.add(EnumChatFormatting.GRAY+this.itemDescription); - } - if (dmg > 3 && dmg <= 25){ - list.add(EnumChatFormatting.GRAY+"You have discovered that smashing this against valuable stones has some function.."); - } - else if (dmg > 0){ - int maxDamage = 250; - list.add(EnumChatFormatting.GRAY+""+(maxDamage-getItemDamage(stack))+"/"+maxDamage+" gems remaining."); - } - } - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack){ - int dmg = (int) getItemDamage(par1ItemStack); - if (dmg > 200){ - return EnumRarity.epic; - } - return this.rarity; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack){ - int dmg = (int) getItemDamage(par1ItemStack); - if (dmg > 200){ - return true; - } - return this.hasEffect; - } - - @Override - public String getItemStackDisplayName(final ItemStack tItem) { - if ((this.itemName == null) || this.itemName.equals("")) { - return super.getItemStackDisplayName(tItem); - } - return this.itemName; - } - - private static boolean createNBT(ItemStack rStack){ - final NBTTagCompound tagMain = new NBTTagCompound(); - final NBTTagCompound tagNBT = new NBTTagCompound(); - tagNBT.setLong("Value", 0); - tagMain.setTag("Damage", tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - public static final long getItemDamage(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("Damage"); - if (aNBT != null) { - return aNBT.getLong("Value"); - } - } - else { - createNBT(aStack); - } - return 0L; - } - - public static final boolean setItemDamage(final ItemStack aStack, final long aDamage) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("Damage"); - if (aNBT != null) { - aNBT.setLong("Value", aDamage); - return true; - } - } - else { - createNBT(aStack); - } - return false; - } - - @Override - public double getDurabilityForDisplay(ItemStack stack) { - if (stack.getTagCompound() == null){ - createNBT(stack); - } - double currentDamage = getItemDamage(stack); - double durabilitypercent = currentDamage / 100; - double inverse = (100-durabilitypercent); - return durabilitypercent; - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - int dmg = (int) getItemDamage(stack); - if (dmg <= 20){ - return false; - } - else { - return true; - } - } - - public static ItemStack damageItem(ItemStack item){ - if (item != null){ - long currentUse = BaseItemDamageable.getItemDamage(item); - if (currentUse >= 0 && currentUse <= 250){ - BaseItemDamageable.setItemDamage(item, currentUse+1); - return item; - } - else { - return item; - } - } - return null; - } - - @Override - public boolean doesContainerItemLeaveCraftingGrid(ItemStack stack) { - Logger.INFO("Does Leave Table? "+stack.getDisplayName()); - return true; - } - - @Override - public boolean getShareTag() { - return true; - } - - @Override - public boolean hasContainerItem() { - return true; - } - - @Override - public boolean hasContainerItem(ItemStack stack) { - Logger.INFO("hasContainerItem? "+stack.getDisplayName()); - return true; - } - - @Override - public ItemStack getContainerItem(ItemStack itemStack) { - ItemStack stack = itemStack.copy(); - //stack.setItemDamage(stack.getItemDamage() + 1); - damageItem(stack); - stack.stackSize = 1; - return stack; - } - - @Override - public int getDamage(ItemStack stack) { - return (int) getItemDamage(stack); - } - -} - - - diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java b/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java deleted file mode 100644 index 970d5ec0c8..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java +++ /dev/null @@ -1,28 +0,0 @@ -package gtPlusPlus.core.item.base; - -import java.util.List; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.lib.CORE; - -public class BaseItemGeneric extends Item -{ - public BaseItemGeneric(final String unlocalizedName, final CreativeTabs c, final int stackSize, final int maxDmg) - { - this.setUnlocalizedName(CORE.MODID + "_" + unlocalizedName); - this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setCreativeTab(c); - this.setMaxStackSize(stackSize); - this.setMaxDamage(maxDmg); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - super.addInformation(stack, aPlayer, list, bool); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java b/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java deleted file mode 100644 index 3d9ff9fa48..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java +++ /dev/null @@ -1,109 +0,0 @@ -package gtPlusPlus.core.item.base; - -import java.util.List; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import gregtech.api.enums.Materials; - -import gtPlusPlus.api.enums.Quality; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class BaseItemLoot extends Item{ - - private final String materialName; - private final String unlocalName; - private final LootTypes lootTypes; - private Quality lootQuality; - private final Materials lootMaterial; - - public BaseItemLoot(final LootTypes lootType, final Materials material) { - this.lootTypes = lootType; - this.lootMaterial = material; - this.materialName = material.mDefaultLocalName; - this.unlocalName = "item"+lootType.LOOT_TYPE+this.materialName; - this.setUnlocalizedName(this.unlocalName); - this.setMaxStackSize(1); - this.setTextureName(CORE.MODID + ":" + "item"+lootType.LOOT_TYPE); - } - - public ItemStack generateLootStack(){ - this.lootQuality = Quality.getRandomQuality(); - return ItemUtils.getSimpleStack(this, 1); - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return (this.materialName+this.lootTypes.DISPLAY_SUFFIX); - } - - public final String getMaterialName() { - return this.materialName; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(this.lootQuality.getQuality()); - - /*if (componentMaterial.isRadioactive){ - list.add(CORE.GT_Tooltip_Radioactive); - }*/ - - super.addInformation(stack, aPlayer, list, bool); - } - - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - final short[] temp = this.lootMaterial.mRGBa; - return Utils.rgbtoHexValue(temp[0], temp[1], temp[2]); - } - - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - //EntityUtils.applyRadiationDamageToEntity(lootQuality.vRadioationLevel, world, entityHolding); - } - - - - - - - - - public static enum LootTypes { - Sword("Sword", " Longsword", "sword"), - Shortsword("Sword", " Short Blade", "blade"), - Helmet("Helmet", " Medium Helm", "helmet"), - Chestplate("Platebody", " Chestplate", "platebody"), - Leggings("Platelegs", " Platelegs", "platelegs"), - Boots("Boots", " Boots", "boots"); - private String LOOT_TYPE; - private String DISPLAY_SUFFIX; - private String OREDICT_NAME; - private LootTypes (final String LocalName, final String DisplayName, final String OreDictName){ - this.LOOT_TYPE = LocalName; - this.DISPLAY_SUFFIX = DisplayName; - this.OREDICT_NAME = OreDictName; - } - public String getLootType(){ - return this.LOOT_TYPE; - } - public String getName(){ - return this.DISPLAY_SUFFIX; - } - public String getOreDictName(){ - return this.OREDICT_NAME; - } - } - -} - - diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemTCShard.java b/src/Java/gtPlusPlus/core/item/base/BaseItemTCShard.java deleted file mode 100644 index 4f0db3e2ec..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemTCShard.java +++ /dev/null @@ -1,82 +0,0 @@ -package gtPlusPlus.core.item.base; - -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import gregtech.api.util.GT_OreDictUnificator; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class BaseItemTCShard extends Item{ - - public final String unlocalName; - public final String displayName; - public final String descriptionString; - public final String descriptionString2; - public final int itemColour; - - public BaseItemTCShard(final String DisplayName, final int colour) { - this(DisplayName, colour, ""); - } - - public BaseItemTCShard(final String DisplayName, final int colour, final String Description) { - this(DisplayName, colour, "", Description); - } - - public BaseItemTCShard(final String DisplayName, final int colour, final String Description, final String Description2) { - this.unlocalName = "item"+Utils.sanitizeString(DisplayName); - this.displayName = DisplayName; - this.itemColour = colour; - this.descriptionString = Description; - this.descriptionString2 = Description2; - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(this.unlocalName); - this.setMaxStackSize(64); - this.setTextureName(CORE.MODID + ":" + "itemShard"); - GameRegistry.registerItem(this, this.unlocalName); - GT_OreDictUnificator.registerOre("shard"+DisplayName, ItemUtils.getSimpleStack(this)); - GT_OreDictUnificator.registerOre("gemInfused"+DisplayName, ItemUtils.getSimpleStack(this)); - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return (this.displayName+" Shard"); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if ((this.descriptionString != "") || !this.descriptionString.equals("")){ - list.add(EnumChatFormatting.GRAY+this.descriptionString); - } - if ((this.descriptionString2 != "") || !this.descriptionString2.equals("")){ - list.add(EnumChatFormatting.GRAY+this.descriptionString2); - } - } - - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - return this.itemColour; - } - - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - - } - - -} - - diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java b/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java deleted file mode 100644 index eb066024e0..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java +++ /dev/null @@ -1,341 +0,0 @@ -package gtPlusPlus.core.item.base; - -import java.util.List; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class BaseItemTickable extends CoreItem { - - public final String[] descriptionString; - public final int itemColour; - public final int maxTicks; - public final boolean twoRenderPasses; - public final boolean ticksInContainers; - - public IIcon[] mIcon = new IIcon[2]; - - public BaseItemTickable(boolean twoPass, final String unlocalName, final int colour, final int maxTicks) { - this(false, twoPass, unlocalName, colour, maxTicks, new String[] {}); - } - - public BaseItemTickable(boolean containerTick, boolean twoPass, final String unlocalName, final int colour, final int maxTicks) { - this(containerTick, twoPass, unlocalName, colour, maxTicks, new String[] {}); - } - - public BaseItemTickable(boolean containerTick, boolean twoPass, final String unlocalName, final int colour, final int maxTicks, final String[] Description) { - super(unlocalName, AddToCreativeTab.tabMisc, 1, 999999999, Description, EnumRarity.epic, EnumChatFormatting.DARK_RED, true, null); - this.itemColour = colour; - this.descriptionString = Description; - this.maxTicks = maxTicks; - this.twoRenderPasses = twoPass; - this.ticksInContainers = containerTick; - this.maxStackSize = 1; - //setGregtechItemList(); - } - - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - if (world == null || iStack == null) { - return; - } - if (world.isRemote) { - return; - } - - - boolean active = isTicking(world, iStack); - if (active) { - tickItemTag(world, iStack); - } - - } - - /*private final boolean setGregtechItemList() { - ItemList.Component_LavaFilter.set(this); - return ItemList.Component_LavaFilter.get(1) != null ? true : false; - }*/ - - /** - * - * Handle Custom Rendering - * - */ - - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses(){ - return this.twoRenderPasses; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int renderPass) { - if (renderPass == 1 && this.twoRenderPasses){ - return Utils.rgbtoHexValue(255, 255, 255); - } - return this.itemColour; - } - - @Override - public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { - if (this.twoRenderPasses) { - if(pass == 0) { - return this.mIcon[0]; - } - return this.mIcon[1]; - } - return this.mIcon[0]; - } - - @Override - public void registerIcons(final IIconRegister i) { - - if (this.twoRenderPasses){ - this.mIcon[0] = i.registerIcon(CORE.MODID + ":" + this.getUnlocalizedName()); - this.mIcon[1] = i.registerIcon(CORE.MODID + ":" + this.getUnlocalizedName() + "_OVERLAY"); - } - else { - this.mIcon[0] = i.registerIcon(CORE.MODID + ":" + this.getUnlocalizedName()); - //this.overlay = i.registerIcon(getCorrectTextures() + "_OVERLAY"); - } - } - - protected int getMaxTicks(ItemStack aStack) { - return maxTicks; - } - - protected boolean createNBT(World world, ItemStack rStack){ - final NBTTagCompound tagMain = new NBTTagCompound(); - final NBTTagCompound tagNBT = new NBTTagCompound(); - tagNBT.setLong("Tick", 0); - tagNBT.setLong("maxTick", getMaxTicks(rStack)); - tagNBT.setBoolean("isActive", true); - - //Try set world time - if (world != null) { - //tagNBT.setLong("CreationDate", world.getTotalWorldTime()); - } - - tagMain.setTag("TickableItem", tagNBT); - rStack.setTagCompound(tagMain); - Logger.INFO("Created Tickable NBT data."); - return true; - } - - public final long getTicks(World world, final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("TickableItem"); - if (aNBT != null) { - return aNBT.getLong("Tick"); - } - } - else { - createNBT(world, aStack); - } - return 0L; - } - - public final boolean setTicks(World world, final ItemStack aStack, final long aDamage) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("TickableItem"); - if (aNBT != null) { - aNBT.setLong("Tick", aDamage); - return true; - } - } - else { - createNBT(world, aStack); - } - return false; - } - - public final boolean isTicking(World world, final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("TickableItem"); - if (aNBT != null) { - return aNBT.getBoolean("isActive"); - } - } - else { - return createNBT(world, aStack); - } - return true; - } - - public final boolean setTicking(World world, final ItemStack aStack, final boolean active) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("TickableItem"); - if (aNBT != null) { - aNBT.setBoolean("isActive", active); - return true; - } - } - else { - createNBT(world, aStack); - } - return false; - } - - public final boolean getTicksInContainer(World world, final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("TickableItem"); - if (aNBT != null) { - return aNBT.getBoolean("ticksInContainer"); - } - } - else { - createNBT(world, aStack); - } - return false; - } - - public final boolean setTicksInContainer(World world, final ItemStack aStack, final boolean active) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("TickableItem"); - if (aNBT != null) { - aNBT.setBoolean("ticksInContainer", active); - return true; - } - } - else { - createNBT(world, aStack); - } - return false; - } - - public final long getDifferenceInWorldTimeToCreationTime(World world, final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("TickableItem"); - if (aNBT != null) { - return (world.getTotalWorldTime() - aNBT.getLong("CreationDate")); - } - } - else { - createNBT(world, aStack); - } - return 0L; - } - - public final boolean setItemStackCreationTime(final ItemStack aStack, World world) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("TickableItem"); - if (aNBT != null) { - aNBT.setLong("CreationDate", world.getTotalWorldTime()); - return true; - } - } - else { - createNBT(world, aStack); - } - return false; - } - - public final boolean tickItemTag(World world, ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - if (aNBT.hasKey("TickableItem")) { - aNBT = aNBT.getCompoundTag("TickableItem"); - //Done Ticking - if (getMaxTicks(aStack)-getTicks(world, aStack) <= 0) { - setTicking(world, aStack, false); - return false; - } - if (isTicking(world, aStack)) { - if (aNBT != null) { - aNBT.setLong("Tick", getTicks(world, aStack)+1); - return true; - } - else { - return false; - } - } - else { - return false; - } - } - } - return createNBT(world, aStack); - } - - @Override - public double getDurabilityForDisplay(ItemStack stack) { - if (stack.getTagCompound() == null){ - //createNBT(null, stack); - return 0; - } - double currentDamage = getTicks(null, stack); - double durabilitypercent = currentDamage / getMaxTicks(stack); - return durabilitypercent; - } - - @SuppressWarnings("unchecked") - @Override - public void addInformation(ItemStack stack, EntityPlayer player, @SuppressWarnings("rawtypes") List list, boolean bool) { - World world = player.getEntityWorld(); - if (this.descriptionString.length > 0) { - list.add(EnumChatFormatting.GRAY+this.descriptionString[0]); - } - long maxTicks = getMaxTicks(stack); - long ticks = 0; - if (stack.hasTagCompound()) { - ticks = getTicks(world, stack); - } - EnumChatFormatting durability = EnumChatFormatting.GRAY; - if (maxTicks-ticks > (maxTicks*0.8)){ - durability = EnumChatFormatting.GRAY; - } - else if (maxTicks-ticks > (maxTicks*0.6)){ - durability = EnumChatFormatting.GREEN; - } - else if (maxTicks-ticks > (maxTicks*0.4)){ - durability = EnumChatFormatting.YELLOW; - } - else if (maxTicks-ticks > (maxTicks*0.2)){ - durability = EnumChatFormatting.GOLD; - } - else if (maxTicks-ticks > 0){ - durability = EnumChatFormatting.RED; - } - list.add(durability+""+((maxTicks-ticks)/20)+EnumChatFormatting.GRAY+" seconds until decay"); - - if (this.descriptionString.length > 1) { - for (int h=1;h<this.descriptionString.length;h++) { - list.add(EnumChatFormatting.GRAY+this.descriptionString[h]); - } - } - - //super.addInformation(stack, player, list, bool); - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return false; - } - - -} - - diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemWithCharge.java b/src/Java/gtPlusPlus/core/item/base/BaseItemWithCharge.java deleted file mode 100644 index d81112e0c6..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemWithCharge.java +++ /dev/null @@ -1,76 +0,0 @@ -package gtPlusPlus.core.item.base; - -import java.util.List; - -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; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; - -public class BaseItemWithCharge extends Item{ - - public int int_Charge = 0; - public int int_Max_Charge = 0; - - public BaseItemWithCharge(final String unlocalizedName, final int constructor_Charge, final 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; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - int NBT_Charge = this.int_Charge; - int NBT_Max_Charge = this.int_Max_Charge; - if (stack.stackTagCompound != null) { - NBT_Charge = stack.stackTagCompound.getInteger("charge_Current"); - NBT_Max_Charge = stack.stackTagCompound.getInteger("charge_Max"); - final String tempX = String.valueOf(NBT_Charge); - final String tempY = String.valueOf(NBT_Max_Charge); - final String formattedX = EnumChatFormatting.RED+tempX+EnumChatFormatting.GRAY; - final 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(final ItemStack itemStack, final World world, final EntityPlayer player) { - - } - - @Override - public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4, final boolean par5) { - - } - - @Override - public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer par3Entity) { - itemStack.stackTagCompound = new NBTTagCompound(); - return super.onItemRightClick(itemStack, world, par3Entity); - } - - - -} diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java b/src/Java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java deleted file mode 100644 index 14597ae876..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java +++ /dev/null @@ -1,27 +0,0 @@ -package gtPlusPlus.core.item.base; - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.lib.CORE; - -public class BaseItemWithDamageValue extends Item{ - public BaseItemWithDamageValue(final String unlocalizedName) { - this.setUnlocalizedName(unlocalizedName); - this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setMaxStackSize(1); - this.setMaxDamage(100); - } - @Override - public void setDamage(final ItemStack stack, final int damage) { - super.setDamage(stack, damage); - } - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - super.addInformation(stack, aPlayer, list, bool); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java b/src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java deleted file mode 100644 index 57d42d721e..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java +++ /dev/null @@ -1,254 +0,0 @@ -package gtPlusPlus.core.item.base; - - -import java.util.List; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockLiquid; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.*; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemMonsterPlacer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.*; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; - - - -public class BasicSpawnEgg extends ItemMonsterPlacer -{ - @SideOnly(Side.CLIENT) - private IIcon theIcon; - protected int colorBase = 0x000000; - protected int colorSpots = 0xFFFFFF; - protected String entityMODID = ""; - protected String entityToSpawnName = ""; - protected String entityToSpawnNameFull = ""; - protected EntityLiving entityToSpawn = null; - - public BasicSpawnEgg(){ - super(); - } - - public BasicSpawnEgg(final String MODID, final String parEntityToSpawnName, final int parPrimaryColor, final int parSecondaryColor){ - this.setHasSubtypes(false); - this.maxStackSize = 64; - this.setCreativeTab(AddToCreativeTab.tabOther); - this.setEntityToSpawnName(parEntityToSpawnName); - this.colorBase = parPrimaryColor; - this.colorSpots = parSecondaryColor; - this.entityMODID = MODID; - - // DEBUG - Logger.WARNING("Spawn egg constructor for "+this.entityToSpawnName); - } - - /** - * Callback for item usage. If the item does something special on right clicking, - - * he will have one of those. Return - * True if something happen and false if it don't. This is for ITEMS, not BLOCKS - */ - @Override - public boolean onItemUse(final ItemStack par1ItemStack, final EntityPlayer par2EntityPlayer, final World par3World, int par4, int par5, int par6, final int par7, final float par8, final float par9, final float par10){ - if (par3World.isRemote) - { - return true; - } - final Block block = par3World.getBlock(par4, par5, par6); - par4 += Facing.offsetsXForSide[par7]; - par5 += Facing.offsetsYForSide[par7]; - par6 += Facing.offsetsZForSide[par7]; - double d0 = 0.0D; - - if ((par7 == 1) && (block.getRenderType() == 11)) - { - d0 = 0.5D; - } - - final Entity entity = this.spawnEntity(par3World, par4 + 0.5D, par5 + d0, par6 + 0.5D); - - if (entity != null) - { - if ((entity instanceof EntityLivingBase) && par1ItemStack.hasDisplayName()) - { - ((EntityLiving)entity).setCustomNameTag(par1ItemStack.getDisplayName()); - } - - if (!par2EntityPlayer.capabilities.isCreativeMode) - { - --par1ItemStack.stackSize; - } - } - - return true; - } - - /** - * Called whenever this item is equipped and the right mouse button is pressed. - - *Args: itemStack, world, entityPlayer - */ - @Override - public ItemStack onItemRightClick(final ItemStack par1ItemStack, final World par2World, final EntityPlayer par3EntityPlayer){ - if (par2World.isRemote) - { - return par1ItemStack; - } - final MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true); - - if (movingobjectposition == null) - { - return par1ItemStack; - } - if (movingobjectposition.typeOfHit == MovingObjectPosition - - .MovingObjectType.BLOCK) - - { - final int i = movingobjectposition.blockX; - final int j = movingobjectposition.blockY; - final int k = movingobjectposition.blockZ; - - if (!par2World.canMineBlock(par3EntityPlayer, i, j, k)) - { - return par1ItemStack; - } - - if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, par1ItemStack)) - { - return par1ItemStack; - } - - if (par2World.getBlock(i, j, k) instanceof BlockLiquid) - { - final Entity entity = this.spawnEntity(par2World, i, j, k); - - if (entity != null) - { - if ((entity instanceof EntityLivingBase) && par1ItemStack.hasDisplayName()) - { - ((EntityLiving)entity).setCustomNameTag(par1ItemStack.getDisplayName()); - } - - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - --par1ItemStack.stackSize; - } - } - } - } - - return par1ItemStack; - } - - /** - * Spawns the creature specified by the egg's type in the location specified by - - * the last three parameters. - * Parameters: world, entityID, x, y, z. - */ - public Entity spawnEntity(final World parWorld, final double parX, final double parY, final double parZ){ - - if (!parWorld.isRemote) // never spawn entity on client side - { - this.entityToSpawnNameFull = this.entityMODID+"."+this.entityToSpawnName; - if (EntityList.stringToClassMapping.containsKey(this.entityToSpawnNameFull)) - { - this.entityToSpawn = (EntityLiving) EntityList - - .createEntityByName(this.entityToSpawnNameFull, parWorld); - this.entityToSpawn.setLocationAndAngles(parX, parY, parZ, - - MathHelper.wrapAngleTo180_float(parWorld.rand.nextFloat() - - * 360.0F), 0.0F); - parWorld.spawnEntityInWorld(this.entityToSpawn); - this.entityToSpawn.onSpawnWithEgg((IEntityLivingData)null); - this.entityToSpawn.playLivingSound(); - } - else - { - //DEBUG - Logger.WARNING("Entity not found "+this.entityToSpawnName); - } - } - - return this.entityToSpawn; - } - - - /** - * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(final Item parItem, final CreativeTabs parTab, final List parList){ - parList.add(new ItemStack(parItem, 1, 0)); - } - - @Override - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(final ItemStack par1ItemStack, final int parColorType){ - return (parColorType == 0) ? this.colorBase : this.colorSpots; - } - - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses(){ - return true; - } - - @Override - // Doing this override means that there is no localization for language - // unless you specifically check for localization here and convert - public String getItemStackDisplayName(final ItemStack par1ItemStack){ - return "Spawn "+this.entityToSpawnName; - } - - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(final IIconRegister par1IconRegister){ - super.registerIcons(par1IconRegister); - this.theIcon = par1IconRegister.registerIcon(this.getIconString() + "_overlay"); - } - - /** - * Gets an icon index based on an item's damage value and the given render pass - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamageForRenderPass(final int parDamageVal, final int parRenderPass){ - return parRenderPass > 0 ? this.theIcon : super.getIconFromDamageForRenderPass(parDamageVal, parRenderPass); - } - - public void setColors(final int parColorBase, final int parColorSpots){ - this.colorBase = parColorBase; - this.colorSpots = parColorSpots; - } - - public int getColorBase(){ - return this.colorBase; - } - - public int getColorSpots(){ - return this.colorSpots; - } - - public final void setEntityToSpawnName(final String parEntityToSpawnName){ - this.entityToSpawnName = parEntityToSpawnName; - this.entityToSpawnNameFull = this.entityMODID+"."+this.entityToSpawnName; - } - -} - diff --git a/src/Java/gtPlusPlus/core/item/base/CoreItem.java b/src/Java/gtPlusPlus/core/item/base/CoreItem.java deleted file mode 100644 index 7ce96b2a88..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/CoreItem.java +++ /dev/null @@ -1,237 +0,0 @@ -package gtPlusPlus.core.item.base; - -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class CoreItem extends Item -{ - - private final EnumRarity rarity; - private final EnumChatFormatting descColour; - private final String[] itemDescription; - protected String itemName; - private final boolean hasEffect; - - //Replace Item - What does this item turn into when held. - private final ItemStack turnsInto; - - //0 - /* - * Name, Tab - 64 Stack, 0 Dmg - */ - public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab) - { - this(unlocalizedName, creativeTab, 64, 0); //Calls 3 - } - - //0 - /* - * Name, Tab - 64 Stack, 0 Dmg - */ - public CoreItem(final String unlocalizedName, final String displayName, final CreativeTabs creativeTab) - { - this(unlocalizedName, creativeTab, 64, 0); //Calls 3 - this.itemName = displayName; - } - - //0.1 - /* - * Name, Tab - 64 Stack, 0 Dmg - */ - public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final ItemStack OverrideItem) - { - this(unlocalizedName, creativeTab, 64, 0, new String[] {"This item will be replaced by another when held by a player, it is old and should not be used in recipes."}, EnumRarity.uncommon, EnumChatFormatting.UNDERLINE, false, OverrideItem); //Calls 5 - } - //0.1 - /* - * Name, Tab - 64 Stack, 0 Dmg - */ - public CoreItem(final String unlocalizedName, final String displayName, final CreativeTabs creativeTab, final ItemStack OverrideItem) - { - this(unlocalizedName, creativeTab, 64, 0, new String[] {"This item will be replaced by another when held by a player, it is old and should not be used in recipes."}, EnumRarity.uncommon, EnumChatFormatting.UNDERLINE, false, OverrideItem); //Calls 5 - this.itemName = displayName; - } - - //1 - /* - * Name, Tab, Stack - 0 Dmg - */ - public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize) - { - this(unlocalizedName, creativeTab, stackSize, 0); //Calls 3 - } - //2 - /* - * Name, Tab, Stack, Description - 0 Dmg - */ - public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final String[] description) - { - this(unlocalizedName, creativeTab, stackSize, 0, description); //Calls 4 - } - //3 - /* - * Name, Tab, Stack, Dmg - Description - */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, String string) { - this(unlocalizedName, creativeTab, stackSize, new String[] {string}); - } - public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg) - { - this(unlocalizedName, creativeTab, stackSize, maxDmg, new String[] {}); //Calls 4 - } - //4 //Not Rare + basic tooltip - /* - * Name, Tab, Stack, Dmg, Description - */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String string) { - this(unlocalizedName, creativeTab, stackSize, maxDmg, new String[] {string}); - } - public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String[] description) - { - this(unlocalizedName, creativeTab, stackSize, maxDmg, description, EnumRarity.common, EnumChatFormatting.GRAY, false, null); //Calls 4.5 - } - //4.5 - /* - * Name, Tab, Stack, Dmg, Description, Text Colour - Common - */ - public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String[] description, final EnumChatFormatting colour) - { - this(unlocalizedName, creativeTab, stackSize, maxDmg, description, EnumRarity.common, colour, false, null); //Calls 5 - } - - //4.75 - /* - * Name, Tab, Stack, Dmg, Description, Rarity - Gray text - */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String string, EnumRarity uncommon) { - this(unlocalizedName, creativeTab, stackSize, maxDmg, new String[] {string}, uncommon); - } - public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String[] description, final EnumRarity rarity) - { - this(unlocalizedName, creativeTab, stackSize, maxDmg, description, rarity, EnumChatFormatting.GRAY, false, null); //Calls 5 - } - - //5 - /* - * Name, Tab, Stack, Dmg, Description, Rarity, Text Colour, Effect - */ - public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String[] description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect, final ItemStack OverrideItem) - { - this.setUnlocalizedName(unlocalizedName); - this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setCreativeTab(creativeTab); - this.setMaxStackSize(stackSize); - this.setMaxDamage(maxDmg); - this.rarity = regRarity; - this.itemDescription = description; - this.descColour = colour; - this.hasEffect = Effect; - this.turnsInto = OverrideItem; - GameRegistry.registerItem(this, unlocalizedName); - } - - //6 - /* - * Name, Tab, Stack, Dmg, Description, Rarity, Text Colour, Effect - */ - public CoreItem(final String unlocalizedName, final String displayName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String[] description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect, final ItemStack OverrideItem) - { - this.setUnlocalizedName(unlocalizedName); - this.itemName = displayName; - this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setCreativeTab(creativeTab); - this.setMaxStackSize(stackSize); - this.setMaxDamage(maxDmg); - this.rarity = regRarity; - this.itemDescription = description; - this.descColour = colour; - this.hasEffect = Effect; - this.turnsInto = OverrideItem; - GameRegistry.registerItem(this, unlocalizedName); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if (this.itemDescription.length > 0) { - for (int u=0;u<this.itemDescription.length;u++) { - list.add(this.descColour+this.itemDescription[u]); - } - } - //list.add(this.descColour+this.itemDescription); - //super.addInformation(stack, aPlayer, list, bool); - } - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack){ - return this.rarity; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack){ - return this.hasEffect; - } - - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - if (this.turnsInto != null){ - if (entityHolding instanceof EntityPlayer){ - - Logger.INFO("Replacing "+iStack.getDisplayName()+" with "+this.turnsInto.getDisplayName()+"."); - final ItemStack tempTransform = this.turnsInto; - if (iStack.stackSize == 64){ - tempTransform.stackSize=64; - ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform)); - for (int l=0;l<64;l++){ - ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this); - } - - } - else { - tempTransform.stackSize=1; - ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform)); - ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this); - } - } - } - } - - @Override - public boolean isDamageable() { - return false; - } - - @Override - public boolean isRepairable() { - return false; - } - - public ItemStack getStack() { - return ItemUtils.getSimpleStack(this); - } - -/* @Override - public String getItemStackDisplayName(final ItemStack tItem) { - if ((this.itemName == null) || this.itemName.equals("")) { - return super.getItemStackDisplayName(tItem); - } - return this.itemName; - }*/ -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java b/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java deleted file mode 100644 index 0420809253..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java +++ /dev/null @@ -1,11 +0,0 @@ -package gtPlusPlus.core.item.base.bolts; - -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.material.Material; - -public class BaseItemBolt extends BaseItemComponent{ - - public BaseItemBolt(final Material material) { - super(material, BaseItemComponent.ComponentTypes.BOLT); - } -} diff --git a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java deleted file mode 100644 index 688483b831..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java +++ /dev/null @@ -1,66 +0,0 @@ -package gtPlusPlus.core.item.base.cell; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import ic2.core.Ic2Items; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; - -public class BaseItemCell extends BaseItemComponent{ - - ComponentTypes Cell = ComponentTypes.CELL; - - public BaseItemCell(final Material material) { - super(material, BaseItemComponent.ComponentTypes.CELL); - this.fluidColour = (short[]) material.getRGBA(); - //FluidContainerRegistry.registerFluidContainer(material.getFluid(1000), ItemUtils.getSimpleStack(this), Ic2Items.cell.copy()); - } - - public BaseItemCell(final String unlocalName, final String localName, final short[] RGBa) { - super(unlocalName, localName, RGBa); - this.fluidColour = RGBa; - FluidContainerRegistry.registerFluidContainer(FluidUtils.getFluidStack(unlocalName.toLowerCase(), 0), ItemUtils.getSimpleStack(this), Ic2Items.cell.copy()); - } - - public BaseItemCell(final String unlocalName, final String localName, final short[] RGBa, final Fluid cellFluid) { - super(unlocalName, localName, RGBa); - this.fluidColour = RGBa; - FluidContainerRegistry.registerFluidContainer(FluidUtils.getFluidStack(cellFluid, 1000), ItemUtils.getSimpleStack(this), Ic2Items.cell.copy()); - } - - @Override - public void registerIcons(final IIconRegister i) { - - if (CORE.ConfigSwitches.useGregtechTextures){ - this.base = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "cell"); - this.overlay = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "cell_OVERLAY"); - } - else { - this.base = i.registerIcon(CORE.MODID + ":" + "item"+this.Cell.getComponent()); - this.overlay = i.registerIcon(CORE.MODID + ":" + "item"+this.Cell.getComponent()+"_Overlay"); - } - //this.overlay = cellMaterial.getFluid(1000).getFluid().get - } - - private final short[] fluidColour; - boolean upwards = true; - - @Override - public int getColorFromItemStack(final ItemStack stack, final int renderPass) { - if (renderPass == 0 && !CORE.ConfigSwitches.useGregtechTextures){ - return Utils.rgbtoHexValue(230, 230, 230); - } - if (renderPass == 1 && CORE.ConfigSwitches.useGregtechTextures){ - return Utils.rgbtoHexValue(230, 230, 230); - } - return this.componentColour; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java deleted file mode 100644 index 23d1d022fa..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java +++ /dev/null @@ -1,83 +0,0 @@ -package gtPlusPlus.core.item.base.cell; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.DamageSource; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; - -public class BaseItemPlasmaCell extends BaseItemComponent{ - - private IIcon base; - private IIcon overlay; - ComponentTypes PlasmaCell = ComponentTypes.PLASMACELL; - private int tickCounter = 0; - private final int tickCounterMax = 200; - private final short[] fluidColour; - - public BaseItemPlasmaCell(final Material material) { - super(material, ComponentTypes.PLASMACELL); - this.fluidColour = (short[]) material.getRGBA(); - } - - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses(){ - return true; - } - - @Override - public void registerIcons(final IIconRegister i) { - this.base = i.registerIcon(CORE.MODID + ":" + "item"+this.PlasmaCell.getComponent()); - this.overlay = i.registerIcon(CORE.MODID + ":" + "item"+this.PlasmaCell.getComponent()+"_Overlay"); - //this.overlay = cellMaterial.getFluid(1000).getFluid().get - } - - - @Override - public int getColorFromItemStack(final ItemStack stack, final int renderPass) { - if (renderPass == 0){ - return Utils.rgbtoHexValue(230, 230, 230); - } - return this.componentColour; - } - - @Override - public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { - if(pass == 0) { - return this.base; - } - return this.overlay; - } - - @Override - public String getItemStackDisplayName(final ItemStack cell) { - return this.materialName+" Plasma Cell"; - } - - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - if (this.componentMaterial != null){ - if (!world.isRemote){ - if(this.tickCounter < this.tickCounterMax ){ - this.tickCounter++; - } - else if(this.tickCounter >= this.tickCounterMax){ - entityHolding.attackEntityFrom(DamageSource.onFire, 2); - this.tickCounter = 0; - } - } - } - super.onUpdate(iStack, world, entityHolding, p_77663_4_, p_77663_5_); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java deleted file mode 100644 index 9022f864cb..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java +++ /dev/null @@ -1,145 +0,0 @@ -package gtPlusPlus.core.item.base.dusts; - -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.material.Material; - -public class BaseItemDust extends BaseItemComponent { - - private BaseItemComponent[] mSizedDusts = new BaseItemComponent[2]; - - public BaseItemDust(Material aMat) { - this(aMat, true); - } - - public BaseItemDust(Material aMat, boolean generateSmallDusts) { - super(aMat, ComponentTypes.DUST); - if (generateSmallDusts) { - mSizedDusts[0] = new BaseItemComponent(aMat, ComponentTypes.DUSTSMALL); - mSizedDusts[1] = new BaseItemComponent(aMat, ComponentTypes.DUSTTINY); - } - } - - public BaseItemDust(DustState aState, Material aMat) { - super(aMat, ComponentTypes.DUST); - if (aState.generatesSmallDust()) { - mSizedDusts[0] = new BaseItemComponent(aMat, ComponentTypes.DUSTSMALL); - } - if (aState.generatesTinyDust()) { - mSizedDusts[1] = new BaseItemComponent(aMat, ComponentTypes.DUSTTINY); - } - } - - private BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, int tier, boolean addRecipes) { - super(matInfo, ComponentTypes.DUST); - } - - public static class DustState { - static final int NORMAL = (1); - static final int SMALL = (10); - static final int TINY = (100); - final int MIXTURE; - final boolean[] doesThings = new boolean[3]; - - public DustState (boolean genDust, boolean genSmallDust, boolean genDustTiny){ - int aTotal = 0; - if (genDust) { - aTotal += NORMAL; - doesThings[0] = true; - } - else { - doesThings[0] = false; - } - if (genSmallDust) { - aTotal += SMALL; - doesThings[1] = true; - } - else { - doesThings[1] = false; - } - if (genDustTiny) { - aTotal += TINY; - doesThings[2] = true; - } - else { - doesThings[2] = false; - } - MIXTURE = aTotal; - } - - public boolean generatesDust() { - return doesThings[0]; - } - public boolean generatesSmallDust() { - return doesThings[1]; - } - public boolean generatesTinyDust() { - return doesThings[2]; - } - - private DustState(int amount) { - - if (amount == 1) { - doesThings[0] = true; - doesThings[1] = false; - doesThings[2] = false; - - } - else if (amount == 10) { - doesThings[0] = false; - doesThings[1] = true; - doesThings[2] = false; - } - else if (amount == 100) { - doesThings[0] = false; - doesThings[1] = false; - doesThings[2] = true; - - } - else if (amount == 11) { - doesThings[0] = true; - doesThings[1] = true; - doesThings[2] = false; - - } - else if (amount == 101) { - doesThings[0] = true; - doesThings[1] = false; - doesThings[2] = true; - - } - else if (amount == 110) { - doesThings[0] = false; - doesThings[1] = true; - doesThings[2] = true; - - } - else if (amount == 111) { - doesThings[0] = true; - doesThings[1] = true; - doesThings[2] = true; - } - else { - doesThings[0] = false; - doesThings[1] = false; - doesThings[2] = false; - } - MIXTURE = amount; - } - - public DustState get(int a) { - if (a == 1) { - return new DustState(NORMAL); - } - else if (a == 10) { - return new DustState(SMALL); - } - else if (a == 100) { - return new DustState(TINY); - } - else { - return new DustState(MIXTURE); - } - } - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java deleted file mode 100644 index 8ee871e9c4..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java +++ /dev/null @@ -1,44 +0,0 @@ -package gtPlusPlus.core.item.base.dusts; - -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.lib.CORE; - -public abstract class BaseItemDustAbstract extends Item{ - - protected int colour = 0; - protected String materialName; - protected String pileType; - - public BaseItemDustAbstract(final String unlocalizedName, final String materialName, final int colour, final String pileSize) { - this.setUnlocalizedName(unlocalizedName); - this.setMaxStackSize(64); - if (pileSize.equalsIgnoreCase("dust")){ - this.setTextureName(CORE.MODID + ":" + "dust"); - } - else{ - this.setTextureName(CORE.MODID + ":" + "dust"+pileSize); - } - this.setMaxStackSize(64); - this.colour = colour; - this.materialName = materialName; - this.setUnlocalizedName(unlocalizedName); - GameRegistry.registerItem(this, unlocalizedName); - } - - @SuppressWarnings("rawtypes") - @Override - public abstract void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool); - - public abstract String getMaterialName(); - - @Override - public abstract int getColorFromItemStack(ItemStack stack, int hex); - -} diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustEx.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustEx.java deleted file mode 100644 index 0757177e58..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustEx.java +++ /dev/null @@ -1,126 +0,0 @@ -package gtPlusPlus.core.item.base.dusts; - -import java.util.*; - -import org.apache.commons.lang3.StringUtils; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -import gregtech.api.enums.TextureSet; -import gregtech.api.util.GT_OreDictUnificator; - -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class BaseItemDustEx extends BaseItemComponent{ - - public static Map<String, String> mCachedPileLinkages = new HashMap<String, String>(); - - protected IIcon[] baseAr = new IIcon[3]; - protected IIcon[] overlayAr = new IIcon[3]; - public final static ComponentTypes[] componentTypeAr = new ComponentTypes[] {ComponentTypes.DUST, ComponentTypes.DUSTSMALL, ComponentTypes.DUSTTINY}; - - public BaseItemDustEx(final Material material) { - super(material, componentTypeAr[0]); - //OreDict this beauty - GT_OreDictUnificator.registerOre(componentTypeAr[0].getOreDictName()+material.getUnlocalizedName(), ItemUtils.simpleMetaStack(this, 0, 1)); - GT_OreDictUnificator.registerOre(componentTypeAr[1].getOreDictName()+material.getUnlocalizedName(), ItemUtils.simpleMetaStack(this, 0, 1)); - GT_OreDictUnificator.registerOre(componentTypeAr[2].getOreDictName()+material.getUnlocalizedName(), ItemUtils.simpleMetaStack(this, 0, 1)); - bakeRegistry(); - } - - private void bakeRegistry() { - String unlocalName = getUnlocalizedName(); - if (unlocalName.contains("item.")) { - unlocalName = StringUtils.remove(unlocalName, "item."); - } - if (unlocalName.contains("itemDust")) { - unlocalName = StringUtils.remove(unlocalName, "itemDust"); - } - mCachedPileLinkages.put(this.getUnlocalizedName(), "itemDust"+unlocalName); - mCachedPileLinkages.put(this.getUnlocalizedName(), "itemDustSmall"+unlocalName); - mCachedPileLinkages.put(this.getUnlocalizedName(), "itemDustTiny"+unlocalName); - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 3; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public IIcon getIconFromDamageForRenderPass(int meta, int pass) { - if (CORE.ConfigSwitches.useGregtechTextures) { - if (meta == 0) { - if (pass == 0) { - return this.baseAr[0]; - } - else { - return this.overlayAr[0]; - } - } - else if (meta == 1) { - if (pass == 0) { - return this.baseAr[1]; - } - else { - return this.overlayAr[1]; - } - } - else { - if (pass == 0) { - return this.baseAr[2]; - } - else { - return this.overlayAr[2]; - } - } - } - else { - return this.baseAr[meta]; - } - } - - @Override - public void registerIcons(final IIconRegister i) { - if (CORE.ConfigSwitches.useGregtechTextures){ - this.baseAr[0] = i.registerIcon(getCorrectTextures()); - this.overlayAr[0] = i.registerIcon(getCorrectTextures() + "_OVERLAY"); - this.baseAr[1] = i.registerIcon(getCorrectTextures()+"Small"); - this.overlayAr[1] = i.registerIcon(getCorrectTextures() + "Small_OVERLAY"); - this.baseAr[2] = i.registerIcon(getCorrectTextures()+"Tiny"); - this.overlayAr[2] = i.registerIcon(getCorrectTextures() + "Tiny_OVERLAY"); - } - else { - this.baseAr[0] = i.registerIcon(getCorrectTextures()); - this.baseAr[1] = i.registerIcon(getCorrectTextures()+"Small"); - this.baseAr[2] = i.registerIcon(getCorrectTextures()+"Tiny"); - } - } - - @Override - public String getCorrectTextures(){ - if (!CORE.ConfigSwitches.useGregtechTextures){ - return CORE.MODID + ":" + "item"+this.componentType.getComponent(); - } - String metType = "9j4852jyo3rjmh3owlhw9oe"; - if (this.componentMaterial != null) { - TextureSet u = this.componentMaterial.getTextureSet(); - if (u != null) { - metType = u.mSetName; - } - } - metType = (metType.equals("9j4852jyo3rjmh3owlhw9oe") ? "METALLIC" : metType); - return "gregtech" + ":" + "materialicons/"+metType+"/" + this.componentType.getOreDictName(); - } - - -} diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java deleted file mode 100644 index e4fa06c58e..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java +++ /dev/null @@ -1,162 +0,0 @@ -package gtPlusPlus.core.item.base.dusts; - -import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_OreDictUnificator; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.data.StringUtils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class BaseItemDustUnique extends Item{ - - protected final int colour; - protected final int sRadiation; - protected final String materialName; - protected final String name; - protected final String chemicalNotation; - - public BaseItemDustUnique(final String unlocalizedName, final String materialName, final int colour, final String pileSize) { - this(unlocalizedName, materialName, "NullFormula", colour, pileSize); - } - - public BaseItemDustUnique(final String unlocalizedName, final String materialName, final String mChemicalFormula, final int colour, final String pileSize) { - this.setUnlocalizedName(unlocalizedName); - this.setMaxStackSize(64); - this.setTextureName(this.getCorrectTexture(pileSize)); - this.setCreativeTab(tabMisc); - this.colour = colour; - this.materialName = materialName; - if (mChemicalFormula == null || mChemicalFormula.equals("") || mChemicalFormula.equals("NullFormula")){ - this.chemicalNotation = StringUtils.subscript(materialName); - } - else { - this.chemicalNotation = StringUtils.subscript(mChemicalFormula); - } - this.sRadiation = ItemUtils.getRadioactivityLevel(materialName); - GameRegistry.registerItem(this, unlocalizedName); - - if (this.getUnlocalizedName().contains("DustTiny")){ - this.name = "Tiny Pile of "+this.materialName+ " Dust"; - } - else if (this.getUnlocalizedName().contains("DustSmall")){ - this.name = "Small Pile of "+this.materialName+ " Dust"; - } - else { - this.name = this.materialName+ " Dust"; - } - - String temp = ""; - Logger.WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); - if (this.getUnlocalizedName().contains("item.")){ - temp = this.getUnlocalizedName().replace("item.", ""); - Logger.WARNING("Generating OreDict Name: "+temp); - } - else { - temp = this.getUnlocalizedName(); - } - if (temp.contains("DustTiny")){ - temp = temp.replace("itemD", "d"); - Logger.WARNING("Generating OreDict Name: "+temp); - } - else if (temp.contains("DustSmall")){ - temp = temp.replace("itemD", "d"); - Logger.WARNING("Generating OreDict Name: "+temp); - } - else { - temp = temp.replace("itemD", "d"); - Logger.WARNING("Generating OreDict Name: "+temp); - } - if ((temp != null) && !temp.equals("")){ - GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); - } - registerComponent(); - } - - public boolean registerComponent() { - if (this.materialName == null) { - return false; - } - String aName = materialName; - //Register Component - Map<String, ItemStack> aMap = Material.mComponentMap.get(aName); - if (aMap == null) { - aMap = new HashMap<String, ItemStack>(); - } - String aKey = OrePrefixes.dust.name(); - ItemStack x = aMap.get(aKey); - if (x == null) { - aMap.put(aKey, ItemUtils.getSimpleStack(this)); - Logger.MATERIALS("Registering a material component. Item: ["+aName+"] Map: ["+aKey+"]"); - Material.mComponentMap.put(aName, aMap); - return true; - } - else { - //Bad - Logger.MATERIALS("Tried to double register a material component. "); - return false; - } - } - - @Override - public String getItemStackDisplayName(final ItemStack iStack) { - return this.name; - } - - private String getCorrectTexture(final String pileSize){ - if (!CORE.ConfigSwitches.useGregtechTextures){ - if ((pileSize.equals("dust")) || (pileSize.equals("Dust"))){ - this.setTextureName(CORE.MODID + ":" + "dust");} - else{ - this.setTextureName(CORE.MODID + ":" + "dust"+pileSize); - } - } - if (pileSize.toLowerCase().contains("small")){ - return "gregtech" + ":" + "materialicons/SHINY/dustSmall"; - } - else if (pileSize.toLowerCase().contains("tiny")){ - return "gregtech" + ":" + "materialicons/SHINY/dustTiny"; - } - return "gregtech" + ":" + "materialicons/SHINY/dust"; - } - - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if (this.sRadiation > 0){ - list.add(CORE.GT_Tooltip_Radioactive); - } - if (this.chemicalNotation.length() > 0 && !chemicalNotation.equals("") && !chemicalNotation.equals("NullFormula")){ - list.add(this.chemicalNotation); - } - super.addInformation(stack, aPlayer, list, bool); - } - - public final String getMaterialName() { - return StringUtils.subscript(this.materialName); - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - if (this.colour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return this.colour; - - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java deleted file mode 100644 index c6aff85da1..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java +++ /dev/null @@ -1,58 +0,0 @@ -package gtPlusPlus.core.item.base.dusts.decimal; - -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; - -public class BaseItemCentidust extends Item{ - - final Material dustMaterial; - final String materialName; - final String unlocalName; - - public BaseItemCentidust(final Material material) { - this.dustMaterial = material; - this.unlocalName = "itemCentidust"+material.getUnlocalizedName(); - this.materialName = material.getLocalizedName(); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(this.unlocalName); - this.setMaxStackSize(10); - this.setTextureName(CORE.MODID + ":" + "itemCentidust"); //TODO - GameRegistry.registerItem(this, this.unlocalName); - //GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"), UtilsItems.getSimpleStack(this)); //TODO - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - - return (this.materialName+ " Centidust"); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if ((this.materialName != null) && (this.materialName != "") && !this.materialName.equals("")){ - list.add(EnumChatFormatting.GRAY+"1% of a " + this.materialName + " dust pile."); - } - super.addInformation(stack, aPlayer, list, bool); - } - - public final String getMaterialName() { - return this.materialName; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - return this.dustMaterial.getRgbAsHex(); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java deleted file mode 100644 index 2d1b4a8d27..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java +++ /dev/null @@ -1,58 +0,0 @@ -package gtPlusPlus.core.item.base.dusts.decimal; - -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; - -public class BaseItemDecidust extends Item{ - - final Material dustMaterial; - final String materialName; - final String unlocalName; - - public BaseItemDecidust(final Material material) { - this.dustMaterial = material; - this.unlocalName = "itemDecidust"+material.getUnlocalizedName(); - this.materialName = material.getLocalizedName(); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(this.unlocalName); - this.setMaxStackSize(10); - this.setTextureName(CORE.MODID + ":" + "itemDecidust"); //TODO - GameRegistry.registerItem(this, this.unlocalName); - //GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"), UtilsItems.getSimpleStack(this)); //TODO - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - - return (this.materialName+ " Decidust"); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if ((this.materialName != null) && (this.materialName != "") && !this.materialName.equals("")){ - list.add(EnumChatFormatting.GRAY+"10% of a " + this.materialName + " dust pile."); - } - super.addInformation(stack, aPlayer, list, bool); - } - - public final String getMaterialName() { - return this.materialName; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - return this.dustMaterial.getRgbAsHex(); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/foil/BaseItemFoil.java b/src/Java/gtPlusPlus/core/item/base/foil/BaseItemFoil.java deleted file mode 100644 index 3e2816bf52..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/foil/BaseItemFoil.java +++ /dev/null @@ -1,11 +0,0 @@ -package gtPlusPlus.core.item.base.foil; - -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.material.Material; - -public class BaseItemFoil extends BaseItemComponent{ - - public BaseItemFoil(final Material material) { - super(material, BaseItemComponent.ComponentTypes.FOIL); - } -} diff --git a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemFood.java b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemFood.java deleted file mode 100644 index 54aa90c03f..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemFood.java +++ /dev/null @@ -1,50 +0,0 @@ -package gtPlusPlus.core.item.base.foods; - -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemFood; -import net.minecraft.item.ItemStack; -import net.minecraft.potion.PotionEffect; -import net.minecraft.world.World; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; - -public class BaseItemFood extends ItemFood { - - private final PotionEffect[] effects; - protected String localName; - - public BaseItemFood(final String unlocalizedName, final String localizedName, final int healAmount, final float saturationModifier, final boolean wolvesFavorite, final PotionEffect... effects) { - super(healAmount, saturationModifier, wolvesFavorite); - this.setUnlocalizedName(unlocalizedName); - this.setTextureName(CORE.MODID + ":" + unlocalizedName.replace("Hot", "")); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.effects = effects; - this.localName = localizedName; - GameRegistry.registerItem(this, unlocalizedName); - } - - @Override - protected void onFoodEaten(final ItemStack stack, final World world, final EntityPlayer player) { - super.onFoodEaten(stack, world, player); - - for (int i = 0; i < this.effects.length; i ++) { - if (!world.isRemote && (this.effects[i] != null) && (this.effects[i].getPotionID() > 0)) { - player.addPotionEffect(new PotionEffect(this.effects[i].getPotionID(), - this.effects[i].getDuration(), this.effects[i].getAmplifier(), - this.effects[i].getIsAmbient() - ) - ); - } - } - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - - return ("A Serving of "+this.localName); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java deleted file mode 100644 index 528b9593e6..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java +++ /dev/null @@ -1,80 +0,0 @@ -package gtPlusPlus.core.item.base.foods; - -import java.util.List; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.DamageSource; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class BaseItemHotFood extends BaseItemFood{ - - protected String materialName; - protected String unlocalName; - protected int cooldownTime; - protected Item output; - - public BaseItemHotFood(final String unlocalizedName, final int healAmount, final float healSaturation, final String foodName, final int timeToCoolInSeconds, final Item cooledFood) { - super(unlocalizedName, "Hot "+foodName, healAmount, healSaturation, false); - this.unlocalName = unlocalizedName; - this.cooldownTime = timeToCoolInSeconds * 20; - this.materialName = foodName; - this.output = cooledFood; - this.setMaxStackSize(1); - } - - @Override - public ItemStack onEaten(final ItemStack iStack, final World world, final EntityPlayer player) { - return super.onEaten(iStack, world, player); - } - - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - //Utils.LOG_INFO("Item Damage: "+iStack.getItemDamage()+" Max Damage: "+iStack.getMaxDamage()); - if (!world.isRemote){ - if(iStack.getItemDamage() == this.cooldownTime) { - if (entityHolding instanceof EntityPlayer){ - Logger.INFO("Foods Done."); - ((EntityPlayer) entityHolding).inventory.addItemStackToInventory(ItemUtils.getSimpleStack(this.output)); - ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this); - } - }else if(iStack.getItemDamage() < this.cooldownTime){ - iStack.setItemDamage(iStack.getItemDamage() + 1); - } - if(MathUtils.divideXintoY(iStack.getItemDamage(), 150)){ - entityHolding.attackEntityFrom(DamageSource.onFire, 1); - } - - - } - super.onUpdate(iStack, world, entityHolding, p_77663_4_, p_77663_5_); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if ((this.materialName != null) && (this.materialName != "") && !this.materialName.equals("")){ - list.add(EnumChatFormatting.GRAY+"Warning: "+EnumChatFormatting.RED+"Very hot!"+EnumChatFormatting.GRAY+" Avoid direct handling.."); - list.add(EnumChatFormatting.GRAY+"This food has "+((this.cooldownTime-stack.getItemDamage())/20)+" seconds left, until it is cool."); - } - super.addInformation(stack, aPlayer, list, bool); - } - - public final String getMaterialName() { - return this.materialName; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - return Utils.rgbtoHexValue(230, 96, 96); - - } -} diff --git a/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java b/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java deleted file mode 100644 index b72ea5db15..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java +++ /dev/null @@ -1,11 +0,0 @@ -package gtPlusPlus.core.item.base.gears; - -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.material.Material; - -public class BaseItemGear extends BaseItemComponent{ - - public BaseItemGear(final Material material) { - super(material, BaseItemComponent.ComponentTypes.GEAR); - } -} diff --git a/src/Java/gtPlusPlus/core/item/base/gears/BaseItemSmallGear.java b/src/Java/gtPlusPlus/core/item/base/gears/BaseItemSmallGear.java deleted file mode 100644 index 5435c692c6..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/gears/BaseItemSmallGear.java +++ /dev/null @@ -1,11 +0,0 @@ -package gtPlusPlus.core.item.base.gears; - -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.material.Material; - -public class BaseItemSmallGear extends BaseItemComponent{ - - public BaseItemSmallGear(final Material material) { - super(material, BaseItemComponent.ComponentTypes.SMALLGEAR); - } -} diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java deleted file mode 100644 index ea96e2914c..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java +++ /dev/null @@ -1,21 +0,0 @@ -package gtPlusPlus.core.item.base.ingots; - -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.material.Material; - -public class BaseItemIngot extends BaseItemComponent{ - - protected final String materialName; - protected final String unlocalName; - - public BaseItemIngot(final Material material) { - this(material, ComponentTypes.INGOT); - } - - public BaseItemIngot(final Material material, final ComponentTypes type) { - super(material, type); - this.materialName = material.getLocalizedName(); - this.unlocalName = material.getUnlocalizedName(); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java deleted file mode 100644 index c19fecd924..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java +++ /dev/null @@ -1,110 +0,0 @@ -package gtPlusPlus.core.item.base.ingots; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.DamageSource; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class BaseItemIngotHot extends BaseItemIngot{ - - private final ItemStack outputIngot; - private int tickCounter = 0; - private final int tickCounterMax = 200; - private final int mTier; - - private IIcon base; - private IIcon overlay; - - public BaseItemIngotHot(final Material material) { - super(material, ComponentTypes.HOTINGOT); - this.setTextureName(CORE.MODID + ":" + "itemIngotHot"); - this.outputIngot = material.getIngot(1); - this.mTier = material.vTier; - this.generateRecipe(); - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return super.getItemStackDisplayName(p_77653_1_); - //return ("Hot "+this.materialName+ " Ingot"); - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - return Utils.rgbtoHexValue(225, 225, 225); - } - - private void generateRecipe(){ - Logger.WARNING("Adding Vacuum Freezer recipe for a Hot Ingot of "+this.materialName+"."); - CORE.RA.addVacuumFreezerRecipe(ItemUtils.getSimpleStack(this), this.outputIngot.copy(), (int) Math.max(this.componentMaterial.getMass() * 3L, 1L), this.componentMaterial.vVoltageMultiplier); - } - - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - if (this.componentMaterial != null){ - if (entityHolding != null && entityHolding instanceof EntityPlayer){ - if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){ - EntityUtils.applyHeatDamageToEntity(1, world, entityHolding); - } - } - } - super.onUpdate(iStack, world, entityHolding, p_77663_4_, p_77663_5_); - } - - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses(){ - if (CORE.ConfigSwitches.useGregtechTextures){ - return true; - } - else { - return false; - } - } - - @Override - public void registerIcons(final IIconRegister i) { - - if (CORE.ConfigSwitches.useGregtechTextures){ - this.base = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "ingotHot"); - this.overlay = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "ingotHot_OVERLAY"); - } - else { - this.base = i.registerIcon(CORE.MODID + ":" + "item"+BaseItemComponent.ComponentTypes.HOTINGOT.getComponent()); - //this.overlay = i.registerIcon(CORE.MODID + ":" + "item"+BaseItemComponent.ComponentTypes.HOTINGOT.getComponent()+"_Overlay"); - } - //this.overlay = cellMaterial.getFluid(1000).getFluid().get - } - - @Override - public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { - if(pass == 0 && CORE.ConfigSwitches.useGregtechTextures) { - return this.base; - } - else if(pass == 1 && CORE.ConfigSwitches.useGregtechTextures) { - return this.overlay; - } - else { - return this.overlay; - } - } - - -} diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot_OLD.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot_OLD.java deleted file mode 100644 index 6ad323333f..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot_OLD.java +++ /dev/null @@ -1,101 +0,0 @@ -package gtPlusPlus.core.item.base.ingots; - -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.entity.Entity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class BaseItemIngot_OLD extends Item{ - - protected int colour; - protected String materialName; - protected String unlocalName; - - public BaseItemIngot_OLD(final String unlocalizedName, final String materialName, final int colour, final int sRadioactivity) { - this.setUnlocalizedName(unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.unlocalName = unlocalizedName; - this.setMaxStackSize(64); - this.setTextureName(CORE.MODID + ":" + "itemIngot"); - this.colour = colour; - this.materialName = materialName; - this.sRadiation = sRadioactivity; - GameRegistry.registerItem(this, unlocalizedName); - String temp = ""; - if (this.unlocalName.contains("itemIngot")){ - temp = this.unlocalName.replace("itemI", "i"); - } - else if (this.unlocalName.contains("itemHotIngot")){ - temp = this.unlocalName.replace("itemHotIngot", "ingotHot"); - } - if ((temp != null) && !temp.equals("")){ - GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); - } - //this.generateCompressorRecipe(); - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - - return (this.materialName+ " Ingot"); - } - - public final String getMaterialName() { - return this.materialName; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - if (this.colour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return this.colour; - - } - - private void generateCompressorRecipe(){ - if (this.unlocalName.contains("itemIngot")){ - final ItemStack tempStack = ItemUtils.getSimpleStack(this, 9); - ItemStack tempOutput = null; - String temp = this.getUnlocalizedName().replace("item.itemIngot", "block"); - Logger.WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); - if (this.getUnlocalizedName().contains("item.")){ - temp = this.getUnlocalizedName().replace("item.", ""); - Logger.WARNING("Generating OreDict Name: "+temp); - } - temp = temp.replace("itemIngot", "block"); - Logger.WARNING("Generating OreDict Name: "+temp); - if ((temp != null) && !temp.equals("")){ - tempOutput = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); - if (tempOutput != null){ - GT_ModHandler.addCompressionRecipe(tempStack, tempOutput); - } - - } - } - else if (this.unlocalName.contains("itemHotIngot")){ - return; - } - - - } - - - protected final int sRadiation; - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.sRadiation, world, entityHolding); - } -} diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/FluidItemBlock.java b/src/Java/gtPlusPlus/core/item/base/itemblock/FluidItemBlock.java deleted file mode 100644 index 96b5425437..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/FluidItemBlock.java +++ /dev/null @@ -1,61 +0,0 @@ -package gtPlusPlus.core.item.base.itemblock; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.fluids.BlockFluidBase; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class FluidItemBlock extends ItemBlock{ - - protected final int blockColour; - final BlockFluidBase baseBlock; - String name; - - public FluidItemBlock(final Block block) { - super(block); - this.baseBlock = (BlockFluidBase) block; - this.blockColour = this.baseBlock.getRenderColor(1); - this.name = this.baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "").replace("name", "").replace("block", "").replace(".", ""); - //GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), UtilsItems.getSimpleStack(this)); - } - - public int getRenderColor(final int aMeta) { - return this.blockColour; - } - - @Override - public String getItemStackDisplayName(final ItemStack iStack) { - /*if (this.thisFluid != null){ - this.name = "Molten "+this.thisFluid.getLocalizedName(); - return this.name; - }*/ - this.name = "Molten "+this.baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "").replace("name", "").replace("block", "").replace(".", ""); - return this.name; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - if (this.blockColour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return this.blockColour; - } - - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - /*list.add("Temperature: "+MathUtils.celsiusToKelvin(this.thisFluid.getMeltingPointC())+"K"); - if (this.sRadiation > 0){ - list.add(CORE.GT_Tooltip_Radioactive); - }*/ - super.addInformation(stack, aPlayer, list, bool); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java deleted file mode 100644 index 14344c1817..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java +++ /dev/null @@ -1,71 +0,0 @@ -package gtPlusPlus.core.item.base.itemblock; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.api.interfaces.ITileTooltip; - -public class ItemBlockBasicTile extends ItemBlock { - - private final int mID; - - public ItemBlockBasicTile(final Block block) { - super(block); - this.mID = ((ITileTooltip) block).getTooltipID(); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if (this.mID == 0) { // Fish trap - list.add("This trap catches fish faster if surrounded by more water blocks"); - list.add("Can also be placed beside upto 4 other fish traps"); - list.add("Requires at least two faces touching water"); - list.add("1/1000 chance to produce triple loot."); - } - else if (this.mID == 1) { // Modularity - list.add("Used to construct modular armour & bauble upgrades.."); - } - else if (this.mID == 2) { // Trade - list.add("Allows for SMP trade-o-mat type trading."); - } - else if (this.mID == 3) { // Project - list.add("Scan any crafting recipe in this to mass fabricate them in the Autocrafter.."); - } - else if (this.mID == 4) { // Circuit Table - list.add("Easy Circuit Configuration"); - list.add("Change default setting with a Screwdriver"); - list.add("Default is used to select slot for auto-insertion"); - } - else if (this.mID == 5) { // Decayables Chest - list.add("Chest which holds radioactive materials"); - list.add("Items which decay will tick while inside"); - list.add("Place with right click"); - } - else if (this.mID == 6) { // Butterfly Killer - list.add("Kills Forestry Butterflies, Bats and other pests"); - list.add("Use either Formaldehyde or Hydrogen cyanide"); - list.add("Be weary of your neighbours"); - } - else if (this.mID == 7) { // Egg Box - list.add("A box for holding big eggs"); - } - else if (this.mID == 8){ // Volumetric Flask Setter - list.add("Easy Flask Configuration"); - list.add("Configure default input slot with a screwdriver"); - } - else if (this.mID == 9){ - - } - - else { - list.add("Bad Tooltip ID - " + mID); - } - super.addInformation(stack, aPlayer, list, bool); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockDoor.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockDoor.java deleted file mode 100644 index 2aba494d6e..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockDoor.java +++ /dev/null @@ -1,100 +0,0 @@ -package gtPlusPlus.core.item.base.itemblock; - -import java.util.List; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; - -public class ItemBlockDoor extends ItemBlock { - @SideOnly(Side.CLIENT) - private IIcon field_150938_b; - - public ItemBlockDoor(Block p_i45328_1_) { - super(p_i45328_1_); - } - - /** - * Callback for item usage. If the item does something special on right - * clicking, he will have one of those. Return True if something happen and - * false if it don't. This is for ITEMS, not BLOCKS - */ - @Override - public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, - int par5, int par6, int par7, float par8, float par9, float par10) { - if (par7 != 1) { - return false; - } else { - ++par5; - Block block; - - block = field_150939_a; - - if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) - && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)) { - if (!block.canPlaceBlockAt(par3World, par4, par5, par6)) { - return false; - } else { - int i1 = MathHelper.floor_double( - (double) ((par2EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3; - byte b0 = 0; - byte b1 = 0; - - if (i1 == 0) { - b1 = 1; - } - - if (i1 == 1) { - b0 = -1; - } - - if (i1 == 2) { - b1 = -1; - } - - if (i1 == 3) { - b0 = 1; - } - - int i2 = (par3World.getBlock(par4 - b0, par5, par6 - b1).isNormalCube() ? 1 : 0) - + (par3World.getBlock(par4 - b0, par5 + 1, par6 - b1).isNormalCube() ? 1 : 0); - int j1 = (par3World.getBlock(par4 + b0, par5, par6 + b1).isNormalCube() ? 1 : 0) - + (par3World.getBlock(par4 + b0, par5 + 1, par6 + b1).isNormalCube() ? 1 : 0); - boolean flag = par3World.getBlock(par4 - b0, par5, par6 - b1) == block - || par3World.getBlock(par4 - b0, par5 + 1, par6 - b1) == block; - boolean flag1 = par3World.getBlock(par4 + b0, par5, par6 + b1) == block - || par3World.getBlock(par4 + b0, par5 + 1, par6 + b1) == block; - boolean flag2 = false; - - if (flag && !flag1) { - flag2 = true; - } else if (j1 > i2) { - flag2 = true; - } - - par3World.setBlock(par4, par5, par6, block, i1, 2); - par3World.setBlock(par4, par5 + 1, par6, block, 8 | (flag2 ? 1 : 0), 2); - par3World.notifyBlocksOfNeighborChange(par4, par5, par6, block); - par3World.notifyBlocksOfNeighborChange(par4, par5 + 1, par6, block); - - --par1ItemStack.stackSize; - return true; - } - } else { - return false; - } - } - } - - @Override - public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) { - p_77624_3_.add("This is a block, you can place it by right clicking"); - super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockEntityBase.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockEntityBase.java deleted file mode 100644 index ac6740f268..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockEntityBase.java +++ /dev/null @@ -1,41 +0,0 @@ -package gtPlusPlus.core.item.base.itemblock; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import gtPlusPlus.core.block.general.BlockTankXpConverter; -import gtPlusPlus.core.creative.AddToCreativeTab; - -public class ItemBlockEntityBase extends ItemBlock { - - public ItemBlockEntityBase(final Block block) { - super(block); - this.setMaxDamage(0); - //this.setHasSubtypes(true); - this.setCreativeTab(AddToCreativeTab.tabMachines); - } - - @Override - public int getColorFromItemStack(final ItemStack p_82790_1_, final int p_82790_2_) { - return super.getColorFromItemStack(p_82790_1_, p_82790_2_); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public final void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if (Block.getBlockFromItem(stack.getItem()) instanceof BlockTankXpConverter){ - /*list.add(EnumChatFormatting.GRAY+"Can convert Liquid Xp to Mob Essence and back."); - list.add(EnumChatFormatting.GRAY+"Right click with a Screwdriver to change mode."); - list.add(EnumChatFormatting.GRAY+"Shift+Right click to view tank information.");*/ - list.add(EnumChatFormatting.GRAY+"Currently disabled, Use a GT Brewery instead. (New Recipes Added!)"); - } - super.addInformation(stack, aPlayer, list, bool); - } - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java deleted file mode 100644 index 396689ef63..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java +++ /dev/null @@ -1,156 +0,0 @@ -package gtPlusPlus.core.item.base.itemblock; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import gtPlusPlus.core.block.base.BlockBaseModular; -import gtPlusPlus.core.block.base.BlockBaseOre; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialStack; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.sys.KeyboardUtils; - -public class ItemBlockGtBlock extends ItemBlock { - - protected final int blockColour; - private int sRadiation; - - private Material mMaterial; - - private final Block thisBlock; - private boolean isOre = false; - private boolean isModular = false; - - public ItemBlockGtBlock(final Block block) { - super(block); - this.thisBlock = block; - if (block instanceof BlockBaseOre) { - this.isOre = true; - } else if (block instanceof BlockBaseModular) { - this.isModular = true; - } - final BlockBaseModular baseBlock = (BlockBaseModular) block; - if (isModular) { - this.blockColour = baseBlock.getRenderColor(0); - } else if (isOre) { - this.blockColour = block.getBlockColor(); - } else { - this.blockColour = block.getBlockColor(); - } - - if (block instanceof BlockBaseModular){ - BlockBaseModular g = (BlockBaseModular) block; - this.mMaterial = g.getMaterialEx(); - } - else { - this.mMaterial = null; - } - - // GT_OreDictUnificator.registerOre("block"+block.getUnlocalizedName().replace("tile.block", - // "").replace("tile.", "").replace("of", "").replace("Of", "").replace("Block", - // "").replace("-", "").replace("_", "").replace(" ", ""), - // ItemUtils.getSimpleStack(this)); - } - - public int getRenderColor(final int aMeta) { - return this.blockColour; - } - - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - - if (this.mMaterial != null) { - list.add(this.mMaterial.vChemicalFormula); - } else { - - try { - BlockBaseModular g = (BlockBaseModular) thisBlock; - this.mMaterial = g.getMaterialEx(); - } - catch (Throwable t) { - - } - - - //list.add("Material is Null."); - } - - if (this.isOre) { - if (KeyboardUtils.isCtrlKeyDown()) { - Block b = Block.getBlockFromItem(stack.getItem()); - if (b != null) { - - String aTool = b.getHarvestTool(stack.getItemDamage()); - int aMiningLevel1 = b.getHarvestLevel(stack.getItemDamage()); - - if (this.mMaterial != null) { - list.add("Mining Level: " + Math.min(Math.max(aMiningLevel1, 0), 5)); - list.add("Contains: "); - if (mMaterial.getComposites().isEmpty()) { - list.add("- " + mMaterial.getLocalizedName()); - } else { - for (MaterialStack m : mMaterial.getComposites()) { - list.add("- " + m.getStackMaterial().getLocalizedName() + " x" + m.getPartsPerOneHundred()); - } - } - } - } - } else { - list.add(EnumChatFormatting.DARK_GRAY + "Hold Ctrl to show additional info."); - } - } - else { - Block b = Block.getBlockFromItem(stack.getItem()); - if (b != null) { - String aTool = b.getHarvestTool(stack.getItemDamage()); - int aMiningLevel1 = b.getHarvestLevel(stack.getItemDamage()); - list.add("Mining Level: " + Math.min(Math.max(aMiningLevel1, 0), 5)); - } - } - - if (this.mMaterial != null) { - if (this.mMaterial.vRadiationLevel > 0) { - list.add(CORE.GT_Tooltip_Radioactive); - } - } - - super.addInformation(stack, aPlayer, list, bool); - } - - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, - final boolean p_77663_5_) { - - if (!isModular && !isOre) { - mMaterial = null; - } else { - if (this.mMaterial == null) { - Block b = Block.getBlockFromItem(iStack.getItem()); - if (isOre) { - mMaterial = ((BlockBaseOre) b).getMaterialEx(); - } else { - mMaterial = ((BlockBaseModular) b).getMaterialEx(); - } - if (mMaterial != null) { - this.sRadiation = mMaterial.vRadiationLevel; - } else { - this.sRadiation = 0; - } - } - if (this.sRadiation > 0) { - EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.sRadiation, world, entityHolding); - } - } - - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java deleted file mode 100644 index 0dd125bf7b..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java +++ /dev/null @@ -1,94 +0,0 @@ -package gtPlusPlus.core.item.base.itemblock; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import java.util.List; - -import gtPlusPlus.core.block.base.BlockBaseModular; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialStack; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.sys.KeyboardUtils; - -public class ItemBlockGtFrameBox extends ItemBlock{ - - protected int blockColour; - private Material mMaterial; - private int sRadiation; - - public ItemBlockGtFrameBox(final Block block) { - super(block); - final BlockBaseModular baseBlock = (BlockBaseModular) block; - this.blockColour = baseBlock.getRenderColor(1); - - - - if (block instanceof BlockBaseModular){ - BlockBaseModular g = (BlockBaseModular) block; - this.mMaterial = g.getMaterialEx(); - sRadiation = mMaterial.vRadiationLevel; - } - else { - this.mMaterial = null; - sRadiation = 0; - } - - //GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), ItemUtils.getSimpleStack(this)); - } - - public int getRenderColor(final int aMeta) { - return this.blockColour; - } - - @SuppressWarnings("unchecked") - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if (this.mMaterial != null) { - list.add(this.mMaterial.vChemicalFormula); - if (this.mMaterial.vRadiationLevel > 0) { - list.add(CORE.GT_Tooltip_Radioactive); - } - } else { - list.add("Material is Null."); - } - if (KeyboardUtils.isCtrlKeyDown()) { - Block b = Block.getBlockFromItem(stack.getItem()); - if (b != null) { - String aTool = b.getHarvestTool(stack.getItemDamage()); - int aMiningLevel1 = b.getHarvestLevel(stack.getItemDamage()); - list.add("Mining Level: " + Math.min(Math.max(aMiningLevel1, 0), 5)); - if (this.mMaterial != null) { - list.add("Contains: "); - if (mMaterial.getComposites().isEmpty()) { - list.add("- " + mMaterial.getLocalizedName()); - } else { - for (MaterialStack m : mMaterial.getComposites()) { - list.add("- " + m.getStackMaterial().getLocalizedName() + " x" + m.getPartsPerOneHundred()); - } - } - } - } - } else { - list.add(EnumChatFormatting.DARK_GRAY + "Hold Ctrl to show additional info."); - } - super.addInformation(stack, aPlayer, list, bool); - } - - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, - final boolean p_77663_5_) { - - if (this.sRadiation > 0) { - EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.sRadiation, world, entityHolding); - } - } - - -} diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockMeta.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockMeta.java deleted file mode 100644 index b26ac67225..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockMeta.java +++ /dev/null @@ -1,114 +0,0 @@ -package gtPlusPlus.core.item.base.itemblock; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.api.interfaces.ITileTooltip; -import gtPlusPlus.api.objects.data.AutoMap; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlockWithMetadata; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -public class ItemBlockMeta extends ItemBlockWithMetadata -{ - private final Block mBlock; - private HashMap<Integer, AutoMap<String>> aTooltips = new LinkedHashMap<Integer, AutoMap<String>>(); - - public ItemBlockMeta(final Block aBlock) - { - super(aBlock, aBlock); - this.mBlock = aBlock; - this.setMaxDamage(0); - this.setHasSubtypes(true); - if (aBlock instanceof ITileTooltip) { - ITileTooltip aTooltip = (ITileTooltip) aBlock; - //aTooltips.put(aTooltip.getTooltipID(), aTooltip.getTooltipMap()); - } - } - - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - Block aThis = Block.getBlockFromItem(stack.getItem()); - if (aThis != null) { - if (!aTooltips.isEmpty()) { - AutoMap<String> h = aTooltips.get(stack.getItemDamage()); - if (h != null && !h.isEmpty()) { - for (String s : h) { - list.add(s); - } - } - } - } - super.addInformation(stack, aPlayer, list, bool); - } - - /** - * Gets an icon index based on an item's damage value - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(final int p_77617_1_) - { - return this.mBlock.getIcon(2, p_77617_1_); - } - - /** - * Returns the metadata of the block which this Item (ItemBlock) can place - */ - @Override - public int getMetadata(final int p_77647_1_) - { - return p_77647_1_; - } - - @Override - public String getUnlocalizedName(final ItemStack stack) { - return this.getUnlocalizedName() + "." + stack.getItemDamage(); - } - - @Override - public boolean isDamageable() { - return false; - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { - return false; - } - - @Override - public boolean isBookEnchantable(ItemStack stack, ItemStack book) { - return false; - } - - @Override - public int getDisplayDamage(ItemStack stack) { - return 0; - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return false; - } - - @Override - public double getDurabilityForDisplay(ItemStack stack) { - return 0; - } - - @Override - public int getItemEnchantability(ItemStack stack) { - return 0; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java deleted file mode 100644 index 99367c5ef5..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java +++ /dev/null @@ -1,104 +0,0 @@ -package gtPlusPlus.core.item.base.itemblock; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; - -import gregtech.api.util.GT_Utility; - -import gtPlusPlus.api.interfaces.ITileTooltip; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.tileentities.base.TileEntityBase; -import gtPlusPlus.core.util.minecraft.PlayerUtils; - -public class ItemBlockNBT extends ItemBlock { - - - protected final int mID; - - public ItemBlockNBT(final Block block) { - super(block); - this.mID = ((ITileTooltip) block).getTooltipID(); - } - - - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - - //if () - - - - if (this.mID == 0){ //blockDarkWorldPortalFrame - list.add("Assembled in the same shape as the Nether Portal."); - } - } - - - - @Override - public void onCreated(ItemStack item, World world, EntityPlayer player) { - addNBT(player, item); - super.onCreated(item, world, player); - } - - @Override - public void onUpdate(ItemStack item, World world, Entity entity, int p_77663_4_, boolean p_77663_5_) { - if (entity instanceof EntityPlayerMP) { - EntityPlayerMP mPlayer = (EntityPlayerMP) entity; - - NBTTagCompound rNBT = item.getTagCompound(); - rNBT = ((rNBT == null) ? new NBTTagCompound() : rNBT); - if (!rNBT.hasKey("mOwner")){ - addNBT(mPlayer, item); - } - } - super.onUpdate(item, world, entity, p_77663_4_, p_77663_5_); - } - - private void addNBT(EntityPlayer player, ItemStack item) { - NBTTagCompound rNBT = item.getTagCompound(); - rNBT = ((rNBT == null) ? new NBTTagCompound() : rNBT); - if (player != null) { - boolean mOP = PlayerUtils.isPlayerOP(player); - rNBT.setString("mOwner", player.getDisplayName()); - rNBT.setString("mUUID", ""+player.getUniqueID()); - rNBT.setBoolean("mOP", mOP); - } - else if (player == null) { - rNBT.setString("mOwner", "fakeplayer"); - rNBT.setString("mUUID", "00000000"); - rNBT.setBoolean("mOP", false); - } - GT_Utility.ItemNBT.setNBT(item, rNBT); - } - - @Override - public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side, - float hitX, float hitY, float hitZ, int aMeta) { - if (!(aWorld.setBlock(aX, aY, aZ, this.field_150939_a, 0, 3))) { - return false; - } - if (aWorld.getBlock(aX, aY, aZ) == this.field_150939_a) { - this.field_150939_a.onBlockPlacedBy(aWorld, aX, aY, aZ, aPlayer, aStack); - this.field_150939_a.onPostBlockPlaced(aWorld, aX, aY, aZ, aMeta); - } - TileEntityBase tTileEntity = (TileEntityBase) aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity != null && aPlayer != null) { - if (tTileEntity.isServerSide()){ - Logger.INFO("Setting Tile Entity information"); - NBTTagCompound aNBT = GT_Utility.ItemNBT.getNBT(aStack); - tTileEntity.setOwnerInformation(aNBT.getString("mOwner"), aNBT.getString("mUUID"), aNBT.getBoolean("mOP")); - } - } - return true; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java deleted file mode 100644 index e4079521d4..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java +++ /dev/null @@ -1,161 +0,0 @@ -package gtPlusPlus.core.item.base.itemblock; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.block.base.BlockBaseOre; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialStack; -import gtPlusPlus.core.material.nuclear.FLUORIDES; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.sys.KeyboardUtils; -import gtPlusPlus.everglades.gen.gt.WorldGen_GT_Ore_Layer; - -public class ItemBlockOre extends ItemBlock{ - - private final BlockBaseOre mThisOre; - private final Material mThisMaterial; - private final int mThisRadiation; - private final int mThisColour; - - public ItemBlockOre(final Block block) { - super(block); - if (block instanceof BlockBaseOre){ - this.mThisOre = (BlockBaseOre) block; - this.mThisMaterial = this.mThisOre.getMaterialEx(); - this.mThisRadiation = this.mThisMaterial.vRadiationLevel; - this.mThisColour = this.mThisMaterial.getRgbAsHex(); - } - else { - this.mThisOre = null; - this.mThisMaterial = null; - this.mThisRadiation = 0; - this.mThisColour = Utils.rgbtoHexValue(255, 255, 255); - } - } - - public int getRenderColor(final int aMeta) { - return this.mThisColour; - } - - private static Map<String, AutoMap<String>> mMapOreBlockItemToDimName = new LinkedHashMap<String, AutoMap<String>>(); - private static boolean mInitOres_Everglades = false; - private AutoMap<String> mDimsForThisOre = new AutoMap<String>(); - - - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - - if (!mInitOres_Everglades) { - for (WorldGen_GT_Ore_Layer f : gtPlusPlus.everglades.gen.gt.WorldGen_Ores.validOreveins.values()) { - Material[] m2 = new Material[] {f.mPrimary, f.mSecondary, f.mBetween, f.mSporadic}; - for (Material m1 : m2) { - AutoMap<String> aMap = mMapOreBlockItemToDimName.get(m1.getUnlocalizedName().toLowerCase()); - if (aMap == null) { - aMap = new AutoMap<String>(); - } - String aDimName = "Everglades"; - if (!aMap.containsValue(aDimName)) { - aMap.put(aDimName); - } - mMapOreBlockItemToDimName.put(m1.getUnlocalizedName().toLowerCase(), aMap); - } - } - mInitOres_Everglades = true; - } - - - if (this.mThisMaterial != null){ - list.add(this.mThisMaterial.vChemicalFormula); - } - - //Radioactive? - if (this.mThisRadiation > 0){ - list.add(CORE.GT_Tooltip_Radioactive); - } - - /** - * Tooltip Handler for Ores - */ - if (this.mThisMaterial == FLUORIDES.FLUORITE){ - list.add("Mined from Sandstone with a 1/"+(CORE.ConfigSwitches.chanceToDropFluoriteOre*20)+" chance, or Limestone with a 1/"+(CORE.ConfigSwitches.chanceToDropFluoriteOre)+" chance."); - } - - if (this.mThisMaterial != null) { - list.add("Ore contains: "); - if (mThisMaterial.getComposites().isEmpty()) { - list.add("- "+mThisMaterial.getLocalizedName()); - } - else { - for (MaterialStack m : mThisMaterial.getComposites()) { - list.add("- "+m.getStackMaterial().getLocalizedName()+" x"+m.getPartsPerOneHundred()); - } - } - } - - if (KeyboardUtils.isCtrlKeyDown()) { - - Block b = Block.getBlockFromItem(stack.getItem()); - if (b != null) { - String aTool = b.getHarvestTool(stack.getItemDamage()); - int aMiningLevel1 = b.getHarvestLevel(stack.getItemDamage()); - if (aMiningLevel1 != 0) { - list.add("Mining Level: "+Math.min(Math.max(aMiningLevel1, 0), 5)); - } - } - - if (mDimsForThisOre.isEmpty()) { - AutoMap<String> A = mMapOreBlockItemToDimName.get(this.mThisMaterial.getUnlocalizedName().toLowerCase()); - if (A != null) { - mDimsForThisOre = A; - } - } - - list.add("Found: "); - if (!mDimsForThisOre.isEmpty()) { - for (String m : mDimsForThisOre) { - list.add("- "+m); - } - } - else { - list.add("- Unknown"); - } - - } - else { - list.add(EnumChatFormatting.DARK_GRAY+"Hold Ctrl to show additional info."); - } - - - - - - - super.addInformation(stack, aPlayer, list, bool); - } - - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - if (this.mThisMaterial != null){ - if (this.mThisRadiation > 0){ - if (entityHolding instanceof EntityPlayer){ - if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){ - EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.mThisMaterial.vRadiationLevel, world, entityHolding); - } - } - } - } - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java deleted file mode 100644 index 7a4222ed0f..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java +++ /dev/null @@ -1,115 +0,0 @@ -package gtPlusPlus.core.item.base.itemblock; -import java.util.List; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlockWithMetadata; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -public class ItemBlockRoundRobinator extends ItemBlockWithMetadata -{ - private final Block mBlock; - - public ItemBlockRoundRobinator(final Block aBlock){ - super(aBlock, aBlock); - this.mBlock = aBlock; - } - - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add("Attempts to output items evenly on all four horizontal planes"); - if (stack.getItemDamage() == 0) { - list.add("1 Item per enabled side every 400 ticks"); - } - else if (stack.getItemDamage() == 1) { - list.add("1 Item per enabled side every 100 ticks"); - } - else if (stack.getItemDamage() == 2) { - list.add("1 Item per enabled side every 20 ticks"); - } - else if (stack.getItemDamage() == 3) { - list.add("1 Item per enabled side every 10 ticks"); - } - else if (stack.getItemDamage() == 4) { - list.add("1 Item per enabled side every tick"); - } - list.add("Top and bottom do not pull, so you must push items in"); - list.add("Sides can also be disabled with a screwdriver"); - list.add("Shift+RMB with empty hand to view inventory contents"); - super.addInformation(stack, aPlayer, list, bool); - } - - /** - * Gets an icon index based on an item's damage value - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(final int p_77617_1_) - { - return this.mBlock.getIcon(0, p_77617_1_); - } - - /** - * Returns the metadata of the block which this Item (ItemBlock) can place - */ - @Override - public int getMetadata(final int p_77647_1_) - { - return p_77647_1_; - } - - @Override - public String getUnlocalizedName(final ItemStack stack) { - return this.getUnlocalizedName() + "." + stack.getItemDamage(); - } - - @Override - public boolean isDamageable() { - return false; - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { - return false; - } - - @Override - public boolean isBookEnchantable(ItemStack stack, ItemStack book) { - return false; - } - - @Override - public int getDisplayDamage(ItemStack stack) { - return 0; - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return false; - } - - @Override - public double getDurabilityForDisplay(ItemStack stack) { - return 0; - } - - @Override - public int getItemEnchantability(ItemStack stack) { - return 0; - } - - @Override - public boolean getHasSubtypes() { - return true; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockSpawner.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockSpawner.java deleted file mode 100644 index 53c9cdb193..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockSpawner.java +++ /dev/null @@ -1,39 +0,0 @@ -package gtPlusPlus.core.item.base.itemblock; - -import java.util.List; - -import cpw.mods.fml.common.registry.EntityRegistry; -import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration; -import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -public class ItemBlockSpawner extends ItemBlockMeta{ - - private final Block mBlock; - - public ItemBlockSpawner(Block aBlock) { - super(aBlock); - mBlock = aBlock; - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aBool) { - if (mBlock != null) { - int x = this.getMetadata(aStack.getItemDamage()); - if (x >= 0) { - try { - EntityRegistration x1 = EntityRegistry.instance().lookupModSpawn(TileEntityGenericSpawner.mSpawners.get(x), false); - if (x1 != null) { - aList.add(EnumChatFormatting.RED+x1.getEntityName()); - } - } - catch (Throwable t) {} - } - } - super.addInformation(aStack, aPlayer, aList, aBool); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/misc/BaseItemMisc.java b/src/Java/gtPlusPlus/core/item/base/misc/BaseItemMisc.java deleted file mode 100644 index 25070ad817..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/misc/BaseItemMisc.java +++ /dev/null @@ -1,174 +0,0 @@ -package gtPlusPlus.core.item.base.misc; - -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -import gregtech.api.util.GT_OreDictUnificator; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class BaseItemMisc extends Item{ - - public final String displayName; - public final String unlocalName; - public final MiscTypes miscType; - public final Object componentColour; - public final String[] description; - - public BaseItemMisc( - final String displayName, - final short[] RGB, - final int maxStackSize, - final MiscTypes miscType, - String[] description) { - - //Set-up the Misc Generic Item - this.displayName = displayName; - String unlocalName = Utils.sanitizeString(displayName); - this.unlocalName = "item"+miscType.TYPE+unlocalName; - this.miscType = miscType; - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(this.unlocalName); - this.setMaxStackSize(maxStackSize); - //this.setTextureName(this.getCorrectTextures()); - if (RGB != null){ - this.componentColour = Utils.rgbtoHexValue(RGB[0], RGB[1], RGB[2]); - } - else { - this.componentColour = null; - } - this.description = description; - GameRegistry.registerItem(this, this.unlocalName); - GT_OreDictUnificator.registerOre(miscType.getOreDictPrefix()+unlocalName, ItemUtils.getSimpleStack(this)); - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return this.displayName+miscType.DISPLAY_NAME_SUFFIX; - } - - private String getCorrectTextures(){ - return CORE.MODID + ":" + "item"+this.miscType.TYPE; - } - - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() { - return this.miscType == MiscTypes.DROP; - } - - @Override - public int getRenderPasses(int meta) { - return (this.miscType == MiscTypes.DROP) ? 2 : 1; - } - - @SideOnly(Side.CLIENT) - private IIcon secondIcon; - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) { - if (this.miscType == MiscTypes.DROP && LoadedMods.Forestry){ - this.itemIcon = par1IconRegister.registerIcon("forestry:honeyDrop.0"); - this.secondIcon = par1IconRegister.registerIcon("forestry:honeyDrop.1"); - } - else { - this.itemIcon = par1IconRegister.registerIcon(getCorrectTextures()); - } - } - - @Override - public IIcon getIcon(ItemStack stack, int pass) { - return (pass == 0) ? itemIcon : secondIcon; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public final void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if (this.description != null){ //Incase I don't add one - if (this.description.length > 0){ //Incase I somehow add a blank one - for (int x=0;x<this.description.length;x++){ - list.add(EnumChatFormatting.GRAY+description[x]); - } - } - } - super.addInformation(stack, aPlayer, list, bool); - } - - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - //Returns default colour if a custom one is not set. - if (this.componentColour == null){ - return 16777215; - } - else { - return (int) this.componentColour; - } - - - } - - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - //Nothing Fancy here yet. - } - - - - - - - - - public static enum MiscTypes { - POTION("Potion", " Potion", "potion"), - KEY("Key", " Key", "key"), - BIGKEY("KeyBig", " Big Key", "bosskey"), - BOTTLE("Bottle", " Bottle", "bottle"), - GEM("Gem", " Gemstone", "gem"), - DROP("Droplet", " Droplet", "droplet"), - MUSHROOM("Mushroom", " Mushroom", "mushroom"); - - private String TYPE; - private String DISPLAY_NAME_SUFFIX; - private String OREDICT_PREFIX; - - private MiscTypes (final String LocalName, final String DisplayNameSuffix, final String OreDictPrefix){ - this.TYPE = LocalName; - this.DISPLAY_NAME_SUFFIX = DisplayNameSuffix; - this.OREDICT_PREFIX = OreDictPrefix; - } - - public String getType(){ - return this.TYPE; - } - - public String getName(){ - return this.DISPLAY_NAME_SUFFIX; - } - - public String getOreDictPrefix(){ - return this.OREDICT_PREFIX; - } - - } - -} - - diff --git a/src/Java/gtPlusPlus/core/item/base/misc/BaseItemParticle.java b/src/Java/gtPlusPlus/core/item/base/misc/BaseItemParticle.java deleted file mode 100644 index b7bbc84757..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/misc/BaseItemParticle.java +++ /dev/null @@ -1,57 +0,0 @@ -package gtPlusPlus.core.item.base.misc; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.CoreItem; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -public abstract class BaseItemParticle extends CoreItem { - - protected static final Map<Integer, Integer> aColourMap = new LinkedHashMap<Integer, Integer> (); - private final int aMaxCount; - - public BaseItemParticle(String aType, int aCount, EnumRarity aRarity) { - super("particle"+aType, aType, AddToCreativeTab.tabOther, 64, 0, new String[] {}, aRarity, EnumChatFormatting.DARK_AQUA, false, null); - this.setTextureName(CORE.MODID + ":" + "science/Atom"); - aMaxCount = aCount; - this.setHasSubtypes(true); - - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - return aColourMap.get(stack.getItemDamage()); - } - - public int getColorFromParentClass(ItemStack stack, int aaa) { - return super.getColorFromItemStack(stack, aaa); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < aMaxCount; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - - - @Override - public final String getItemStackDisplayName(final ItemStack tItem) { - String aReturnValue = super.getItemStackDisplayName(tItem); - String[] a2 = getAffixes(); - aReturnValue = (a2[0] + aReturnValue + a2[1]); - return aReturnValue; - } - - public abstract String[] getAffixes(); - -} diff --git a/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java b/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java deleted file mode 100644 index 1644856bf8..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java +++ /dev/null @@ -1,12 +0,0 @@ -package gtPlusPlus.core.item.base.nugget; - -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.material.Material; - -public class BaseItemNugget extends BaseItemComponent{ - - public BaseItemNugget(final Material material) { - super(material, BaseItemComponent.ComponentTypes.NUGGET); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseItemCentrifugedCrushedOre.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseItemCentrifugedCrushedOre.java deleted file mode 100644 index 73a13f568d..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/ore/BaseItemCentrifugedCrushedOre.java +++ /dev/null @@ -1,10 +0,0 @@ -package gtPlusPlus.core.item.base.ore; - -import gtPlusPlus.core.material.Material; - -public class BaseItemCentrifugedCrushedOre extends BaseOreComponent{ - - public BaseItemCentrifugedCrushedOre(final Material material) { - super(material, BaseOreComponent.ComponentTypes.CRUSHEDCENTRIFUGED); - } -} diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseItemCrushedOre.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseItemCrushedOre.java deleted file mode 100644 index f2ca40334f..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/ore/BaseItemCrushedOre.java +++ /dev/null @@ -1,10 +0,0 @@ -package gtPlusPlus.core.item.base.ore; - -import gtPlusPlus.core.material.Material; - -public class BaseItemCrushedOre extends BaseOreComponent{ - - public BaseItemCrushedOre(final Material material) { - super(material, BaseOreComponent.ComponentTypes.CRUSHED); - } -} diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseItemImpureDust.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseItemImpureDust.java deleted file mode 100644 index 45dc4f4402..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/ore/BaseItemImpureDust.java +++ /dev/null @@ -1,10 +0,0 @@ -package gtPlusPlus.core.item.base.ore; - -import gtPlusPlus.core.material.Material; - -public class BaseItemImpureDust extends BaseOreComponent{ - - public BaseItemImpureDust(final Material material) { - super(material, BaseOreComponent.ComponentTypes.DUSTIMPURE); - } -} diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseItemMilledOre.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseItemMilledOre.java deleted file mode 100644 index 4edf4ae75d..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/ore/BaseItemMilledOre.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.core.item.base.ore; - -import gregtech.api.enums.Materials; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import net.minecraft.item.Item; - -public class BaseItemMilledOre extends BaseOreComponent{ - - public BaseItemMilledOre(final Material material, int aMaterialEU) { - super(material, BaseOreComponent.ComponentTypes.MILLED); - CORE.RA.addMillingRecipe(material, aMaterialEU); - } - - public static Item generate(Materials aMat, int aMaterialEU) { - return generate(MaterialUtils.generateMaterialFromGtENUM(aMat), aMaterialEU); - } - - public static Item generate(Material aMat, int aMaterialEU) { - return new BaseItemMilledOre(aMat, aMaterialEU); - } - - -} diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseItemPurifiedCrushedOre.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseItemPurifiedCrushedOre.java deleted file mode 100644 index 3f2a1c23e6..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/ore/BaseItemPurifiedCrushedOre.java +++ /dev/null @@ -1,10 +0,0 @@ -package gtPlusPlus.core.item.base.ore; - -import gtPlusPlus.core.material.Material; - -public class BaseItemPurifiedCrushedOre extends BaseOreComponent{ - - public BaseItemPurifiedCrushedOre(final Material material) { - super(material, BaseOreComponent.ComponentTypes.CRUSHEDPURIFIED); - } -} diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseItemPurifiedDust.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseItemPurifiedDust.java deleted file mode 100644 index 0c9816fb56..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/ore/BaseItemPurifiedDust.java +++ /dev/null @@ -1,10 +0,0 @@ -package gtPlusPlus.core.item.base.ore; - -import gtPlusPlus.core.material.Material; - -public class BaseItemPurifiedDust extends BaseOreComponent{ - - public BaseItemPurifiedDust(final Material material) { - super(material, BaseOreComponent.ComponentTypes.DUSTPURE); - } -} diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java deleted file mode 100644 index 2cb23b3f97..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java +++ /dev/null @@ -1,279 +0,0 @@ -package gtPlusPlus.core.item.base.ore; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.api.enums.CustomOrePrefix; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -public class BaseOreComponent extends Item{ - - @SideOnly(Side.CLIENT) - private IIcon base; - @SideOnly(Side.CLIENT) - private IIcon overlay; - - public final Material componentMaterial; - public final String materialName; - public final String unlocalName; - public final ComponentTypes componentType; - public final int componentColour; - public Object extraData; - - public BaseOreComponent(final Material material, final ComponentTypes componentType) { - this.componentMaterial = material; - this.unlocalName = componentType.COMPONENT_NAME+material.getUnlocalizedName(); - this.materialName = material.getLocalizedName(); - this.componentType = componentType; - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(this.unlocalName); - this.setMaxStackSize(64); - this.componentColour = material.getRgbAsHex(); - GameRegistry.registerItem(this, this.unlocalName); - registerComponent(); - GT_OreDictUnificator.registerOre(componentType.getComponent()+material.getUnlocalizedName(), ItemUtils.getSimpleStack(this)); - if (LoadedMods.Thaumcraft) { - //ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), TC_Aspect_Wrapper.generate(TC_Aspects.METALLUM.mAspect), 1); - if (componentMaterial.isRadioactive) { - //ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), TC_Aspect_Wrapper.generate(TC_Aspects.RADIO.mAspect), componentMaterial.vRadiationLevel); - } - } - - } - - public boolean registerComponent() { - Logger.MATERIALS("Attempting to register "+this.getUnlocalizedName()+"."); - if (this.componentMaterial == null) { - Logger.MATERIALS("Tried to register "+this.getUnlocalizedName()+" but the material was null."); - return false; - } - //Register Component - Map<String, ItemStack> aMap = Material.mComponentMap.get(componentMaterial.getUnlocalizedName()); - if (aMap == null) { - aMap = new HashMap<String, ItemStack>(); - } - String aKey = "Invalid"; - if (componentType == ComponentTypes.CRUSHED) { - aKey = OrePrefixes.crushed.name(); - } - else if (componentType == ComponentTypes.CRUSHEDCENTRIFUGED) { - aKey = OrePrefixes.crushedCentrifuged.name(); - } - else if (componentType == ComponentTypes.CRUSHEDPURIFIED) { - aKey = OrePrefixes.crushedPurified.name(); - } - else if (componentType == ComponentTypes.DUST) { - aKey = OrePrefixes.dust.name(); - } - else if (componentType == ComponentTypes.DUSTIMPURE) { - aKey = OrePrefixes.dustImpure.name(); - } - else if (componentType == ComponentTypes.DUSTPURE) { - aKey = OrePrefixes.dustPure.name(); - } - else if (componentType == ComponentTypes.MILLED) { - aKey = CustomOrePrefix.milled.get().name(); - } - - ItemStack x = aMap.get(aKey); - if (x == null) { - aMap.put(aKey, ItemUtils.getSimpleStack(this)); - Logger.MATERIALS("Registering a material component. Item: ["+componentMaterial.getUnlocalizedName()+"] Map: ["+aKey+"]"); - Material.mComponentMap.put(componentMaterial.getUnlocalizedName(), aMap); - return true; - } - else { - //Bad - Logger.MATERIALS("Tried to double register a material component. "); - return false; - } - } - - /*@Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return (this.componentType.getPrefix()+this.componentMaterial.getLocalizedName()+this.componentType.DISPLAY_NAME); - }*/ - - public final String getMaterialName() { - return this.materialName; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public final void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if (this.materialName != null && !this.materialName.equals("")){ - if (this.componentMaterial != null){ - if (!this.componentMaterial.vChemicalFormula.contains("?")) { - list.add(Utils.sanitizeStringKeepBrackets(this.componentMaterial.vChemicalFormula)); - } - else if (this.componentMaterial.vChemicalFormula.contains("?")) { - String temp = componentMaterial.vChemicalFormula; - temp = temp.replace(" ", ""); - temp = temp.replace("-", ""); - temp = temp.replace("_", ""); - temp = temp.replace("!", ""); - temp = temp.replace("@", ""); - temp = temp.replace("#", ""); - temp = temp.replace(" ", ""); - list.add(temp); - } - if (this.componentMaterial.isRadioactive){ - list.add(CORE.GT_Tooltip_Radioactive+" | Level: "+this.componentMaterial.vRadiationLevel); - } - } - else { - String aChemicalFormula = Material.sChemicalFormula.get(materialName.toLowerCase()); - if (aChemicalFormula != null && aChemicalFormula.length() > 0) { - list.add(Utils.sanitizeStringKeepBrackets(aChemicalFormula)); - } - } - } - super.addInformation(stack, aPlayer, list, bool); - } - - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - if (this.componentMaterial != null){ - if (entityHolding instanceof EntityPlayer){ - if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){ - EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.componentMaterial.vRadiationLevel, world, entityHolding); - } - } - } - } - - - - /** - * Rendering Related - * @author Alkalus - * - */ - - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses(){ - if (this.componentType.hasOverlay()){ - return true; - } - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(final IIconRegister par1IconRegister){ - if (this.componentType == ComponentTypes.MILLED) { - this.base = par1IconRegister.registerIcon(CORE.MODID + ":" + "processing/MilledOre/milled"); - if (this.componentType.hasOverlay()){ - this.overlay = par1IconRegister.registerIcon(CORE.MODID + ":" + "processing/MilledOre/milled_OVERLAY"); - } - } - else if (CORE.ConfigSwitches.useGregtechTextures){ - //Logger.MATERIALS(this.componentType.getPrefix()+this.componentMaterial.getLocalizedName()+this.componentType.DISPLAY_NAME+" is using `"+"gregtech" + ":" + "materialicons/METALLIC/" + this.componentType.COMPONENT_NAME+"' as the layer 0 texture path."); - this.base = par1IconRegister.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + this.componentType.COMPONENT_NAME); - if (this.componentType.hasOverlay()){ - //Logger.MATERIALS(this.componentType.getPrefix()+this.componentMaterial.getLocalizedName()+this.componentType.DISPLAY_NAME+" is using `"+"gregtech" + ":" + "materialicons/METALLIC/" + this.componentType.COMPONENT_NAME+"_OVERLAY"+"' as the layer 1 texture path."); - this.overlay = par1IconRegister.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + this.componentType.COMPONENT_NAME+"_OVERLAY"); - } - } - else { - this.base = par1IconRegister.registerIcon(CORE.MODID + ":" + "item"+this.componentType.getComponent()); - if (this.componentType.hasOverlay()){ - this.overlay = par1IconRegister.registerIcon(CORE.MODID + ":" + "item"+this.componentType.getComponent()+"_Overlay"); - } - } - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int renderPass) { - if (this.componentType == ComponentTypes.MILLED) { - if (renderPass == 1){ - return Utils.rgbtoHexValue(230, 230, 230); - } - return this.componentColour; - } - else { - if (renderPass == 0 && !CORE.ConfigSwitches.useGregtechTextures){ - return this.componentColour; - } - if (renderPass == 1 && CORE.ConfigSwitches.useGregtechTextures){ - return Utils.rgbtoHexValue(230, 230, 230); - } - return this.componentColour; - } - } - - - @Override - public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { - if(pass == 0) { - return this.base; - } - return this.overlay; - } - - - - - public static enum ComponentTypes { - DUST("dust", "", " Dust", true), - DUSTIMPURE("dustImpure", "Impure ", " Dust", true), - DUSTPURE("dustPure", "Purified ", " Dust", true), - CRUSHED("crushed", "Crushed ", " Ore", true), - CRUSHEDCENTRIFUGED("crushedCentrifuged", "Centrifuged Crushed "," Ore", true), - CRUSHEDPURIFIED("crushedPurified", "Purified Crushed ", " Ore", true), - MILLED("milled", "Milled ", " Ore", true); - - private String COMPONENT_NAME; - private String PREFIX; - private String DISPLAY_NAME; - private boolean HAS_OVERLAY; - private ComponentTypes (final String LocalName, final String prefix, final String DisplayName, final boolean overlay){ - this.COMPONENT_NAME = LocalName; - this.PREFIX = prefix; - this.DISPLAY_NAME = DisplayName; - this.HAS_OVERLAY = overlay; - // dust + Dirty, Impure, Pure, Refined - // crushed + centrifuged, purified - } - - public String getComponent(){ - return this.COMPONENT_NAME; - } - - public String getName(){ - return this.DISPLAY_NAME; - } - - public boolean hasOverlay(){ - return this.HAS_OVERLAY; - } - - public String getPrefix(){ - return this.PREFIX; - } - } - -} - - diff --git a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java deleted file mode 100644 index a810b22c70..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java +++ /dev/null @@ -1,18 +0,0 @@ -package gtPlusPlus.core.item.base.plates; - -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.state.MaterialState; -import gtPlusPlus.core.util.minecraft.MaterialUtils; - -public class BaseItemPlate extends BaseItemComponent{ - - public BaseItemPlate(final Material material) { - super(material, BaseItemComponent.ComponentTypes.PLATE); - } - - public BaseItemPlate(final String unlocalizedName, final String materialName, final MaterialState state, final short[] colour, final int tier, final int sRadioactivity) { - this(MaterialUtils.generateQuickMaterial(materialName, state, new short[]{colour[0], colour[1], colour[2], 0}, sRadioactivity)); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java deleted file mode 100644 index 31f86e8ffa..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java +++ /dev/null @@ -1,20 +0,0 @@ -package gtPlusPlus.core.item.base.plates; - -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.material.Material; - -public class BaseItemPlateDouble extends BaseItemComponent{ - - public BaseItemPlateDouble(final Material material) { - super(material, BaseItemComponent.ComponentTypes.PLATEDOUBLE); - this.setMaxStackSize(32); - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return ("Double "+this.materialName+ " Plate"); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateHeavy.java b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateHeavy.java deleted file mode 100644 index c9072b0d82..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateHeavy.java +++ /dev/null @@ -1,47 +0,0 @@ -package gtPlusPlus.core.item.base.plates; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.util.IIcon; - -public class BaseItemPlateHeavy extends BaseItemComponent{ - - final static ComponentTypes HEAVY = ComponentTypes.PLATEHEAVY; - - public BaseItemPlateHeavy(final Material material) { - super(material, HEAVY); - } - - @Override - public String getCorrectTextures(){ - return CORE.MODID + ":" + "itemHeavyPlate"; - } - - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses(){ - return true; - } - - @Override - public void registerIcons(final IIconRegister i) { - this.base = i.registerIcon(CORE.MODID + ":" + "itemHeavyPlate"); - this.overlay = i.registerIcon(CORE.MODID + ":" + "itemHeavyPlate_Overlay"); - } - - @Override - public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { - - if (pass == 0) { - return this.base; - } - else { - return this.overlay; - } - - } -} diff --git a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java deleted file mode 100644 index ec3f449b0a..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java +++ /dev/null @@ -1,95 +0,0 @@ -package gtPlusPlus.core.item.base.plates; - -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import gregtech.api.util.GT_OreDictUnificator; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.data.StringUtils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class BaseItemPlate_OLD extends Item{ - - protected final int colour; - protected final int sRadiation; - protected final String materialName; - protected final String unlocalName; - protected final String chemicalNotation; - - public BaseItemPlate_OLD(final String unlocalizedName, final String materialName, final int colour, final int sRadioactivity) { - this(unlocalizedName, materialName, "NullFormula", colour, sRadioactivity); - } - - public BaseItemPlate_OLD(final String unlocalizedName, final String materialName, final String mChemicalFormula, final int colour, final int sRadioactivity) { - this.setUnlocalizedName("itemPlate"+unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.unlocalName = "itemPlate"+unlocalizedName; - this.setMaxStackSize(64); - this.setTextureName(CORE.MODID + ":" + "itemPlate"); - this.setMaxStackSize(64); - this.colour = colour; - this.materialName = materialName; - if (mChemicalFormula.equals("") || mChemicalFormula.equals("NullFormula")){ - this.chemicalNotation = StringUtils.subscript(materialName); - } - else { - this.chemicalNotation = StringUtils.subscript(mChemicalFormula); - } - this.sRadiation = sRadioactivity; - GameRegistry.registerItem(this, "itemPlate"+unlocalizedName); - String temp; - if (this.unlocalName.toLowerCase().contains("itemplate")){ - temp = this.unlocalName.replace("itemP", "p"); - if ((temp != null) && !temp.equals("")){ - GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); - } - } - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - - return (this.materialName+ " plate"); - } - - public final String getMaterialName() { - return this.materialName; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - if (this.colour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return this.colour; - - } - - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.sRadiation, world, entityHolding); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if (this.sRadiation > 0){ - list.add(CORE.GT_Tooltip_Radioactive); - } - if (StringUtils.containsSuperOrSubScript(this.chemicalNotation)){ - list.add(this.chemicalNotation); - } - super.addInformation(stack, aPlayer, list, bool); - } -} diff --git a/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java b/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java deleted file mode 100644 index c83ae94af1..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java +++ /dev/null @@ -1,12 +0,0 @@ -package gtPlusPlus.core.item.base.rings; - -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.material.Material; - -public class BaseItemRing extends BaseItemComponent{ - - public BaseItemRing(final Material material) { - super(material, BaseItemComponent.ComponentTypes.RING); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java deleted file mode 100644 index f77f846d34..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java +++ /dev/null @@ -1,12 +0,0 @@ -package gtPlusPlus.core.item.base.rods; - -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.material.Material; - -public class BaseItemRod extends BaseItemComponent{ - - public BaseItemRod(final Material material) { - super(material, BaseItemComponent.ComponentTypes.ROD); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java deleted file mode 100644 index 215012817d..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java +++ /dev/null @@ -1,18 +0,0 @@ -package gtPlusPlus.core.item.base.rods; - -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.material.Material; -import net.minecraft.item.ItemStack; - -public class BaseItemRodLong extends BaseItemComponent{ - - public BaseItemRodLong(final Material material) { - super(material, BaseItemComponent.ComponentTypes.RODLONG); - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return ("Long "+this.materialName+ " Rod"); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java b/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java deleted file mode 100644 index 6960e89e89..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java +++ /dev/null @@ -1,11 +0,0 @@ -package gtPlusPlus.core.item.base.rotors; - -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.material.Material; - -public class BaseItemRotor extends BaseItemComponent{ - - public BaseItemRotor(final Material material) { - super(material, BaseItemComponent.ComponentTypes.ROTOR); - } -} diff --git a/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java b/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java deleted file mode 100644 index dbd817215a..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java +++ /dev/null @@ -1,12 +0,0 @@ -package gtPlusPlus.core.item.base.screws; - -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.material.Material; - -public class BaseItemScrew extends BaseItemComponent{ - - public BaseItemScrew(final Material material) { - super(material, BaseItemComponent.ComponentTypes.SCREW); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/bauble/BaseBauble.java b/src/Java/gtPlusPlus/core/item/bauble/BaseBauble.java deleted file mode 100644 index fdd148b97b..0000000000 --- a/src/Java/gtPlusPlus/core/item/bauble/BaseBauble.java +++ /dev/null @@ -1,190 +0,0 @@ -package gtPlusPlus.core.item.bauble; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; - -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.DamageSource; -import net.minecraft.world.World; - -import baubles.api.BaubleType; -import baubles.api.IBauble; -import baubles.common.container.InventoryBaubles; -import baubles.common.lib.PlayerHandler; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils.BT; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import net.minecraftforge.event.entity.living.LivingAttackEvent; - -@Optional.InterfaceList(value = { @Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), - @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles") }) -public class BaseBauble extends Item implements IBauble { - - /** - * Implementation suggestions taken from Botania. - */ - - private BaubleType mThisBauble; - private final String mDisplayName; - private List<String> damageNegations = new ArrayList<String>(); - Multimap<String, AttributeModifier> attributes = HashMultimap.create(); - - public BaseBauble(BaubleType type, String displayName) { - this.mThisBauble = type; - this.mDisplayName = displayName; - Utils.registerEvent(this); - this.setMaxStackSize(1); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(Utils.sanitizeString(displayName.toLowerCase())); - GameRegistry.registerItem(this, getUnlocalizedName()); - } - - public BaseBauble(BaubleType type, String unlocalName, int register) { - this.mThisBauble = type; - this.mDisplayName = ""; - Utils.registerEvent(this); - this.setMaxStackSize(1); - this.setCreativeTab(AddToCreativeTab.tabMisc); - } - - @Override - public String getItemStackDisplayName(final ItemStack tItem) { - if (this.mDisplayName == null || this.mDisplayName.length() < 1) { - return super.getItemStackDisplayName(tItem).replaceAll(".name", ""); - } - return this.mDisplayName; - } - - @SubscribeEvent - public void onPlayerAttacked(LivingAttackEvent event) { - if (event.entityLiving instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) event.entityLiving; - if (getCorrectBauble(player) != null && damageNegations.contains(event.source.damageType)) - event.setCanceled(true); - } - } - - public boolean addDamageNegation(DamageSource damageSource) { - return addDamageNegation(damageSource, null); - } - - public boolean addDamageNegation(DamageSource damageSource, ItemStack aStack) { - return damageNegations.add(damageSource.damageType); - } - - public void clearDamageNegation() { - damageNegations.clear(); - } - - @Override - public boolean canEquip(ItemStack arg0, EntityLivingBase arg1) { - return EntityPlayer.class.isInstance(arg1) ? true : false; - } - - @Override - public boolean canUnequip(ItemStack arg0, EntityLivingBase arg1) { - return EntityPlayer.class.isInstance(arg1) ? true : false; - } - - @Override - public BaubleType getBaubleType(ItemStack arg0) { - return mThisBauble; - } - - public boolean SetBaubleType(BT arg0) { - return SetBaubleType(arg0.getType()); - } - - public boolean SetBaubleType(BaubleType arg0) { - BaubleType temp = this.mThisBauble; - this.mThisBauble = arg0; - if (this.mThisBauble != temp) { - return true; - } - return false; - } - - @Override - public void onEquipped(ItemStack stack, EntityLivingBase entity) { - if (entity != null && EntityPlayer.class.isInstance(entity)) { - onEquippedOrLoadedIntoWorld(stack, entity); - setPlayerHashcode(stack, entity.hashCode()); - } - } - - @Override - public void onWornTick(ItemStack stack, EntityLivingBase player) { - if (getPlayerHashcode(stack) != player.hashCode()) { - onEquippedOrLoadedIntoWorld(stack, player); - setPlayerHashcode(stack, player.hashCode()); - } - } - - public void onEquippedOrLoadedIntoWorld(ItemStack stack, EntityLivingBase player) { - attributes.clear(); - fillModifiers(attributes, stack); - player.getAttributeMap().applyAttributeModifiers(attributes); - } - - @Override - public void onUnequipped(ItemStack stack, EntityLivingBase player) { - attributes.clear(); - fillModifiers(attributes, stack); - player.getAttributeMap().removeAttributeModifiers(attributes); - } - - void fillModifiers(Multimap<String, AttributeModifier> attributes, ItemStack stack) { - - } - - public ItemStack getCorrectBauble(EntityPlayer player) { - InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player); - ItemStack stack1 = baubles.getStackInSlot(1); - ItemStack stack2 = baubles.getStackInSlot(2); - return isCorrectBauble(stack1) ? stack1 : isCorrectBauble(stack2) ? stack2 : null; - } - - private boolean isCorrectBauble(ItemStack stack) { - return stack != null && (stack.getItem() == this); - } - - @Override - public int getEntityLifespan(ItemStack itemStack, World world) { - return Integer.MAX_VALUE; - } - - public static UUID getBaubleUUID(ItemStack stack) { - long most = NBTUtils.getLong(stack, "baubleUUIDMost"); - if (most == 0) { - UUID uuid = UUID.randomUUID(); - NBTUtils.setLong(stack, "baubleUUIDMost", uuid.getMostSignificantBits()); - NBTUtils.setLong(stack, "baubleUUIDLeast", uuid.getLeastSignificantBits()); - return getBaubleUUID(stack); - } - - long least = NBTUtils.getLong(stack, "baubleUUIDLeast"); - return new UUID(most, least); - } - - public static int getPlayerHashcode(ItemStack stack) { - return NBTUtils.getInteger(stack, "mPlayerHashcode"); - } - - public static void setPlayerHashcode(ItemStack stack, int hash) { - NBTUtils.setInteger(stack, "mPlayerHashcode", hash); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java b/src/Java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java deleted file mode 100644 index 70de4603e7..0000000000 --- a/src/Java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java +++ /dev/null @@ -1,259 +0,0 @@ -package gtPlusPlus.core.item.bauble; - -import java.util.List; - -import baubles.api.BaubleType; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.GT_Values; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; - -public class BatteryPackBaseBauble extends ElectricBaseBauble { - - - public BatteryPackBaseBauble(int tier) { - super(BaubleType.BELT, tier, GT_Values.V[tier] * 20 * 300, "GTPP.BattPack.0" + tier + ".name"); - String aUnlocalName = "GTPP.BattPack.0" + tier + ".name"; - this.setCreativeTab(AddToCreativeTab.tabMachines); - if (GameRegistry.findItem(CORE.MODID, aUnlocalName) == null) { - GameRegistry.registerItem(this, aUnlocalName); - } - } - - @SideOnly(Side.CLIENT) - @Override - public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) { - ItemStack itemStack = new ItemStack(this, 1); - ItemStack charged; - if (this.getEmptyItem(itemStack) == this) { - charged = new ItemStack(this, 1); - ElectricItem.manager.charge(charged, 0.0D, Integer.MAX_VALUE, true, false); - itemList.add(charged); - } - if (this.getChargedItem(itemStack) == this) { - charged = new ItemStack(this, 1); - ElectricItem.manager.charge(charged, Double.POSITIVE_INFINITY, Integer.MAX_VALUE, true, false); - itemList.add(charged); - } - - } - - @Override - public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, - final boolean p_77663_5_) { - super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_); - } - - @Override - public boolean canProvideEnergy(final ItemStack itemStack) { - double aItemCharge = ElectricItem.manager.getCharge(itemStack); - return aItemCharge > 0; - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return (EnumChatFormatting.BLUE + super.getItemStackDisplayName(p_77653_1_) + EnumChatFormatting.GRAY); - } - - @Override - public boolean showDurabilityBar(final ItemStack stack) { - return true; - } - - public int secondsLeft(final ItemStack stack) { - double r = 0; - r = this.getCharge(stack) / (10000 * 20); - return (int) MathUtils.decimalRounding(r); - } - - @SuppressWarnings("unchecked") - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(""); - String aString1 = StatCollector.translateToLocal("GTPP.battpack.tooltip.1"); - String aString2 = StatCollector.translateToLocal("GTPP.battpack.tooltip.2"); - String aString3 = StatCollector.translateToLocal("GTPP.battpack.tooltip.3"); - String aString4 = StatCollector.translateToLocal("GTPP.battpack.tooltip.4"); - - String aEU = StatCollector.translateToLocal("GTPP.info.eu"); - String aEUT = aEU+"/t"; - - list.add(EnumChatFormatting.GREEN + aString1 + EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GREEN + aString2+" " + (int) getTransferLimit(stack) + aEUT +" "+ aString3 + EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GREEN + aString4 + EnumChatFormatting.GRAY); - super.addInformation(stack, aPlayer, list, bool); - } - - @Override - public String getToolTip(final ItemStack stack) { - return ElectricItem.manager.getToolTip(stack); - } - - @Override - public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) { - return true; - } - - @Override - public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) { - return true; - } - - @Override // TODO - public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) { - - } - - @Override // TODO - public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) { - - } - - @Override // TODO - public void onWornTick(final ItemStack aBaubleStack, final EntityLivingBase aPlayer) { - if (!aPlayer.worldObj.isRemote) { - - try { - - if (this.getCharge(aBaubleStack) >= getTransferLimit(aBaubleStack)) { - // Try Iterate Armour Slots of Player - if (aPlayer instanceof EntityPlayer) { - - // amour - for (final ItemStack aInvStack : ((EntityPlayer) aPlayer).inventory.armorInventory) { - if (aInvStack != null) { - if (aInvStack == aBaubleStack) { - continue; - } - if (ChargingHelper.isItemValid(aInvStack)) { - double aTransferRate = 0; - final IElectricItem electricItem = (IElectricItem) aInvStack.getItem(); - if (electricItem != null) { - aTransferRate = electricItem.getTransferLimit(aInvStack); - double aItemCharge = ElectricItem.manager.getCharge(aInvStack); - if (aItemCharge >= 0 && aItemCharge != electricItem.getMaxCharge(aInvStack)) { - if (aItemCharge <= (electricItem.getMaxCharge(aInvStack) - aTransferRate)) { - if (ElectricItem.manager.getCharge(aBaubleStack) >= aTransferRate) { - if (ElectricItem.manager.getCharge(aInvStack) <= (electricItem.getMaxCharge(aInvStack) - aTransferRate)) { - double d = ElectricItem.manager.charge(aInvStack, aTransferRate * 16, mTier, false, true); - if (d > 0) { - d = ElectricItem.manager.charge(aInvStack, aTransferRate * 16, mTier, false, false); - ElectricItem.manager.discharge(aBaubleStack, d, mTier, false, true, false); - //Logger.INFO("Charging " + aInvStack.getDisplayName() + " | " + d + " | "+electricItem.getMaxCharge(aInvStack)); - } - } - else { - //Logger.INFO("5"); - } - } - else { - //Logger.INFO("4"); - } - } - else { - //Logger.INFO("3"); - } - - } - else { - //Logger.INFO("1"); - } - } - - } - } - if (this.getCharge(aBaubleStack) > 0) { - continue; - } else { - break; - } - } - - // Hotbar Slots - int aSlotCounter = 0; - for (final ItemStack aInvStack : ((EntityPlayer) aPlayer).inventory.mainInventory) { - if (aSlotCounter > (InventoryPlayer.getHotbarSize() - 1)) { - break; - } - aSlotCounter++; - if (aInvStack != null) { - if (aInvStack == aBaubleStack) { - continue; - } - if (ChargingHelper.isItemValid(aInvStack)) { - double aTransferRate = 0; - final IElectricItem electricItem = (IElectricItem) aInvStack.getItem(); - if (electricItem != null) { - aTransferRate = electricItem.getTransferLimit(aInvStack); - double aItemCharge = ElectricItem.manager.getCharge(aInvStack); - if (aItemCharge >= 0 && aItemCharge != electricItem.getMaxCharge(aInvStack)) { - if (aItemCharge <= (electricItem.getMaxCharge(aInvStack) - aTransferRate)) { - if (ElectricItem.manager.getCharge(aBaubleStack) >= aTransferRate) { - if (ElectricItem.manager.getCharge(aInvStack) <= (electricItem.getMaxCharge(aInvStack) - aTransferRate)) { - double d = ElectricItem.manager.charge(aInvStack, aTransferRate, mTier, false, true); - if (d > 0) { - d = ElectricItem.manager.charge(aInvStack, aTransferRate, mTier, false, false); - ElectricItem.manager.discharge(aBaubleStack, d, mTier, false, true, false); - //Logger.INFO("Charging " + aInvStack.getDisplayName() + " | " + d + " | "+electricItem.getMaxCharge(aInvStack)); - } - } - else { - //Logger.INFO("5"); - } - } - else { - //Logger.INFO("4"); - } - } - else { - //Logger.INFO("3"); - } - - } - else { - //Logger.INFO("1"); - } - } - } - } - if (this.getCharge(aBaubleStack) > 0) { - continue; - } else { - break; - } - } - } - } - } - catch (Throwable t) { - - } - } - - - - - } - - @Override - public String getTextureNameForBauble() { - return "chargepack/"+mTier; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/bauble/ElectricBaseBauble.java b/src/Java/gtPlusPlus/core/item/bauble/ElectricBaseBauble.java deleted file mode 100644 index 4316f13401..0000000000 --- a/src/Java/gtPlusPlus/core/item/bauble/ElectricBaseBauble.java +++ /dev/null @@ -1,197 +0,0 @@ -package gtPlusPlus.core.item.bauble; - -import java.util.List; - -import baubles.api.BaubleType; -import baubles.api.IBauble; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.GT_Values; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; -import ic2.api.item.IElectricItemManager; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; - -@Optional.InterfaceList(value = { @Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), -@Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles") }) -public abstract class ElectricBaseBauble extends BaseBauble implements IElectricItem, IElectricItemManager, IBauble { - - public final int mTier; - private final double maxValueEU; - private final BaubleType mType; - - public ElectricBaseBauble(BaubleType aType, int aTier, double aMaxEU, String aUnlocalName) { - super(aType, aUnlocalName, 0); - mType = aType; - mTier = aTier; - maxValueEU = aMaxEU; - this.setUnlocalizedName(aUnlocalName); - this.setTextureName(CORE.MODID + ":" + getTextureNameForBauble()); - this.setMaxDamage(27); - this.setMaxStackSize(1); - this.setNoRepair(); - this.setCreativeTab(AddToCreativeTab.tabMachines); - if (GameRegistry.findItem(CORE.MODID, aUnlocalName) == null) { - GameRegistry.registerItem(this, aUnlocalName); - } - } - - public abstract String getTextureNameForBauble(); - - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - @Override - public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) { - ItemStack itemStack = new ItemStack(this, 1); - ItemStack charged; - if (this.getEmptyItem(itemStack) == this) { - charged = new ItemStack(this, 1); - ElectricItem.manager.charge(charged, 0.0D, Integer.MAX_VALUE, true, false); - itemList.add(charged); - } - if (this.getChargedItem(itemStack) == this) { - charged = new ItemStack(this, 1); - ElectricItem.manager.charge(charged, Double.POSITIVE_INFINITY, Integer.MAX_VALUE, true, false); - itemList.add(charged); - } - - } - - @Override - public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, - final boolean p_77663_5_) { - super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_); - } - - @Override - public boolean canProvideEnergy(final ItemStack itemStack) { - double aItemCharge = ElectricItem.manager.getCharge(itemStack); - return aItemCharge > 0; - } - - @Override - public final Item getChargedItem(final ItemStack itemStack) { - final ItemStack x = itemStack.copy(); - x.setItemDamage(27); - return x.getItem(); - } - - @Override - public final Item getEmptyItem(final ItemStack itemStack) { - final ItemStack x = itemStack.copy(); - x.setItemDamage(0); - return x.getItem(); - } - - @Override - public final double getMaxCharge(final ItemStack itemStack) { - return maxValueEU; - } - - @Override - public final int getTier(final ItemStack itemStack) { - return mTier; - } - - @Override - public final double getTransferLimit(final ItemStack itemStack) { - return GT_Values.V[mTier]; - } - - @Override - public final double getDurabilityForDisplay(final ItemStack stack) { - return 1.0D - (this.getCharge(stack) / this.getMaxCharge(stack)); - } - - @Override - public boolean showDurabilityBar(final ItemStack stack) { - return true; - } - - @SuppressWarnings("unchecked") - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(""); - String aEuInfo = StatCollector.translateToLocal("GTPP.info.euInfo"); - String aTier = StatCollector.translateToLocal("GTPP.machines.tier"); - String aInputLimit = StatCollector.translateToLocal("GTPP.info.inputLimit"); - String aCurrentPower = StatCollector.translateToLocal("GTPP.info.currentPower"); - String aEU = StatCollector.translateToLocal("GTPP.info.eu"); - String aEUT = aEU+"/t"; - - list.add(EnumChatFormatting.GOLD + aEuInfo + EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GRAY + aTier+": [" + EnumChatFormatting.YELLOW + this.getTier(stack) - + EnumChatFormatting.GRAY + "] "+aInputLimit+": [" + EnumChatFormatting.YELLOW - + this.getTransferLimit(stack) + EnumChatFormatting.GRAY + aEUT+"]"); - list.add(EnumChatFormatting.GRAY + aCurrentPower +": [" + EnumChatFormatting.YELLOW + (long) this.getCharge(stack) - + EnumChatFormatting.GRAY + aEU +"] [" + EnumChatFormatting.YELLOW - + MathUtils.findPercentage(this.getCharge(stack), this.getMaxCharge(stack)) + EnumChatFormatting.GRAY - + "%]"); - super.addInformation(stack, aPlayer, list, bool); - } - - @Override - public final double charge(final ItemStack stack, final double amount, final int tier, final boolean ignoreTransferLimit, - final boolean simulate) { - /*if (!simulate) { - ElectricItem.manager.charge(stack, amount, tier, true, simulate); - }*/ - - return ElectricItem.manager.charge(stack, amount, tier, true, simulate); - } - - @Override - public final double discharge(final ItemStack stack, final double amount, final int tier, - final boolean ignoreTransferLimit, final boolean externally, final boolean simulate) { - /*if (!simulate) { - ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); - }*/ - - return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); - } - - @Override - public final double getCharge(final ItemStack stack) { - return ElectricItem.manager.getCharge(stack); - } - - @Override - public final boolean canUse(final ItemStack stack, final double amount) { - return ElectricItem.manager.canUse(stack, amount); - } - - @Override - public final boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) { - return ElectricItem.manager.use(stack, amount, entity); - } - - @Override - public final void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) { - ElectricItem.manager.chargeFromArmor(stack, entity); - } - - @Override - public String getToolTip(final ItemStack stack) { - //return ElectricItem.manager.getToolTip(stack); - return null; - } - - @Override - public final BaubleType getBaubleType(final ItemStack arg0) { - return mType; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java b/src/Java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java deleted file mode 100644 index 6a8751b682..0000000000 --- a/src/Java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java +++ /dev/null @@ -1,137 +0,0 @@ -package gtPlusPlus.core.item.bauble; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.UUID; - -import baubles.api.BaubleType; -import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.preloader.DevHelper; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -public class FireProtectionBauble extends BaseBauble { - - public static HashMap<UUID, Boolean> mDataMap = new HashMap<UUID, Boolean>(); - public static HashSet<UUID> mPlayerMap = new HashSet<UUID>(); - - private static Field isImmuneToFire; - - static { - isImmuneToFire = ReflectionUtils.getField(Entity.class, DevHelper.isObfuscatedEnvironment() ? "func_70045_F" : "isImmuneToFire"); - } - - public static boolean fireImmune(Entity aEntity) { - return aEntity.isImmuneToFire(); - } - - public static boolean setEntityImmuneToFire(Entity aEntity, boolean aImmune) { - try { - return ReflectionUtils.setField(aEntity, isImmuneToFire, aImmune); - } - catch (Throwable t) {} - return false; - } - - public FireProtectionBauble() { - super(BaubleType.RING, "GTPP.bauble.fireprotection.0" + ".name", 0); - String aUnlocalName = "GTPP.bauble.fireprotection.0" + ".name"; - this.setUnlocalizedName(aUnlocalName); - this.setTextureName(CORE.MODID + ":" + getTextureNameForBauble()); - this.setMaxDamage(100); - this.setMaxStackSize(1); - this.setNoRepair(); - this.setCreativeTab(AddToCreativeTab.tabMachines); - if (GameRegistry.findItem(CORE.MODID, aUnlocalName) == null) { - GameRegistry.registerItem(this, aUnlocalName); - } - } - - @Override - public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, - final boolean p_77663_5_) { - super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_); - - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return (EnumChatFormatting.DARK_RED + super.getItemStackDisplayName(p_77653_1_) + EnumChatFormatting.GRAY); - } - - @Override - public boolean showDurabilityBar(final ItemStack stack) { - return false; - } - - @SuppressWarnings("unchecked") - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - super.addInformation(stack, aPlayer, list, bool); - } - - @Override - public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) { - return true; - } - - @Override - public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) { - return true; - } - - @Override - public void onEquipped(final ItemStack arg0, final EntityLivingBase aPlayer) { - if (!aPlayer.worldObj.isRemote) { - if (aPlayer instanceof EntityPlayer) { - EntityPlayer bPlayer = (EntityPlayer) aPlayer; - mPlayerMap.add(bPlayer.getUniqueID()); - } - } - } - - @Override - public void onUnequipped(final ItemStack arg0, final EntityLivingBase aPlayer) { - if (!aPlayer.worldObj.isRemote) { - if (aPlayer instanceof EntityPlayer) { - EntityPlayer bPlayer = (EntityPlayer) aPlayer; - if (bPlayer.isPotionActive(Potion.fireResistance)) { - bPlayer.removePotionEffect(Potion.fireResistance.id); - } - mPlayerMap.remove(bPlayer.getUniqueID()); - setEntityImmuneToFire(bPlayer, false); - } - } - } - - @Override - public void onWornTick(final ItemStack aBaubleStack, final EntityLivingBase aPlayer) { - if (!aPlayer.worldObj.isRemote) { - if (aPlayer instanceof EntityPlayer) { - EntityPlayer bPlayer = (EntityPlayer) aPlayer; - if (!fireImmune(bPlayer)) { - setEntityImmuneToFire(bPlayer, true); - } - if (!bPlayer.isPotionActive(Potion.fireResistance)) { - bPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 100, 4)); - } - } - } - } - - public String getTextureNameForBauble() { - return "baubles/itemFireProtectGlovesBetter"; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/bauble/HealthBoostBauble.java b/src/Java/gtPlusPlus/core/item/bauble/HealthBoostBauble.java deleted file mode 100644 index 49ce7ad715..0000000000 --- a/src/Java/gtPlusPlus/core/item/bauble/HealthBoostBauble.java +++ /dev/null @@ -1,39 +0,0 @@ -package gtPlusPlus.core.item.bauble; - -import java.util.List; - -import com.google.common.collect.Multimap; - -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.DamageSource; -import net.minecraft.util.EnumChatFormatting; - -import baubles.api.BaubleType; -import gtPlusPlus.core.lib.CORE; - -public class HealthBoostBauble extends BaseBauble{ - - - public HealthBoostBauble() { - super(BaubleType.AMULET, "The Key to the City"); - addDamageNegation(DamageSource.wither); - this.setTextureName(CORE.MODID + ":" + "itemKeyGold"); - } - - @Override - void fillModifiers(Multimap<String, AttributeModifier> attributes, ItemStack stack) { - attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "Bauble modifier", 40, 0)); - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { - list.add(EnumChatFormatting.GRAY+"You feel like you're on top of the world."); - list.add(EnumChatFormatting.GRAY+"Wear it around your neck like an amulet."); - super.addInformation(stack, player, list, bool); - } - - -} diff --git a/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java b/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java deleted file mode 100644 index a8d216e1bc..0000000000 --- a/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java +++ /dev/null @@ -1,408 +0,0 @@ -package gtPlusPlus.core.item.bauble; - -import java.util.List; - -import org.lwjgl.input.Keyboard; - -import com.google.common.collect.Multimap; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.attributes.AttributeModifier; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.DamageSource; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; - -import baubles.api.BaubleType; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils.BT; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils.Modifiers; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; - -public class ModularBauble extends BaseBauble { - - @SideOnly(Side.CLIENT) - private IIcon mTextureAmulet; - @SideOnly(Side.CLIENT) - private IIcon mTextureRing; - @SideOnly(Side.CLIENT) - private IIcon mTextureBelt; - private IIcon iconArray[] = new IIcon[3]; - @SideOnly(Side.CLIENT) - private IIcon mfallback; - - public ModularBauble() { - super(BaubleType.AMULET, "Modular Bauble"); - } - - @Override - void fillModifiers(Multimap<String, AttributeModifier> attributes, ItemStack stack) { - - // Get Stats - int mStatlevel = 0; - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DAMAGE)) > 0) { - if (mStatlevel > 0 && mStatlevel < 20) { - attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), - new AttributeModifier(getBaubleUUID(stack), "AD" + mStatlevel, 1, 0)); - } else if (mStatlevel > 20 && mStatlevel < 45) { - attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), - new AttributeModifier(getBaubleUUID(stack), "AD" + mStatlevel, 2, 0)); - } else if (mStatlevel >= 45 && mStatlevel < 75) { - attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), - new AttributeModifier(getBaubleUUID(stack), "AD" + mStatlevel, 4, 0)); - } else if (mStatlevel >= 75 && mStatlevel < 99) { - attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), - new AttributeModifier(getBaubleUUID(stack), "AD" + mStatlevel, 8, 0)); - } else if (mStatlevel >= 100) { - attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), - new AttributeModifier(getBaubleUUID(stack), "AD" + mStatlevel, 16, 0)); - } - } - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DEF)) > 0) { - if (mStatlevel > 0 && mStatlevel < 20) { - attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), - new AttributeModifier(getBaubleUUID(stack), "BD" + mStatlevel, 1, 0)); - } else if (mStatlevel > 20 && mStatlevel < 45) { - attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), - new AttributeModifier(getBaubleUUID(stack), "BD" + mStatlevel, 2, 0)); - } else if (mStatlevel > 45 && mStatlevel < 75) { - attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), - new AttributeModifier(getBaubleUUID(stack), "BD" + mStatlevel, 3, 0)); - } else if (mStatlevel > 75 && mStatlevel < 99) { - attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), - new AttributeModifier(getBaubleUUID(stack), "BD" + mStatlevel, 6, 0)); - } else if (mStatlevel >= 100) { - attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), - new AttributeModifier(getBaubleUUID(stack), "BD" + mStatlevel, 10, 0)); - } - } - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HP)) > 0) { - if (mStatlevel > 0 && mStatlevel <= 100) { - int bonus = mStatlevel / 5; - attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), - new AttributeModifier(getBaubleUUID(stack), "HP" + mStatlevel, bonus * 2, 0)); - } - } - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_SPEED)) > 0) { - if (mStatlevel > 0 && mStatlevel < 20) { - attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), - new AttributeModifier(getBaubleUUID(stack), "SP" + mStatlevel, 1, 0)); - } else if (mStatlevel > 20 && mStatlevel < 45) { - attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), - new AttributeModifier(getBaubleUUID(stack), "SP" + mStatlevel, 2, 0)); - } else if (mStatlevel > 45 && mStatlevel < 75) { - attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), - new AttributeModifier(getBaubleUUID(stack), "SP" + mStatlevel, 3, 0)); - } else if (mStatlevel > 75 && mStatlevel < 99) { - attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), - new AttributeModifier(getBaubleUUID(stack), "SP" + mStatlevel, 4, 0)); - } else if (mStatlevel >= 100) { - attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), - new AttributeModifier(getBaubleUUID(stack), "SP" + mStatlevel, 5, 0)); - } - } - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_MINING)) > 0) { - } - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HOLY)) > 0) { - } - - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { - // Bauble Type - if (ModularArmourUtils.getBaubleType(stack) == BaubleType.AMULET) { - list.add(EnumChatFormatting.GRAY + "Current Form: " + EnumChatFormatting.RED + "Amulet" - + EnumChatFormatting.GRAY + "."); - list.add(EnumChatFormatting.GRAY + "You can change this into a Ring or a Belt."); - } else if (ModularArmourUtils.getBaubleType(stack) == BaubleType.RING) { - list.add(EnumChatFormatting.GRAY + "Current Form: " + EnumChatFormatting.RED + "Ring" - + EnumChatFormatting.GRAY + "."); - list.add(EnumChatFormatting.GRAY + "You can change this into an Amulet or a Belt."); - } else if (ModularArmourUtils.getBaubleType(stack) == BaubleType.BELT) { - list.add(EnumChatFormatting.GRAY + "Current Form: " + EnumChatFormatting.RED + "Belt" - + EnumChatFormatting.GRAY + "."); - list.add(EnumChatFormatting.GRAY + "You can change this into a Ring or an Amulet."); - } - - // Get Stats - int mStatlevel = 0; - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DAMAGE)) > 0) { - list.add(EnumChatFormatting.GRAY + "Damage Boost: " + EnumChatFormatting.DARK_RED + mStatlevel - + EnumChatFormatting.GRAY + "/100."); - } - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HP)) > 0) { - list.add(EnumChatFormatting.GRAY + "Health Boost: " + EnumChatFormatting.RED + mStatlevel - + EnumChatFormatting.GRAY + "/100. Bonus " + (mStatlevel / 5) + " hearts."); - } - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_SPEED)) > 0) { - list.add(EnumChatFormatting.GRAY + "Speed Boost: " + EnumChatFormatting.WHITE + mStatlevel - + EnumChatFormatting.GRAY + "/100."); - } - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_MINING)) > 0) { - list.add(EnumChatFormatting.GRAY + "Mining Boost: " + EnumChatFormatting.DARK_GRAY + mStatlevel - + EnumChatFormatting.GRAY + "/100."); - } - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HOLY)) > 0) { - list.add(EnumChatFormatting.GRAY + "Holy Boost: " + EnumChatFormatting.GOLD + mStatlevel - + EnumChatFormatting.GRAY + "/100."); - } - - // Defence Boost - if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DEF)) > 0) { - list.add(EnumChatFormatting.GRAY + "Defence Boost: " + EnumChatFormatting.BLUE + mStatlevel - + EnumChatFormatting.GRAY + "/100."); - - if ((Keyboard.isKeyDown(42)) || (Keyboard.isKeyDown(54))) { - - if (mStatlevel >= 1) { - list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Cactus" - + EnumChatFormatting.GRAY + "."); - } - if (mStatlevel >= 10) { - list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Falling Blocks" - + EnumChatFormatting.GRAY + "."); - } - if (mStatlevel >= 20) { - list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Wall Suffocation" - + EnumChatFormatting.GRAY + "."); - } - if (mStatlevel >= 35) { - list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Drowning" - + EnumChatFormatting.GRAY + "."); - } - if (mStatlevel >= 50) { - list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Starvation" - + EnumChatFormatting.GRAY + "."); - } - if (mStatlevel >= 60) { - list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Falling" - + EnumChatFormatting.GRAY + "."); - } - if (mStatlevel >= 75) { - list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Lava" - + EnumChatFormatting.GRAY + "."); - } - if (mStatlevel >= 80) { - list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Magic" - + EnumChatFormatting.GRAY + "."); - } - if (mStatlevel >= 95) { - list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Wither" - + EnumChatFormatting.GRAY + "."); - } - if (mStatlevel >= 100) { - list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Fire" - + EnumChatFormatting.GRAY + "."); - } - if (mStatlevel >= 100) { - list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Void" - + EnumChatFormatting.GRAY + "."); - } - - } - else { - list.add(EnumChatFormatting.GRAY + "<Press Shift to view protections>"); - } - } - - if (NBTUtils.getBotanicaSoulboundOwner(stack) != null) { - if (!NBTUtils.getBotanicaSoulboundOwner(stack).equals("")) { - list.add(EnumChatFormatting.GRAY + "Owner: " + EnumChatFormatting.GREEN - + NBTUtils.getBotanicaSoulboundOwner(stack) + EnumChatFormatting.GRAY + "."); - } - } - super.addInformation(stack, player, list, bool); - } - - @Override - public boolean addDamageNegation(DamageSource damageSource, ItemStack aStack) { - - this.clearDamageNegation(); - int mStatlevel = 0; - if ((mStatlevel = ModularArmourUtils.getModifierLevel(aStack, Modifiers.BOOST_HOLY)) > 0) { - if (mStatlevel >= 1) { - addDamageNegation(DamageSource.cactus); - } - if (mStatlevel >= 10) { - addDamageNegation(DamageSource.fallingBlock); - } - if (mStatlevel >= 20) { - addDamageNegation(DamageSource.inWall); - } - if (mStatlevel >= 35) { - addDamageNegation(DamageSource.drown); - } - if (mStatlevel >= 50) { - addDamageNegation(DamageSource.starve); - } - if (mStatlevel >= 60) { - addDamageNegation(DamageSource.fall); - } - if (mStatlevel >= 75) { - addDamageNegation(DamageSource.lava); - } - if (mStatlevel >= 80) { - addDamageNegation(DamageSource.magic); - } - if (mStatlevel >= 95) { - addDamageNegation(DamageSource.wither); - } - if (mStatlevel >= 100) { - addDamageNegation(DamageSource.inFire); - } - if (mStatlevel >= 100) { - addDamageNegation(DamageSource.onFire); - } - if (mStatlevel >= 100) { - addDamageNegation(DamageSource.outOfWorld); - } - } - return super.addDamageNegation(damageSource, null); - } - - @Override - public boolean canEquip(ItemStack arg0, EntityLivingBase arg1) { - if (ModularArmourUtils.getBaubleTypeID(arg0) == BT.TYPE_AMULET.getID()) { - this.SetBaubleType(BT.TYPE_AMULET); - } else if (ModularArmourUtils.getBaubleTypeID(arg0) == BT.TYPE_RING.getID()) { - this.SetBaubleType(BT.TYPE_RING); - } else if (ModularArmourUtils.getBaubleTypeID(arg0) == BT.TYPE_BELT.getID()) { - this.SetBaubleType(BT.TYPE_BELT); - } else { - this.SetBaubleType(BT.TYPE_RING); - } - if (PlayerUtils.isPlayerOP((EntityPlayer) arg1)) { - return true; // Let OPs wear other peoples shit. - } - - String mOwner; - if (NBTUtils.getBotanicaSoulboundOwner(arg0) == null || NBTUtils.getBotanicaSoulboundOwner(arg0).equals("")) { - return true; - } else if ((mOwner = NBTUtils.getBotanicaSoulboundOwner(arg0)) != null) { - String mPlayerName = arg1.getCommandSenderName(); - if (mOwner.toLowerCase().equals(mPlayerName.toLowerCase())) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - @Override - public BaubleType getBaubleType(ItemStack arg0) { - return ModularArmourUtils.getBaubleType(arg0); - } - - @Override - public void onEquipped(ItemStack stack, EntityLivingBase entity) { - if (entity instanceof EntityPlayer) { - if (NBTUtils.getBotanicaSoulboundOwner(stack) == null - || NBTUtils.getBotanicaSoulboundOwner(stack).equals("")) { - NBTUtils.setBotanicaSoulboundOwner(stack, entity.getCommandSenderName()); - } - } - super.onEquipped(stack, entity); - } - - /*@Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { - if (usingItem == null) { - return mfallback; - } - try { - if (stack.getItemDamage() == 0) { - return mfallback = mTextureAmulet; - } - else if (stack.getItemDamage() == 1) { - return mfallback = mTextureRing; - } - else if (stack.getItemDamage() == 2) { - return mfallback = mTextureBelt; - } else { - return mfallback = mTextureRing; - } - } catch (Throwable t) { - return mfallback = mTextureRing; - } - }*/ - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int meta) { - if (meta < this.iconArray.length && this.iconArray[meta] != null){ - return this.iconArray[meta]; - } - return this.mfallback; - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 3; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister register) { - this.mfallback = register.registerIcon("miscutils" + ":" + "itemAmulet"); - // you cannot initialize iconArray when declared nor in the constructor, - // as it is client-side only, so do it here: - if (LoadedMods.Thaumcraft) { - iconArray[0] = register.registerIcon("thaumcraft" + ":" + "bauble_amulet"); - iconArray[1] = register.registerIcon("thaumcraft" + ":" + "bauble_ring"); - iconArray[2] = register.registerIcon("thaumcraft" + ":" + "bauble_belt"); - } else { - iconArray[0] = register.registerIcon("miscutils" + ":" + "itemAmulet"); - iconArray[1] = register.registerIcon("miscutils" + ":" + "itemRingWearable"); - iconArray[2] = register.registerIcon("miscutils" + ":" + "itemBelt"); - } - - mTextureAmulet = iconArray[0]; - mTextureRing = iconArray[1]; - mTextureBelt = iconArray[2]; - - } - - @Override - public void onWornTick(ItemStack stack, EntityLivingBase player) { - super.onWornTick(stack, player); - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return false; - } - - @Override - public Item setFull3D() { - // TODO Auto-generated method stub - return super.setFull3D(); - } - - @Override - public boolean isFull3D() { - return true; - } - - @Override - public boolean isRepairable() { - return false; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java b/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java deleted file mode 100644 index aab302688b..0000000000 --- a/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java +++ /dev/null @@ -1,175 +0,0 @@ -package gtPlusPlus.core.item.bauble; - -import java.util.List; - -import baubles.api.BaubleType; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.GT_Values; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.AABB; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import ic2.api.item.ElectricItem; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; - -public class MonsterKillerBaseBauble extends ElectricBaseBauble { - - private final Class[] mTargets; - - public MonsterKillerBaseBauble(Class[] aMonsterBaseClassArray, String aMonsterTypeName, int aPowerTier) { - super(BaubleType.AMULET, aPowerTier, GT_Values.V[aPowerTier] * 20 * 300, - "GTPP.MonsterKiller." + aMonsterTypeName + ".name"); - mTargets = aMonsterBaseClassArray; - } - - @SideOnly(Side.CLIENT) - @Override - public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) { - ItemStack itemStack = new ItemStack(this, 1); - ItemStack charged; - if (this.getEmptyItem(itemStack) == this) { - charged = new ItemStack(this, 1); - ElectricItem.manager.charge(charged, 0.0D, Integer.MAX_VALUE, true, false); - itemList.add(charged); - } - if (this.getChargedItem(itemStack) == this) { - charged = new ItemStack(this, 1); - ElectricItem.manager.charge(charged, Double.POSITIVE_INFINITY, Integer.MAX_VALUE, true, false); - itemList.add(charged); - } - - } - - @Override - public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, - final boolean p_77663_5_) { - super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_); - } - - @Override - public boolean canProvideEnergy(final ItemStack itemStack) { - double aItemCharge = ElectricItem.manager.getCharge(itemStack); - return aItemCharge > 0; - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return (EnumChatFormatting.WHITE + super.getItemStackDisplayName(p_77653_1_) + EnumChatFormatting.GRAY); - } - - @Override - public boolean showDurabilityBar(final ItemStack stack) { - return true; - } - - @SuppressWarnings("unchecked") - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(""); - String aString1 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.1"); - String aString2 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.2"); - String aString3 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.3"); - String aString4 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.4"); - String aEU = StatCollector.translateToLocal("GTPP.info.eu"); - String aEUT = aEU + "/t"; - - list.add(EnumChatFormatting.GREEN + aString1 + EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GREEN + aString2 + " " + (int) getTransferLimit(stack) + aEUT + " " + aString3 - + EnumChatFormatting.GRAY); - list.add(""); - list.add("" + EnumChatFormatting.GREEN + aString4 + " " + EnumChatFormatting.GRAY); - for (Class cz : mTargets) { - list.add("- " + EnumChatFormatting.DARK_GREEN + cz.getSimpleName().replace("Entity", "") + EnumChatFormatting.GRAY); - } - - super.addInformation(stack, aPlayer, list, bool); - } - - @Override - public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) { - return true; - } - - @Override - public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) { - return true; - } - - @Override - public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) { - - } - - @Override - public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) { - - } - - @Override // TODO - public void onWornTick(final ItemStack aBaubleStack, final EntityLivingBase aPlayerEntity) { - if (aPlayerEntity == null) { - return; - } - EntityPlayer aPlayer = (EntityPlayer) aPlayerEntity; - if (!aPlayer.worldObj.isRemote) { - if (this.getCharge(aBaubleStack) >= getTransferLimit(aBaubleStack)) { - AABB aPlayerBox = new AABB(aPlayerEntity, 5, 5, 5); - if (this.mTargets != null && this.mTargets.length > 0) { - for (Class clazz : mTargets) { - AutoMap<?> aEnts = EntityUtils.getEntitiesWithinBoundingBox(clazz, aPlayerBox); - if (aEnts.isEmpty()) { - continue; - } else { - EntityLiving aClosest = null; - double aEntityDistance = Short.MIN_VALUE; - for (Object ent : aEnts) { - if (!EntityLiving.class.isInstance(ent)) { - continue; - } else { - double aCurEntDis = EntityUtils.getDistance(aPlayerEntity, (Entity) ent); - if (aEntityDistance == Short.MIN_VALUE || aCurEntDis < aEntityDistance) { - aEntityDistance = aCurEntDis; - aClosest = (EntityLiving) ent; - } - } - } - if (aClosest != null) { - float aEntHealth = aClosest.getHealth(); - float aEntMaxHealth = aClosest.getMaxHealth(); - double aEntHealthPerc = MathUtils.findPercentage(aEntHealth, aEntMaxHealth); - long aEuUsage = (long) (aEntHealthPerc * 50 * aEntMaxHealth); - if (this.discharge(aBaubleStack, aEuUsage, mTier, true, false, false) > 0) { - aClosest.setDead(); - PlayerUtils.messagePlayer(aPlayer, "Removed 1x "+aClosest.getCommandSenderName()); - break; - } - } else { - continue; - } - } - } - } - } else { - return; - } - } - } - - @Override - public String getTextureNameForBauble() { - return "baubles/itemAmulet"; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java b/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java deleted file mode 100644 index 8e7a760195..0000000000 --- a/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java +++ /dev/null @@ -1,614 +0,0 @@ -package gtPlusPlus.core.item.chemistry; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gtPlusPlus.api.helpers.MaterialHelper; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.ItemPackage; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.plugin.agrichem.BioRecipes; -import gtPlusPlus.plugin.agrichem.item.algae.ItemAgrichemBase; -import gtPlusPlus.plugin.agrichem.item.algae.ItemAlgaeBase; -import gtPlusPlus.plugin.agrichem.item.algae.ItemBioChip; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; - -public class AgriculturalChem extends ItemPackage { - - private static boolean aBOP; - private static boolean aTiCon; - - private static AutoMap<FluidStack> mBloodFluids = new AutoMap<FluidStack>(); - - /** - * Fluids - */ - - // Poop Juice - public static Fluid PoopJuice; - // Manure Slurry - public static Fluid ManureSlurry; - // Fertile Manure Slurry - public static Fluid FertileManureSlurry; - // Blood - public static Fluid CustomBlood; - // Red Mud - public static Fluid RedMud; - /** - * Items - */ - - // Manure Byproducts - public static Item dustManureByproducts; - // Organic Fertilizer - public static Item dustOrganicFertilizer; - // Dirt - public static Item dustDirt; - - // Poop Juice - // vv - Centrifuge - // Manure Slurry && Manure Byproducts -> (Elements) Centrifuge to several tiny - // piles - // vv - Chem Reactor - Add Peat, Meat - // Organic Fertilizer - // vv - Dehydrate - // Fertilizer - - // Poop Juice - // vv - Mixer - Add Blood, Bone, Meat (1000L Poo, 200L Blood, x2 Bone, x3 Meat) - // Fertile Manure Slurry - // vv - Chem Reactor - Add Peat x1.5 - // Organic Fertilizer x3 - // vv - Dehydrate - // Fertilizer - - - - public static Item mAlgae; - public static Item mBioCircuit; - public static Item mAgrichemItem1; - - /* - * 0 - Algae Biomass - * 1 - Green Algae Biomass - * 2 - Brown Algae Biomass - * 3 - Golden-Brown Algae Biomass - * 4 - Red Algae Biomass - * 5 - Cellulose Fiber - * 6 - Golden-Brown Cellulose Fiber - * 7 - Red Cellulose Fiber - * 8 - Compost - * 9 - Wood Pellet - * 10 - Wood Brick - * 11 - Cellulose Pulp - * 12 - Raw Bio Resin - * 13 - Catalyst Carrier - * 14 - Green Metal Catalyst - * 15 - Alginic Acid - * 16 - Alumina - * 17 - Aluminium Pellet - * 18 - Sodium Aluminate - * 19 - Sodium Hydroxide // Exists in Newer GT - * 20 - Sodium Carbonate - * 21 - Lithium Chloride - * 22 - Pellet Mold - * 23 - Clean Aluminium Mix - * 24 - Pinecone - */ - - public static ItemStack mAlgaeBiosmass; - public static ItemStack mGreenAlgaeBiosmass; - public static ItemStack mBrownAlgaeBiosmass; - public static ItemStack mGoldenBrownAlgaeBiosmass; - public static ItemStack mRedAlgaeBiosmass; - public static ItemStack mCelluloseFiber; - public static ItemStack mGoldenBrownCelluloseFiber; - public static ItemStack mRedCelluloseFiber; - public static ItemStack mCompost; - public static ItemStack mWoodPellet; - public static ItemStack mWoodBrick; - public static ItemStack mCellulosePulp; - public static ItemStack mRawBioResin; - public static ItemStack mCatalystCarrier; - public static ItemStack mGreenCatalyst; - public static ItemStack mAlginicAcid; - public static ItemStack mAlumina; - public static ItemStack mAluminiumPellet; - public static ItemStack mSodiumAluminate; - public static ItemStack mSodiumHydroxide; - public static ItemStack mSodiumCarbonate; - public static ItemStack mLithiumChloride; - public static ItemStack mPelletMold; - public static ItemStack mCleanAluminiumMix; - public static ItemStack mPinecone; - public static ItemStack mCrushedPine; - - - @Override - public void items() { - // Nitrogen, Ammonium Nitrate, Phosphates, Calcium, Copper, Carbon - dustManureByproducts = ItemUtils.generateSpecialUseDusts("ManureByproducts", "Manure Byproduct", - "(N2H4O3)N2P2Ca3CuC8", Utils.rgbtoHexValue(110, 75, 25))[0]; - - // Basically Guano - dustOrganicFertilizer = ItemUtils.generateSpecialUseDusts("OrganicFertilizer", "Organic Fertilizer", - "Ca5(PO4)3(OH)", Utils.rgbtoHexValue(240, 240, 240))[0]; - - // Dirt Dust :) - dustDirt = ItemUtils.generateSpecialUseDusts("Dirt", "Dried Earth", Utils.rgbtoHexValue(65, 50, 15))[0]; - - mAlgae = new ItemAlgaeBase(); - mAgrichemItem1 = new ItemAgrichemBase(); - mBioCircuit = new ItemBioChip(); - GregtechItemList.Circuit_BioRecipeSelector.set(mBioCircuit); - - - - mAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 0, 1); - mGreenAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 1, 1); - mBrownAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 2, 1); - mGoldenBrownAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 3, 1); - mRedAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 4, 1); - mCelluloseFiber = ItemUtils.simpleMetaStack(mAgrichemItem1, 5, 1); - mGoldenBrownCelluloseFiber = ItemUtils.simpleMetaStack(mAgrichemItem1, 6, 1); - mRedCelluloseFiber = ItemUtils.simpleMetaStack(mAgrichemItem1, 7, 1); - mCompost = ItemUtils.simpleMetaStack(mAgrichemItem1, 8, 1); - mWoodPellet = ItemUtils.simpleMetaStack(mAgrichemItem1, 9, 1); - mWoodBrick = ItemUtils.simpleMetaStack(mAgrichemItem1, 10, 1); - mCellulosePulp = ItemUtils.simpleMetaStack(mAgrichemItem1, 11, 1); - mRawBioResin = ItemUtils.simpleMetaStack(mAgrichemItem1, 12, 1); - mCatalystCarrier = ItemUtils.simpleMetaStack(mAgrichemItem1, 13, 1); - mGreenCatalyst = ItemUtils.simpleMetaStack(mAgrichemItem1, 14, 1); - mAlginicAcid = ItemUtils.simpleMetaStack(mAgrichemItem1, 15, 1); - mAlumina = ItemUtils.simpleMetaStack(mAgrichemItem1, 16, 1); - mAluminiumPellet = ItemUtils.simpleMetaStack(mAgrichemItem1, 17, 1); - mSodiumAluminate = ItemUtils.simpleMetaStack(mAgrichemItem1, 18, 1); - - /** - * If It exists, don't add a new one. - */ - if (OreDictionary.doesOreNameExist("dustSodiumHydroxide_GT5U") || OreDictionary.doesOreNameExist("dustSodiumHydroxide")) { - List<ItemStack> aTest = OreDictionary.getOres("dustSodiumHydroxide", false); - ItemStack aTestStack; - if (aTest.isEmpty()) { - aTest = OreDictionary.getOres("dustSodiumHydroxide_GT5U", false); - if (aTest.isEmpty()) { - aTestStack = ItemUtils.simpleMetaStack(mAgrichemItem1, 19, 1); - } - else { - aTestStack = aTest.get(0); - } - } - else { - aTestStack = aTest.get(0); - } - mSodiumHydroxide = aTestStack; - } - else { - mSodiumHydroxide = ItemUtils.simpleMetaStack(mAgrichemItem1, 19, 1); - } - mSodiumCarbonate = ItemUtils.simpleMetaStack(mAgrichemItem1, 20, 1); - mLithiumChloride = ItemUtils.simpleMetaStack(mAgrichemItem1, 21, 1); - mPelletMold = ItemUtils.simpleMetaStack(mAgrichemItem1, 22, 1); - mCleanAluminiumMix = ItemUtils.simpleMetaStack(mAgrichemItem1, 23, 1); - mPinecone = ItemUtils.simpleMetaStack(mAgrichemItem1, 24, 1); - mCrushedPine = ItemUtils.simpleMetaStack(mAgrichemItem1, 25, 1); - - ItemUtils.addItemToOreDictionary(mGreenAlgaeBiosmass, "biomassGreenAlgae"); - ItemUtils.addItemToOreDictionary(mBrownAlgaeBiosmass, "biomassBrownAlgae"); - ItemUtils.addItemToOreDictionary(mGoldenBrownAlgaeBiosmass, "biomassGoldenBrownAlgae"); - ItemUtils.addItemToOreDictionary(mRedAlgaeBiosmass, "biomassRedAlgae"); - - ItemUtils.addItemToOreDictionary(mCelluloseFiber, "fiberCellulose"); - ItemUtils.addItemToOreDictionary(mGoldenBrownCelluloseFiber, "fiberCellulose"); - ItemUtils.addItemToOreDictionary(mGoldenBrownCelluloseFiber, "fiberGoldenBrownCellulose"); - ItemUtils.addItemToOreDictionary(mRedCelluloseFiber, "fiberCellulose"); - ItemUtils.addItemToOreDictionary(mRedCelluloseFiber, "fiberRedCellulose"); - - ItemUtils.addItemToOreDictionary(mWoodPellet, "pelletWood"); - ItemUtils.addItemToOreDictionary(mWoodBrick, "brickWood"); - ItemUtils.addItemToOreDictionary(mCellulosePulp, "pulpCellulose"); - - ItemUtils.addItemToOreDictionary(mCatalystCarrier, "catalystEmpty"); - ItemUtils.addItemToOreDictionary(mGreenCatalyst, "catalystAluminiumSilver"); - ItemUtils.addItemToOreDictionary(mAlginicAcid, "dustAlginicAcid"); - ItemUtils.addItemToOreDictionary(mAlumina, "dustAlumina"); - ItemUtils.addItemToOreDictionary(mAluminiumPellet, "pelletAluminium"); - - ItemUtils.addItemToOreDictionary(mSodiumAluminate, "dustSodiumAluminate"); - ItemUtils.addItemToOreDictionary(mSodiumHydroxide, "dustSodiumHydroxide"); - ItemUtils.addItemToOreDictionary(mSodiumCarbonate, "dustSodiumCarbonate"); - ItemUtils.addItemToOreDictionary(mLithiumChloride, "dustLithiumChloride"); - ItemUtils.addItemToOreDictionary(mPinecone, "pinecone"); - ItemUtils.addItemToOreDictionary(mCrushedPine, "crushedPineMaterial"); - - //Handle GT NaOH dusts - List<ItemStack> NaOHSmall = OreDictionary.getOres("dustSmallSodiumHydroxide_GT5U", false); - if (!NaOHSmall.isEmpty()) { - ItemUtils.addItemToOreDictionary(NaOHSmall.get(0), "dustSmallSodiumHydroxide"); - } - List<ItemStack> NaOHTiny = OreDictionary.getOres("dustTinySodiumHydroxide_GT5U", false); - if (!NaOHTiny.isEmpty()) { - ItemUtils.addItemToOreDictionary(NaOHTiny.get(0), "dustTinySodiumHydroxide"); - } - - - } - - @Override - public void blocks() { - // None yet - } - - @Override - public void fluids() { - // Sewage - PoopJuice = FluidUtils.generateFluidNonMolten("raw.waste", "Raw Animal Waste", 32 + 175, - new short[] { 100, 70, 30, 100 }, null, null, 0, true); - - // Sewage - ManureSlurry = FluidUtils.generateFluidNonMolten("manure.slurry", "Manure Slurry", 39 + 175, - new short[] { 75, 45, 15, 100 }, null, null, 0, true); - - // Sewage - FertileManureSlurry = FluidUtils.generateFluidNonMolten("fertile.manure.slurry", "Fertile Manure Slurry", - 45 + 175, new short[] { 65, 50, 15, 100 }, null, null, 0, true); - - RedMud = FluidUtils.generateFluidNoPrefix("mud.red.slurry", "Red Mud Slurry", 32 + 175, new short[] { 180, 35, 25, 100 }, true); - - } - - - - public AgriculturalChem() { - super(); - - aBOP = LoadedMods.BiomesOPlenty; - aTiCon = LoadedMods.TiCon; - - Logger.INFO("Adding Agrochemical content"); - - FluidStack aBlood; - if (aBOP) { - aBlood = FluidUtils.getFluidStack("hell_blood", 100); - if (aBlood != null) { - Logger.INFO("Found Biome's o Plenty, enabled Blood support."); - CustomBlood = aBlood.getFluid(); - mBloodFluids.put(aBlood); - } - } - - if (aTiCon) { - aBlood = FluidUtils.getFluidStack("blood", 100); - if (aBlood != null) { - Logger.INFO("Found Tinker's Construct, enabled Blood support."); - CustomBlood = aBlood.getFluid(); - mBloodFluids.put(FluidUtils.getFluidStack("blood", 100)); - } - } - - // Handle Blood Internally, Create if required. - if (mBloodFluids.isEmpty() || CustomBlood == null) { - Logger.INFO( - "Did not find any existing Blood fluids. Trying to wildcard search the fluid registry, then generate our own if that fails."); - FluidStack aTempBlood = FluidUtils.getWildcardFluidStack("blood", 100); - if (aTempBlood != null) { - CustomBlood = aTempBlood.getFluid(); - } else { - aTempBlood = FluidUtils.getWildcardFluidStack("hell_blood", 100); - if (aTempBlood == null) { - CustomBlood = FluidUtils.generateFluidNoPrefix("blood", "Blood", 32 + 175, - new short[] { 175, 25, 25, 100 }, true); - } else { - CustomBlood = aTempBlood.getFluid(); - } - } - Logger.INFO("Using " + CustomBlood.getName()); - mBloodFluids.put(FluidUtils.getFluidStack(CustomBlood, 100)); - } - - } - - private final static AutoMap<ItemStack> mMeats = new AutoMap<ItemStack>(); - private final static AutoMap<ItemStack> mFish = new AutoMap<ItemStack>(); - private final static AutoMap<ItemStack> mFruits = new AutoMap<ItemStack>(); - private final static AutoMap<ItemStack> mVege = new AutoMap<ItemStack>(); - private final static AutoMap<ItemStack> mNuts = new AutoMap<ItemStack>(); - private final static AutoMap<ItemStack> mSeeds = new AutoMap<ItemStack>(); - private final static AutoMap<ItemStack> mPeat = new AutoMap<ItemStack>(); - private final static AutoMap<ItemStack> mBones = new AutoMap<ItemStack>(); - private final static AutoMap<ItemStack> mBoneMeal = new AutoMap<ItemStack>(); - - private final static AutoMap<ItemStack> mList_Master_Meats = new AutoMap<ItemStack>(); - private final static AutoMap<ItemStack> mList_Master_FruitVege = new AutoMap<ItemStack>(); - private final static AutoMap<ItemStack> mList_Master_Seeds = new AutoMap<ItemStack>(); - private final static AutoMap<ItemStack> mList_Master_Bones = new AutoMap<ItemStack>(); - - private static void processAllOreDict() { - processOreDict("listAllmeatraw", mMeats); - processOreDict("listAllfishraw", mFish); - processOreDict("listAllfruit", mFruits); - processOreDict("listAllVeggie", mVege); - processOreDict("listAllnut", mNuts); - processOreDict("listAllSeed", mSeeds); - processOreDict("brickPeat", mPeat); - processOreDict("bone", mBones); - processOreDict("dustBone", mBoneMeal); - // Just make a mega list, makes life easier. - if (!mMeats.isEmpty()) { - for (ItemStack g : mMeats) { - mList_Master_Meats.put(g); - } - } - if (!mFish.isEmpty()) { - for (ItemStack g : mFish) { - mList_Master_Meats.put(g); - } - } - if (!mFruits.isEmpty()) { - for (ItemStack g : mFruits) { - mList_Master_FruitVege.put(g); - } - } - if (!mVege.isEmpty()) { - for (ItemStack g : mVege) { - mList_Master_FruitVege.put(g); - } - } - if (!mNuts.isEmpty()) { - for (ItemStack g : mNuts) { - mList_Master_FruitVege.put(g); - } - } - if (!mSeeds.isEmpty()) { - for (ItemStack g : mSeeds) { - mList_Master_Seeds.put(g); - } - } - if (!mBoneMeal.isEmpty()) { - for (ItemStack g : mBoneMeal) { - mList_Master_Bones.put(g); - } - } - if (!mBones.isEmpty()) { - for (ItemStack g : mBones) { - mList_Master_Bones.put(g); - } - } - } - - private static void processOreDict(String aOreName, AutoMap<ItemStack> aMap) { - ArrayList<ItemStack> aTemp = OreDictionary.getOres(aOreName); - if (!aTemp.isEmpty()) { - for (ItemStack stack : aTemp) { - aMap.put(stack); - } - } - } - - private static void addBasicSlurryRecipes() { - - ItemStack aManureByprod1 = ItemUtils.getItemStackOfAmountFromOreDict("dustTinyManureByproducts", 1); - ItemStack aManureByprod2 = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallManureByproducts", 1); - ItemStack aDirtDust = ItemUtils.getSimpleStack(dustDirt, 1); - - // Poop Juice to Basic Slurry - GT_Values.RA.addCentrifugeRecipe(CI.getNumberedCircuit(10), null, FluidUtils.getFluidStack(PoopJuice, 1000), // In - // Fluid - FluidUtils.getFluidStack(ManureSlurry, 250), // Out Fluid - aDirtDust, aDirtDust, aManureByprod1, aManureByprod1, aManureByprod1, aManureByprod1, - new int[] { 2000, 2000, 500, 500, 250, 250 }, // Chances - 10 * 20, // Time - 30); // EU - - // More Efficient way to get byproducts, less Slurry - GT_Values.RA.addCentrifugeRecipe(CI.getNumberedCircuit(20), null, FluidUtils.getFluidStack(PoopJuice, 1000), // In - // Fluid - FluidUtils.getFluidStack(ManureSlurry, 50), // Out Fluid - aDirtDust, aDirtDust, aManureByprod1, aManureByprod1, aManureByprod2, aManureByprod2, - new int[] { 4000, 3000, 1250, 1250, 675, 675 }, // Chances - 20 * 20, // Time - 60); // EU - - } - - private static void addAdvancedSlurryRecipes() { - - ItemStack aCircuit = CI.getNumberedCircuit(10); - ItemStack aBone; - ItemStack aMeat; - ItemStack aEmptyCells = CI.emptyCells(2); - ItemStack aInputCells = ItemUtils.getItemStackOfAmountFromOreDict("cellRawAnimalWaste", 2); - FluidStack aOutput = FluidUtils.getFluidStack(FertileManureSlurry, 1000); - - for (FluidStack aBloodStack : mBloodFluids) { - for (ItemStack aBoneStack : mList_Master_Bones) { - aBone = ItemUtils.getSimpleStack(aBoneStack, 2); - for (ItemStack aMeatStack : mList_Master_Meats) { - aMeat = ItemUtils.getSimpleStack(aMeatStack, 5); - // Poop Juice to Fertile Slurry - GT_Values.RA.addMixerRecipe(aCircuit, aBone, aMeat, aInputCells, aBloodStack, // Input Fluid - aOutput, // Output Fluid - aEmptyCells, // Output Item - 20 * 8, // Time? - 60 // Eu? - ); - } - } - } - } - - private static void addBasicOrganiseFertRecipes() { - FluidStack aInputFluid = FluidUtils.getFluidStack(ManureSlurry, 1000); - ItemStack aOutputDust = ItemUtils.getSimpleStack(dustOrganicFertilizer, 3); - ItemStack aPeat; - ItemStack aMeat; - for (ItemStack aPeatStack : mPeat) { - aPeat = ItemUtils.getSimpleStack(aPeatStack, 3); - for (ItemStack aMeatStack : mList_Master_Meats) { - aMeat = ItemUtils.getSimpleStack(aMeatStack, 5); - CORE.RA.addChemicalRecipe(aPeat, aMeat, aInputFluid, null, aOutputDust, 20 * 20, 120); - } - - aPeat = ItemUtils.getSimpleStack(aPeatStack, 2); - for (ItemStack aMeatStack : mList_Master_FruitVege) { - aMeat = ItemUtils.getSimpleStack(aMeatStack, 9); - CORE.RA.addChemicalRecipe(aPeat, aMeat, aInputFluid, null, aOutputDust, 10 * 20, 120); - } - } - } - - private static void addAdvancedOrganiseFertRecipes() { - FluidStack aInputFluid = FluidUtils.getFluidStack(FertileManureSlurry, 1000); - ItemStack aOutputDust = ItemUtils.getSimpleStack(dustOrganicFertilizer, 7); - ItemStack aPeat; - ItemStack aMeat; - for (ItemStack aPeatStack : mPeat) { - aPeat = ItemUtils.getSimpleStack(aPeatStack, 5); - for (ItemStack aMeatStack : mList_Master_Meats) { - aMeat = ItemUtils.getSimpleStack(aMeatStack, 7); - CORE.RA.addChemicalRecipe(aPeat, aMeat, aInputFluid, null, aOutputDust, 10 * 20, 140); - } - aPeat = ItemUtils.getSimpleStack(aPeatStack, 3); - for (ItemStack aMeatStack : mList_Master_FruitVege) { - aMeat = ItemUtils.getSimpleStack(aMeatStack, 12); - CORE.RA.addChemicalRecipe(aPeat, aMeat, aInputFluid, null, aOutputDust, 5 * 20, 140); - } - } - } - - public static ItemStack aFertForestry; - public static ItemStack aFertIC2; - - - private static void addMiscRecipes() { - - ItemStack aDustOrganicFert = ItemUtils.getSimpleStack(dustOrganicFertilizer, 1); - ItemStack aManureByprod = ItemUtils.getSimpleStack(dustManureByproducts, 1); - - // Dehydrate Organise Fert to Normal Fert. - - /** - * Forestry Support - */ - if (LoadedMods.Forestry) { - Field aItemField = ReflectionUtils.getField(ReflectionUtils.getClass("forestry.plugins.PluginCore"), "items"); - try { - Object aItemRegInstance = aItemField != null ? aItemField.get(aItemField) : null; - if (aItemRegInstance != null) { - Field aFertField = ReflectionUtils.getField(aItemRegInstance.getClass(), "fertilizerCompound"); - Object aItemInstance = aFertField.get(aItemRegInstance); - if (aItemInstance instanceof Item) { - aFertForestry = ItemUtils.getSimpleStack((Item) aItemInstance); - Item aForestryFert = (Item) aItemInstance; - CORE.RA.addDehydratorRecipe( - new ItemStack[] { CI.getNumberedCircuit(11), ItemUtils.getSimpleStack(aDustOrganicFert, 4) }, null, - null, new ItemStack[] { ItemUtils.getSimpleStack(aForestryFert, 3), aManureByprod, aManureByprod }, - new int[] { 10000, 2000, 2000 }, 20 * 20, 240); - } - } - } - catch (IllegalArgumentException | IllegalAccessException e) { - - } - } - - /** - * IC2 Support - */ - if (LoadedMods.IndustrialCraft2) { - aFertIC2 = ItemUtils.getItemStackFromFQRN("IC2:itemFertilizer", 1); - CORE.RA.addDehydratorRecipe( - new ItemStack[] { CI.getNumberedCircuit(12), ItemUtils.getSimpleStack(aDustOrganicFert, 4) }, null, - null, new ItemStack[] { ItemUtils.getItemStackFromFQRN("IC2:itemFertilizer", 3), aManureByprod, - aManureByprod }, - new int[] { 10000, 2000, 2000 }, 20 * 20, 240); - } - - // Dirt Production - CORE.RA.addCompressorRecipe(ItemUtils.getSimpleStack(dustDirt, 9), ItemUtils.getSimpleStack(Blocks.dirt), - 20 * 2, 8); - - // Centrifuge Byproducts - - // Ammonium Nitrate, Phosphates, Calcium, Copper, Carbon - GT_Values.RA.addCentrifugeRecipe(CI.getNumberedCircuit(20), ItemUtils.getSimpleStack(aManureByprod, 4), - FluidUtils.getFluidStack("sulfuricacid", 250), // In Fluid - FluidUtils.getFluidStack("sulfuricapatite", 50), // Out Fluid - MaterialHelper.getDustSmall(Materials.Phosphorus, 2), MaterialHelper.getDustSmall(Materials.Calcium, 2), - MaterialHelper.getDustTiny(Materials.Copper, 1), MaterialHelper.getDust(Materials.Carbon, 1), ItemUtils.getSimpleStack(dustDirt, 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAmmoniumNitrate", 1), - new int[] { 2500, 2500, 750, 1000, 5000, 250 }, // Chances - 20 * 20, // Time - 60); // EU - - // Add Fuel Usages - CORE.RA.addSemifluidFuel(FluidUtils.getFluidStack(PoopJuice, 1000), 12); - CORE.RA.addSemifluidFuel(FluidUtils.getFluidStack(ManureSlurry, 1000), 24); - CORE.RA.addSemifluidFuel(FluidUtils.getFluidStack(FertileManureSlurry, 1000), 32); - - // Red Slurry / Tailings Processing - GT_Values.RA.addCentrifugeRecipe( - CI.getNumberedBioCircuit(10), - GT_Values.NI, - FluidUtils.getFluidStack(AgriculturalChem.RedMud, 1000), - FluidUtils.getWater(500), - ELEMENT.getInstance().IRON.getSmallDust(1), - ELEMENT.getInstance().COPPER.getSmallDust(1), - ELEMENT.getInstance().TIN.getSmallDust(1), - ELEMENT.getInstance().SULFUR.getSmallDust(1), - ELEMENT.getInstance().NICKEL.getTinyDust(1), - ELEMENT.getInstance().LEAD.getTinyDust(1), - new int[] { 3000, 3000, 2000, 2000, 1000, 1000 }, - 30 * 20, - 30); - - } - - @Override - public String errorMessage() { - return "Failed to generate recipes for AgroChem."; - } - - @Override - public boolean generateRecipes() { - if (mBloodFluids.isEmpty()) { - Logger.INFO("Could not find, nor create Blood fluid. Unable to add recipes."); - return false; - } - - // Organise OreDict - processAllOreDict(); - - // Slurry Production - addBasicSlurryRecipes(); - addAdvancedSlurryRecipes(); - - // Organic Fert. Production - addBasicOrganiseFertRecipes(); - addAdvancedOrganiseFertRecipes(); - - addMiscRecipes(); - - BioRecipes.init(); - - return true; - } -} diff --git a/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java b/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java deleted file mode 100644 index ca9053dacb..0000000000 --- a/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java +++ /dev/null @@ -1,378 +0,0 @@ -package gtPlusPlus.core.item.chemistry; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.api.objects.minecraft.ItemPackage; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.AddGregtechRecipe; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -public class CoalTar extends ItemPackage { - - public static Fluid Coal_Gas; - public static Fluid Coal_Oil; - public static Fluid Ethylene; - public static Fluid Ethylbenzene; - public static Fluid Anthracene; - public static Fluid Toluene; - public static Fluid Coal_Tar; - public static Fluid Coal_Tar_Oil; - public static Fluid Sulfuric_Coal_Tar_Oil; - public static Fluid Naphthalene; - public static Fluid Phthalic_Acid; - - private static void recipeEthylBenzineFuelsIntoHeavyFuel() { - CORE.RA.addChemicalRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("cellFuel", 9), - ItemUtils.getItemStackOfAmountFromOreDict("cellEthylbenzene", 2), - null, - FluidUtils.getFluidStack("nitrofuel", 7500), - ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 11), - 100, - CORE.GTNH ? 1000 : 500); - CORE.RA.addChemicalRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("cellBioDiesel", 9), - ItemUtils.getItemStackOfAmountFromOreDict("cellEthylbenzene", 2), - null, - FluidUtils.getFluidStack("nitrofuel", 3000), - ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 11), - 300, - CORE.GTNH ? 1000 : 500); - } - - public static void recipeCreateEthylene(){ - - FluidStack bioEth1 = FluidUtils.getFluidStack("fluid.bioethanol", 2000); - FluidStack bioEth2 = FluidUtils.getFluidStack("bioethanol", 2000); - - if (bioEth1 != null){ - CORE.RA.addDehydratorRecipe( - new ItemStack[] { - CI.getNumberedBioCircuit(17), - ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 1) - }, - bioEth1, - FluidUtils.getWater(1000), - new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("cellEthylene", 1) - }, - new int[] {10000}, - 120 * 20, - 80); - } - - if (bioEth2 != null){ - CORE.RA.addDehydratorRecipe( - new ItemStack[] { - CI.getNumberedBioCircuit(18), - ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 1) - }, - bioEth2, - FluidUtils.getWater(1000), - new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("cellEthylene", 1) - }, - new int[] {10000}, - 120 * 20, - 80); - } - } - - public static void recipeCreateBenzene(){ - //Create Benzene - (Toluene + Hydrogen | 95% Benzene / 5% methane) - CORE.RA.addDehydratorRecipe( - new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("cellToluene", 10), - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogen", 10) - }, - null, - null, - new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("cellMethane", 1), - ItemUtils.getItemStackOfAmountFromOreDict("cellBenzene", 19) - }, - new int[]{10000, 10000}, - 20*100, - 90); - } - - public static void recipeCreateEthylbenzene(){ - GT_Values.RA.addChemicalRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("cellEthylene", 2), - ItemUtils.getItemStackOfAmountFromOreDict("cellBenzene", 2), - null, - FluidUtils.getFluidStack("fluid.ethylbenzene", 4000), - ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 4), - 300); - } - - - public static void recipeCoalToCoalTar(){ - //Charcoal - AddGregtechRecipe.addCokeAndPyrolyseRecipes( - GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Charcoal, 32L), - 8, - GT_Values.NF, - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallDirt", 2), - FluidUtils.getFluidStack("fluid.coaltar", 800), - 15, - 120); - //Lignite - AddGregtechRecipe.addCokeAndPyrolyseRecipes( - GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Lignite, 16L), - 8, - GT_Values.NF, - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallDarkAsh", 2), - FluidUtils.getFluidStack("fluid.coaltar", 800), - 45, - 60); - - //Coal - AddGregtechRecipe.addCokeAndPyrolyseRecipes( - GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 12L), - 8, - GT_Values.NF, - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallDarkAsh", 2), - FluidUtils.getFluidStack("fluid.coaltar", 2200), - 30, - 120); - - //Coke - AddGregtechRecipe.addCokeAndPyrolyseRecipes( - ItemUtils.getItemStackOfAmountFromOreDict("fuelCoke", 8), - 8, - GT_Values.NF, - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallAsh", 3), - FluidUtils.getFluidStack("fluid.coaltar", 3400), - 15, - 240); - - } - - private static void recipeCoalTarToCoalTarOil() { - // v - Distill (60% Tar oil/15% Naphtha/20% Ethylbenzene/5% Anthracene) - //Create Coal Tar Oil - //FluidUtils.generateFluidNonMolten("CoalTarOil", "Coal Tar Oil", 240, new short[]{240, 240, 150, 100}, null, null); - GT_Values.RA.addDistilleryRecipe( - CI.getNumberedCircuit(1), //Circuit - FluidUtils.getFluidStack("fluid.coaltar", 1000), //aInput - FluidUtils.getFluidStack("fluid.coaltaroil", 600), //aOutput - 600, //aDuration - 64,//aEUt - false //Hidden? - ); - GT_Values.RA.addDistilleryRecipe( - CI.getNumberedCircuit(2), //Circuit - FluidUtils.getFluidStack("fluid.coaltar", 1000), //aInput - FluidUtils.getFluidStack("liquid_naphtha", 150), //aOutput - 300, //aDuration - 30,//aEUt - false //Hidden? - ); - GT_Values.RA.addDistilleryRecipe( - CI.getNumberedCircuit(3), //Circuit - FluidUtils.getFluidStack("fluid.coaltar", 1000), //aInput - FluidUtils.getFluidStack("fluid.ethylbenzene", 200), //aOutput - 450, //aDuration - 86,//aEUt - false //Hidden? - ); - GT_Values.RA.addDistilleryRecipe( - CI.getNumberedCircuit(4), //Circuit - FluidUtils.getFluidStack("fluid.coaltar", 1000), //aInput - FluidUtils.getFluidStack("fluid.anthracene", 50), //aOutput - 900, //aDuration - 30,//aEUt - false //Hidden? - ); - GT_Values.RA.addDistilleryRecipe( - CI.getNumberedCircuit(5), //Circuit - FluidUtils.getFluidStack("fluid.coaltar", 1500), //aInput - FluidUtils.getFluidStack("fluid.kerosene", 600), //aOutput - 300, //aDuration - 64,//aEUt - false //Hidden? - ); - - GT_Values.RA.addDistillationTowerRecipe( - FluidUtils.getFluidStack("fluid.coaltar", 1200), - new FluidStack[]{ - FluidUtils.getFluidStack("fluid.coaltaroil", 500), //aOutput - FluidUtils.getFluidStack("liquid_naphtha", 100), //aOutput - FluidUtils.getFluidStack("fluid.ethylbenzene", 150), //aOutput - FluidUtils.getFluidStack("fluid.anthracene", 50), //aOutput - FluidUtils.getFluidStack("fluid.kerosene", 400), //aOutput - }, - null, - 900, - 60); - - } - - private static void recipeCoalTarOilToSulfuricOilToNaphthalene() { - //SulfuricCoalTarOil - GT_Values.RA.addChemicalRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("cellCoalTarOil", 8), - ItemUtils.getItemStackOfAmountFromOreDict("cellSulfuricAcid", 8), - null, - null, - ItemUtils.getItemStackOfAmountFromOreDict("cellSulfuricCoalTarOil", 16), - 20*16); - GT_Values.RA.addDistilleryRecipe( - CI.getNumberedCircuit(6), //Circuit - FluidUtils.getFluidStack("fluid.sulfuriccoaltaroil", 1000), //aInput - FluidUtils.getFluidStack("fluid.naphthalene", 1000), //aOutput - 1200, //aDuration - 30,//aEUt - false //Hidden? - ); - - } - - private static void recipeNaphthaleneToPhthalicAcid() { - //SulfuricCoalTarOil - GT_Values.RA.addChemicalRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("cellNaphthalene", 2), - ItemUtils.getItemStackOfAmountFromOreDict("dustLithium", 5), - null, - FluidUtils.getFluidStack("fluid.phthalicacid", 2500), - ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 2), - 20*16); - - } - - private static void recipePhthalicAcidToPhthalicAnhydride() { - CORE.RA.addDehydratorRecipe( - new ItemStack[] { - CI.getNumberedBioCircuit(15) - }, - FluidUtils.getFluidStack("fluid.phthalicacid", 144), - null, - new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("dustPhthalicAnhydride", 1) - }, - new int[] {10000}, - 60 * 20, - 120); - } - - @Override - public String errorMessage() { - return "Bad Coal Science!"; - } - - @Override - public boolean generateRecipes() { - recipeCreateEthylene(); - recipeCreateBenzene(); - recipeCreateEthylbenzene(); - - recipeCoalToCoalTar(); - recipeCoalTarToCoalTarOil(); - recipeCoalTarOilToSulfuricOilToNaphthalene(); - recipeNaphthaleneToPhthalicAcid(); - recipePhthalicAcidToPhthalicAnhydride(); - - recipeEthylBenzineFuelsIntoHeavyFuel(); - - recipePhthalicAcidConversion(); - - //Burn the coal gas! - GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellCoalGas", 1), null, 96, 1); - CORE.RA.addSemifluidFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellSulfuricCoalTarOil", 1), 64); - CORE.RA.addSemifluidFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellCoalTarOil", 1), 32); - CORE.RA.addSemifluidFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellCoalTar", 1), 16); - - return true; - } - - private void recipePhthalicAcidConversion() { - FluidStack aMyAcid = FluidUtils.getFluidStack(Phthalic_Acid, 500); - FluidStack aGtAcid = FluidUtils.getFluidStack("phtalicacid", 500); - if (aMyAcid != null && aGtAcid != null) { - CORE.RA.addDistilleryRecipe(CI.getNumberedBioCircuit(8), aMyAcid, aGtAcid, null, 50, 16, false); - CORE.RA.addDistilleryRecipe(CI.getNumberedBioCircuit(9), aGtAcid, aMyAcid, null, 50, 16, false); - } - } - - @Override - public void items() { - //Phthalic_Acid = FluidUtils.generateFluidNonMolten("PhthalicAcid", "Phthalic Acid", 207, new short[]{210, 220, 210, 100}, null, null); - // v - Dehydrate at 180C+ - //Create Phthalic Anhydride - ItemUtils.generateSpecialUseDusts("PhthalicAnhydride", "Phthalic Anhydride", "C6H4(CO)2O", Utils.rgbtoHexValue(175, 175, 175)); - - //Lithium Hydroperoxide - LiOH + H2O2 → LiOOH + 2 H2O - ItemUtils.generateSpecialUseDusts("LithiumHydroperoxide", "Lithium Hydroperoxide", "HLiO2", Utils.rgbtoHexValue(125, 125, 125)); - // v - Dehydrate - //Lithium Peroxide - 2 LiOOH → Li2O2 + H2O2 + 2 H2O - //Lithium_Peroxide = FluidUtils.generateFluidNonMolten("LithiumPeroxide", "Lithium Peroxide", 446, new short[]{135, 135, 135, 100}, null, null); - } - - @Override - public void blocks() { - - } - - @Override - public void fluids() { - - //Create Coal Gas - Coal_Gas = FluidUtils.generateFluidNonMolten("CoalGas", "Coal Gas", 500, new short[]{48, 48, 48, 100}, null, null); - //Ethanol - // v - Dehydrate cells to remove water - - - //Create Ethylene - if (!FluidUtils.doesFluidExist("ethylene")){ - Ethylene = FluidUtils.generateFluidNonMolten("ethylene", "Ethylene", -103, new short[]{255, 255, 255, 100}, null, null); - } - else { - Ethylene = FluidUtils.getWildcardFluidStack("ethylene", 1).getFluid(); - } - - //Create Ethylbenzene - Ethylbenzene is produced in on a large scale by combining benzene and ethylene in an acid-catalyzed chemical reaction - //Use Chemical Reactor - Ethylbenzene = FluidUtils.generateFluidNonMolten("Ethylbenzene", "Ethylbenzene", 136, new short[]{255, 255, 255, 100}, null, null); - //Create Anthracene - Anthracene = FluidUtils.generateFluidNonMolten("Anthracene", "Anthracene", 340, new short[]{255, 255, 255, 100}, null, null); - //Toluene - if (!FluidUtils.doesFluidExist("liquid_toluene")){ - Toluene = FluidUtils.generateFluidNonMolten("liquid_toluene", "Toluene", -95, new short[]{140, 70, 20, 100}, null, null); - } - else { - Toluene = FluidUtils.getWildcardFluidStack("liquid_toluene", 1).getFluid(); - } - - //Create Coal Tar - Coal_Tar = FluidUtils.generateFluidNonMolten("CoalTar", "Coal Tar", 450, new short[]{32, 32, 32, 100}, null, null); - // v - Distill (60% Tar oil/15% Naphtha/20% Ethylbenzene/5% Anthracene) - //Create Coal Tar Oil - Coal_Tar_Oil = FluidUtils.generateFluidNonMolten("CoalTarOil", "Coal Tar Oil", 240, new short[]{240, 240, 150, 100}, null, null); - // v - Wash With Sulfuric Acid - //Create Sulfuric Coal Tar Oil - Sulfuric_Coal_Tar_Oil = FluidUtils.generateFluidNonMolten("SulfuricCoalTarOil", "Sulfuric Coal Tar Oil", 240, new short[]{250, 170, 12, 100}, null, null); - // v - Distill (No loss, just time consuming) - //Create Naphthalene - Naphthalene = FluidUtils.generateFluidNonMolten("Naphthalene", "Naphthalene", 115, new short[]{210, 185, 135, 100}, null, null); - // v - Oxidize with mercury and nitric acid - //Create Phthalic Acid - Phthalic_Acid = FluidUtils.generateFluidNonMolten("PhthalicAcid", "Phthalic Acid", 207, new short[]{210, 220, 210, 100}, null, null); - // v - Dehydrate at 180C+ - //Create Phthalic Anhydride - //ItemUtils.generateSpecialUseDusts("PhthalicAnhydride", "Phthalic Anhydride", "C6H4(CO)2O", Utils.rgbtoHexValue(175, 175, 175)); - - - - - } - -} diff --git a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java deleted file mode 100644 index a42d179f65..0000000000 --- a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java +++ /dev/null @@ -1,1115 +0,0 @@ -package gtPlusPlus.core.item.chemistry; - -import gregtech.api.enums.*; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.minecraft.ItemPackage; -import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase; -import gtPlusPlus.core.item.circuit.ItemAdvancedChip; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.*; -import gtPlusPlus.core.material.state.MaterialState; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.plugin.agrichem.BioRecipes; -import gtPlusPlus.plugin.agrichem.block.AgrichemFluids; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.*; - -public class GenericChem extends ItemPackage { - - /** - * Switches - */ - - private static boolean usingGregtechNitricOxide = false; - private static boolean usingGregtechNitrogenDioxide = false; - private static boolean usingGregtechHydricSulfur = false; - - /** - * Materials - */ - - //public static final Material BAKELITE = new Material("Bakelite", MaterialState.SOLID, TextureSet.SET_DULL, new short[]{90, 140, 140}, 120, 240, 23, 24, true, null, 0);//Not a GT Inherited Material - //public static final Material NYLON = new Material("Nylon", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{45, 45, 45}, 300, 600, 44, 48, true, null, 0);//Not a GT Inherited Material - //public static final Material CARBYNE = new Material("Carbyne", MaterialState.SOLID, TextureSet.SET_DULL, new short[]{25, 25, 25}, 2500, 5000, 63, 52, true, null, 0);//Not a GT Inherited Material - - - //Refined PTFE - public static final Material TEFLON = new Material( - "Teflon", - MaterialState.SOLID, - TextureSet.SET_SHINY, - new short[] { 75, 45, 75 }, - 330, 640, - -1, -1, - false, - null, - 0, - new MaterialStack[] { - new MaterialStack(NONMATERIAL.PTFE, 75), - new MaterialStack(NONMATERIAL.PLASTIC, 15), - new MaterialStack(ELEMENT.getInstance().CARBON, 5), - new MaterialStack(ELEMENT.getInstance().SODIUM, 5) - }); - - /** - * Fluids - */ - - public static Fluid Benzene; - public static Fluid NitroBenzene; - public static Fluid Aniline; - public static Fluid Polyurethane; - public static Fluid Phenol; //https://en.wikipedia.org/wiki/Phenol#Uses - public static Fluid Cyclohexane; //https://en.wikipedia.org/wiki/Cyclohexane - public static Fluid Cyclohexanone; //https://en.wikipedia.org/wiki/Cyclohexanone - public static Fluid Cadaverine; //https://en.wikipedia.org/wiki/Cadaverine - public static Fluid Putrescine; //https://en.wikipedia.org/wiki/Putrescine - public static Fluid BoricAcid; - public static Fluid HydrochloricAcid; - - - public static Fluid Ethylanthraquinone2; - public static Fluid Ethylanthrahydroquinone2; - public static Fluid Hydrogen_Peroxide; - public static Fluid Lithium_Peroxide; - public static Fluid Nitric_Oxide; - public static Fluid Nitrogen_Dioxide; - public static Fluid Carbon_Disulfide; - public static Fluid Hydrogen_Sulfide; - - /** - * Items - */ - - // Phenol Byproducts - public Item PhenolicResins; //https://en.wikipedia.org/wiki/Phenol_formaldehyde_resin - public static ItemGenericChemBase mGenericChemItem1; - public static Item mAdvancedCircuit; - - private ItemStack mCatalystCarrier; - - public static ItemStack mRedCatalyst; - public static ItemStack mYellowCatalyst; - public static ItemStack mBlueCatalyst; - public static ItemStack mOrangeCatalyst; - public static ItemStack mPurpleCatalyst; - public static ItemStack mBrownCatalyst; - public static ItemStack mPinkCatalyst; - - public static ItemStack mMillingBallAlumina; - public static ItemStack mMillingBallSoapstone; - - public static ItemStack mSodiumEthoxide; - public static ItemStack mSodiumEthylXanthate; - public static ItemStack mPotassiumEthylXanthate; - public static ItemStack mPotassiumHydroxide; - - - - @Override - public void items() { - PhenolicResins = ItemUtils.generateSpecialUseDusts("phenolicresins", "Phenolic Resin", "HOC6H4CH2OH", Utils.rgbtoHexValue(80, 40, 40))[0]; - //MaterialGenerator.generate(BAKELITE, false); - //MaterialGenerator.generate(NYLON, false); - MaterialGenerator.generate(TEFLON, false); - - mGenericChemItem1 = new ItemGenericChemBase(); - mAdvancedCircuit = new ItemAdvancedChip(); - GregtechItemList.Circuit_T3RecipeSelector.set(mAdvancedCircuit); - - registerItemStacks(); - registerOreDict(); - - GregtechItemList.Milling_Ball_Alumina.set(mMillingBallAlumina); - GregtechItemList.Milling_Ball_Soapstone.set(mMillingBallSoapstone); - - } - - - public void registerItemStacks() { - - mCatalystCarrier = ItemUtils.simpleMetaStack(AgriculturalChem.mAgrichemItem1, 13, 1); - - mRedCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 0, 1); - mYellowCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 1, 1); - mBlueCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 2, 1); - mOrangeCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 3, 1); - mPurpleCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 4, 1); - mBrownCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 5, 1); - mPinkCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 6, 1); - mMillingBallAlumina = ItemUtils.simpleMetaStack(mGenericChemItem1, 7, 1); - mMillingBallSoapstone = ItemUtils.simpleMetaStack(mGenericChemItem1, 8, 1); - mSodiumEthoxide = ItemUtils.simpleMetaStack(mGenericChemItem1, 9, 1); - mSodiumEthylXanthate = ItemUtils.simpleMetaStack(mGenericChemItem1, 10, 1); - mPotassiumEthylXanthate = ItemUtils.simpleMetaStack(mGenericChemItem1, 11, 1); - mPotassiumHydroxide = ItemUtils.simpleMetaStack(mGenericChemItem1, 12, 1); - - } - - public void registerOreDict() { - - ItemUtils.addItemToOreDictionary(mRedCatalyst, "catalystIronCopper"); - ItemUtils.addItemToOreDictionary(mYellowCatalyst, "catalystTungstenNickel"); - ItemUtils.addItemToOreDictionary(mBlueCatalyst, "catalystCobaltTitanium"); - ItemUtils.addItemToOreDictionary(mOrangeCatalyst, "catalystVanadiumPalladium"); - ItemUtils.addItemToOreDictionary(mPurpleCatalyst, "catalystIridiumRuthenium"); - ItemUtils.addItemToOreDictionary(mBrownCatalyst, "catalystNickelAluminium"); - ItemUtils.addItemToOreDictionary(mPinkCatalyst, "catalystPlatinumRhodium"); - ItemUtils.addItemToOreDictionary(mMillingBallAlumina, "millingballAlumina"); - ItemUtils.addItemToOreDictionary(mMillingBallSoapstone, "millingballSoapstone"); - ItemUtils.addItemToOreDictionary(mSodiumEthoxide, "dustSodiumEthoxide"); - ItemUtils.addItemToOreDictionary(mSodiumEthylXanthate, "dustSodiumEthylXanthate"); - ItemUtils.addItemToOreDictionary(mPotassiumEthylXanthate, "dustPotassiumEthylXanthate"); - ItemUtils.addItemToOreDictionary(mPotassiumHydroxide, "dustPotassiumHydroxide"); - - } - - @Override - public void blocks() {} - - @Override - public void fluids() { - - if (!FluidRegistry.isFluidRegistered("benzene")) { - Benzene = FluidUtils.generateFluidNoPrefix("benzene", "Benzene", 278, new short[] { 100, 70, 30, 100 }, true); - } - else { - Benzene = FluidRegistry.getFluid("benzene"); - } - - NitroBenzene = FluidUtils.generateFluidNoPrefix("nitrobenzene", "NitroBenzene", 278, new short[] { 70, 50, 40, 100 }, true); - - Aniline = FluidUtils.generateFluidNoPrefix("aniline", "Aniline", 266, new short[] { 100, 100, 30, 100 }, true); - - BoricAcid = FluidUtils.generateFluidNoPrefix("boricacid", "Boric Acid", 278, new short[] { 90, 30, 120, 100 }, true); - - Polyurethane = FluidUtils.generateFluidNoPrefix("polyurethane", "Polyurethane", 350, new short[] { 100, 70, 100, 100 }, true); - - if (!FluidRegistry.isFluidRegistered("phenol")) { - Phenol = FluidUtils.generateFluidNoPrefix("phenol", "Phenol", 313, new short[] { 100, 70, 30, 100 }, true); - } - else { - Phenol = FluidRegistry.getFluid("phenol"); - } - - // Use GT's if it exists, else make our own. - if (FluidRegistry.isFluidRegistered("hydrochloricacid_gt5u")) { - HydrochloricAcid = FluidRegistry.getFluid("hydrochloricacid_gt5u"); - } - else { - HydrochloricAcid = FluidUtils.generateFluidNoPrefix("hydrochloricacid", "Hydrochloric Acid", 285, new short[] { 183, 200, 196, 100 }, true); - } - - Cyclohexane = FluidUtils.generateFluidNoPrefix("cyclohexane", "Cyclohexane", 32 + 175, new short[] { 100, 70, 30, 100 }, true); - Cyclohexanone = FluidUtils.generateFluidNoPrefix("cyclohexanone", "Cyclohexanone", 32 + 175, new short[] { 100, 70, 30, 100 }, true); - - Cadaverine = FluidUtils.generateFluidNoPrefix("cadaverine", "Cadaverine", 32 + 175, new short[] { 100, 70, 30, 100 }, true); - Putrescine = FluidUtils.generateFluidNoPrefix("putrescine", "Putrescine", 32 + 175, new short[] { 100, 70, 30, 100 }, true); - - //Create 2-Ethylanthraquinone - //2-Ethylanthraquinone is prepared from the reaction of phthalic anhydride and ethylbenzene - Ethylanthraquinone2 = FluidUtils.generateFluidNonMolten("2Ethylanthraquinone", "2-Ethylanthraquinone", 415, new short[]{227, 255, 159, 100}, null, null); - //Create 2-Ethylanthrahydroquinone - //Palladium plate + Hydrogen(250) + 2-Ethylanthraquinone(500) = 600 Ethylanthrahydroquinone - Ethylanthrahydroquinone2 = FluidUtils.generateFluidNonMolten("2Ethylanthrahydroquinone", "2-Ethylanthrahydroquinone", 415, new short[]{207, 225, 129, 100}, null, null); - //Create Hydrogen Peroxide - //Compressed Air(1500) + Ethylanthrahydroquinone(500) + Anthracene(5) = 450 Ethylanthraquinone && 200 Peroxide - Hydrogen_Peroxide = FluidUtils.generateFluidNonMolten("HydrogenPeroxide", "Hydrogen Peroxide", 150, new short[]{210, 255, 255, 100}, null, null); - - if (FluidRegistry.isFluidRegistered("nitricoxide")) { - Nitric_Oxide = FluidRegistry.getFluid("nitricoxide"); - usingGregtechNitricOxide = true; - } - else { - Nitric_Oxide = FluidUtils.generateFluidNoPrefix("nitricoxide", "Nitric Oxide", 200, new short[] {125, 200, 240, 100}); - } - if (FluidRegistry.isFluidRegistered("nitrogendioxide")) { - Nitrogen_Dioxide = FluidRegistry.getFluid("nitrogendioxide"); - usingGregtechNitrogenDioxide = true; - } - else { - Nitrogen_Dioxide = FluidUtils.generateFluidNoPrefix("nitrogendioxide", "Nitrogen Dioxide", 200, new short[] {100, 175, 255, 100}); - } - - - - //Lithium Hydroperoxide - LiOH + H2O2 → LiOOH + 2 H2O - //ItemUtils.generateSpecialUseDusts("LithiumHydroperoxide", "Lithium Hydroperoxide", "HLiO2", Utils.rgbtoHexValue(125, 125, 125)); - // v - Dehydrate - //Lithium Peroxide - 2 LiOOH → Li2O2 + H2O2 + 2 H2O - Lithium_Peroxide = FluidUtils.generateFluidNonMolten("LithiumPeroxide", "Lithium Peroxide", 446, new short[]{135, 135, 135, 100}, null, null); - - Carbon_Disulfide = FluidUtils.generateFluidNoPrefix("CarbonDisulfide", "Carbon Disulfide", 350, new short[]{175, 175, 175, 100}); - - if (FluidRegistry.isFluidRegistered("fluid.liquid_hydricsulfur") || MaterialUtils.doesMaterialExist("HydricSulfide")) { - usingGregtechHydricSulfur = true; - Fluid aFluid = null; - if (ItemUtils.doesItemListEntryExist("sHydricSulfur")) { - ItemStack aListItem = ItemUtils.getValueOfItemList("sHydricSulfur", 1, (ItemList) null); - if (aListItem != null) { - FluidStack aFluidStack = FluidContainerRegistry.getFluidForFilledItem(aListItem); - if (aFluidStack != null) { - aFluid = aFluidStack.getFluid(); - } - - } - } - if (aFluid == null) { - aFluid = FluidUtils.getWildcardFluidStack("liquid_hydricsulfur", 1000).getFluid(); - } - Hydrogen_Sulfide = aFluid; - } - else { - Hydrogen_Sulfide = FluidUtils.generateFluidNoPrefix("HydrogenSulfide", "Hydrogen Sulfide", 446, new short[]{240, 130, 30, 100}); - } - - } - - @Override - public String errorMessage() { - return "Failed to generate recipes for GenericChem."; - } - - @Override - public boolean generateRecipes() { - - recipeAdvancedChip(); - recipeCatalystRed(); - recipeCatalystYellow(); - recipeCatalystBlue(); - recipeCatalystOrange(); - recipeCatalystPurple(); - recipeCatalystBrown(); - recipeCatalystPink(); - - recipeGrindingBallAlumina(); - recipeGrindingBallSoapstone(); - - recipeNitroBenzene(); - recipeAniline(); - recipeCadaverineAndPutrescine(); - recipeCyclohexane(); - recipeCyclohexanone(); - - recipe2Ethylanthraquinone(); - recipe2Ethylanthrahydroquinone(); - recipeHydrogenPeroxide(); - recipeLithiumHydroperoxide(); - recipeLithiumPeroxide(); - if (!usingGregtechNitricOxide) { - recipeNitricOxide(); - } - if (!usingGregtechNitrogenDioxide) { - recipeNitrogenDioxide(); - } - if (!usingGregtechHydricSulfur) { - recipeHydricSulfur(); - } - - // Add recipes if we are not using GT's fluid. - if (!FluidRegistry.isFluidRegistered("hydrochloricacid_gt5u")) { - recipeHydrochloricAcid(); - } - - recipeSodiumEthoxide(); - recipeCarbonDisulfide(); - recipeEthylXanthates(); - recipePotassiumHydroxide(); - - registerFuels(); - - return true; - } - - - private void recipeSodiumEthoxide() { - //2 C2H5OH + 2 Na → 2 C2H5ONa + H2 - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedCircuit(16), - ELEMENT.getInstance().SODIUM.getDust(2) - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mEthanol, 1000), - }, - new ItemStack[] { - ItemUtils.getSimpleStack(mSodiumEthoxide, 2) - - }, - new FluidStack[] { - ELEMENT.getInstance().HYDROGEN.getFluidStack(2000) - }, - 20 *20, - 120, - 2); - } - - - private void recipePotassiumHydroxide() { - //Ca(OH)2 + K2CO3 → CaCO3 + 2 KOH - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedCircuit(18), - ELEMENT.getInstance().POTASSIUM.getDust(4), - ELEMENT.getInstance().CARBON.getDust(2), - ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumHydroxide", 2), - }, - new FluidStack[] { - FluidUtils.getFluidStack("oxygen", 6000), - }, - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumCarbonate", 2), - ItemUtils.getSimpleStack(mPotassiumHydroxide, 4) - - }, - new FluidStack[] { - - }, - 20 *30, - 120, - 2); - - } - - - private void recipeEthylXanthates() { - - //Potassium ethyl xanthate - CH3CH2OH + CS2 + KOH → CH3CH2OCS2K + H2O - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedCircuit(17), - ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumHydroxide", 2), - }, - new FluidStack[] { - FluidUtils.getFluidStack(BioRecipes.mEthanol, 1000), - FluidUtils.getFluidStack(Carbon_Disulfide, 1000), - }, - new ItemStack[] { - ItemUtils.getSimpleStack(mPotassiumEthylXanthate, 1) - }, - new FluidStack[] { - FluidUtils.getWater(1000) - }, - 20 *60, - 120, - 4); - - //Sodium ethyl xanthate - CH3CH2ONa + CS2 → CH3CH2OCS2Na - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedCircuit(17), - ItemUtils.getSimpleStack(mSodiumEthoxide, 1) - }, - new FluidStack[] { - FluidUtils.getFluidStack(Carbon_Disulfide, 1000), - }, - new ItemStack[] { - ItemUtils.getSimpleStack(mSodiumEthylXanthate, 1) - }, - new FluidStack[] { - - }, - 20 *60, - 120, - 4); - - } - - - private void recipeHydricSulfur() { - - ItemStack aCellHydricSulfide = ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenSulfide", 1); - GT_Values.RA.addChemicalRecipe( ELEMENT.getInstance().SULFUR.getDust(1), GT_Utility.getIntegratedCircuit(1), ELEMENT.getInstance().HYDROGEN.getFluidStack(2000), FluidUtils.getFluidStack(Hydrogen_Sulfide, 3000), GT_Values.NI, 60, 8); - GT_Values.RA.addChemicalRecipeForBasicMachineOnly(ELEMENT.getInstance().SULFUR.getDust(1), CI.emptyCells(3), ELEMENT.getInstance().HYDROGEN.getFluidStack(2000), GT_Values.NF, ItemUtils.getSimpleStack(aCellHydricSulfide, 3), GT_Values.NI, 60, 8); - - } - - - private void recipeCarbonDisulfide() { - - CORE.RA.addBlastRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("fuelCoke", 8), - ItemUtils.getItemStackOfAmountFromOreDict("dustSulfur", 16) - }, - new FluidStack[] { - - }, - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("dustDarkAsh", 1) - }, - new FluidStack[] { - FluidUtils.getFluidStack(Carbon_Disulfide, 4000) - }, - 20 *60 * 10, - 30, - 1500); - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedCircuit(20), - ItemUtils.getSimpleStack(mBrownCatalyst, 0), - ItemUtils.getItemStackOfAmountFromOreDict("dustSulfur", 4) - }, - new FluidStack[] { - FluidUtils.getFluidStack(CoalTar.Coal_Gas, 1000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(Carbon_Disulfide, 2000), - FluidUtils.getFluidStack(Hydrogen_Sulfide, 4000) - }, - 20 *60 * 5, - 30, - 2); - - - } - - - private static void registerFuels() { - - // Burnables - - // Gas Fuels - GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellNitroBenzene", 1), null, 1250, 1); - - } - - private void recipeGrindingBallAlumina() { - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - CI.getNumberedCircuit(10), - ItemUtils.getSimpleStack(AgriculturalChem.mAlumina, 64) - }, - FluidUtils.getFluidStack(GenericChem.Aniline, 4000), - ItemUtils.getSimpleStack(mMillingBallAlumina, 8), - 180 * 20, - 480); - } - private void recipeGrindingBallSoapstone() { - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - CI.getNumberedCircuit(10), - ItemUtils.getItemStackOfAmountFromOreDict("dustSoapstone", 32) - }, - FluidUtils.getFluidStack(AgrichemFluids.mLiquidResin, 2500), - ItemUtils.getSimpleStack(mMillingBallSoapstone, 8), - 120 * 20, - 480); - } - - private void recipeNitrogenDioxide() { - ItemStack aNitricOxideCell = ItemUtils.getItemStackOfAmountFromOreDict("cellNitricOxide", 1); - ItemStack aNitrogenDioxideCell = ItemUtils.getItemStackOfAmountFromOreDict("cellNitrogenDioxide", 1); - GT_Values.RA.addChemicalRecipe( ItemUtils.getSimpleStack(aNitricOxideCell, 2), GT_Utility.getIntegratedCircuit(1), ELEMENT.getInstance().OXYGEN.getFluidStack(1000), FluidUtils.getFluidStack(Nitrogen_Dioxide, 3000), CI.emptyCells(2), 160); - GT_Values.RA.addChemicalRecipe( ELEMENT.getInstance().OXYGEN.getCell(1), GT_Utility.getIntegratedCircuit(1), FluidUtils.getFluidStack(Nitric_Oxide, 2000), FluidUtils.getFluidStack(Nitrogen_Dioxide, 3000), CI.emptyCells(1), 160); - GT_Values.RA.addChemicalRecipeForBasicMachineOnly(ItemUtils.getSimpleStack(aNitricOxideCell, 2), CI.emptyCells(1), ELEMENT.getInstance().OXYGEN.getFluidStack(1000), GT_Values.NF, ItemUtils.getSimpleStack(aNitrogenDioxideCell, 3), GT_Values.NI, 160, 30); - GT_Values.RA.addChemicalRecipeForBasicMachineOnly(ELEMENT.getInstance().OXYGEN.getCell(1), CI.emptyCells(2), FluidUtils.getFluidStack(Nitric_Oxide, 2000), GT_Values.NF, ItemUtils.getSimpleStack(aNitrogenDioxideCell, 3), GT_Values.NI, 160, 30); - GT_Values.RA.addChemicalRecipeForBasicMachineOnly(ItemUtils.getSimpleStack(aNitricOxideCell, 2), ELEMENT.getInstance().OXYGEN.getCell(1), GT_Values.NF, GT_Values.NF, ItemUtils.getSimpleStack(aNitrogenDioxideCell, 3), GT_Values.NI, 160, 30); - } - - - private void recipeNitricOxide() { - ItemStack aWaterCell = ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 1); - ItemStack aNitricOxideCell = ItemUtils.getItemStackOfAmountFromOreDict("cellNitricOxide", 1); - GT_Values.RA.addChemicalRecipeForBasicMachineOnly(MISC_MATERIALS.AMMONIA.getCell(8), CI.emptyCells(1), ELEMENT.getInstance().OXYGEN.getFluidStack(5000), FluidUtils.getFluidStack(Nitric_Oxide, 4000), ItemUtils.getSimpleStack(aWaterCell, 9), GT_Values.NI, 160, 30); - GT_Values.RA.addChemicalRecipeForBasicMachineOnly(ELEMENT.getInstance().OXYGEN.getCell(5), CI.emptyCells(4), MISC_MATERIALS.AMMONIA.getFluidStack(8000), FluidUtils.getFluidStack(Nitric_Oxide, 4000), ItemUtils.getSimpleStack(aWaterCell, 9), GT_Values.NI, 160, 30); - GT_Values.RA.addChemicalRecipe( MISC_MATERIALS.AMMONIA.getCell(8), GT_Utility.getIntegratedCircuit(11), ELEMENT.getInstance().OXYGEN.getFluidStack(5000), FluidUtils.getWater(9000), ItemUtils.getSimpleStack(aNitricOxideCell, 4), CI.emptyCells(4), 160); - GT_Values.RA.addChemicalRecipe( ELEMENT.getInstance().OXYGEN.getCell(5), GT_Utility.getIntegratedCircuit(11), MISC_MATERIALS.AMMONIA.getFluidStack(8000), FluidUtils.getWater(9000), ItemUtils.getSimpleStack(aNitricOxideCell, 4), CI.emptyCells(1), 160); - GT_Values.RA.addChemicalRecipe( MISC_MATERIALS.AMMONIA.getCell(8), GT_Utility.getIntegratedCircuit(2), ELEMENT.getInstance().OXYGEN.getFluidStack(5000), FluidUtils.getFluidStack(Nitric_Oxide, 4000), CI.emptyCells(8), 320); - GT_Values.RA.addChemicalRecipe( ELEMENT.getInstance().OXYGEN.getCell(5), GT_Utility.getIntegratedCircuit(2), MISC_MATERIALS.AMMONIA.getFluidStack(8000), FluidUtils.getFluidStack(Nitric_Oxide, 4000), CI.emptyCells(5), 320); - GT_Values.RA.addChemicalRecipe( MISC_MATERIALS.AMMONIA.getCell(8), GT_Utility.getIntegratedCircuit(12), ELEMENT.getInstance().OXYGEN.getFluidStack(5000), GT_Values.NF, ItemUtils.getSimpleStack(aNitricOxideCell, 4), CI.emptyCells(4), 160); - GT_Values.RA.addChemicalRecipe( ELEMENT.getInstance().OXYGEN.getCell(5), GT_Utility.getIntegratedCircuit(12), MISC_MATERIALS.AMMONIA.getFluidStack(8000), GT_Values.NF, ItemUtils.getSimpleStack(aNitricOxideCell, 4), CI.emptyCells(1), 160); - GT_Values.RA.addChemicalRecipeForBasicMachineOnly(MISC_MATERIALS.AMMONIA.getCell(8), ELEMENT.getInstance().OXYGEN.getCell(5), GT_Values.NF, GT_Values.NF, ItemUtils.getSimpleStack(aNitricOxideCell, 4), ItemUtils.getSimpleStack(aWaterCell, 9), 160, 30); - GT_Values.RA.addMultiblockChemicalRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(1)}, new FluidStack[]{MISC_MATERIALS.AMMONIA.getFluidStack(8000), ELEMENT.getInstance().OXYGEN.getFluidStack(5000)}, new FluidStack[]{FluidUtils.getFluidStack(Nitric_Oxide, 4000), FluidUtils.getWater(9000)}, null, 160, 30); - } - - - private void recipeHydrochloricAcid() { - - ItemStack aAcidCell = ItemUtils.getItemStackOfAmountFromOreDict("cellHydrochloricAcid", 1); - - CORE.RA.addChemicalRecipe( - ELEMENT.getInstance().CHLORINE.getCell(1), - GT_Utility.getIntegratedCircuit(1), - ELEMENT.getInstance().HYDROGEN.getFluidStack(1000), - FluidUtils.getFluidStack(HydrochloricAcid, 2000), - CI.emptyCells(1), - 60, - 8); - - CORE.RA.addChemicalRecipe( - ELEMENT.getInstance().HYDROGEN.getCell(1), - GT_Utility.getIntegratedCircuit(1), - ELEMENT.getInstance().CHLORINE.getFluidStack(1000), - FluidUtils.getFluidStack(HydrochloricAcid, 2000), - CI.emptyCells(1), - 60, - 8); - - GT_Values.RA.addElectrolyzerRecipe( - CI.emptyCells(1), - GT_Utility.getIntegratedCircuit(1), - FluidUtils.getFluidStack(HydrochloricAcid, 2000), - ELEMENT.getInstance().CHLORINE.getFluidStack(1000), - ELEMENT.getInstance().HYDROGEN.getCell(1), - GT_Values.NI, - GT_Values.NI, - GT_Values.NI, - GT_Values.NI, - GT_Values.NI, - null, - 720, - 30); - - GT_Values.RA.addElectrolyzerRecipe( - CI.emptyCells(1), - GT_Utility.getIntegratedCircuit(11), - FluidUtils.getFluidStack(HydrochloricAcid, 2000), - ELEMENT.getInstance().HYDROGEN.getFluidStack(1000), - ELEMENT.getInstance().CHLORINE.getCell(1), - GT_Values.NI, - GT_Values.NI, - GT_Values.NI, - GT_Values.NI, - GT_Values.NI, - null, - 720, - 30); - - GT_Values.RA.addElectrolyzerRecipe( - ItemUtils.getSimpleStack(aAcidCell, 2), - GT_Values.NI, - GT_Values.NF, - GT_Values.NF, - ELEMENT.getInstance().HYDROGEN.getCell(1), - ELEMENT.getInstance().CHLORINE.getCell(1), - GT_Values.NI, - GT_Values.NI, - GT_Values.NI, - GT_Values.NI, - null, - 720, - 30); - } - - private void recipeCyclohexane() { - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getTierTwoChip(), - ItemUtils.getSimpleStack(mBrownCatalyst, 0) - }, - new FluidStack[] { - FluidUtils.getFluidStack(Benzene, 2000), - FluidUtils.getFluidStack("hydrogen", 10000) - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(Cyclohexane, 1000), - }, - 20 * 120, - 120, - 2); - - } - - private void recipeCyclohexanone() { - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getTierTwoChip(), - ItemUtils.getSimpleStack(mBlueCatalyst, 0) - }, - new FluidStack[] { - FluidUtils.getFluidStack(Cyclohexane, 2000), - FluidUtils.getFluidStack("air", 10000) - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(Cyclohexanone, 2000), - }, - 20 * 120, - 120, - 2); - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getTierTwoChip(), - }, - new FluidStack[] { - FluidUtils.getFluidStack(Phenol, 2000), - FluidUtils.getFluidStack("oxygen", 5000) - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(Cyclohexanone, 2000), - }, - 20 * 120, - 120, - 2); - - - - - } - - private void recipeCatalystRed() { - // Assembly Recipe - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - getTierOneChip(), - CI.getEmptyCatalyst(10), - ELEMENT.getInstance().IRON.getDust(2), - ELEMENT.getInstance().COPPER.getDust(2), - }, - GT_Values.NF, - ItemUtils.getSimpleStack(mRedCatalyst, 10), - 20 * 20, - 30); - - } - - private void recipeCatalystYellow() { - // Assembly Recipe - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - getTierThreeChip(), - CI.getEmptyCatalyst(10), - ELEMENT.getInstance().TUNGSTEN.getDust(4), - ELEMENT.getInstance().NICKEL.getDust(4), - }, - GT_Values.NF, - ItemUtils.getSimpleStack(mYellowCatalyst, 10), - 60 * 20, - 2000); - - } - - private void recipeCatalystBlue() { - // Assembly Recipe - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - getTierTwoChip(), - CI.getEmptyCatalyst(10), - ELEMENT.getInstance().COBALT.getDust(3), - ELEMENT.getInstance().TITANIUM.getDust(3), - }, - GT_Values.NF, - ItemUtils.getSimpleStack(mBlueCatalyst, 10), - 40 * 20, - 500); - - } - - private void recipeCatalystOrange() { - // Assembly Recipe - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - getTierTwoChip(), - CI.getEmptyCatalyst(10), - ELEMENT.getInstance().VANADIUM.getDust(5), - ELEMENT.getInstance().PALLADIUM.getDust(5), - }, - GT_Values.NF, - ItemUtils.getSimpleStack(mOrangeCatalyst, 10), - 40 * 20, - 500); - - } - - private void recipeCatalystPurple() { - // Assembly Recipe - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - getTierFourChip(), - CI.getEmptyCatalyst(10), - ELEMENT.getInstance().IRIDIUM.getDust(6), - ELEMENT.getInstance().RUTHENIUM.getDust(6), - }, - GT_Values.NF, - ItemUtils.getSimpleStack(mPurpleCatalyst, 10), - 120 * 20, - 8000); - - } - - private void recipeCatalystBrown() { - // Assembly Recipe - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - getTierOneChip(), - CI.getEmptyCatalyst(10), - ELEMENT.getInstance().NICKEL.getDust(4), - ELEMENT.getInstance().ALUMINIUM.getDust(4), - }, - GT_Values.NF, - ItemUtils.getSimpleStack(mBrownCatalyst, 10), - 15 * 20, - 30); - - } - - private void recipeCatalystPink() { - // Assembly Recipe - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - getTierThreeChip(), - CI.getEmptyCatalyst(10), - ELEMENT.getInstance().PLATINUM.getDust(4), - ELEMENT.getInstance().RHODIUM.getDust(4), - }, - GT_Values.NF, - ItemUtils.getSimpleStack(mPinkCatalyst, 10), - 30 * 20, - 2000); - - } - - private void recipeCadaverineAndPutrescine() { - - // Basic Recipe - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getTierOneChip(), - ItemUtils.getSimpleStack(Items.rotten_flesh, 64) - }, - new FluidStack[] { - FluidUtils.getHotWater(2000) - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(Cadaverine, 250), - FluidUtils.getFluidStack(Putrescine, 250), - }, - 20 * 120, - 120, - 1); - - // Advanced Recipe - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getTierTwoChip(), - ItemUtils.getSimpleStack(Items.rotten_flesh, 128), - ItemUtils.simpleMetaStack(AgriculturalChem.mAgrichemItem1, 8, 32) - }, - new FluidStack[] { - FluidUtils.getHotWater(3000) - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(Cadaverine, 750), - FluidUtils.getFluidStack(Putrescine, 750), - }, - 20 * 120, - 240, - 2); - - } - - private void recipeAniline() { - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getTierThreeChip(), - ItemUtils.getSimpleStack(mBlueCatalyst, 0) - }, - new FluidStack[] { - FluidUtils.getFluidStack(NitroBenzene, 2000), - FluidUtils.getFluidStack("hydrogen", 10000) - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(Aniline, 2000), - }, - 20 * 30, - 500, - 3); - - } - - private void recipeNitroBenzene() { - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - getTierThreeChip(), - }, - new FluidStack[] { - FluidUtils.getFluidStack(Benzene, 5000), - FluidUtils.getFluidStack("sulfuricacid", 3000), - FluidUtils.getFluidStack("nitricacid", 3000), - FluidUtils.getDistilledWater(10000) - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack("dilutedsulfuricacid", 3000), - FluidUtils.getFluidStack(NitroBenzene, 5000), - }, - 20 * 30, - 500, - 4); - - } - - private void recipe2Ethylanthraquinone() { - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedCircuit(4), - ItemUtils.getItemStackOfAmountFromOreDict("dustPhthalicAnhydride", 4), - }, - new FluidStack[] { - FluidUtils.getFluidStack(CoalTar.Ethylbenzene, 2000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(Ethylanthraquinone2, 2000+(144*4)), - }, - 20 * 15, - 120, - 2); - - /*GT_Values.RA.addChemicalRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("dustPhthalicAnhydride", 4), - ItemUtils.getItemStackOfAmountFromOreDict("cellEthylbenzene", 2), - null, - FluidUtils.getFluidStack("fluid.2ethylanthraquinone", 2000+(144*4)), - ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 2), - 20*16);*/ - - } - - private void recipe2Ethylanthrahydroquinone() { - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedCircuit(4), - ItemUtils.getSimpleStack(mOrangeCatalyst, 0), - }, - new FluidStack[] { - FluidUtils.getFluidStack(Ethylanthraquinone2, 4000), - FluidUtils.getFluidStack("hydrogen", 2000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(Ethylanthrahydroquinone2, 5000), - }, - 20 * 40, - 120, - 2); - - /*GT_Values.RA.addChemicalRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("platePalladium", 0), - ItemUtils.getItemStackOfAmountFromOreDict("cell2Ethylanthraquinone", 1), - FluidUtils.getFluidStack("hydrogen", 500), - FluidUtils.getFluidStack("fluid.2ethylanthrahydroquinone", 1200), - ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 1), - 20*40);*/ - - } - - private void recipeLithiumPeroxide() { - CORE.RA.addDehydratorRecipe( - new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroperoxide", 2), - ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 3) - }, - null, - null, - new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumPeroxide", 1), - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenPeroxide", 1), - ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 2) - }, - new int[]{10000, 10000, 10000}, - 20*100, - 120); - } - - private void recipeLithiumHydroperoxide() { - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedCircuit(4), - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 7), - }, - new FluidStack[] { - FluidUtils.getFluidStack("fluid.hydrogenperoxide", 2000), - }, - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroperoxide", 14), - }, - new FluidStack[] { - - }, - 20 * 30, - 240, - 1); - - - - /*CORE.RA.addChemicalRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 7), - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenPeroxide", 1), - 20, - FluidUtils.getFluidStack("fluid.cellhydrogenperoxide", 50), - null, - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroperoxide", 14), - CI.emptyCells(1), - 20*30, - 240); */ - } - - private void recipeHydrogenPeroxide() { - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedCircuit(4), - }, - new FluidStack[] { - FluidUtils.getFluidStack("air", 15000), - FluidUtils.getFluidStack(Ethylanthrahydroquinone2, 5000), - FluidUtils.getFluidStack("fluid.anthracene", 50), - }, - new ItemStack[] { - }, - new FluidStack[] { - FluidUtils.getFluidStack(Ethylanthraquinone2, 4000), - FluidUtils.getFluidStack("fluid.hydrogenperoxide", 2000), - }, - 20 * 30, - 240, - 1); - - /* CORE.RA.addChemicalRecipe( - GT_ModHandler.getAirCell(15), - ItemUtils.getItemStackOfAmountFromOreDict("cell2Ethylanthrahydroquinone", 5), - 20, - FluidUtils.getFluidStack("fluid.anthracene", 50), - FluidUtils.getFluidStack("fluid.2ethylanthrahydroquinone", 4450), - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenPeroxide", 2), - CI.emptyCells(18), - 20*30, - 240);*/ - - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - private static final ItemStack getTierOneChip() { - return CI.getNumberedAdvancedCircuit(4); - } - private static final ItemStack getTierTwoChip() { - return CI.getNumberedAdvancedCircuit(8); - } - private static final ItemStack getTierThreeChip() { - return CI.getNumberedAdvancedCircuit(12); - } - private static final ItemStack getTierFourChip() { - return CI.getNumberedAdvancedCircuit(16); - } - - private static void recipeAdvancedChip() { - GT_ModHandler.addShapelessCraftingRecipe( - GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 0L), 0, new Object[]{OrePrefixes.circuit.get(Materials.Advanced)}); - - long bits = 0; - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 1L, new Object[0]), bits, - new Object[]{"d ", " P ", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 2L, new Object[0]), bits, - new Object[]{" d ", " P ", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 3L, new Object[0]), bits, - new Object[]{" d", " P ", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 4L, new Object[0]), bits, - new Object[]{" ", " Pd", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 5L, new Object[0]), bits, - new Object[]{" ", " P ", " d", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 6L, new Object[0]), bits, - new Object[]{" ", " P ", " d ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 7L, new Object[0]), bits, - new Object[]{" ", " P ", "d ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 8L, new Object[0]), bits, - new Object[]{" ", "dP ", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 9L, new Object[0]), bits, - new Object[]{"P d", " ", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 10L, new Object[0]), bits, - new Object[]{"P ", " d", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 11L, new Object[0]), bits, - new Object[]{"P ", " ", " d", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 12L, new Object[0]), bits, - new Object[]{"P ", " ", " d ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 13L, new Object[0]), bits, - new Object[]{" P", " ", " d", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 14L, new Object[0]), bits, - new Object[]{" P", " ", " d ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 15L, new Object[0]), bits, - new Object[]{" P", " ", "d ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 16L, new Object[0]), bits, - new Object[]{" P", "d ", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 17L, new Object[0]), bits, - new Object[]{" ", " ", "d P", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 18L, new Object[0]), bits, - new Object[]{" ", "d ", " P", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 19L, new Object[0]), bits, - new Object[]{"d ", " ", " P", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 20L, new Object[0]), bits, - new Object[]{" d ", " ", " P", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 21L, new Object[0]), bits, - new Object[]{"d ", " ", "P ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 22L, new Object[0]), bits, - new Object[]{" d ", " ", "P ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 23L, new Object[0]), bits, - new Object[]{" d", " ", "P ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 24L, new Object[0]), bits, - new Object[]{" ", " d", "P ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])}); - } - - -} diff --git a/src/Java/gtPlusPlus/core/item/chemistry/IonParticles.java b/src/Java/gtPlusPlus/core/item/chemistry/IonParticles.java deleted file mode 100644 index e08a509436..0000000000 --- a/src/Java/gtPlusPlus/core/item/chemistry/IonParticles.java +++ /dev/null @@ -1,165 +0,0 @@ -package gtPlusPlus.core.item.chemistry; - -import java.util.HashMap; -import java.util.List; - -import gregtech.api.enums.Materials; -import gtPlusPlus.core.item.base.misc.BaseItemParticle; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.util.Utils; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; - -public class IonParticles extends BaseItemParticle { - - public static HashMap<String, Integer> NameToMetaMap = new HashMap<String, Integer>(); - public static HashMap<Integer, String> MetaToNameMap = new HashMap<Integer, String>(); - - - public IonParticles() { - super("Ion", ELEMENT.NAMES.length, EnumRarity.rare); - } - - public static IIcon[] overlays = new IIcon[ELEMENT.NAMES.length]; - public static IIcon baseTexture; - - static { - //Generate Ions - int key = 0; - for (String s : ELEMENT.NAMES) { - //Map names to Meta - NameToMetaMap.put(Utils.sanitizeString(s.toLowerCase()), key); - MetaToNameMap.put(key, Utils.sanitizeString(s.toLowerCase())); - Materials m = Materials.get(s); - int aColour = 0; - if (m == null) { - aColour = Utils.rgbtoHexValue(128, 128, 128); - } - else { - aColour = Utils.rgbtoHexValue(m.mRGBa[0], m.mRGBa[1], m.mRGBa[2]); - } - aColourMap.put(key++, aColour); - } - - } - - @Override - public String[] getAffixes() { - return new String[] {"", ""}; - } - - @Override - public String getUnlocalizedName() { - return ""; - } - - @Override - public String getUnlocalizedName(final ItemStack itemStack) { - return "item.particle.ion" + "." + ELEMENT.NAMES[itemStack.getItemDamage()]; - } - - private static boolean createNBT(ItemStack rStack){ - final NBTTagCompound tagMain = new NBTTagCompound(); - final NBTTagCompound tagNBT = new NBTTagCompound(); - tagNBT.setLong("Charge", 0); - tagMain.setTag("Ion", tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - public static final long getChargeState(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("Ion"); - if (aNBT != null) { - return aNBT.getLong("Charge"); - } - } - else { - createNBT(aStack); - } - return 0L; - } - - public static final boolean setChargeState(final ItemStack aStack, final long aCharge) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("Ion"); - if (aNBT != null) { - aNBT.setLong("Charge", aCharge); - return true; - } - } - return false; - } - - @Override - public double getDurabilityForDisplay(ItemStack stack) { - if (stack.getTagCompound() == null){ - createNBT(stack); - } - double chargeState = getChargeState(stack); - return chargeState; - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { - long aCharge = getChargeState(stack); - String aState = EnumChatFormatting.YELLOW+"Unknown"+EnumChatFormatting.GRAY; - //State not set - if (aCharge == 0) { - list.add(EnumChatFormatting.GRAY+"A "+MetaToNameMap.get(stack.getItemDamage())+" Ion with an "+aState+" charge state"); - } - else { - if (aCharge > 0) { - aState = EnumChatFormatting.GREEN+"Positive"+EnumChatFormatting.GRAY; - } - else { - aState = EnumChatFormatting.RED+"Negative"+EnumChatFormatting.GRAY; - } - - list.add(EnumChatFormatting.GRAY+"A "+MetaToNameMap.get(stack.getItemDamage())+" Ion with a "+aState+" charge state of "+aCharge+""); - } - super.addInformation(stack, player, list, bool); - } - - @Override - public void registerIcons(IIconRegister reg) { - for (int i = 0; i < IonParticles.overlays.length; i++) { - IonParticles.overlays[i] = reg.registerIcon(CORE.MODID + ":" + "ion/"+i); - } - IonParticles.baseTexture = reg.registerIcon(CORE.MODID + ":" + "ion/IonBase"); - } - - @Override - public IIcon getIconFromDamage(int meta) { - return IonParticles.overlays[meta]; - } - - @Override - public boolean requiresMultipleRenderPasses() { - return true; - } - - @Override - public IIcon getIconFromDamageForRenderPass(int aMeta, int aPass) { - if (aPass == 0) { - return IonParticles.baseTexture; - } - else { - return IonParticles.overlays[aMeta]; - } - } - - @Override - public int getRenderPasses(int metadata) { - return 2; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java b/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java deleted file mode 100644 index 8dd2cd1187..0000000000 --- a/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java +++ /dev/null @@ -1,820 +0,0 @@ -package gtPlusPlus.core.item.chemistry; - -import java.util.HashMap; - -import gregtech.api.enums.Materials; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.api.objects.data.Quad; -import gtPlusPlus.api.objects.minecraft.ItemPackage; -import gtPlusPlus.core.item.base.ore.BaseItemMilledOre; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.NONMATERIAL; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.*; -import gtPlusPlus.xmod.bop.HANDLER_BiomesOPlenty; -import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -public class MilledOreProcessing extends ItemPackage { - - /** - * Fluids - */ - - public static Fluid SphaleriteFlotationFroth; - public static Fluid ChalcopyriteFlotationFroth; - public static Fluid NickelFlotationFroth; - public static Fluid PlatinumFlotationFroth; - public static Fluid PentlanditeFlotationFroth; - - public static Fluid RedstoneFlotationFroth; - public static Fluid SpessartineFlotationFroth; - public static Fluid GrossularFlotationFroth; - public static Fluid AlmandineFlotationFroth; - public static Fluid PyropeFlotationFroth; - public static Fluid MonaziteFlotationFroth; - - public static Fluid PineOil; - - - /** - * Items - */ - - // Zinc, Iron, Indium, Germanium - public static Item milledSphalerite; - - // Copper, Iron, Cadmium, Indium - public static Item milledChalcopyrite; - - // Nickel, Cobalt, Rhodium, Ruthenium - public static Item milledNickel; - - // Platinum, Rhodium, Selenium, Tellurium - public static Item milledPlatinum; - - // Iron, Nickel, Promethium, Hafnium - public static Item milledPentlandite; - - - - - // Redstone, Chrome, Firestone, Dysprosium - public static Item milledRedstone; - - // Manganese, Aluminium, Osmium, Strontium - public static Item milledSpessartine; - - // Calcium, Aluminium, Tungsten, Thallium - public static Item milledGrossular; - - // Aluminium, Magnesium, Yttrium, Ytterbium - public static Item milledAlmandine; - - // Magnesium, Manganese, Borax, Rhenium - public static Item milledPyrope; - - // Erbium, Lanthanum, Praseodymium, Europium - public static Item milledMonazite; - - - @Override - public void items() { - - milledSphalerite = BaseItemMilledOre.generate(Materials.Sphalerite, MaterialUtils.getVoltageForTier(6)); - milledChalcopyrite = BaseItemMilledOre.generate(Materials.Chalcopyrite, MaterialUtils.getVoltageForTier(5)); - milledNickel = BaseItemMilledOre.generate(Materials.Nickel, MaterialUtils.getVoltageForTier(5)); - milledPlatinum = BaseItemMilledOre.generate(Materials.Platinum, MaterialUtils.getVoltageForTier(6)); - milledPentlandite = BaseItemMilledOre.generate(Materials.Pentlandite, MaterialUtils.getVoltageForTier(6)); - - milledRedstone = BaseItemMilledOre.generate(Materials.Redstone, MaterialUtils.getVoltageForTier(5)); - milledSpessartine = BaseItemMilledOre.generate(Materials.Spessartine, MaterialUtils.getVoltageForTier(6)); - milledGrossular = BaseItemMilledOre.generate(Materials.Grossular, MaterialUtils.getVoltageForTier(6)); - milledAlmandine = BaseItemMilledOre.generate(Materials.Almandine, MaterialUtils.getVoltageForTier(6)); - milledPyrope = BaseItemMilledOre.generate(Materials.Pyrope, MaterialUtils.getVoltageForTier(4)); - milledMonazite = BaseItemMilledOre.generate(Materials.Monazite, MaterialUtils.getVoltageForTier(7)); - - } - - @Override - public void blocks() { - // None yet - } - - @Override - public void fluids() { - - short[] aZincFrothRGB = Materials.Sphalerite.mRGBa; - SphaleriteFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.zincflotation", "Sphalerite Froth", 32 + 175, new short[] { aZincFrothRGB[0], aZincFrothRGB[1], aZincFrothRGB[2], 100 }, true); - short[] aCopperFrothRGB = Materials.Chalcopyrite.mRGBa; - ChalcopyriteFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.copperflotation", "Chalcopyrite Froth", 32 + 175, new short[] { aCopperFrothRGB[0], aCopperFrothRGB[1], aCopperFrothRGB[2], 100 }, true); - short[] aNickelFrothRGB = Materials.Nickel.mRGBa; - NickelFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.nickelflotation", "Nickel Froth", 32 + 175, new short[] { aNickelFrothRGB[0], aNickelFrothRGB[1], aNickelFrothRGB[2], 100 }, true); - short[] aPlatinumFrothRGB = Materials.Platinum.mRGBa; - PlatinumFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.platinumflotation", "Platinum Froth", 32 + 175, new short[] { aPlatinumFrothRGB[0], aPlatinumFrothRGB[1], aPlatinumFrothRGB[2], 100 }, true); - short[] aPentlanditeFrothRGB = Materials.Pentlandite.mRGBa; - PentlanditeFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.pentlanditeflotation", "Pentlandite Froth", 32 + 175, new short[] { aPentlanditeFrothRGB[0], aPentlanditeFrothRGB[1], aPentlanditeFrothRGB[2], 100 }, true); - - short[] aRedstoneFrothRGB = Materials.Redstone.mRGBa; - RedstoneFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.redstoneflotation", "Redstone Froth", 32 + 175, new short[] { aRedstoneFrothRGB[0], aRedstoneFrothRGB[1], aRedstoneFrothRGB[2], 100 }, true); - short[] aSpessartineFrothRGB = Materials.Spessartine.mRGBa; - SpessartineFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.spessartineflotation", "Spessartine Froth", 32 + 175, new short[] { aSpessartineFrothRGB[0], aSpessartineFrothRGB[1], aSpessartineFrothRGB[2], 100 }, true); - short[] aGrossularFrothRGB = Materials.Grossular.mRGBa; - GrossularFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.grossularflotation", "Grossular Froth", 32 + 175, new short[] { aGrossularFrothRGB[0], aGrossularFrothRGB[1], aGrossularFrothRGB[2], 100 }, true); - short[] aAlmandineFrothRGB = Materials.Almandine.mRGBa; - AlmandineFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.almandineflotation", "Almandine Froth", 32 + 175, new short[] { aAlmandineFrothRGB[0], aAlmandineFrothRGB[1], aAlmandineFrothRGB[2], 100 }, true); - short[] aPyropeFrothRGB = Materials.Pyrope.mRGBa; - PyropeFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.pyropeflotation", "Pyrope Froth", 32 + 175, new short[] { aPyropeFrothRGB[0], aPyropeFrothRGB[1], aPyropeFrothRGB[2], 100 }, true); - short[] aMonaziteFrothRGB = Materials.Monazite.mRGBa; - MonaziteFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.Monaziteflotation", "Monazite Froth", 32 + 175, new short[] { aMonaziteFrothRGB[0], aMonaziteFrothRGB[1], aMonaziteFrothRGB[2], 100 }, true); - - - PineOil = FluidUtils.generateFluidNoPrefix("pineoil", "Pine Oil", 32 + 175, new short[] { 250, 200, 60, 100 }, true); - - } - - - - public MilledOreProcessing() { - super(); - Logger.INFO("Adding Ore Milling content"); - } - - private static void addMiscRecipes() { - - /* - * First 5 - */ - - //milledSphalerite - registerOreDataForMilledType( - SphaleriteFlotationFroth, - ELEMENT.getInstance().ZINC, 180, - ELEMENT.getInstance().IRON, 120, - ELEMENT.getInstance().INDIUM, 40, - ELEMENT.getInstance().GERMANIUM, 15 - ); - //milledChalcopyrite - registerOreDataForMilledType( - ChalcopyriteFlotationFroth, - ELEMENT.getInstance().COPPER, 180, - ELEMENT.getInstance().IRON, 120, - ELEMENT.getInstance().CADMIUM, 50, - ELEMENT.getInstance().INDIUM, 10 - ); - //milledNickel - registerOreDataForMilledType( - NickelFlotationFroth, - ELEMENT.getInstance().NICKEL, 150, - ELEMENT.getInstance().COBALT, 120, - ELEMENT.getInstance().RHODIUM, 32, - ELEMENT.getInstance().RUTHENIUM, 16 - ); - //milledPlatinum - registerOreDataForMilledType( - PlatinumFlotationFroth, - ELEMENT.getInstance().PLATINUM, 120, - ELEMENT.getInstance().RHODIUM, 60, - ELEMENT.getInstance().SELENIUM, 40, - ELEMENT.getInstance().TELLURIUM, 10 - ); - //milledPentlandite - registerOreDataForMilledType( - PentlanditeFlotationFroth, - ELEMENT.getInstance().IRON, 150, - ELEMENT.getInstance().NICKEL, 100, - ELEMENT.getInstance().PROMETHIUM, 20, - ELEMENT.getInstance().HAFNIUM, 10 - ); - - /* - * Second 5 - */ - //milledRedstone - registerOreDataForMilledType( - RedstoneFlotationFroth, - NONMATERIAL.REDSTONE, 300, - ELEMENT.getInstance().CHROMIUM, 60, - MaterialUtils.generateMaterialFromGtENUM(Materials.Firestone), 45, - ELEMENT.getInstance().DYSPROSIUM, 16 - ); - //milledSpessartine - registerOreDataForMilledType( - SpessartineFlotationFroth, - ELEMENT.getInstance().MANGANESE, 150, - ELEMENT.getInstance().ALUMINIUM, 90, - ELEMENT.getInstance().OSMIUM, 30, - ELEMENT.getInstance().STRONTIUM, 20 - ); - //milledGrossular - registerOreDataForMilledType( - GrossularFlotationFroth, - ELEMENT.getInstance().CALCIUM, 180, - ELEMENT.getInstance().ALUMINIUM, 110, - ELEMENT.getInstance().TUNGSTEN, 60, - ELEMENT.getInstance().THALLIUM, 15 - ); - //milledAlmandine - registerOreDataForMilledType( - AlmandineFlotationFroth, - ELEMENT.getInstance().ALUMINIUM, 150, - ELEMENT.getInstance().MAGNESIUM, 75, - ELEMENT.getInstance().YTTRIUM, 25, - ELEMENT.getInstance().YTTERBIUM, 15 - ); - //milledPyrope - registerOreDataForMilledType( - PyropeFlotationFroth, - ELEMENT.getInstance().MAGNESIUM, 110, - ELEMENT.getInstance().MANGANESE, 70, - MaterialUtils.generateMaterialFromGtENUM(Materials.Borax), 60, - ELEMENT.getInstance().RHENIUM, 20 - ); - //milledMonazite TODO - registerOreDataForMilledType( - MonaziteFlotationFroth, - ELEMENT.getInstance().ERBIUM, 64, - ELEMENT.getInstance().LANTHANUM, 32, - ELEMENT.getInstance().LUTETIUM, 16, - ELEMENT.getInstance().EUROPIUM, 8 - ); - - - } - - @Override - public String errorMessage() { - return "Failed to generate recipes for OreMillingProc."; - } - - @Override - public boolean generateRecipes() { - addMiscRecipes(); - addPineOilExtraction(); - addFlotationRecipes1(); - addFlotationRecipes2(); - addVacuumFurnaceRecipes(); - return true; - } - - private void addVacuumFurnaceRecipes() { - int aCircuitID = 1; - - CORE.RA.addVacuumFurnaceRecipe( - new ItemStack[] { - CI.getNumberedCircuit(aCircuitID++) - }, - new FluidStack[] { - FluidUtils.getFluidStack(SphaleriteFlotationFroth, 4000) - }, - getOutputsFromMap(SphaleriteFlotationFroth), - new FluidStack[] { - FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000), - FluidUtils.getWater(2000) - }, - 20 * 120, - MaterialUtils.getVoltageForTier(6), - 5500); - CORE.RA.addVacuumFurnaceRecipe( - new ItemStack[] { - CI.getNumberedCircuit(aCircuitID++) - }, - new FluidStack[] { - FluidUtils.getFluidStack(ChalcopyriteFlotationFroth, 4000) - }, - getOutputsFromMap(ChalcopyriteFlotationFroth), - new FluidStack[] { - FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000), - FluidUtils.getWater(2000) - }, - 20 * 120, - MaterialUtils.getVoltageForTier(5), - 4500); - - CORE.RA.addVacuumFurnaceRecipe( - new ItemStack[] { - CI.getNumberedCircuit(aCircuitID++) - }, - new FluidStack[] { - FluidUtils.getFluidStack(NickelFlotationFroth, 4000) - }, - getOutputsFromMap(NickelFlotationFroth), - new FluidStack[] { - FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000), - FluidUtils.getWater(2000) - }, - 20 * 120, - MaterialUtils.getVoltageForTier(5), - 4500); - CORE.RA.addVacuumFurnaceRecipe( - new ItemStack[] { - CI.getNumberedCircuit(aCircuitID++) - }, - new FluidStack[] { - FluidUtils.getFluidStack(PlatinumFlotationFroth, 4000) - }, - getOutputsFromMap(PlatinumFlotationFroth), - new FluidStack[] { - FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000), - FluidUtils.getWater(2000) - }, - 20 * 120, - MaterialUtils.getVoltageForTier(6), - 5500); - CORE.RA.addVacuumFurnaceRecipe( - new ItemStack[] { - CI.getNumberedCircuit(aCircuitID++) - }, - new FluidStack[] { - FluidUtils.getFluidStack(PentlanditeFlotationFroth, 4000) - }, - getOutputsFromMap(PentlanditeFlotationFroth), - new FluidStack[] { - FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000), - FluidUtils.getWater(2000) - }, - 20 * 120, - MaterialUtils.getVoltageForTier(6), - 5500); - - - - CORE.RA.addVacuumFurnaceRecipe( - new ItemStack[] { - CI.getNumberedCircuit(aCircuitID++) - }, - new FluidStack[] { - FluidUtils.getFluidStack(RedstoneFlotationFroth, 4000) - }, - getOutputsFromMap(RedstoneFlotationFroth), - new FluidStack[] { - FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000), - FluidUtils.getWater(2000) - }, - 20 * 120, - MaterialUtils.getVoltageForTier(5), - 4500); - CORE.RA.addVacuumFurnaceRecipe( - new ItemStack[] { - CI.getNumberedCircuit(aCircuitID++) - }, - new FluidStack[] { - FluidUtils.getFluidStack(SpessartineFlotationFroth, 4000) - }, - getOutputsFromMap(SpessartineFlotationFroth), - new FluidStack[] { - FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000), - FluidUtils.getWater(2000) - }, - 20 * 120, - MaterialUtils.getVoltageForTier(6), - 5500); - CORE.RA.addVacuumFurnaceRecipe( - new ItemStack[] { - CI.getNumberedCircuit(aCircuitID++) - }, - new FluidStack[] { - FluidUtils.getFluidStack(GrossularFlotationFroth, 4000) - }, - getOutputsFromMap(GrossularFlotationFroth), - new FluidStack[] { - FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000), - FluidUtils.getWater(2000) - }, - 20 * 120, - MaterialUtils.getVoltageForTier(6), - 5500); - CORE.RA.addVacuumFurnaceRecipe( - new ItemStack[] { - CI.getNumberedCircuit(aCircuitID++) - }, - new FluidStack[] { - FluidUtils.getFluidStack(AlmandineFlotationFroth, 4000) - }, - getOutputsFromMap(AlmandineFlotationFroth), - new FluidStack[] { - FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000), - FluidUtils.getWater(2000) - }, - 20 * 120, - MaterialUtils.getVoltageForTier(6), - 5500); - CORE.RA.addVacuumFurnaceRecipe( - new ItemStack[] { - CI.getNumberedCircuit(aCircuitID++) - }, - new FluidStack[] { - FluidUtils.getFluidStack(PyropeFlotationFroth, 4000) - }, - getOutputsFromMap(PyropeFlotationFroth), - new FluidStack[] { - FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000), - FluidUtils.getWater(2000) - }, - 20 * 120, - MaterialUtils.getVoltageForTier(4), - 3500); - CORE.RA.addVacuumFurnaceRecipe( - new ItemStack[] { - CI.getNumberedCircuit(aCircuitID++) - }, - new FluidStack[] { - FluidUtils.getFluidStack(MonaziteFlotationFroth, 4000) - }, - getOutputsFromMap(MonaziteFlotationFroth), - new FluidStack[] { - FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000), - FluidUtils.getWater(2000) - }, - 20 * 120, - MaterialUtils.getVoltageForTier(7), - 7500); - - } - - private void addFlotationRecipes1() { - - // Sphalerite - CORE.RA.addFlotationRecipe( - Materials.Sphalerite, - ItemUtils.getSimpleStack(GenericChem.mSodiumEthylXanthate, 1), - new FluidStack[] { - FluidUtils.getFluidStack(PineOil, 14000), - }, - new FluidStack[] { - FluidUtils.getFluidStack(SphaleriteFlotationFroth, 1000) - }, - 20 * 1200, - MaterialUtils.getVoltageForTier(6) - ); - - // Chalcopyrite - CORE.RA.addFlotationRecipe( - Materials.Chalcopyrite, - ItemUtils.getSimpleStack(GenericChem.mSodiumEthylXanthate, 1), - new FluidStack[] { - FluidUtils.getFluidStack(PineOil, 12000), - }, - new FluidStack[] { - FluidUtils.getFluidStack(ChalcopyriteFlotationFroth, 1000) - }, - 20 * 1200, - MaterialUtils.getVoltageForTier(5) - ); - - // Nickel - CORE.RA.addFlotationRecipe( - Materials.Nickel, - ItemUtils.getSimpleStack(GenericChem.mPotassiumEthylXanthate, 1), - new FluidStack[] { - FluidUtils.getFluidStack(PineOil, 25000), - }, - new FluidStack[] { - FluidUtils.getFluidStack(NickelFlotationFroth, 1000) - }, - 20 * 1200, - MaterialUtils.getVoltageForTier(5) - ); - - // Platinum - CORE.RA.addFlotationRecipe( - Materials.Platinum, - ItemUtils.getSimpleStack(GenericChem.mPotassiumEthylXanthate, 1), - new FluidStack[] { - FluidUtils.getFluidStack(PineOil, 35000), - }, - new FluidStack[] { - FluidUtils.getFluidStack(PlatinumFlotationFroth, 1000) - }, - 20 * 1200, - MaterialUtils.getVoltageForTier(6) - ); - - - // Pentlandite - CORE.RA.addFlotationRecipe( - Materials.Pentlandite, - ItemUtils.getSimpleStack(GenericChem.mSodiumEthylXanthate, 1), - new FluidStack[] { - FluidUtils.getFluidStack(PineOil, 14000), - }, - new FluidStack[] { - FluidUtils.getFluidStack(PentlanditeFlotationFroth, 1000) - }, - 20 * 1200, - MaterialUtils.getVoltageForTier(6) - ); - - } - - private void addFlotationRecipes2() { - - // Redstone - CORE.RA.addFlotationRecipe( - Materials.Redstone, - ItemUtils.getSimpleStack(GenericChem.mSodiumEthylXanthate, 1), - new FluidStack[] { - FluidUtils.getFluidStack(PineOil, 13000), - }, - new FluidStack[] { - FluidUtils.getFluidStack(RedstoneFlotationFroth, 1000) - }, - 20 * 1200, - MaterialUtils.getVoltageForTier(5) - ); - - // Spessartine - CORE.RA.addFlotationRecipe( - Materials.Spessartine, - ItemUtils.getSimpleStack(GenericChem.mPotassiumEthylXanthate, 1), - new FluidStack[] { - FluidUtils.getFluidStack(PineOil, 35000), - }, - new FluidStack[] { - FluidUtils.getFluidStack(SpessartineFlotationFroth, 1000) - }, - 20 * 1200, - MaterialUtils.getVoltageForTier(6) - ); - - // Grossular - CORE.RA.addFlotationRecipe( - Materials.Grossular, - ItemUtils.getSimpleStack(GenericChem.mPotassiumEthylXanthate, 1), - new FluidStack[] { - FluidUtils.getFluidStack(PineOil, 28000), - }, - new FluidStack[] { - FluidUtils.getFluidStack(GrossularFlotationFroth, 1000) - }, - 20 * 1200, - MaterialUtils.getVoltageForTier(6) - ); - - // Almandine - CORE.RA.addFlotationRecipe( - Materials.Almandine, - ItemUtils.getSimpleStack(GenericChem.mSodiumEthylXanthate, 1), - new FluidStack[] { - FluidUtils.getFluidStack(PineOil, 18000), - }, - new FluidStack[] { - FluidUtils.getFluidStack(AlmandineFlotationFroth, 1000) - }, - 20 * 1200, - MaterialUtils.getVoltageForTier(5) - ); - - // Pyrope - CORE.RA.addFlotationRecipe( - Materials.Pyrope, - ItemUtils.getSimpleStack(GenericChem.mSodiumEthylXanthate, 1), - new FluidStack[] { - FluidUtils.getFluidStack(PineOil, 8000), - }, - new FluidStack[] { - FluidUtils.getFluidStack(PyropeFlotationFroth, 1000) - }, - 20 * 1200, - MaterialUtils.getVoltageForTier(4) - ); - - // Monazite - CORE.RA.addFlotationRecipe( - Materials.Monazite, - ItemUtils.getSimpleStack(GenericChem.mPotassiumEthylXanthate, 1), - new FluidStack[] { - FluidUtils.getFluidStack(PineOil, 30000), - }, - new FluidStack[] { - FluidUtils.getFluidStack(MonaziteFlotationFroth, 1000) - }, - 20 * 1200, - MaterialUtils.getVoltageForTier(6) - ); - - } - - private void addPineOilExtraction() { - AutoMap<ItemStack> aLogs = new AutoMap<ItemStack>(); - AutoMap<ItemStack> aLeaves = new AutoMap<ItemStack>(); - AutoMap<ItemStack> aSaplings = new AutoMap<ItemStack>(); - AutoMap<ItemStack> aPinecones = new AutoMap<ItemStack>(); - - ItemStack aCrushedPine = ItemUtils.getSimpleStack(AgriculturalChem.mCrushedPine, 1); - - aLogs.add(ItemUtils.getSimpleStack(BOP_Block_Registrator.log_Pine)); - aLeaves.add(ItemUtils.getSimpleStack(BOP_Block_Registrator.leaves_Pine)); - aSaplings.add(ItemUtils.getSimpleStack(BOP_Block_Registrator.sapling_Pine)); - aPinecones.add(ItemUtils.getSimpleStack(AgriculturalChem.mPinecone, 1)); - - if (LoadedMods.BiomesOPlenty) { - aLogs.add(HANDLER_BiomesOPlenty.getStack(HANDLER_BiomesOPlenty.logs4, 0, 1)); - aLeaves.add(HANDLER_BiomesOPlenty.getStack(HANDLER_BiomesOPlenty.colorizedLeaves2, 1, 1)); - aSaplings.add(HANDLER_BiomesOPlenty.getStack(HANDLER_BiomesOPlenty.colorizedSaplings, 5, 1)); - aPinecones.add(ItemUtils.simpleMetaStack(HANDLER_BiomesOPlenty.mPineCone, 13, 1)); - } - if (LoadedMods.Forestry) { - ItemStack aForestryLog = ItemUtils.getItemStackFromFQRN("Forestry:logs", 1); - if (aForestryLog != null) { - aForestryLog.setItemDamage(20); // Set to Pine - aLogs.add(aForestryLog); - } - ItemStack aForestryLeaves = ItemUtils.getItemStackFromFQRN("Forestry:leaves", 1); - if (aForestryLeaves != null) { - NBTUtils.setString(aForestryLeaves, "species", "forestry.treePine"); // Set to Pine - aLeaves.add(aForestryLeaves); - } - } - - for (ItemStack aLog : aLogs) { - addRecipe(aLog, ItemUtils.getSimpleStack(aCrushedPine, 16), new int[] {10000, 7500, 5000, 2500}, 10, 120); - } - for (ItemStack aLeaf : aLeaves) { - addRecipe(aLeaf, ItemUtils.getSimpleStack(aCrushedPine, 2), new int[] {5000, 5000, 2500, 2500}, 10, 30); - } - for (ItemStack aSapling : aSaplings) { - addRecipe(aSapling, ItemUtils.getSimpleStack(aCrushedPine, 4), new int[] {7500, 7500, 2500, 2500}, 10, 60); - } - for (ItemStack aCone : aPinecones) { - addRecipe(aCone, ItemUtils.getSimpleStack(aCrushedPine, 1), new int[] {7500, 7500, 5000, 2500}, 10, 60); - } - - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(16), - ItemUtils.getSimpleStack(aCrushedPine, 64) - }, - new FluidStack[] { - FluidUtils.getSteam(5000), - }, - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 5), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 5), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 5), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 5) - }, - new FluidStack[] { - FluidUtils.getFluidStack(PineOil, 500) - }, - new int[] { - 2000, 2000, 2000, 2000 - }, - 20 * 60, - 120, - 3); - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(18), - ItemUtils.getSimpleStack(aCrushedPine, 64) - }, - new FluidStack[] { - FluidUtils.getSuperHeatedSteam(5000), - }, - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 5), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 5), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 5), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 5) - }, - new FluidStack[] { - FluidUtils.getFluidStack(PineOil, 1500) - }, - new int[] { - 3000, 3000, 3000, 3000 - }, - 20 * 45, - 120, - 4); - - } - - public boolean addRecipe(ItemStack aInput, ItemStack aOutput1, int[] aChances, int aTime, int aEU) { - aOutput1 = GT_OreDictUnificator.get(true, aOutput1); - ItemStack aOutputs[] = new ItemStack[4]; - for (int i=0;i<aChances.length;i++) { - aOutputs[i] = aOutput1; - } - aOutputs = cleanArray(aOutputs); - if ((GT_Utility.isStackInvalid(aInput)) || (GT_Utility.isStackInvalid(aOutput1) || (GT_Utility.getContainerItem(aInput, false) != null))) { - return false; - } - - return CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(14), - aInput - }, - new FluidStack[] { - - }, - aOutputs, - new FluidStack[] { - - }, - aChances, - aTime * 20, - aEU, - 3); - } - - public static ItemStack[] cleanArray(ItemStack[] input) { - int aArraySize = input.length; - AutoMap<ItemStack> aCleanedItems = new AutoMap<ItemStack>(); - for (ItemStack checkStack : input) { - if (ItemUtils.checkForInvalidItems(checkStack)) { - aCleanedItems.put(checkStack); - } - } - ItemStack[] aOutput = new ItemStack[aCleanedItems.size()]; - for (int i=0;i<aArraySize;i++) { - ItemStack aMappedStack = aCleanedItems.get(i); - if (aMappedStack != null){ - aOutput[i] = aMappedStack; - } - } - return aOutput; - } - - private static final HashMap<String, Quad<Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>>> aMilledFluidMap = new HashMap<String, Quad<Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>>>(); - - public static void registerOreDataForMilledType(Fluid aMilledFluid, Materials aOutput1, int aPerc1, Materials aOutput2, int aPerc2, Materials aOutput3, int aPerc3, Materials aOutput4, int aPerc4) { - registerOreDataForMilledType(aMilledFluid, MaterialUtils.generateMaterialFromGtENUM(aOutput1), aPerc1, MaterialUtils.generateMaterialFromGtENUM(aOutput2), aPerc2, MaterialUtils.generateMaterialFromGtENUM(aOutput3), aPerc3, MaterialUtils.generateMaterialFromGtENUM(aOutput4), aPerc4); - } - - public static void registerOreDataForMilledType(Fluid aMilledFluid, Material aOutput1, int aPerc1, Material aOutput2, int aPerc2, Material aOutput3, int aPerc3, Material aOutput4, int aPerc4) { - - Pair<Material, Integer> aFluidOutput1 = new Pair<Material, Integer>(aOutput1, aPerc1); - Pair<Material, Integer> aFluidOutput2 = new Pair<Material, Integer>(aOutput2, aPerc2); - Pair<Material, Integer> aFluidOutput3 = new Pair<Material, Integer>(aOutput3, aPerc3); - Pair<Material, Integer> aFluidOutput4 = new Pair<Material, Integer>(aOutput4, aPerc4); - Quad<Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>> aDataQuad = new Quad<Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>>(aFluidOutput1, aFluidOutput2, aFluidOutput3, aFluidOutput4); - aMilledFluidMap.put(aMilledFluid.getUnlocalizedName(), aDataQuad); - - } - - private static ItemStack[] getOutputsFromMap(Fluid aFluid) { - String aKey = aFluid.getUnlocalizedName(); - return getArrayFromQuad(aMilledFluidMap.get(aKey)); - } - - private static ItemStack[] getArrayFromQuad(Quad<Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>> aData) { - AutoMap<ItemStack> aOutputs = new AutoMap<ItemStack>(); - for (Object aPair : aData.values()) { - if (aPair != null && Pair.class.isInstance(aPair)) { - Pair aObj = (Pair) aPair; - Material aMat = (Material) aObj.getKey(); - int aCount = (int) aObj.getValue(); - aOutputs.addAll(getItemStackFromPair(aMat, aCount)); - } - } - ItemStack[] aRealOutputArray = new ItemStack[aOutputs.size()]; - int aIndex = 0; - for (ItemStack aStack : aOutputs) { - aRealOutputArray[aIndex++] = aStack; - } - return aRealOutputArray; - } - - private static AutoMap<ItemStack> getItemStackFromPair(Material aMat, Integer aCount) { - AutoMap<ItemStack> aOutputs = new AutoMap<ItemStack>(); - if (aCount > 64) { - AutoMap<Integer> sizes = getStackSizes(aCount); - for (int aSplitSize : sizes) { - ItemStack aDustStack = aMat.getDust(aSplitSize); - aOutputs.put(aDustStack); - } - } - else { - ItemStack aDustStack = aMat.getDust(aCount); - aOutputs.put(aDustStack); - } - return aOutputs; - } - - private static AutoMap<Integer> getStackSizes(int aBigSize){ - AutoMap<Integer> aSizes = new AutoMap<Integer>(); - if (aBigSize <= 64) { - aSizes.add(aBigSize); - } - else { - for (int i = aBigSize; i > 0; i -= 64) { - aSizes.add(i); - } - } - return aSizes; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/chemistry/NuclearChem.java b/src/Java/gtPlusPlus/core/item/chemistry/NuclearChem.java deleted file mode 100644 index f112b0d2a5..0000000000 --- a/src/Java/gtPlusPlus/core/item/chemistry/NuclearChem.java +++ /dev/null @@ -1,116 +0,0 @@ -package gtPlusPlus.core.item.chemistry; - -import gtPlusPlus.api.objects.minecraft.ItemPackage; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase; -import gtPlusPlus.core.item.chemistry.general.ItemNuclearChemBase; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; - -public class NuclearChem extends ItemPackage { - - public static Fluid Burnt_LiFBeF2ThF4UF4; - public static Fluid Burnt_LiFBeF2ZrF4UF4; - public static Fluid Burnt_LiFBeF2ZrF4U235; - - - public static Fluid Impure_LiFBeF2; - - public static Fluid GeneticMutagen; - private static boolean generateMutagenRecipe = false; - - public static ItemNuclearChemBase mNuclearChemItem1; - - public static ItemStack mResidueUranium; - public static ItemStack mResiduePlutonium; - public static ItemStack mResidueFluorides; - public static ItemStack mResidueNobles; - - @Override - public void items() { - - mNuclearChemItem1 = new ItemNuclearChemBase(); - registerItemStacks(); - registerOreDict(); - } - - - public void registerItemStacks() { - - mResidueUranium = ItemUtils.simpleMetaStack(mNuclearChemItem1, 0, 1); - mResidueUranium = ItemUtils.simpleMetaStack(mNuclearChemItem1, 1, 1); - mResidueUranium = ItemUtils.simpleMetaStack(mNuclearChemItem1, 2, 1); - mResidueUranium = ItemUtils.simpleMetaStack(mNuclearChemItem1, 3, 1); - - } - - public void registerOreDict() { - - ItemUtils.addItemToOreDictionary(mResidueUranium, "dustResidueUranium"); - ItemUtils.addItemToOreDictionary(mResiduePlutonium, "dustResiduePlutonium"); - ItemUtils.addItemToOreDictionary(mResidueFluorides, "dustResidueFluoride"); - ItemUtils.addItemToOreDictionary(mResidueNobles, "dustResidueNoble"); - - } - - @Override - public void blocks() { - } - - @Override - public void fluids() { - //Create Used Nuclear Fuels - Burnt_LiFBeF2ThF4UF4 = FluidUtils.generateFluidNonMolten("BurntLiFBeF2ThF4UF4", "Burnt LiFBeF2ThF4UF4 Salt", 545, new short[]{48, 175, 48, 100}, null, null); - Burnt_LiFBeF2ZrF4UF4 = FluidUtils.generateFluidNonMolten("BurntLiFBeF2ZrF4UF4", "Burnt LiFBeF2ZrF4UF4 Salt", 520, new short[]{48, 168, 68, 100}, null, null); - Burnt_LiFBeF2ZrF4U235 = FluidUtils.generateFluidNonMolten("BurntLiFBeF2ZrF4U235", "Burnt LiFBeF2ZrF4U235 Salt", 533, new short[]{68, 185, 48, 100}, null, null); - Impure_LiFBeF2 = FluidUtils.generateFluidNonMolten("ImpureLiFBeF2", "Impure LiFBeF2 Salt", 533, new short[]{110, 75, 186, 100}, null, null); - if (FluidUtils.getFluidStack("fluid.Mutagen", 1) == null) { - GeneticMutagen = FluidUtils.generateFluidNonMolten("GeneticMutagen", "Genetic Mutagen", 12, new short[]{22, 148, 185, 100}, null, null); - generateMutagenRecipe = true; - } - else { - GeneticMutagen = FluidUtils.getFluidStack("fluid.Mutagen", 1).getFluid(); - } - } - - @Override - public String errorMessage() { - return "Bad Nuclear Chemistry Recipes."; - } - - @Override - public boolean generateRecipes() { - if (generateMutagenRecipe) { - chemReator_CreateMutagen(); - } - chemReactor_MutagenWithEggs(); - return true; - } - - private static void chemReator_CreateMutagen() { - CORE.RA.addChemicalRecipe( - CI.getNumberedCircuit(20), - ItemUtils.getSimpleStack(Items.nether_star, 2), - FluidUtils.getMobEssence(5000), - FluidUtils.getFluidStack(GeneticMutagen, 8000), - null, - 30*20, - 500); - } - - private static void chemReactor_MutagenWithEggs() { - CORE.RA.addChemicalRecipe( - CI.getNumberedCircuit(20), - ItemUtils.getSimpleStack(Items.egg, 2), - FluidUtils.getFluidStack(GeneticMutagen, 500), - null, - ItemUtils.getSimpleStack(ModItems.itemBigEgg, 2), - 300*20, - 500); - } -} diff --git a/src/Java/gtPlusPlus/core/item/chemistry/OilChem.java b/src/Java/gtPlusPlus/core/item/chemistry/OilChem.java deleted file mode 100644 index 4406995d27..0000000000 --- a/src/Java/gtPlusPlus/core/item/chemistry/OilChem.java +++ /dev/null @@ -1,45 +0,0 @@ -package gtPlusPlus.core.item.chemistry; - -import gtPlusPlus.api.objects.minecraft.ItemPackage; - -public class OilChem extends ItemPackage { - - /** - * Fluids - */ - - - /** - * Items - */ - - - - @Override - public void items() { - - } - - @Override - public void blocks() { - // None yet - } - - @Override - public void fluids() { - - } - - - - @Override - public String errorMessage() { - return "Failed to generate recipes for OilChem."; - } - - @Override - public boolean generateRecipes() { - - return true; - } -} diff --git a/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java b/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java deleted file mode 100644 index b96e0c76ea..0000000000 --- a/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java +++ /dev/null @@ -1,1071 +0,0 @@ -package gtPlusPlus.core.item.chemistry; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; - -import cpw.mods.fml.common.event.FMLLoadCompleteEvent; -import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; -import gregtech.api.util.GT_Utility; -import gregtech.api.util.GTPP_Recipe; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.ItemPackage; -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.xmod.gregtech.common.StaticFields59; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -public class RocketFuels extends ItemPackage { - - public static HashSet<String> mValidRocketFuelNames = new HashSet<String>(); - public static HashMap<Integer, Fluid> mValidRocketFuels = new HashMap<Integer, Fluid>(); - - public static Fluid Oil_Heavy; - public static Fluid Diesel; - public static Fluid Kerosene; - public static Fluid RP1; - public static Fluid Nitrogen_Tetroxide; - public static Fluid Hydrazine; - public static Fluid Monomethylhydrazine; - public static Fluid Unsymmetrical_Dimethylhydrazine; - public static Fluid Nitrous_Oxide; - public static Fluid Hydrated_Ammonium_Nitrate_Slurry; - public static Fluid Liquid_Oxygen; - public static Fluid Liquid_Hydrogen; - public static Fluid Formaldehyde; - - - //Rocket Fuel Mixes - public static Fluid Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide; - public static Fluid RP1_Plus_Liquid_Oxygen; - public static Fluid Dense_Hydrazine_Mix; - public static Fluid Monomethylhydrazine_Plus_Nitric_Acid; - - public static Item Ammonium_Nitrate_Dust; - public static Item Formaldehyde_Catalyst; - public static ItemStack Formaldehyde_Catalyst_Stack; - - public RocketFuels() { - super(true); - } - - public static void createKerosene(){ - - FluidStack fuelA = FluidUtils.getFluidStack("diesel", 3000); - FluidStack fuelB = FluidUtils.getFluidStack("fuel", 3000); - - if (fuelA != null){ - //GT_Values.RA.addDistilleryRecipe(23, fuelA, FluidUtils.getFluidStack(Kerosene, 50), 200, 64, false); - GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelA, FluidUtils.getFluidStack(Kerosene, 1800), 200, 64, false); - } - if (fuelA == null && fuelB != null){ - //GT_Values.RA.addDistilleryRecipe(23, fuelB, FluidUtils.getFluidStack(Kerosene, 50), 200, 64, false); - GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelB, FluidUtils.getFluidStack(Kerosene, 1800), 200, 64, false); - } - } - - public static void createRP1(){ - FluidStack fuelA = FluidUtils.getFluidStack(Kerosene, 1000); - if (fuelA != null){ - GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelA, FluidUtils.getFluidStack(RP1, 750), 20 * 40, 120, false); - } - } - - public static void createNitrogenTetroxide(){ - /*CORE.RA.addDehydratorRecipe( - new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 4) - }, - FluidUtils.getFluidStack("nitricacid", 2000), - FluidUtils.getFluidStack(Nitrogen_Tetroxide, 450), - new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 1) - }, - new int[]{100, 50}, - 20*16, - 500);*/ - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 12), - ItemUtils.getSimpleStack(GenericChem.mOrangeCatalyst, 0), - }, - new FluidStack[] { - FluidUtils.getFluidStack("nitricacid", 4000) - }, - new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallAsh", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallDarkAsh", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 1) - }, - new FluidStack[] { - FluidUtils.getFluidStack(Nitrogen_Tetroxide, 3000), - }, - new int[]{100, 100, 50, 50}, - 20 * 30, - MaterialUtils.getVoltageForTier(3), - 3); - - - } - - public static void createHydrazine(){ - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedCircuit(21) - }, - new FluidStack[] { - FluidUtils.getFluidStack("fluid.hydrogenperoxide", 2000), - FluidUtils.getFluidStack("ammonia", 2000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(Hydrazine, 4000), - - }, - 20 * 30, - MaterialUtils.getVoltageForTier(2), - 1); - - FluidStack aBartWorksHydrogenPeroxide = FluidUtils.getWildcardFluidStack("Hydrogen Peroxide", 2000); - if (aBartWorksHydrogenPeroxide != null) { - Logger.INFO("Found BW Hydrogen Peroxide, adding compat recipe."); - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedCircuit(22) - }, - new FluidStack[] { - aBartWorksHydrogenPeroxide, - FluidUtils.getFluidStack("ammonia", 2000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(Hydrazine, 4000), - - }, - 20 * 30, - MaterialUtils.getVoltageForTier(2), - 1); - } - - } - - - public static void createMonomethylhydrazine(){ - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedCircuit(21), - ItemUtils.getItemStackOfAmountFromOreDict("dustCarbon", 2) - }, - new FluidStack[] { - FluidUtils.getFluidStack("hydrogen", 2000), - FluidUtils.getFluidStack(Hydrazine, 2000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(Monomethylhydrazine, 4000), - - }, - 20 * 48, - 240, - 2); - - } - - private static void createLOX() { - GT_Values.RA.addVacuumFreezerRecipe(ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 1), ItemUtils.getItemStackOfAmountFromOreDict("cellLiquidOxygen", 1), 20*16); - CORE.RA.addAdvancedFreezerRecipe(new ItemStack[] {}, new FluidStack[] {FluidUtils.getFluidStack("oxygen", 3000)}, new FluidStack[] {FluidUtils.getFluidStack(Liquid_Oxygen, 3000)}, new ItemStack[] {}, new int[] {}, 20*16, 240, 0); - } - - private static void createLOH() { - GT_Values.RA.addVacuumFreezerRecipe(ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogen", 1), ItemUtils.getItemStackOfAmountFromOreDict("cellLiquidHydrogen", 1), 20*16); - CORE.RA.addAdvancedFreezerRecipe(new ItemStack[] {}, new FluidStack[] {FluidUtils.getFluidStack("hydrogen", 300)}, new FluidStack[] {FluidUtils.getFluidStack(Liquid_Hydrogen, 300)}, new ItemStack[] {}, new int[] {}, 20*4, 540, 0); - } - - private static void createHydratedAmmoniumNitrateSlurry() { - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(21), - }, - new FluidStack[] { - FluidUtils.getFluidStack("ammonia", 4000), - FluidUtils.getFluidStack("nitricacid", 4000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(Hydrated_Ammonium_Nitrate_Slurry, 8000), - - }, - 20 * 60, - 120, - 1); - - } - - private static void createAmmoniumNitrateDust() { - CORE.RA.addDehydratorRecipe( - new ItemStack[] {CI.getNumberedCircuit(8)}, - FluidUtils.getFluidStack(Hydrated_Ammonium_Nitrate_Slurry, 8*144), - FluidUtils.getWater(2000), - new ItemStack[] { - ItemUtils.getSimpleStack(Ammonium_Nitrate_Dust, 8) - }, - new int[] {10000}, - 90 * 20, - 480); - - } - - private static void createFormaldehyde() { - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(21), - ItemUtils.getSimpleStack(Formaldehyde_Catalyst, 0), - }, - new FluidStack[] { - FluidUtils.getFluidStack("oxygen", 16000), - FluidUtils.getFluidStack("methanol", 32000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(Formaldehyde, 8000), - - }, - 20 * 90, - 120, - 1); - - } - - private static void createFormaldehydeCatalyst() { - GT_Values.RA.addMixerRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("dustIron", 16), - ItemUtils.getItemStackOfAmountFromOreDict("dustVanadium", 1), - CI.getNumberedCircuit(18), - null, - null, - null, - ItemUtils.getSimpleStack(Formaldehyde_Catalyst, 4), - 160, - 30); - - } - - private static void createUnsymmetricalDimethylhydrazine() { - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(21), - ItemUtils.getSimpleStack(Formaldehyde_Catalyst, 0), - }, - new FluidStack[] { - FluidUtils.getFluidStack("fluid.hydrazine", 2000), - FluidUtils.getFluidStack(Formaldehyde, 2000), - FluidUtils.getFluidStack("hydrogen", 4000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine, 2000), - FluidUtils.getWater(2000) - - }, - 20 * 60, - 120, - 3); - - } - - private static void addRocketFuelsToMap() { - HashMap<Integer, GTPP_Recipe> mRocketFuels = new LinkedHashMap<Integer, GTPP_Recipe>(); - mRocketFuels.put(0, new GTPP_Recipe( - true, - new ItemStack[] {}, - new ItemStack[] {}, - null, - new int[] {}, - new FluidStack[] {FluidUtils.getFluidStack(RP1_Plus_Liquid_Oxygen, 1000)}, - new FluidStack[] {}, - 0, - 0, - 512)); //Fuel Value - - mRocketFuels.put(1, new GTPP_Recipe( - true, - new ItemStack[] {}, - new ItemStack[] {}, - null, - new int[] {}, - new FluidStack[] {FluidUtils.getFluidStack(Dense_Hydrazine_Mix, 1000)}, - new FluidStack[] {}, - 0, - 0, - 1024)); //Fuel Value - - mRocketFuels.put(2, new GTPP_Recipe( - true, - new ItemStack[] {}, - new ItemStack[] {}, - null, - new int[] {}, - new FluidStack[] {FluidUtils.getFluidStack(Monomethylhydrazine_Plus_Nitric_Acid, 1000)}, - new FluidStack[] {}, - 0, - 0, - 2048)); //Fuel Value - - mRocketFuels.put(3, new GTPP_Recipe( - true, - new ItemStack[] {}, - new ItemStack[] {}, - null, - new int[] {}, - new FluidStack[] {FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide, 1000)}, - new FluidStack[] {}, - 0, - 0, - 4196)); //Fuel Value - - - //Add in default Diesel for the Buggy - mValidRocketFuels.put(-1, Diesel); - - mValidRocketFuelNames.add(FluidRegistry.getFluidName(Diesel)); - for (int mID : mRocketFuels.keySet()) { - GTPP_Recipe aFuelRecipe = mRocketFuels.get(mID); - if (aFuelRecipe != null) { - mValidRocketFuelNames.add(FluidRegistry.getFluidName(aFuelRecipe.mFluidInputs[0].getFluid())); - mValidRocketFuels.put(mID, aFuelRecipe.mFluidInputs[0].getFluid()); - GTPP_Recipe.GTPP_Recipe_Map.sRocketFuels.add(aFuelRecipe); - } - } - - } - - - private static void createRocketFuels() { - - // RP1_Plus_Liquid_Oxygen - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedCircuit(1), - }, - new FluidStack[] { - FluidUtils.getFluidStack(Liquid_Oxygen, 2000), - FluidUtils.getFluidStack(RP1, 500), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(RP1_Plus_Liquid_Oxygen, 1500), - - }, - 20 * 15, - 240, - 3); - - - // Dense_Hydrazine_Mix - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedCircuit(2), - }, - new FluidStack[] { - FluidUtils.getFluidStack(Hydrazine, 4000), - FluidUtils.getFluidStack("methanol", 6000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(Dense_Hydrazine_Mix, 10000), - - }, - 20 * 30, - 240, - 4); - - - // Monomethylhydrazine_Plus_Nitric_Acid - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedCircuit(3), - }, - new FluidStack[] { - FluidUtils.getFluidStack(Monomethylhydrazine, 2000), - FluidUtils.getFluidStack("nitricacid", 1000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(Monomethylhydrazine_Plus_Nitric_Acid, 2000), - - }, - 20 * 45, - 480, - 5); - - - // Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedCircuit(4), - }, - new FluidStack[] { - FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine, 2000), - FluidUtils.getFluidStack(Nitrogen_Tetroxide, 2000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide, 5000), - - }, - 20 * 60, - 480, - 6); - - } - - @Override - public String errorMessage() { - return "Bad Rocket Fuel Science!"; - } - - @Override - public boolean generateRecipes() { - createKerosene(); - createRP1(); - createNitrogenTetroxide(); - createHydrazine(); - createMonomethylhydrazine(); - - if (!CORE.GTNH) { - createLOX(); - } - createLOH(); - - - createHydratedAmmoniumNitrateSlurry(); - createAmmoniumNitrateDust(); - createFormaldehyde(); - createFormaldehydeCatalyst(); - createUnsymmetricalDimethylhydrazine(); - - createRocketFuels(); - addRocketFuelsToMap(); - - return true; - } - - @Override - public void items() { - Formaldehyde_Catalyst = ItemUtils.generateSpecialUseDusts("FormaldehydeCatalyst", "Formaldehyde Catalyst", "Fe16V1", Utils.rgbtoHexValue(25, 5, 25))[0]; - Formaldehyde_Catalyst_Stack = ItemUtils.getSimpleStack(Formaldehyde_Catalyst); - } - - @Override - public void blocks() { - } - - @Override - public void fluids() { - - //Register default fluids - Diesel = MaterialUtils.getMaterial("Fuel", "Diesel").getFluid(1).getFluid(); - - // 5.08 Compat - if (!FluidUtils.doesFluidExist("liquid_heavy_oil")){ - Oil_Heavy = FluidUtils.generateFluidNoPrefix("liquid_heavy_oil", "Heavy Oil", 200, new short[]{10, 10, 10, 100}); - } - else { - Oil_Heavy = MaterialUtils.getMaterial("OilHeavy", "Oil").getFluid(1).getFluid(); - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellOilHeavy", 1) == null){ - new BaseItemComponent("OilHeavy", "Heavy Oil", new short[] {10, 10, 10}); - } - } - - - //Create Kerosene - Kerosene = FluidUtils.generateFluidNonMolten("Kerosene", "Kerosene", 233, new short[]{150, 40, 150, 100}, null, null); - CoalTar.Coal_Oil = Kerosene; - - //RP! Focket Fuel - RP1 = FluidUtils.generateFluidNonMolten("RP1Fuel", "RP-1", 500, new short[]{210, 50, 50, 100}, null, null); - - //Create Nitrogen Tetroxide - Nitrogen_Tetroxide = FluidUtils.generateFluidNonMolten("NitrogenTetroxide", "Nitrogen Tetroxide", 261, new short[]{170, 170, 0, 100}, null, null); - - //Create Hydrazine - Hydrazine = FluidUtils.generateFluidNonMolten("Hydrazine", "Hydrazine", 2, new short[]{250, 250, 250, 100}, null, null); - - //Create Monomethylhydrazine - Monomethylhydrazine = FluidUtils.generateFluidNonMolten("Monomethylhydrazine", "Monomethylhydrazine", 221, new short[]{125, 125, 125, 100}, null, null); - - //Create Anthracene - Nitrous_Oxide = FluidUtils.generateFluidNonMolten("NitrousOxide", "Nitrous Oxide", 182, new short[]{255, 255, 255, 100}, null, null); - - //Nos - if (!FluidUtils.doesFluidExist("NitrousOxide")){ - Nitrous_Oxide = FluidUtils.generateFluidNoPrefix("NitrousOxide", "Nitrous Oxide", 182, new short[]{255, 255, 255, 100}); - } - else { - Nitrous_Oxide = FluidUtils.getWildcardFluidStack("NitrousOxide", 1).getFluid(); - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellNitrousOxide", 1) == null){ - new BaseItemComponent("NitrousOxide", "Nitrous Oxide", new short[] {10, 10, 175}); - } - } - - //Unsymmetrical_Dimethylhydrazine - if (FluidUtils.getFluidStack("1,1dimethylhydrazine", 1) == null){ - Unsymmetrical_Dimethylhydrazine = FluidUtils.generateFluidNonMolten("UnsymmetricalDimethylhydrazine", "Unsymmetrical Dimethylhydrazine", 216, new short[]{70, 210, 20, 100}, null, null); - } - else { - Unsymmetrical_Dimethylhydrazine = FluidUtils.getFluidStack("1,1dimethylhydrazine", 1000).getFluid(); - } - - //Create Hydrated_Ammonium_Nitrate_Slurry - Hydrated_Ammonium_Nitrate_Slurry = FluidUtils.generateFluidNonMolten("AmmoniumNitrateSlurry", "Hydrated Ammonium Nitrate Slurry", 450, new short[]{150, 75, 150, 100}, null, null); - - //Lithium Hydroperoxide - LiOH + H2O2 → LiOOH + 2 H2O - Ammonium_Nitrate_Dust = ItemUtils.generateSpecialUseDusts("AmmoniumNitrate", "Ammonium Nitrate", "N2H4O3", Utils.rgbtoHexValue(150, 75, 150))[0]; - - //Create Liquid_Oxygen - if (FluidUtils.getFluidStack("LiquidOxygen", 1) == null && FluidUtils.getFluidStack("liquidoxygen", 1) == null){ - Liquid_Oxygen = FluidUtils.generateFluidNonMolten("LiquidOxygen", "Liquid Oxygen", 54, new short[]{75, 75, 220, 100}, null, null); - } - else { - if (FluidUtils.getFluidStack("LiquidOxygen", 1) != null ) { - Liquid_Oxygen = FluidUtils.getFluidStack("LiquidOxygen", 1).getFluid(); - } - else { - Liquid_Oxygen = FluidUtils.getFluidStack("liquidoxygen", 1).getFluid(); - } - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellLiquidOxygen", 1) == null){ - new BaseItemComponent("LiquidOxygen", "Liquid Oxygen", new short[] {10, 10, 175}); - } - } - - //Create Liquid_Hydrogen - if (FluidUtils.getFluidStack("LiquidHydrogen", 1) == null && FluidUtils.getFluidStack("liquidhydrogen", 1) == null){ - Liquid_Hydrogen = FluidUtils.generateFluidNonMolten("LiquidHydrogen", "Liquid Hydrogen", 14, new short[]{75, 75, 220, 100}, null, null); - } - else { - if (FluidUtils.getFluidStack("LiquidHydrogen", 1) != null ) { - Liquid_Hydrogen = FluidUtils.getFluidStack("LiquidHydrogen", 1).getFluid(); - } - else { - Liquid_Hydrogen = FluidUtils.getFluidStack("liquidhydrogen", 1).getFluid(); - } - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellLiquidHydrogen", 1) == null){ - new BaseItemComponent("LiquidHydrogen", "Liquid Hydrogen", new short[] {10, 10, 175}); - } - } - - Formaldehyde = FluidUtils.generateFluidNonMolten("Formaldehyde", "Formaldehyde", 185, new short[]{150, 75, 150, 100}, null, null); - - Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide = FluidUtils.generateFluidNonMolten("RocketFuelMixA", "H8N4C2O4 Rocket Fuel", 216, new short[]{50, 220, 50, 100}, null, null); - RP1_Plus_Liquid_Oxygen = FluidUtils.generateFluidNonMolten("RocketFuelMixB", "Rp-1 Rocket Fuel", 250, new short[]{250, 50, 50, 100}, null, null); - Monomethylhydrazine_Plus_Nitric_Acid = FluidUtils.generateFluidNonMolten("RocketFuelMixC", "CN3H7O3 Rocket Fuel", 221, new short[]{125, 75, 180, 100}, null, null); - Dense_Hydrazine_Mix = FluidUtils.generateFluidNonMolten("RocketFuelMixD", "Dense Hydrazine Fuel Mixture", 275, new short[]{175, 80, 120, 100}, null, null); - - } - - @Override - public boolean onLoadComplete(FMLLoadCompleteEvent event) { - - Logger.INFO("Trying to remove GT recipes for '1,1dimethylhydrazine' && 'rocket_fuel' if they exist."); - /*if (FluidRegistry.isFluidRegistered("1,1dimethylhydrazine")) { - - // Try Remove recipes for GT/EIO Rocket Fuel Cells - if (FluidRegistry.isFluidRegistered("rocket_fuel")) { - - // Old Recipe - if (MaterialUtils.doesMaterialExist("NitrogenDioxide")) { - GT_Recipe aOldRecipe = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellNitrogenDioxide", 1), - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogen", 3), - }, - new FluidStack[] { - FluidUtils.getFluidStack("air", 500) - }, - 388); - boolean aDidRemove = removeRecipe(aOldRecipe, GT_Recipe_Map.sChemicalRecipes); - Logger.INFO("Removed Old Recipe for Rocket Fuel: "+aDidRemove); - } - - // Simple Recipes - if (MaterialUtils.doesMaterialExist("Ammonia") && MaterialUtils.doesMaterialExist("Methanol")) { - - GT_Recipe aSimpleRecipe1 = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellAmmonia", 3), - ItemUtils.getItemStackOfAmountFromOreDict("cellMethanol", 4), - }, - new FluidStack[] { - FluidUtils.getFluidStack("chlorine", 1000) - }, - 480); - GT_Recipe aSimpleRecipe2 = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellChlorine", 1), - ItemUtils.getItemStackOfAmountFromOreDict("cellMethanol", 4), - }, - new FluidStack[] { - FluidUtils.getFluidStack("ammonia", 3000) - }, - 480); - GT_Recipe aSimpleRecipe3 = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellAmmonia", 3), - ItemUtils.getItemStackOfAmountFromOreDict("cellChlorine", 1), - }, - new FluidStack[] { - FluidUtils.getFluidStack("methanol", 4000) - }, - 480); - - boolean aDidRemove1 = removeRecipe(aSimpleRecipe1, GT_Recipe_Map.sChemicalRecipes); - boolean aDidRemove2 = removeRecipe(aSimpleRecipe2, GT_Recipe_Map.sChemicalRecipes); - boolean aDidRemove3 = removeRecipe(aSimpleRecipe3, GT_Recipe_Map.sChemicalRecipes); - Logger.INFO("Removed Simple Recipe 1 for Rocket Fuel: "+aDidRemove1); - Logger.INFO("Removed Simple Recipe 2 for Rocket Fuel: "+aDidRemove2); - Logger.INFO("Removed Simple Recipe 3 for Rocket Fuel: "+aDidRemove3); - } - - - // Complex Recipes I - if (MaterialUtils.doesMaterialExist("Dimethylhydrazine") && MaterialUtils.doesMaterialExist("DinitrogenTetroxide")) { - - GT_Recipe aAdvRecipe1 = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylhydrazine", 1), - }, - new FluidStack[] { - FluidUtils.getFluidStack("dinitrogentetroxide", 1000) - }, - 16); - GT_Recipe aAdvRecipe2 = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellDinitrogenTetroxide", 1), - }, - new FluidStack[] { - FluidUtils.getFluidStack("dimethylhydrazine", 1000) - }, - 16); - - GT_Recipe aAdvRecipe3 = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylhydrazine", 2), - }, - new FluidStack[] { - FluidUtils.getFluidStack("oxygen", 1000) - }, - 16); - GT_Recipe aAdvRecipe4 = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 1), - }, - new FluidStack[] { - FluidUtils.getFluidStack("dimethylhydrazine", 2000) - }, - 16); - - boolean aDidRemove1 = removeRecipe(aAdvRecipe1, GT_Recipe_Map.sMixerRecipes); - boolean aDidRemove2 = removeRecipe(aAdvRecipe2, GT_Recipe_Map.sMixerRecipes); - boolean aDidRemove3 = removeRecipe(aAdvRecipe3, GT_Recipe_Map.sMixerRecipes); - boolean aDidRemove4 = removeRecipe(aAdvRecipe4, GT_Recipe_Map.sMixerRecipes); - Logger.INFO("Removed Complex Recipe 1 for Rocket Fuel: "+aDidRemove1); - Logger.INFO("Removed Complex Recipe 2 for Rocket Fuel: "+aDidRemove2); - Logger.INFO("Removed Complex Recipe 3 for Rocket Fuel: "+aDidRemove3); - Logger.INFO("Removed Complex Recipe 4 for Rocket Fuel: "+aDidRemove4); - } - } - - - // Complex Recipes II - if (MaterialUtils.doesMaterialExist("Dimethylhydrazine")) { - - GT_Recipe aAdvRecipe1 = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylhydrazine", 2), - }, - new FluidStack[] { - FluidUtils.getFluidStack("oxygen", 1000) - }, - 16); - GT_Recipe aAdvRecipe2 = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 1), - }, - new FluidStack[] { - FluidUtils.getFluidStack("dimethylhydrazine", 2000) - }, - 16); - - boolean aDidRemove1 = removeRecipe(aAdvRecipe1, GT_Recipe_Map.sMixerRecipes); - boolean aDidRemove2 = removeRecipe(aAdvRecipe2, GT_Recipe_Map.sMixerRecipes); - Logger.INFO("Removed Complex Recipe 5 for Rocket Fuel: "+aDidRemove1); - Logger.INFO("Removed Complex Recipe 6 for Rocket Fuel: "+aDidRemove2); - } - - if (MaterialUtils.doesMaterialExist("Chloramine") && MaterialUtils.doesMaterialExist("Dimethylamine")) { - GT_Recipe aSimpleRecipe1 = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 2), - GT_Utility.getIntegratedCircuit(1) - }, - new FluidStack[] { - FluidUtils.getFluidStack("dimethylamine", 5000) - }, - 480); - GT_Recipe aSimpleRecipe2 = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 5), - GT_Utility.getIntegratedCircuit(1) - }, - new FluidStack[] { - FluidUtils.getFluidStack("chloramine", 2000) - }, - 16); - - - - GT_Recipe aAdvRecipe1 = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 2), - CI.emptyCells(4) - }, - new FluidStack[] { - FluidUtils.getFluidStack("dimethylamine", 5000) - }, - 480); - GT_Recipe aAdvRecipe2 = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 5), - CI.emptyCells(1) - }, - new FluidStack[] { - FluidUtils.getFluidStack("chloramine", 2000) - }, - 16); - GT_Recipe aAdvRecipe3 = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 2), - ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 5), - }, - new FluidStack[] { - FluidUtils.getFluidStack("chloramine", 2000) - }, - 480); - - boolean aDidRemove1 = removeRecipe(aSimpleRecipe1, GT_Recipe_Map.sChemicalRecipes); - boolean aDidRemove2 = removeRecipe(aSimpleRecipe2, GT_Recipe_Map.sChemicalRecipes); - boolean aDidRemove3 = removeRecipe(aAdvRecipe1, GT_Recipe_Map.sChemicalRecipes); - boolean aDidRemove4 = removeRecipe(aAdvRecipe2, GT_Recipe_Map.sChemicalRecipes); - boolean aDidRemove5 = removeRecipe(aAdvRecipe3, GT_Recipe_Map.sChemicalRecipes); - Logger.INFO("Removed Complex Recipe 1 for 1,1dimethylhydrazine: "+aDidRemove1); - Logger.INFO("Removed Complex Recipe 2 for 1,1dimethylhydrazine: "+aDidRemove2); - Logger.INFO("Removed Complex Recipe 3 for 1,1dimethylhydrazine: "+aDidRemove3); - Logger.INFO("Removed Complex Recipe 4 for 1,1dimethylhydrazine: "+aDidRemove4); - Logger.INFO("Removed Complex Recipe 5 for 1,1dimethylhydrazine: "+aDidRemove5); - - } - - if (MaterialUtils.doesMaterialExist("Chloramine") && MaterialUtils.doesMaterialExist("Dimethylamine")) { - GT_Recipe aSimpleRecipe1 = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 1), - GT_Utility.getIntegratedCircuit(1) - }, - new FluidStack[] { - FluidUtils.getFluidStack("dimethylamine", 1000) - }, - 480); - GT_Recipe aSimpleRecipe2 = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 1), - GT_Utility.getIntegratedCircuit(1) - }, - new FluidStack[] { - FluidUtils.getFluidStack("chloramine", 1000) - }, - 16); - - - - GT_Recipe aAdvRecipe1 = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 1), - GT_Utility.getIntegratedCircuit(11) - }, - new FluidStack[] { - FluidUtils.getFluidStack("dimethylamine", 1000) - }, - 480); - GT_Recipe aAdvRecipe2 = getHalfBakedRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 1), - GT_Utility.getIntegratedCircuit(11) - }, - new FluidStack[] { - FluidUtils.getFluidStack("chloramine", 1000) - }, - 16); - - boolean aDidRemove1 = removeRecipe(aSimpleRecipe1, GT_Recipe_Map.sChemicalRecipes); - boolean aDidRemove2 = removeRecipe(aSimpleRecipe2, GT_Recipe_Map.sChemicalRecipes); - boolean aDidRemove3 = removeRecipe(aAdvRecipe1, GT_Recipe_Map.sChemicalRecipes); - boolean aDidRemove4 = removeRecipe(aAdvRecipe2, GT_Recipe_Map.sChemicalRecipes); - Logger.INFO("Removed Complex Recipe 5 for 1,1dimethylhydrazine: "+aDidRemove1); - Logger.INFO("Removed Complex Recipe 6 for 1,1dimethylhydrazine: "+aDidRemove2); - Logger.INFO("Removed Complex Recipe 7 for 1,1dimethylhydrazine: "+aDidRemove3); - Logger.INFO("Removed Complex Recipe 8 for 1,1dimethylhydrazine: "+aDidRemove4); - - } - - if (MaterialUtils.doesMaterialExist("HypochlorousAcid") && MaterialUtils.doesMaterialExist("Ammonia") && MaterialUtils.doesMaterialExist("Methanol")) { - - GT_Recipe aAdvRecipe1 = getHalfBakedRecipe( - new ItemStack[] { - GT_Utility.getIntegratedCircuit(24), - }, - new FluidStack[] { - FluidUtils.getFluidStack("hypochlorousacid", 3000), - FluidUtils.getFluidStack("ammonia", 8000), - FluidUtils.getFluidStack("methanol", 12000) - }, - 480); - - GT_Recipe aAdvRecipe2 = getHalfBakedRecipe( - new ItemStack[] { - GT_Utility.getIntegratedCircuit(24), - }, - new FluidStack[] { - FluidUtils.getFluidStack("hypochlorousacid", 1000), - FluidUtils.getFluidStack("ammonia", 1000), - FluidUtils.getFluidStack("methanol", 2000) - }, - 480); - - boolean aDidRemove1 = removeRecipe(aAdvRecipe1, StaticFields59.getLargeChemicalReactorRecipeMap()); - boolean aDidRemove2 = removeRecipe(aAdvRecipe2, StaticFields59.getLargeChemicalReactorRecipeMap()); - Logger.INFO("Removed Complex Recipe 9 for 1,1dimethylhydrazine: "+aDidRemove1); - Logger.INFO("Removed Complex Recipe 10 for 1,1dimethylhydrazine: "+aDidRemove2); - - - } - }*/ - - // Try Butcher recipes manually - - //1,1Dimethylhydrazine - if (FluidRegistry.isFluidRegistered("1,1dimethylhydrazine")) { - Logger.INFO("Making sure all Chemical Reactor recipes for 1,1dimethylhydrazine have been removed."); - AutoMap<GT_Recipe> aToRemoveSingle = new AutoMap<GT_Recipe>(); - ItemStack aUnsymCell = ItemUtils.getItemStackOfAmountFromOreDict("cell1,1Dimethylhydrazine", 1); - FluidStack aUnsymFluid = FluidUtils.getFluidStack("1,1dimethylhydrazine", 1); - recipe : for (GT_Recipe aRecipeSingleBlock : GT_Recipe_Map.sChemicalRecipes.mRecipeList) { - if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) { - if (aRecipeSingleBlock.mOutputs != null && aRecipeSingleBlock.mOutputs.length > 0) { - for (ItemStack aOutputItem : aRecipeSingleBlock.mOutputs) { - ItemStack aTemp = aOutputItem.copy(); - aTemp.stackSize = 1; - if (GT_Utility.areStacksEqual(aTemp, aUnsymCell)) { - aToRemoveSingle.add(aRecipeSingleBlock); - continue recipe; - } - } - } - if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) { - for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) { - if (GT_Utility.areFluidsEqual(aOutput, aUnsymFluid)) { - aToRemoveSingle.add(aRecipeSingleBlock); - continue recipe; - } - } - } - } - } - // Handle Multi Also - AutoMap<GT_Recipe> aToRemoveMulti = new AutoMap<GT_Recipe>(); - recipe : for (GT_Recipe aRecipeSingleBlock : StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList) { - if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) { - if (aRecipeSingleBlock.mOutputs != null && aRecipeSingleBlock.mOutputs.length > 0) { - for (ItemStack aOutputItem : aRecipeSingleBlock.mOutputs) { - ItemStack aTemp = aOutputItem.copy(); - aTemp.stackSize = 1; - if (GT_Utility.areStacksEqual(aTemp, aUnsymCell)) { - aToRemoveMulti.add(aRecipeSingleBlock); - continue recipe; - } - } - } - if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) { - for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) { - if (GT_Utility.areFluidsEqual(aOutput, aUnsymFluid)) { - aToRemoveMulti.add(aRecipeSingleBlock); - continue recipe; - } - } - } - } - } - if (!aToRemoveSingle.isEmpty()) { - Logger.INFO("Found "+aToRemoveSingle.size()+" single block recipes, removing by force."); - for (GT_Recipe remove : aToRemoveSingle) { - GT_Recipe_Map.sChemicalRecipes.mRecipeList.remove(remove); - } - } - if (!aToRemoveMulti.isEmpty()) { - Logger.INFO("Found "+aToRemoveSingle.size()+" multiblock recipes, removing by force."); - for (GT_Recipe remove : aToRemoveMulti) { - StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList.remove(remove); - } - } - } - - - if (FluidRegistry.isFluidRegistered("rocket_fuel")) { - Logger.INFO("Making sure all Mixer recipes for rocket_fuel have been removed."); - AutoMap<GT_Recipe> aToRemoveSingle = new AutoMap<GT_Recipe>(); - FluidStack aRocketFluid = FluidUtils.getFluidStack("rocket_fuel", 1); - recipe : for (GT_Recipe aRecipeSingleBlock : GT_Recipe_Map.sMixerRecipes.mRecipeList) { - if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) { - if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) { - for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) { - if (GT_Utility.areFluidsEqual(aOutput, aRocketFluid)) { - aToRemoveSingle.add(aRecipeSingleBlock); - continue recipe; - } - } - } - } - } - if (!aToRemoveSingle.isEmpty()) { - Logger.INFO("Found "+aToRemoveSingle.size()+" recipes, removing by force."); - for (GT_Recipe remove : aToRemoveSingle) { - GT_Recipe_Map.sMixerRecipes.mRecipeList.remove(remove); - } - aToRemoveSingle.clear(); - } - - Logger.INFO("Making sure all Chemical Reactor recipes for rocket_fuel have been removed."); - recipe : for (GT_Recipe aRecipeSingleBlock : GT_Recipe_Map.sChemicalRecipes.mRecipeList) { - if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) { - if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) { - for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) { - if (GT_Utility.areFluidsEqual(aOutput, aRocketFluid)) { - aToRemoveSingle.add(aRecipeSingleBlock); - continue recipe; - } - } - } - } - } - // Handle Multi Also - AutoMap<GT_Recipe> aToRemoveMulti = new AutoMap<GT_Recipe>(); - recipe : for (GT_Recipe aRecipeSingleBlock : StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList) { - if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) { - if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) { - for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) { - if (GT_Utility.areFluidsEqual(aOutput, aRocketFluid)) { - aToRemoveMulti.add(aRecipeSingleBlock); - continue recipe; - } - } - } - } - } - if (!aToRemoveSingle.isEmpty()) { - Logger.INFO("Found "+aToRemoveSingle.size()+" single block recipes, removing by force."); - for (GT_Recipe remove : aToRemoveSingle) { - GT_Recipe_Map.sChemicalRecipes.mRecipeList.remove(remove); - } - } - if (!aToRemoveMulti.isEmpty()) { - Logger.INFO("Found "+aToRemoveSingle.size()+" multiblock recipes, removing by force."); - for (GT_Recipe remove : aToRemoveMulti) { - StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList.remove(remove); - } - } - - } - - - - Logger.INFO("Finished clean-up of GT Rocket Fuel Recipes."); - return true; - } - - private static GTPP_Recipe getHalfBakedRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, int aEU) { - return new GTPP_Recipe(false, aInputs, null, null, null, aFluidInputs, null, 0, aEU, 0); - - } - - public static boolean removeRecipe(GT_Recipe aRecipe, GT_Recipe_Map aMap) { - if (aMap != GT_Recipe_Map.sChemicalRecipes) { - GT_Recipe aFoundRecipe = aMap.findRecipe(null, false, true, aRecipe.mEUt, aRecipe.mFluidInputs, aRecipe.mInputs); - boolean aSingle = false; - if (aFoundRecipe != null) { - Logger.INFO("Found Single Block Recipe, removing."); - aSingle = aMap.mRecipeList.remove(aFoundRecipe); - Logger.INFO("Success? "+aSingle); - } - return aSingle; - } - else { - GT_Recipe aFoundRecipe = aMap.findRecipe(null, false, true, aRecipe.mEUt, aRecipe.mFluidInputs, aRecipe.mInputs); - GT_Recipe aFoundRecipe2 = StaticFields59.getLargeChemicalReactorRecipeMap().findRecipe(null, false, true, aRecipe.mEUt, aRecipe.mFluidInputs, aRecipe.mInputs); - boolean aSingle = false; - boolean aMulti = false; - if (aFoundRecipe != null) { - Logger.INFO("Found Single Block Recipe, removing."); - aSingle = GT_Recipe_Map.sChemicalRecipes.mRecipeList.remove(aFoundRecipe); - Logger.INFO("Success? "+aSingle); - } - if (aFoundRecipe2 != null) { - Logger.INFO("Found Multiblock Recipe, removing."); - aMulti = StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList.remove(aFoundRecipe2); - Logger.INFO("Success? "+aSingle); - } - return aSingle && aMulti; - } - } - - - -} diff --git a/src/Java/gtPlusPlus/core/item/chemistry/StandardBaseParticles.java b/src/Java/gtPlusPlus/core/item/chemistry/StandardBaseParticles.java deleted file mode 100644 index 10eaaf0da9..0000000000 --- a/src/Java/gtPlusPlus/core/item/chemistry/StandardBaseParticles.java +++ /dev/null @@ -1,161 +0,0 @@ -package gtPlusPlus.core.item.chemistry; - -import java.util.HashMap; -import java.util.List; - -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.item.base.misc.BaseItemParticle; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Particle; -import gtPlusPlus.core.material.Particle.ElementaryGroup; -import gtPlusPlus.core.util.Utils; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; - -public class StandardBaseParticles extends BaseItemParticle { - - public static HashMap<String, Integer> NameToMetaMap = new HashMap<String, Integer>(); - public static HashMap<Integer, String> MetaToNameMap = new HashMap<Integer, String>(); - - public StandardBaseParticles() { - super("Base", aTypes.length, EnumRarity.rare); - } - - private static final String[] aTypes = new String[] { "Graviton", "Up", "Down", "Charm", "Strange", "Top", - "Bottom", "Electron", "Electron Neutrino", "Muon", "Muon Neutrino", "Tau", "Tau Neutrino", "Gluon", - "Photon", "Z Boson", "W Boson", "Higgs Boson", "Proton", "Neutron", "Lambda", "Omega", "Pion", - "ETA Meson", "Unknown" }; - - public IIcon[] icons = new IIcon[aTypes.length]; - - static { - //Generate Ions - int key = 0; - - - for (String s : aTypes) { - //Map names to Meta - NameToMetaMap.put(Utils.sanitizeString(s.toLowerCase()), key); - MetaToNameMap.put(key, Utils.sanitizeString(s.toLowerCase())); - for (Particle o : Particle.aMap) { - int aColour = 0; - if (o.mParticleName.toLowerCase().equals(s.toLowerCase())) { - if (o.mParticleType == ElementaryGroup.BARYON) { - aColour = Utils.rgbtoHexValue(174, 226, 156); - aColourMap.put(key++, aColour); - } - else if (o.mParticleType == ElementaryGroup.BOSON) { - if (o == Particle.HIGGS_BOSON) { - aColour = Utils.rgbtoHexValue(226, 196, 104); - aColourMap.put(key++, aColour); - } - else { - aColour = Utils.rgbtoHexValue(226, 52, 66); - aColourMap.put(key++, aColour); - } - } - else if (o.mParticleType == ElementaryGroup.LEPTON) { - aColour = Utils.rgbtoHexValue(126, 226, 95); - aColourMap.put(key++, aColour); - } - else if (o.mParticleType == ElementaryGroup.MESON) { - aColour = Utils.rgbtoHexValue(90, 154, 226); - aColourMap.put(key++, aColour); - } - else { - aColour = Utils.rgbtoHexValue(188, 61, 226); - aColourMap.put(key++, aColour); - } - } - } - } - - } - - @Override - public String[] getAffixes() { - return new String[] {"", ""}; - } - - @Override - public String getUnlocalizedName() { - return ""; - } - - @Override - public String getUnlocalizedName(final ItemStack itemStack) { - return "item.particle.base" + "." + aTypes[itemStack.getItemDamage()]; - } - - public static Particle getParticle(ItemStack aStack) { - AutoMap<Particle> g = Particle.aMap; - for (Particle p : g) { - String aPartName = Utils.sanitizeString(p.mParticleName.toLowerCase()); - String expectedPart = Utils.sanitizeString(aTypes[aStack.getItemDamage()].toLowerCase()); - if (aPartName.equals(expectedPart)) { - return p; - } - } - return Particle.UNKNOWN; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - //return Utils.rgbtoHexValue(200, 200, 200); - return super.getColorFromParentClass(stack, HEX_OxFFFFFF); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { - Particle aCharge = getParticle(stack); - EnumChatFormatting aColour = EnumChatFormatting.GRAY; - String aState = aColour+"Unknown"+EnumChatFormatting.RESET; - if (aCharge != null) { - String aGroup = aCharge.mParticleType.name().toLowerCase(); - if (aGroup.toLowerCase().contains("quark")) { - aColour = EnumChatFormatting.LIGHT_PURPLE; - } - else if (aGroup.toLowerCase().contains("lepton")) { - aColour = EnumChatFormatting.GREEN; - } - else if (aCharge == Particle.HIGGS_BOSON) { - aColour = EnumChatFormatting.YELLOW; - } - else if (aGroup.toLowerCase().contains("boson")) { - aColour = EnumChatFormatting.RED; - } - else if (aGroup.toLowerCase().contains("baryon")) { - aColour = EnumChatFormatting.BLUE; - } - else if (aGroup.toLowerCase().contains("meson")) { - aColour = EnumChatFormatting.WHITE; - } - else { - aColour = EnumChatFormatting.GRAY; - } - String aFirstLet = aGroup.substring(0, 1).toUpperCase(); - aGroup = aGroup.replaceFirst(aGroup.substring(0, 1), aFirstLet); - aState = aColour+aGroup+EnumChatFormatting.RESET; - list.add(EnumChatFormatting.GRAY + "Type: "+aState); - } - super.addInformation(stack, player, list, bool); - } - - @Override - public void registerIcons(IIconRegister reg) { - for (int i = 0; i < this.icons.length; i++) { - this.icons[i] = reg.registerIcon(CORE.MODID + ":" + "particle/new/"+i); - } - } - - @Override - public IIcon getIconFromDamage(int meta) { - return this.icons[meta]; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java b/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java deleted file mode 100644 index 9a00b49342..0000000000 --- a/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java +++ /dev/null @@ -1,318 +0,0 @@ -package gtPlusPlus.core.item.chemistry.general; - -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.item.chemistry.GenericChem; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -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.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -public class ItemGenericChemBase extends Item { - - final protected IIcon base[]; - - final private int aMetaSize = 13; - - /* - * 0 - Red Metal Catalyst //FeCu - * 1 - Yellow Metal Catalyst //WNi - * 2 - Blue Metal Catalyst //CoTi - * 3 - Orange Metal Catalyst //Vanadium Pd - * 4 - Purple Metal Catalyst //IrIdium Ruthenium - * 5 - Brown Metal Catalyst //NiAl - * 6 - Pink Metal Catalyst //PtRh - * 7 - Alumina Grinding Ball - * 8 - Soapstone Grinding Ball - * 9 - Sodium Ethoxide // 2 Sodium + 1 Ethanol | 2 C2H5OH + 2 Na → 2 C2H5ONa + H2 - * 10 - Sodium Ethyl Xanthate //CH3CH2ONa + CS2 → CH3CH2OCS2Na - * 11 - Potassium Ethyl Xanthate //CH3CH2OH + CS2 + KOH → CH3CH2OCS2K + H2O - * 12 - Potassium Hydroxide // KOH - */ - - public ItemGenericChemBase() { - this.setHasSubtypes(true); - this.setNoRepair(); - this.setMaxStackSize(64); - this.setMaxDamage(0); - base = new IIcon[aMetaSize]; - this.setUnlocalizedName("BasicGenericChemItem"); - GameRegistry.registerItem(this, this.getUnlocalizedName()); - } - - @Override - public int getItemStackLimit(ItemStack stack) { - if (ItemUtils.isMillingBall(stack)) { - return 16; - } - return super.getItemStackLimit(stack); - } - - @Override - public boolean isDamageable() { - return false; - } - - @Override - public boolean shouldRotateAroundWhenRendering() { - return super.shouldRotateAroundWhenRendering(); - } - - @Override - public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { - super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_); - } - - @Override - public String getItemStackDisplayName(ItemStack aStack) { - return super.getItemStackDisplayName(aStack); - } - - @Override - public EnumRarity getRarity(ItemStack p_77613_1_) { - return EnumRarity.common; - } - - @Override - public boolean requiresMultipleRenderPasses() { - return false; - } - - @Override - public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) { - for (int i=0;i<aMetaSize;i++) { - aList.add(ItemUtils.simpleMetaStack(aItem, i, 1)); - } - } - - @Override - public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { - return false; - } - - @Override - public boolean isRepairable() { - return false; - } - - @Override - public boolean isBookEnchantable(ItemStack stack, ItemStack book) { - return false; - } - - @Override - public int getDisplayDamage(ItemStack stack) { - return stack.getItemDamage(); - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public int getItemEnchantability(ItemStack stack) { - return 0; - } - - @Override - public void registerIcons(final IIconRegister u) { - for (int i=0;i<this.aMetaSize;i++) { - String aPath = CORE.MODID + ":" + "science/general/MetaItem1/"+i; - this.base[i] = u.registerIcon(aPath); - } - } - - - @Override - public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { - return this.base[damage]; - } - - @Override - public IIcon getIconFromDamage(int damage) { - return this.base[damage]; - } - - @Override - public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { - return this.base[stack.getItemDamage()]; - } - - @Override - public IIcon getIcon(ItemStack stack, int pass) { - return this.base[stack.getItemDamage()]; - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName() + "." + stack.getItemDamage(); - } - - @Override - public double getDurabilityForDisplay(ItemStack aStack) { - if (ItemUtils.isMillingBall(aStack)) { - if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()){ - createMillingBallNBT(aStack); - } - double currentDamage = getMillingBallDamage(aStack); - return currentDamage / getMaxBallDurability(aStack); - } - else if (ItemUtils.isCatalyst(aStack)) { - if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()){ - createCatalystNBT(aStack); - } - double currentDamage = getCatalystDamage(aStack); - return currentDamage / getCatalystMaxDamage(aStack); - } - else { - return 1D; - } - } - - @SuppressWarnings("unchecked") - @Override - public void addInformation(ItemStack aStack, EntityPlayer player, List list, boolean bool) { - boolean aHasSpecialTooltips = false; - int aMaxDamage = 0; - int aDamageSegment = 0; - int aDam = 0; - EnumChatFormatting durability = EnumChatFormatting.GRAY; - if (ItemUtils.isMillingBall(aStack)) { - list.add(EnumChatFormatting.GRAY+"Tumble Tumble Tumble"); - aMaxDamage = getMillingBallMaxDamage(aStack); - aDamageSegment = aMaxDamage / 5; - aDam = aMaxDamage-getMillingBallDamage(aStack); - aHasSpecialTooltips = true; - } - if (ItemUtils.isCatalyst(aStack)) { - list.add(EnumChatFormatting.GRAY+"Active Reaction Agent"); - aMaxDamage = getCatalystMaxDamage(aStack); - aDamageSegment = aMaxDamage / 5; - aDam = aMaxDamage-getCatalystDamage(aStack); - aHasSpecialTooltips = true; - } - if (aHasSpecialTooltips) { - if (aDam > aDamageSegment * 3){ - durability = EnumChatFormatting.GREEN; - } - else if (aDam > aDamageSegment * 2){ - durability = EnumChatFormatting.YELLOW; - } - else if (aDam > aDamageSegment){ - durability = EnumChatFormatting.GOLD; - } - else if (aDam >= 0){ - durability = EnumChatFormatting.RED; - } - list.add(durability+""+(aDam)+EnumChatFormatting.GRAY+" / "+aMaxDamage); - } - super.addInformation(aStack, player, list, bool); - } - - @Override - public boolean showDurabilityBar(ItemStack aStack) { - if (ItemUtils.isMillingBall(aStack)) { - int aDam = getMillingBallDamage(aStack); - if (aDam > 0) { - return true; - } - } - else if (ItemUtils.isCatalyst(aStack)) { - int aDam = getCatalystDamage(aStack); - if (aDam > 0) { - return true; - } - } - return false; - } - - public static boolean createMillingBallNBT(ItemStack rStack){ - final NBTTagCompound tagMain = new NBTTagCompound(); - final NBTTagCompound tagNBT = new NBTTagCompound(); - tagNBT.setLong("Damage", 0); - tagNBT.setLong("MaxDamage", getMaxBallDurability(rStack)); - tagMain.setTag("MillingBall", tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - public static int getMillingBallDamage(ItemStack aStack) { - if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()) { - createMillingBallNBT(aStack); - } - NBTTagCompound aNBT = aStack.getTagCompound(); - return aNBT.getCompoundTag("MillingBall").getInteger("Damage"); - } - - public static int getMillingBallMaxDamage(ItemStack aStack) { - if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()) { - createMillingBallNBT(aStack); - } - NBTTagCompound aNBT = aStack.getTagCompound(); - return aNBT.getCompoundTag("MillingBall").getInteger("MaxDamage"); - } - - public static void setMillingBallDamage(ItemStack aStack,int aAmount) { - NBTTagCompound aNBT = aStack.getTagCompound(); - aNBT = aNBT.getCompoundTag("MillingBall"); - aNBT.setInteger("Damage", aAmount); - } - - public static int getMaxBallDurability(ItemStack aStack) { - if (GT_Utility.areStacksEqual(aStack, GenericChem.mMillingBallAlumina, true)) { - return 100; - } - if (GT_Utility.areStacksEqual(aStack, GenericChem.mMillingBallSoapstone, true)) { - return 50; - } - return 0; - } - - public static boolean createCatalystNBT(ItemStack rStack){ - final NBTTagCompound tagMain = new NBTTagCompound(); - final NBTTagCompound tagNBT = new NBTTagCompound(); - tagNBT.setLong("Damage", 0); - tagNBT.setLong("MaxDamage", getMaxCatalystDurability(rStack)); - tagMain.setTag("catalyst", tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - public static int getCatalystDamage(ItemStack aStack) { - if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()) { - createCatalystNBT(aStack); - } - NBTTagCompound aNBT = aStack.getTagCompound(); - return aNBT.getCompoundTag("catalyst").getInteger("Damage"); - } - - public static int getCatalystMaxDamage(ItemStack aStack) { - if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()) { - createCatalystNBT(aStack); - } - NBTTagCompound aNBT = aStack.getTagCompound(); - return aNBT.getCompoundTag("catalyst").getInteger("MaxDamage"); - } - - public static void setCatalystDamage(ItemStack aStack,int aAmount) { - NBTTagCompound aNBT = aStack.getTagCompound(); - aNBT = aNBT.getCompoundTag("catalyst"); - aNBT.setInteger("Damage", aAmount); - } - - public static int getMaxCatalystDurability(ItemStack aStack) { - return 50; - } -} diff --git a/src/Java/gtPlusPlus/core/item/chemistry/general/ItemNuclearChemBase.java b/src/Java/gtPlusPlus/core/item/chemistry/general/ItemNuclearChemBase.java deleted file mode 100644 index cfd3fd6259..0000000000 --- a/src/Java/gtPlusPlus/core/item/chemistry/general/ItemNuclearChemBase.java +++ /dev/null @@ -1,152 +0,0 @@ -package gtPlusPlus.core.item.chemistry.general; - -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -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.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -public class ItemNuclearChemBase extends Item { - - final protected IIcon base[]; - - final private int aMetaSize = 4; - - /* - * 0 - Uranium Residue - * 1 - Plutonium Residue - * 2 - Fluoride Reside - * 3 - Noble Gas Residue - */ - - public ItemNuclearChemBase() { - this.setHasSubtypes(true); - this.setNoRepair(); - this.setMaxStackSize(64); - this.setMaxDamage(0); - base = new IIcon[aMetaSize]; - this.setUnlocalizedName("BasicNuclearChemItem"); - GameRegistry.registerItem(this, this.getUnlocalizedName()); - } - - @Override - public int getItemStackLimit(ItemStack stack) { - return super.getItemStackLimit(stack); - } - - @Override - public boolean isDamageable() { - return false; - } - - @Override - public boolean shouldRotateAroundWhenRendering() { - return super.shouldRotateAroundWhenRendering(); - } - - @Override - public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { - super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_); - } - - @Override - public String getItemStackDisplayName(ItemStack aStack) { - return super.getItemStackDisplayName(aStack); - } - - @Override - public EnumRarity getRarity(ItemStack p_77613_1_) { - return EnumRarity.common; - } - - @Override - public boolean requiresMultipleRenderPasses() { - return false; - } - - @Override - public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) { - for (int i=0;i<aMetaSize;i++) { - aList.add(ItemUtils.simpleMetaStack(aItem, i, 1)); - } - } - - @Override - public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { - return false; - } - - @Override - public boolean isRepairable() { - return false; - } - - @Override - public boolean isBookEnchantable(ItemStack stack, ItemStack book) { - return false; - } - - @Override - public int getDisplayDamage(ItemStack stack) { - return stack.getItemDamage(); - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public int getItemEnchantability(ItemStack stack) { - return 0; - } - - @Override - public void registerIcons(final IIconRegister u) { - for (int i=0;i<this.aMetaSize;i++) { - String aPath = CORE.MODID + ":" + "science/nuclear/MetaItem1/"+i; - this.base[i] = u.registerIcon(aPath); - } - } - - - @Override - public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { - return this.base[damage]; - } - - @Override - public IIcon getIconFromDamage(int damage) { - return this.base[damage]; - } - - @Override - public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { - return this.base[stack.getItemDamage()]; - } - - @Override - public IIcon getIcon(ItemStack stack, int pass) { - return this.base[stack.getItemDamage()]; - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName() + "." + stack.getItemDamage(); - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer player, List list, boolean bool) { - super.addInformation(aStack, player, list, bool); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/circuit/ItemAdvancedChip.java b/src/Java/gtPlusPlus/core/item/circuit/ItemAdvancedChip.java deleted file mode 100644 index 17321a0c45..0000000000 --- a/src/Java/gtPlusPlus/core/item/circuit/ItemAdvancedChip.java +++ /dev/null @@ -1,237 +0,0 @@ -package gtPlusPlus.core.item.circuit; - -import java.util.*; -import java.util.function.BiFunction; -import java.util.function.Predicate; - -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.gui.GT_GUIDialogSelectItem; -import gregtech.api.interfaces.INetworkUpdatableItem; -import gregtech.api.net.GT_Packet_UpdateItem; -import gregtech.api.objects.XSTR; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -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.entity.player.EntityPlayerMP; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.*; -import net.minecraft.world.World; -import net.minecraftforge.common.util.Constants; -import net.minecraftforge.common.util.FakePlayer; -import org.apache.commons.lang3.tuple.Pair; - -public class ItemAdvancedChip extends Item implements INetworkUpdatableItem { - private static final List<ItemStack> ALL_VARIANTS = new ArrayList<>(); - protected IIcon base; - - public ItemAdvancedChip() { - this.setHasSubtypes(true); - this.setNoRepair(); - this.setMaxStackSize(64); - this.setMaxDamage(0); - this.setUnlocalizedName("T3RecipeSelector"); - GameRegistry.registerItem(this, this.getUnlocalizedName()); - ALL_VARIANTS.add(new ItemStack(this, 0, 0)); - for (int i = 1; i <= 24; i++) { - ItemStack aStack = new ItemStack(this, 0, i); - ALL_VARIANTS.add(aStack); - } - } - - @Override - public boolean isDamageable() { - return false; - } - - @Override - public boolean shouldRotateAroundWhenRendering() { - return super.shouldRotateAroundWhenRendering(); - } - - @Override - public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { - super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_); - } - - @Override - public String getItemStackDisplayName(ItemStack aStack) { - return super.getItemStackDisplayName(aStack); - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { - try { - aList.add("Configuration == "+aStack.getItemDamage()); - aList.add(GT_LanguageManager.addStringLocalization(new StringBuilder().append(getUnlocalizedName()).append(".tooltip.0").toString(), "Right click to reconfigure")); - aList.add(GT_LanguageManager.addStringLocalization(new StringBuilder().append(getUnlocalizedName()).append(".tooltip.1").toString(), "Needs a screwdriver or circuit programming tool")); - } - catch (Throwable t) { - t.printStackTrace(); - } - super.addInformation(aStack, p_77624_2_, aList, p_77624_4_); - } - - @Override - public EnumRarity getRarity(ItemStack p_77613_1_) { - return EnumRarity.common; - } - - @Override - public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) { - aList.add(ItemUtils.simpleMetaStack(aItem, 0, 1)); - } - - @Override - public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { - return false; - } - - @Override - public boolean isRepairable() { - return false; - } - - @Override - public boolean isBookEnchantable(ItemStack stack, ItemStack book) { - return false; - } - - @Override - public int getDisplayDamage(ItemStack stack) { - return stack.getItemDamage(); - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return false; - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public int getItemEnchantability(ItemStack stack) { - return 0; - } - - @Override - public void registerIcons(final IIconRegister u) { - this.base = u.registerIcon(CORE.MODID + ":" + "science/general/AdvancedCircuit"); - } - - @Override - public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { - return this.base; - } - - @Override - public IIcon getIconFromDamage(int damage) { - return this.base; - } - - @Override - public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { - return this.base; - } - - @Override - public IIcon getIcon(ItemStack stack, int pass) { - return this.base; - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName(); - } - - @Override - public boolean receive(ItemStack stack, EntityPlayerMP player, NBTTagCompound tag) { - int meta = tag.hasKey("meta", Constants.NBT.TAG_BYTE) ? tag.getByte("meta") : -1; - if (meta < 0 || meta > 24) - return true; - - if (!player.capabilities.isCreativeMode) { - Pair<Integer, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> toolIndex = findConfiguratorInInv(player); - if (toolIndex == null) return true; - - ItemStack[] mainInventory = player.inventory.mainInventory; - mainInventory[toolIndex.getKey()] = toolIndex.getValue().apply(mainInventory[toolIndex.getKey()], player); - } - stack.setItemDamage(meta); - - return true; - } - - @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) { - // nothing on server side or fake player - if (player instanceof FakePlayer || !world.isRemote) return false; - // check if any screwdriver - ItemStack configuratorStack; - if (player.capabilities.isCreativeMode) { - configuratorStack = null; - } else { - Pair<Integer, ?> configurator = findConfiguratorInInv(player); - if (configurator == null) { - int count; - try { - count = Integer.parseInt(StatCollector.translateToLocal("GT5U.item.programmed_circuit.no_screwdriver.count")); - } catch (NumberFormatException e) { - player.addChatComponentMessage(new ChatComponentText("Error in translation GT5U.item.programmed_circuit.no_screwdriver.count: " + e.getMessage())); - count = 1; - } - player.addChatComponentMessage(new ChatComponentTranslation("GT5U.item.programmed_circuit.no_screwdriver." + XSTR.XSTR_INSTANCE.nextInt(count))); - return false; - } - configuratorStack = player.inventory.mainInventory[configurator.getKey()]; - } - openSelectorGui(configuratorStack, stack.getItemDamage()); - return true; - } - - private void openSelectorGui(ItemStack configurator, int meta) { - FMLCommonHandler.instance().showGuiScreen(new GT_GUIDialogSelectItem( - StatCollector.translateToLocal("GT5U.item.programmed_circuit.select.header"), - configurator, - null, - ItemAdvancedChip::onConfigured, - ALL_VARIANTS, - meta, - true - )); - } - - private static void onConfigured(ItemStack stack) { - NBTTagCompound tag = new NBTTagCompound(); - tag.setByte("meta", (byte) stack.getItemDamage()); - GT_Values.NW.sendToServer(new GT_Packet_UpdateItem(tag)); - } - - private static Pair<Integer, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> findConfiguratorInInv(EntityPlayer player) { - ItemStack[] mainInventory = player.inventory.mainInventory; - for (int j = 0, mainInventoryLength = mainInventory.length; j < mainInventoryLength; j++) { - ItemStack toolStack = mainInventory[j]; - - if (!GT_Utility.isStackValid(toolStack)) - continue; - - for (Map.Entry<Predicate<ItemStack>, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> p : GregTech_API.sCircuitProgrammerList.entrySet()) - if (p.getKey().test(toolStack)) - return Pair.of(j, p.getValue()); - } - return null; - } -} diff --git a/src/Java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java b/src/Java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java deleted file mode 100644 index d8ddb26675..0000000000 --- a/src/Java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java +++ /dev/null @@ -1,114 +0,0 @@ -package gtPlusPlus.core.item.crafting; - -import java.util.LinkedHashMap; -import java.util.Map; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.item.general.ItemGenericToken; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -public class ItemDummyResearch extends ItemGenericToken { - - public static enum ASSEMBLY_LINE_RESEARCH { - - - RESEARCH_1_CONTAINMENT("Containment Fields", "Advanced scientific study"), - RESEARCH_2_BASIC_CHEM("Basic Chemistry", "Time to start at the beginning"), - RESEARCH_3_ADV_CHEM("Advanced Chemistry", "Best learn more than chemical equations"), - RESEARCH_4_BASIC_PHYSICS("Basic Physics", "Fundamental laws of motion"), - RESEARCH_5_ADV_PHYSICS("Advanced Physics", "Advanced knowledge!"), - RESEARCH_6_BASIC_METALLURGY("Basic Metallurgy", "Information about material smelting"), - RESEARCH_7_ADV_METALLURGY("Advanced Metallurgy", "Advanced Material Sciences!"), - RESEARCH_8_TURBINE_AUTOMATION("Turbine Automation", "You really don't want to share this with anyone!"), - RESEARCH_9_CLOAKING("Cloaking Technologies", "Sneaking around like a mouse"), - RESEARCH_10_SPARGING("Gas Sparging", "Blowing gas for results"); - - - - - - - - - - - - - - - - - - - private String mName; - private String mDesc; - - private ASSEMBLY_LINE_RESEARCH(String aName, String aDesc) { - mName = aName; - mDesc = aDesc; - ModItems.itemDummyResearch.register(mName, mDesc); - } - - } - - - - - - - - - - - private static Map<String, Integer> mInternalNameToIdMap = new LinkedHashMap<String, Integer>(); - - public static ItemStack getResearchStack(ASSEMBLY_LINE_RESEARCH aResearchName, int aStacksize) { - Integer aMeta = mInternalNameToIdMap.get(Utils.sanitizeString(aResearchName.mName)); - if (aMeta == null) { - aMeta = 0; - } - return ItemUtils.simpleMetaStack(ModItems.itemDummyResearch, aMeta, aStacksize); - } - - private int aID = 0; - public ItemDummyResearch() { - super("dummyResearch", "Research", new String[] {"This object requires some further study"}, "research"); - - - - } - - /** - * - * @param aResearchType - What is the research for? - * @param aDescriptThe - tooltip for this research - * @return - Did we register a custom research item? - */ - public boolean register(String aResearchType, String aDescript) { - int aNewID = aID++; - mInternalNameToIdMap.put(Utils.sanitizeString(aResearchType), aNewID); - return register(aNewID, "Research on "+aResearchType, 1, aDescript); - } - - @Override - public boolean register(int id, String aLocalName, int aMaxStack, String aDescript) { - return register(id, aLocalName, 1, new String[] {aDescript, EnumChatFormatting.DARK_GRAY+"Used to further your knowledge"}, EnumRarity.common, EnumChatFormatting.LIGHT_PURPLE); - } - - @Override - @SideOnly(Side.CLIENT) - public final void registerIcons(final IIconRegister aIconRegister) { - for (int i = 0, j = mLocalNames.size(); i < j; i++) { - mIcons.put(i, aIconRegister.registerIcon(CORE.MODID + ":" + "research" + "/" + "note")); - } - } - -} diff --git a/src/Java/gtPlusPlus/core/item/effects/RarityEffect.java b/src/Java/gtPlusPlus/core/item/effects/RarityEffect.java deleted file mode 100644 index 7cfd64a2e7..0000000000 --- a/src/Java/gtPlusPlus/core/item/effects/RarityEffect.java +++ /dev/null @@ -1,42 +0,0 @@ -package gtPlusPlus.core.item.effects; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -/* - * -This determines the name colour. EnumRarity can be: -EnumRarity.common - the standard white colour. -EnumRarity.uncommon - a yellow colour. -EnumRarity.rare - a light blue colour. This is used for enchanted items. -EnumRarity.epic - the purple colour used on the Golden Apple. -@SideOnly is an FML annotation. It marks the method below it for existing only on one side. Possible values are: -Side.CLIENT is probably the most common one. This marks the method as existing only on the client side. -Side.SERVER marks the method as existing only on the server side. - * - */ - -public class RarityEffect extends Item { - - public RarityEffect(final int par1){ - super(); - this.setCreativeTab(CreativeTabs.tabMaterials); - } - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack){ - return EnumRarity.common; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack){ - return true; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/effects/RarityEpic.java b/src/Java/gtPlusPlus/core/item/effects/RarityEpic.java deleted file mode 100644 index 74ee5ab12c..0000000000 --- a/src/Java/gtPlusPlus/core/item/effects/RarityEpic.java +++ /dev/null @@ -1,29 +0,0 @@ -package gtPlusPlus.core.item.effects; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public class RarityEpic extends Item { - - public RarityEpic(final int par1){ - super(); - this.setCreativeTab(CreativeTabs.tabMaterials); - } - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack){ - return EnumRarity.epic; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack){ - return true; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/effects/RarityRare.java b/src/Java/gtPlusPlus/core/item/effects/RarityRare.java deleted file mode 100644 index 60d5a681b9..0000000000 --- a/src/Java/gtPlusPlus/core/item/effects/RarityRare.java +++ /dev/null @@ -1,29 +0,0 @@ -package gtPlusPlus.core.item.effects; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public class RarityRare extends Item { - - public RarityRare(){ - super(); - this.setCreativeTab(CreativeTabs.tabMaterials); - } - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack){ - return EnumRarity.rare; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack){ - return true; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/effects/RarityUncommon.java b/src/Java/gtPlusPlus/core/item/effects/RarityUncommon.java deleted file mode 100644 index 1ce8eec5d8..0000000000 --- a/src/Java/gtPlusPlus/core/item/effects/RarityUncommon.java +++ /dev/null @@ -1,23 +0,0 @@ -package gtPlusPlus.core.item.effects; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public class RarityUncommon extends Item { - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack){ - return EnumRarity.uncommon; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack){ - return true; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/food/BaseItemMetaFood.java b/src/Java/gtPlusPlus/core/item/food/BaseItemMetaFood.java deleted file mode 100644 index 94d5a8e80f..0000000000 --- a/src/Java/gtPlusPlus/core/item/food/BaseItemMetaFood.java +++ /dev/null @@ -1,431 +0,0 @@ -package gtPlusPlus.core.item.food; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -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.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemFood; -import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -public class BaseItemMetaFood extends ItemFood { - - private static final HashMap<Integer, IIcon> mIconMap = new HashMap<Integer, IIcon>(); - private static int mTotalMetaItems = 0; - - /* - * 0 - Raw Human Meat - * 1 - Cooked Human Meat - * 2 - Raw Horse Meat - * 3 - Cooked Horse Meat - * 4 - Raw Wolf Meat - * 5 - Cooked Wolf Meat - * 6 - Raw Ocelot Meat - * 7 - Cooked Ocelot Meat - * 8 - Blaze Flesh - */ - - //listAllmeatraw - //listAllmeatcooked - - public static void registerMetaFoods() { - registerNewMetaFood(0, "I wouldn't eat this unless I was starving", 2, 0, 64, getPotionEffectPackage(new EffectWeaknessModerate(80), new EffectSlownessModerate(80)), getOreDictNamesAsArrayList("listAllmeatraw")); - registerNewMetaFood(1, "Doesn't look any better cooked", 4, 1, 64, getPotionEffectPackage(new EffectWeaknessBasic(50), new EffectSlownessBasic(50)), getOreDictNamesAsArrayList("listAllmeatcooked")); - registerNewMetaFood(2, "", 2, 0, 64, getPotionEffectPackage(new EffectWeaknessBasic(30), new EffectSlownessBasic(30)), getOreDictNamesAsArrayList("listAllmeatraw")); - registerNewMetaFood(3, "", 4, 1, 64, getOreDictNamesAsArrayList("listAllmeatcooked")); - registerNewMetaFood(4, "", 2, 0, 64, getPotionEffectPackage(new EffectWeaknessBasic(25), new EffectSlownessBasic(30)), getOreDictNamesAsArrayList("listAllmeatraw")); - registerNewMetaFood(5, "", 4, 1, 64, getOreDictNamesAsArrayList("listAllmeatcooked")); - registerNewMetaFood(6, "", 2, 0, 64, getPotionEffectPackage(new EffectWeaknessBasic(30), new EffectSlownessBasic(25)), getOreDictNamesAsArrayList("listAllmeatraw")); - registerNewMetaFood(7, "", 4, 1, 64, getOreDictNamesAsArrayList("listAllmeatcooked")); - registerNewMetaFood(8, "Warm to the touch", EnumRarity.uncommon, 4, 1, 64, new AutoMap<PotionEffectPackage>(), new setOnFire(), getOreDictNamesAsArrayList("listAllmeatcooked")); - } - - private static final HashMap<Integer, Integer> mMaxStackSizeMap = new HashMap<Integer, Integer>(); - private static final HashMap<Integer, String> mTooltipMap = new HashMap<Integer, String>(); - private static final HashMap<Integer, EnumRarity> mRarityMap = new HashMap<Integer, EnumRarity>(); - private static final HashMap<Integer, Integer> mHealAmountMap = new HashMap<Integer, Integer>(); - private static final HashMap<Integer, Float> mSaturationAmountMap = new HashMap<Integer, Float>(); - private static final HashMap<Integer, AutoMap<PotionEffectPackage>> mPotionEffectsMap = new HashMap<Integer, AutoMap<PotionEffectPackage>>(); - private static final HashMap<Integer, Boolean> mHasSpecialBehaviourMap = new HashMap<Integer, Boolean>(); - private static final HashMap<Integer, SpecialFoodBehaviour> mSpecialBehaviourMap = new HashMap<Integer, SpecialFoodBehaviour>(); - private static final HashMap<Integer, ArrayList<String>> mOreDictNames = new HashMap<Integer, ArrayList<String>>(); - - - public static void registerNewMetaFood(final int aMetaID, String aTooltip, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize) { - registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, new AutoMap<PotionEffectPackage>(), null, new ArrayList<String>()); - } - - public static void registerNewMetaFood(final int aMetaID, String aTooltip, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final ArrayList<String> aOreDictNames) { - registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, new AutoMap<PotionEffectPackage>(), null, aOreDictNames); - } - - - public static void registerNewMetaFood(final int aMetaID, String aTooltip, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final AutoMap<PotionEffectPackage> aPotionEffects) { - registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, new AutoMap<PotionEffectPackage>(), null, new ArrayList<String>()); - } - - public static void registerNewMetaFood(final int aMetaID, String aTooltip, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final AutoMap<PotionEffectPackage> aPotionEffects, final ArrayList<String> aOreDictNames) { - registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, aPotionEffects, null, aOreDictNames); - } - - public static void registerNewMetaFood(final int aMetaID, String aTooltip, EnumRarity aRarity, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final AutoMap<PotionEffectPackage> aPotionEffects, final SpecialFoodBehaviour aSpecialBehaviour) { - registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, aPotionEffects, null, new ArrayList<String>()); - } - - public static void registerNewMetaFood(final int aMetaID, String aTooltip, EnumRarity aRarity, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final AutoMap<PotionEffectPackage> aPotionEffects, final SpecialFoodBehaviour aSpecialBehaviour, final ArrayList<String> aOreDictNames) { - mTotalMetaItems++; - mMaxStackSizeMap.put(aMetaID, aMaxStacksize); - mTooltipMap.put(aMetaID, aTooltip); - mRarityMap.put(aMetaID, aRarity); - mHealAmountMap.put(aMetaID, aHealAmount); - mSaturationAmountMap.put(aMetaID, aSaturationModifier); - mPotionEffectsMap.put(aMetaID, aPotionEffects); - mHasSpecialBehaviourMap.put(aMetaID, (aSpecialBehaviour != null)); - if (aSpecialBehaviour != null) { - mSpecialBehaviourMap.put(aMetaID, aSpecialBehaviour); - } - mOreDictNames.put(aMetaID, aOreDictNames); - } - - public static void registerFoodsToOreDict() { - for (int aMetaID=0; aMetaID < mTotalMetaItems; aMetaID++) { - ArrayList<String> aOreDictNames = mOreDictNames.get(aMetaID); - if (aOreDictNames != null && !aOreDictNames.isEmpty()) { - ItemStack aFoodStack = ItemUtils.simpleMetaStack(ModItems.itemMetaFood, aMetaID, 1); - for (String aOreName : aOreDictNames) { - ItemUtils.addItemToOreDictionary(aFoodStack, aOreName); - } - } - } - } - - - public BaseItemMetaFood() { - super(0, 0, false); - this.setHasSubtypes(true); - this.setNoRepair(); - this.setMaxStackSize(64); - this.setMaxDamage(0); - this.setUnlocalizedName("BasicMetaFood"); - this.setCreativeTab(AddToCreativeTab.tabMisc); - GameRegistry.registerItem(this, this.getUnlocalizedName()); - BaseItemMetaFood.registerMetaFoods(); - } - - private static final int getMetaKey(ItemStack aStack) { - return aStack.getItemDamage(); - } - - // Heal Amount - public int func_150905_g(ItemStack aStack) { - return mHealAmountMap.get(getMetaKey(aStack)); - } - - // Saturation Amount - public float func_150906_h(ItemStack aStack) { - return mSaturationAmountMap.get(getMetaKey(aStack)); - } - - // Whether wolves like this food, sadly doesn't support meta items - public boolean isWolfsFavoriteMeat() { - return false; - } - - @Override - protected void onFoodEaten(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { - //super.onFoodEaten(stack, world, player); - AutoMap<PotionEffectPackage> aPotionEffects = mPotionEffectsMap.get(getMetaKey(aStack)); - if (!aWorld.isRemote && aPotionEffects != null && aPotionEffects.size() > 0) { - for (PotionEffectPackage aFoodEffect : aPotionEffects) { - if (MathUtils.randInt(0, 100) <= aFoodEffect.getChance() || aFoodEffect.getChance() == 100) { - PotionEffect aEffect = aFoodEffect.getEffect(); - if (aEffect != null && aEffect.getPotionID() > 0) { - aPlayer.addPotionEffect(new PotionEffect(aEffect.getPotionID(), aEffect.getDuration() * 20, aEffect.getAmplifier(), aEffect.getIsAmbient())); - } - } - } - } - - boolean aHasEpcialBehaviour = mHasSpecialBehaviourMap.get(getMetaKey(aStack)); - if (!aWorld.isRemote && aHasEpcialBehaviour) { - SpecialFoodBehaviour aBehaviour = mSpecialBehaviourMap.get(getMetaKey(aStack)); - if (aBehaviour != null) { - aBehaviour.doBehaviour(aPlayer); - } - } - } - - @Override - public ItemStack onEaten(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - return super.onEaten(aStack, aWorld, aPlayer); - } - - - @Override - public int getItemStackLimit(ItemStack aStack) { - return mMaxStackSizeMap.get(getMetaKey(aStack)); - } - - - @Override - public boolean isDamageable() { - return false; - } - - @Override - public boolean shouldRotateAroundWhenRendering() { - return super.shouldRotateAroundWhenRendering(); - } - - @Override - public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { - super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_); - } - - @Override - public String getItemStackDisplayName(ItemStack aStack) { - return super.getItemStackDisplayName(aStack); - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { - try { - String aTooltip = mTooltipMap.get(getMetaKey(aStack)); - if (aTooltip != null && aTooltip.length() > 0) { - aList.add(aTooltip); - } - } - catch (Throwable t) { - t.printStackTrace(); - } - super.addInformation(aStack, p_77624_2_, aList, p_77624_4_); - } - - @Override - public EnumRarity getRarity(ItemStack aStack) { - return mRarityMap.get(getMetaKey(aStack)); - } - - @Override - public boolean requiresMultipleRenderPasses() { - return false; - } - - @Override - public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) { - for (int i=0;i<mIconMap.size();i++) { - aList.add(ItemUtils.simpleMetaStack(aItem, i, 1)); - } - } - - @Override - public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { - return false; - } - - @Override - public boolean isRepairable() { - return false; - } - - @Override - public boolean isBookEnchantable(ItemStack stack, ItemStack book) { - return false; - } - - @Override - public int getDisplayDamage(ItemStack stack) { - return stack.getItemDamage(); - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return false; - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public int getItemEnchantability(ItemStack stack) { - return 0; - } - - @Override - public void registerIcons(final IIconRegister u) { - for (int i=0;i<mTotalMetaItems;i++) { - String aPath = CORE.MODID + ":" + "food/MetaItem1/"+i; - mIconMap.put(i, u.registerIcon(aPath)); - } - } - - @Override - public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { - return mIconMap.get(damage); - } - - @Override - public IIcon getIconFromDamage(int damage) { - return mIconMap.get(damage); - } - - @Override - public IIcon getIcon(ItemStack aStack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { - return mIconMap.get(getMetaKey(aStack)); - } - - @Override - public IIcon getIcon(ItemStack aStack, int pass) { - return mIconMap.get(getMetaKey(aStack)); - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName() + "." + stack.getItemDamage(); - } - - private static class PotionEffectPackage { - - private final PotionEffect mEffect; - private final int mChance; - - private PotionEffectPackage(PotionEffect aEffect, int aChance) { - mEffect = aEffect; - mChance = aChance; - } - - public PotionEffect getEffect() { - return this.mEffect; - } - - public int getChance() { - return this.mChance; - } - - } - - private static AutoMap<PotionEffectPackage> getPotionEffectPackage(PotionEffectPackage... aEffects){ - AutoMap<PotionEffectPackage> aPackage = new AutoMap<PotionEffectPackage>(); - if (aEffects != null && aEffects.length > 0) { - for (PotionEffectPackage aEffect : aEffects) { - aPackage.put(aEffect); - } - } - return aPackage; - } - - private static ArrayList<String> getOreDictNamesAsArrayList(String... aOreDictNames){ - ArrayList<String> aPackage = new ArrayList<String>(); - if (aOreDictNames != null && aOreDictNames.length > 0) { - for (String aEffect : aOreDictNames) { - aPackage.add(aEffect); - } - } - return aPackage; - } - - private static class EffectWeaknessBasic extends PotionEffectPackage { - - protected EffectWeaknessBasic(int aChance) { - super(new PotionEffect(Potion.weakness.getId(), 1, 20), aChance); - } - - } - - private static class EffectWeaknessModerate extends PotionEffectPackage { - - protected EffectWeaknessModerate(int aChance) { - super(new PotionEffect(Potion.weakness.getId(), 2, 40), aChance); - } - - } - - private static class EffectWeaknessSevere extends PotionEffectPackage { - - protected EffectWeaknessSevere(int aChance) { - super(new PotionEffect(Potion.weakness.getId(), 3, 60), aChance); - } - - } - - private static class EffectSlownessBasic extends PotionEffectPackage { - - protected EffectSlownessBasic(int aChance) { - super(new PotionEffect(Potion.moveSlowdown.getId(), 1, 20), aChance); - } - - } - - private static class EffectSlownessModerate extends PotionEffectPackage { - - protected EffectSlownessModerate(int aChance) { - super(new PotionEffect(Potion.moveSlowdown.getId(), 2, 40), aChance); - } - - } - - private static class EffectSlownessSevere extends PotionEffectPackage { - - protected EffectSlownessSevere(int aChance) { - super(new PotionEffect(Potion.moveSlowdown.getId(), 3, 60), aChance); - } - - } - - - - - private static abstract class SpecialFoodBehaviour { - - protected final int mChance; - - public SpecialFoodBehaviour(int aChance) { - mChance = aChance; - } - - public final void doBehaviour(EntityPlayer aPlayer) { - if (aPlayer != null && !aPlayer.worldObj.isRemote) { - if (MathUtils.randInt(0, 100) < mChance || mChance == 100) { - behaviour(aPlayer); - } - } - } - - protected abstract void behaviour(EntityPlayer aPlayer); - - } - - - private static class setOnFire extends SpecialFoodBehaviour { - - public setOnFire() { - super(100); - } - - @Override - public void behaviour(EntityPlayer aPlayer) { - EntityUtils.setEntityOnFire(aPlayer, 5); - } - - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/general/BaseItemGrindle.java b/src/Java/gtPlusPlus/core/item/general/BaseItemGrindle.java deleted file mode 100644 index 0ff922d853..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/BaseItemGrindle.java +++ /dev/null @@ -1,84 +0,0 @@ -package gtPlusPlus.core.item.general; - -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import gtPlusPlus.GTplusplus; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.handler.GuiHandler; -import gtPlusPlus.core.lib.CORE; - -public class BaseItemGrindle extends Item { - - protected final String unlocalName; - - public BaseItemGrindle() { - this.unlocalName = "itemGrindleTablet"; - this.setUnlocalizedName("itemGrindleTablet"); - this.setTextureName(CORE.MODID + ":" + "itemTablet"); - GameRegistry.registerItem(this, "itemGrindleTablet"); - this.setMaxStackSize(1); - this.setCreativeTab(AddToCreativeTab.tabOther); - } - - @Override - public int getMaxItemUseDuration(final ItemStack stack) { - return 1; - } - - @Override - public ItemStack onItemRightClick(final ItemStack itemstack, final World world, final EntityPlayer player) { - if (!world.isRemote) { - if (!player.isSneaking()) { - player.openGui(GTplusplus.instance, GuiHandler.GUI9, world, 0, 0, 0); - } - } - return itemstack; - } - - @Override - public String getItemStackDisplayName(final ItemStack aStack) { - String aName = super.getItemStackDisplayName(aStack); - if (aName.toLowerCase().contains(".name") || aName.toLowerCase().contains("git")) { - aName = "Grindle"; - } - return aName; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(final IIconRegister iconRegister) { - this.itemIcon = iconRegister.registerIcon(CORE.MODID + ":" + "itemTablet"); - } - - @Override - public String getPotionEffect(ItemStack p_150896_1_) { - return super.getPotionEffect(p_150896_1_); - } - - @Override - public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { - super.addInformation(p_77624_1_, p_77624_2_, aList, p_77624_4_); - aList.add("Used to read data from DataSticks & DataOrbs."); - } - - @Override - public EnumRarity getRarity(ItemStack i) { - return EnumRarity.uncommon; - } - - @Override - public boolean isRepairable() { - return false; - } -} diff --git a/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java b/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java deleted file mode 100644 index 5aa2e4ae9e..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java +++ /dev/null @@ -1,107 +0,0 @@ -package gtPlusPlus.core.item.general; - -import java.util.List; - -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; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; - -public class BedLocator_Base extends Item{ - - public int bed_X = 0; - public int bed_Y = 0; - public int bed_Z = 0; - - public BedLocator_Base(final String unlocalizedName) { - this.setUnlocalizedName(unlocalizedName); - this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setMaxStackSize(1); - this.setCreativeTab(AddToCreativeTab.tabMachines); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - - - int NBT_X = this.bed_X; - int NBT_Y = this.bed_Y; - int NBT_Z = this.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"); - - final String tempX = String.valueOf(NBT_X); - final String tempY = String.valueOf(NBT_Y); - final String tempZ = String.valueOf(NBT_Z); - final String formattedX = EnumChatFormatting.DARK_RED+tempX+EnumChatFormatting.GRAY; - final String formattedY = EnumChatFormatting.RED+tempY+EnumChatFormatting.GRAY; - final 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(final ItemStack itemStack, final World world, final EntityPlayer player) { - itemStack.stackTagCompound = new NBTTagCompound(); - this.bed_X = 0; - this.bed_Y = 0; - this.bed_Z = 0; - itemStack.stackTagCompound.setInteger("pos_x", this.bed_X); - itemStack.stackTagCompound.setInteger("pos_y", this.bed_Y); - itemStack.stackTagCompound.setInteger("pos_z", this.bed_Z); - } - - @Override - public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4, final boolean par5) { - - - } - - @Override - public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final 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", this.bed_X); - itemStack.stackTagCompound.setInteger("pos_y", this.bed_Y); - itemStack.stackTagCompound.setInteger("pos_z", this.bed_Z); - return super.onItemRightClick(itemStack, world, par3Entity); - } - - - -} diff --git a/src/Java/gtPlusPlus/core/item/general/BufferCore.java b/src/Java/gtPlusPlus/core/item/general/BufferCore.java deleted file mode 100644 index 9b00d3d034..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/BufferCore.java +++ /dev/null @@ -1,72 +0,0 @@ -package gtPlusPlus.core.item.general; - -import java.util.List; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.GT_Values; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import gtPlusPlus.core.item.base.BaseItemWithDamageValue; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; - -public class BufferCore extends BaseItemWithDamageValue{ - - public int coreTier = 0; - - public BufferCore(final String unlocalizedName, final int i) { - super(unlocalizedName+i); - this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setMaxStackSize(32); - this.coreTier = i; - } - - @Override - public String getItemStackDisplayName(final ItemStack stack) { - return super.getItemStackDisplayName(stack)/*+" ["+GT_Values.VN[this.coreTier-1]+"]."*/; - } - - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { - return true; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(EnumChatFormatting.GRAY+"A key crafting component for "+GT_Values.VN[this.coreTier-1]+" Applicances"); - } - - public final int getCoreTier() { - return this.coreTier; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { - - int[] mTierTypes = new int[] { - Utils.rgbtoHexValue(200, 180, 180), - Utils.rgbtoHexValue(142, 153, 161), - Utils.rgbtoHexValue(230, 121, 75), - Utils.rgbtoHexValue(215, 156, 70), - Utils.rgbtoHexValue(97, 97, 96), //EV - Utils.rgbtoHexValue(202, 202, 201), - Utils.rgbtoHexValue(247, 159, 157), - Utils.rgbtoHexValue(181, 223, 223), - Utils.rgbtoHexValue(187, 219, 185), - }; - - if (this.coreTier == 10){ - return Utils.rgbtoHexValue(MathUtils.randInt(220, 250), MathUtils.randInt(221, 251), MathUtils.randInt(220, 250)); - } - - return mTierTypes[this.coreTier-1]; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/general/ItemAirFilter.java b/src/Java/gtPlusPlus/core/item/general/ItemAirFilter.java deleted file mode 100644 index a354e63fe3..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/ItemAirFilter.java +++ /dev/null @@ -1,141 +0,0 @@ -package gtPlusPlus.core.item.general; -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -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.util.IIcon; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; - -public class ItemAirFilter extends Item { - - public IIcon[] icons = new IIcon[1]; - - public ItemAirFilter() { - super(); - this.setHasSubtypes(true); - String unlocalizedName = "itemAirFilter"; - this.setUnlocalizedName(unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setMaxStackSize(1); - GameRegistry.registerItem(this, unlocalizedName); - } - - @Override - public void registerIcons(IIconRegister reg) { - this.icons[0] = reg.registerIcon(CORE.MODID + ":" + "itemAirFilter"); - } - - @Override - public IIcon getIconFromDamage(int meta) { - return this.icons[0]; - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 2; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return this.getUnlocalizedName() + "_" + stack.getItemDamage(); - } - - @Override - public String getItemStackDisplayName(final ItemStack tItem) { - - if (tItem == null) { - return "Air Filter"; - } - - String itemName = tItem == null ? "Air Filter" : super.getItemStackDisplayName(tItem); - String suffixName = ""; - if (tItem.getItemDamage() == 0){ - suffixName = " [Tier 1]"; - } - else if (tItem.getItemDamage() == 1){ - suffixName = " [Tier 2]"; - } - return (itemName+suffixName); - } - - @Override - public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { - int meta = stack.getItemDamage(); - if (meta == 1){ - HEX_OxFFFFFF = Utils.rgbtoHexValue(150,180,35); - } - return HEX_OxFFFFFF; - } - - private static boolean createNBT(ItemStack rStack){ - final NBTTagCompound tagMain = new NBTTagCompound(); - final NBTTagCompound tagNBT = new NBTTagCompound(); - tagNBT.setLong("Damage", 0); - tagMain.setTag("AirFilter", tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - public static final long getFilterDamage(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("AirFilter"); - if (aNBT != null) { - return aNBT.getLong("Damage"); - } - } - else { - createNBT(aStack); - } - return 0L; - } - - public static final boolean setFilterDamage(final ItemStack aStack, final long aDamage) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("AirFilter"); - if (aNBT != null) { - aNBT.setLong("Damage", aDamage); - return true; - } - } - return false; - } - - @Override - public double getDurabilityForDisplay(ItemStack stack) { - if (stack.getTagCompound() == null){ - createNBT(stack); - } - double currentDamage = getFilterDamage(stack); - double meta = stack.getItemDamage() == 0 ? 50 : 2500; - double durabilitypercent = currentDamage / meta; - return durabilitypercent; - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { - list.add(EnumChatFormatting.GRAY+"An Air filter for Atmospheric Reconditioning."); - int maxDamage = (stack.getItemDamage() == 0 ? 50 : 2500); - list.add(EnumChatFormatting.GRAY+""+(maxDamage-getFilterDamage(stack))+"/"+maxDamage+" uses left."); - super.addInformation(stack, player, list, bool); - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return true; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java b/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java deleted file mode 100644 index 5be184b3db..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java +++ /dev/null @@ -1,202 +0,0 @@ -package gtPlusPlus.core.item.general; - -import java.util.List; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.common.blocks.GT_Block_Ores; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.block.base.BlockBaseOre; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.CoreItem; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EntityUtils; - -public class ItemAreaClear extends CoreItem { - - public IIcon[] mIcon = new IIcon[1]; - - public ItemAreaClear() { - super("itemDebugClearing", AddToCreativeTab.tabMachines, 1, 100, new String[] {EnumChatFormatting.OBFUSCATED+"F A M C Y N A M E"}, EnumRarity.rare, - EnumChatFormatting.BOLD, false, null); - } - - @Override - public void registerIcons(IIconRegister reg) { - this.mIcon[0] = reg.registerIcon(CORE.MODID + ":" + "itemLavaFilter"); - } - - @Override - public IIcon getIconFromDamage(int meta) { - return this.mIcon[0]; - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 2; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public String getItemStackDisplayName(final ItemStack tItem) { - String itemName = "Debug Square"; - String suffixName = ""; - if (tItem.getItemDamage() == 0){ - suffixName = " [1]"; - } - else if (tItem.getItemDamage() == 1){ - suffixName = " [2]"; - } - return (itemName+suffixName); - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { - String mMode = (stack.getItemDamage() == 0 ? "Clear" : "Fill"); - list.add(EnumChatFormatting.GRAY+""+("Mode: "+mMode)); - super.addInformation(stack, player, list, bool); - } - - private static boolean createNBT(ItemStack rStack){ - final NBTTagCompound tagMain = new NBTTagCompound(); - final NBTTagCompound tagNBT = new NBTTagCompound(); - tagNBT.setLong("Mode", 0); - tagMain.setTag("GTPP_DEBUG", tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - public static final long getFilterDamage(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("GTPP_DEBUG"); - if (aNBT != null) { - return aNBT.getLong("Mode"); - } - } - else { - createNBT(aStack); - } - return 0L; - } - - public static final boolean setFilterDamage(final ItemStack aStack, final long aDamage) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("GTPP_DEBUG"); - if (aNBT != null) { - aNBT.setLong("Mode", aDamage); - return true; - } - } - return false; - } - - public boolean removeBlocks(World world, BlockPos pos){ - int x1 = pos.xPos; - int y1 = pos.yPos; - int z1 = pos.zPos; - - int x2 = (x1-24); - int y2 = (y1-10); - int z2 = (z1-24); - - removeBlockColumn(world, new BlockPos(x2, y2, z2, world)); - return true; - } - - public boolean removeBlockColumn(World world, BlockPos pos){ - for (int i=0; i<50; i++){ - removeBlockRow(world, new BlockPos(pos.xPos, pos.yPos-10, pos.zPos+i, world)); - removeBlockRow(world, new BlockPos(pos.xPos, pos.yPos, pos.zPos+i, world)); - removeBlockRow(world, new BlockPos(pos.xPos, pos.yPos+10, pos.zPos+i, world)); - } - return true; - } - - public boolean removeBlockRow(World world, BlockPos pos){ - for (int j=0; j<20; j++){ - for (int i=0; i<50; i++){ - - if (!(world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) instanceof BlockBaseOre) && - !(world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) instanceof IGregTechTileEntity) && - !(world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) instanceof GT_Block_Ores)){ - if (!world.isAirBlock(pos.xPos+i, pos.yPos+j, pos.zPos) && - world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) != Blocks.bedrock){ - int chance = MathUtils.randInt(0, 500); - if (chance <= 0){ - if (pos.yPos+j <= 50){ - world.setBlock(pos.xPos+i, pos.yPos+j, pos.zPos, Blocks.glowstone); - } - } - else { - if ((world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) == Blocks.glowstone && ((pos.yPos+j) > 50)) || world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) != Blocks.glowstone){ - world.setBlockToAir(pos.xPos+i, pos.yPos+j, pos.zPos); - } - } - } - } - } - } - return true; - } - - public boolean fillBlocks(World world, BlockPos pos){ - int x1 = pos.xPos; - int y1 = pos.yPos; - int z1 = pos.zPos; - - int x2 = (x1-10); - int y2 = (y1-1); - int z2 = (z1-10); - - fillBlockColumn(world, new BlockPos(x2, y2, z2, world)); - return true; - } - - public boolean fillBlockColumn(World world, BlockPos pos){ - for (int i=0; i<21; i++){ - fillBlockRow(world, new BlockPos(pos.xPos, pos.yPos, pos.zPos+i, world)); - } - return true; - } - - public boolean fillBlockRow(World world, BlockPos pos){ - for (int j=0; j<2; j++){ - for (int i=0; i<21; i++){ - if (world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) != Blocks.bedrock){ - world.setBlock(pos.xPos+i, pos.yPos+j, pos.zPos, Blocks.grass); - } - } - } - return true; - } - - @Override - public ItemStack onItemRightClick(ItemStack thisItem, World world, EntityPlayer parEntity) { - BlockPos groundBlock = EntityUtils.findBlockPosUnderEntity(parEntity); - if (thisItem.getItemDamage() == 0){ - removeBlocks(world, groundBlock); - } - else { - Logger.INFO("Filling."); - fillBlocks(world, groundBlock); - } - return super.onItemRightClick(thisItem, world, parEntity); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java b/src/Java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java deleted file mode 100644 index ca6c5e8c8c..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java +++ /dev/null @@ -1,85 +0,0 @@ -package gtPlusPlus.core.item.general; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import gtPlusPlus.core.block.general.FirePit; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.CoreItem; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; - -public class ItemBasicFirestarter extends CoreItem { - - public ItemBasicFirestarter() { - super("itemSimpleFiremaker", AddToCreativeTab.tabTools, 1, 5, "Can probably make you a fire"); - this.setTextureName(CORE.MODID+":"+"itemFireStarter"); - } - - @Override - public boolean onItemUse( - final ItemStack thisItem, final EntityPlayer thisPlayer, final World thisWorld, - int blockX, int blockY, int blockZ, - final int p_77648_7_, final float p_77648_8_, final float p_77648_9_, final float p_77648_10_) { - if (p_77648_7_ == 0) { - --blockY; - } - if (p_77648_7_ == 1) { - ++blockY; - } - if (p_77648_7_ == 2) { - --blockZ; - } - if (p_77648_7_ == 3) { - ++blockZ; - } - if (p_77648_7_ == 4) { - --blockX; - } - if (p_77648_7_ == 5) { - ++blockX; - } - if (!thisPlayer.canPlayerEdit(blockX, blockY, blockZ, p_77648_7_, thisItem)) { - return false; - } - if (thisWorld.getBlock(blockX, blockY, blockZ) instanceof FirePit){ - thisWorld.setBlockMetadataWithNotify(blockX, blockY, blockZ, 2, 4); - PlayerUtils.messagePlayer(thisPlayer, "You light the fire pit. "); - } - if (thisWorld.isAirBlock(blockX, blockY, blockZ)) - { - final int random = MathUtils.randInt(0, 3); - //Explode, lol. - if (random == 0){ - PlayerUtils.messagePlayer(thisPlayer, "You somehow managed to set yourself on fire... "); - thisWorld.playSoundEffect(thisPlayer.posX + 0.5D, thisPlayer.posY + 0.5D, thisPlayer.posZ + 0.5D, "fire.ignite", 1.0F, (itemRand.nextFloat() * 0.4F) + 0.8F); - thisPlayer.setFire(4); - thisItem.damageItem(thisItem.getMaxDamage(), thisPlayer); - } - - //Create a fire - else if (random == 2){ - PlayerUtils.messagePlayer(thisPlayer, "You created a fire!"); - thisWorld.playSoundEffect(blockX + 0.5D, blockY + 0.5D, blockZ + 0.5D, "fire.ignite", 1.0F, (itemRand.nextFloat() * 0.4F) + 0.8F); - thisWorld.setBlock(blockX, blockY, blockZ, Blocks.fire); - } - - //Do nothing - else { - PlayerUtils.messagePlayer(thisPlayer, "Your attemp does nothing."); - thisItem.damageItem(1, thisPlayer); - return false; - } - } - thisItem.damageItem(1, thisPlayer); - return true; - } - - @Override - public String getItemStackDisplayName(final ItemStack thisItem) { - return "Basic Firemaker"; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/general/ItemBasicScrubberTurbine.java b/src/Java/gtPlusPlus/core/item/general/ItemBasicScrubberTurbine.java deleted file mode 100644 index 2b7b98640e..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/ItemBasicScrubberTurbine.java +++ /dev/null @@ -1,153 +0,0 @@ -package gtPlusPlus.core.item.general; -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -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.util.IIcon; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; - -public class ItemBasicScrubberTurbine extends Item { - - public IIcon[] icons = new IIcon[1]; - - public ItemBasicScrubberTurbine() { - super(); - this.setHasSubtypes(true); - String unlocalizedName = "itemBasicTurbine"; - this.setUnlocalizedName(unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setMaxStackSize(1); - GameRegistry.registerItem(this, unlocalizedName); - } - - @Override - public void registerIcons(IIconRegister reg) { - this.icons[0] = reg.registerIcon(CORE.MODID + ":" + "itemBasicTurbine"); - } - - @Override - public IIcon getIconFromDamage(int meta) { - return this.icons[0]; - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 3; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return this.getUnlocalizedName() + "_" + stack.getItemDamage(); - } - - @Override - public String getItemStackDisplayName(final ItemStack tItem) { - if (tItem == null) { - return "Basic Turbine"; - } - return super.getItemStackDisplayName(tItem); - } - - @Override - public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { - int meta = stack.getItemDamage(); - if (meta == 0){ - HEX_OxFFFFFF = Utils.rgbtoHexValue(200,200,200); - } - if (meta == 1){ - HEX_OxFFFFFF = Utils.rgbtoHexValue(255,128,0); - } - if (meta == 2){ - HEX_OxFFFFFF = Utils.rgbtoHexValue(128,128,128); - } - return HEX_OxFFFFFF; - } - - private static boolean createNBT(ItemStack rStack){ - final NBTTagCompound tagMain = new NBTTagCompound(); - final NBTTagCompound tagNBT = new NBTTagCompound(); - tagNBT.setLong("Damage", 0); - tagMain.setTag("BasicTurbine", tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - public static final long getFilterDamage(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("BasicTurbine"); - if (aNBT != null) { - return aNBT.getLong("Damage"); - } - } - else { - createNBT(aStack); - } - return 0L; - } - - public static final boolean setFilterDamage(final ItemStack aStack, final long aDamage) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("BasicTurbine"); - if (aNBT != null) { - aNBT.setLong("Damage", aDamage); - return true; - } - } - return false; - } - - public int getMaxDurability(ItemStack aStack) { - if (aStack != null) { - int aMeta = aStack.getItemDamage(); - if (aMeta == 0) { - return 2000; - } - if (aMeta == 1) { - return 4000; - } - if (aMeta == 2) { - return 6000; - } - } - return 0; - } - - @Override - public double getDurabilityForDisplay(ItemStack stack) { - if (stack.getTagCompound() == null){ - createNBT(stack); - } - double currentDamage = getFilterDamage(stack); - double meta = getMaxDurability(stack); - double durabilitypercent = currentDamage / meta; - return durabilitypercent; - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { - list.add(EnumChatFormatting.GRAY+"An early tier Turbine for Atmospheric Reconditioning."); - int maxDamage = getMaxDurability(stack); - list.add(EnumChatFormatting.GRAY+""+(maxDamage-getFilterDamage(stack))+"/"+maxDamage+" uses left."); - super.addInformation(stack, player, list, bool); - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return true; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java b/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java deleted file mode 100644 index eded4e2585..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java +++ /dev/null @@ -1,295 +0,0 @@ -package gtPlusPlus.core.item.general; - -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -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.util.EnumChatFormatting; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.interfaces.IItemBlueprint; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; - -public class ItemBlueprint extends Item implements IItemBlueprint{ - - public ItemBlueprint(final String unlocalizedName) { - this.setUnlocalizedName(unlocalizedName); - this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setMaxStackSize(1); - this.setCreativeTab(AddToCreativeTab.tabMachines); - //this.bpID = MathUtils.randInt(0, 1000); - GameRegistry.registerItem(this, unlocalizedName); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack itemStack, final EntityPlayer aPlayer, final List list, final boolean bool) { - //Create some NBT if it's not there, otherwise this does nothing. - if (!itemStack.hasTagCompound()){ - this.createNBT(itemStack); - } - //Set up some default variables. - int id = -1; - String name = ""; - boolean blueprint = false; - //Get proper display vars from NBT if it's there - if (itemStack.hasTagCompound()){ - //Utils.LOG_WARNING("Found TagCompound"); - id = (int) this.getNBT(itemStack, "mID"); - name = (String) this.getNBT(itemStack, "mName"); - blueprint = (boolean) this.getNBT(itemStack, "mBlueprint"); - } - //Write to tooltip list for each viable setting. - if (itemStack.hasTagCompound()) { - if (id != -1){ - list.add(EnumChatFormatting.GRAY+"Technical Document No. "+id); - } - if(blueprint){ - list.add(EnumChatFormatting.BLUE+"Currently holding a blueprint for "+name); - } - else { - list.add(EnumChatFormatting.RED+"Currently not holding a blueprint for anything."); - } - } - else { - list.add(EnumChatFormatting.RED+"Currently not holding a blueprint for anything."); - } - super.addInformation(itemStack, aPlayer, list, bool); - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return "Blueprint [I am useless]"; - } - - @Override - public void onCreated(final ItemStack itemStack, final World world, final EntityPlayer player) { - this.createNBT(itemStack); - } - - @Override - public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4, final boolean par5) { - - } - - @Override - public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer par3Entity) { - //Let the player know what blueprint is held - if (itemStack.hasTagCompound()) { - PlayerUtils.messagePlayer(par3Entity, "This Blueprint holds NBT data. "+"|"+this.getNBT(itemStack, "mID")+"|"+this.getNBT(itemStack, "mBlueprint")+"|"+this.getNBT(itemStack, "mName")+"|"+ItemUtils.getArrayStackNames(this.readItemsFromNBT(itemStack))); - } - else { - this.createNBT(itemStack); - PlayerUtils.messagePlayer(par3Entity, "This is a placeholder. "+this.getNBT(itemStack, "mID")); - } - - - return super.onItemRightClick(itemStack, world, par3Entity); - } - - public ItemStack[] readItemsFromNBT(final ItemStack itemStack){ - ItemStack[] blueprint = new ItemStack[9]; - if (itemStack.hasTagCompound()){ - final NBTTagCompound nbt = itemStack.getTagCompound(); - final NBTTagList list = nbt.getTagList("Items", 10); - blueprint = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++) - { - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if((slot >= 0) && (slot < INV_SIZE)) - { - blueprint[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - return blueprint; - } - return null; - } - - public ItemStack writeItemsToNBT(final ItemStack itemStack, final ItemStack[] craftingGrid){ - final ItemStack[] blueprint = craftingGrid; - if (itemStack.hasTagCompound()){ - final NBTTagCompound nbt = itemStack.getTagCompound(); - final NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++) - { - final ItemStack stack = blueprint[i]; - if(stack != null) - { - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - itemStack.setTagCompound(nbt); - return itemStack; - } - return null; - } - - @Override - public boolean isBlueprint(final ItemStack stack) { - return true; - } - - @Override - public boolean setBlueprint(final ItemStack stack, final IInventory craftingTable, final ItemStack output) { - boolean hasBP = false; - ItemStack[] blueprint = new ItemStack[9]; - - if (stack.hasTagCompound()){ - hasBP = (boolean) this.getNBT(stack, "mBlueprint"); - blueprint = this.readItemsFromNBT(stack); - } - - if (!hasBP){ - try { - for (int o=0; o<craftingTable.getSizeInventory(); o++){ - blueprint[o] = craftingTable.getStackInSlot(o); - if (blueprint[0] != null){ - blueprint[0].stackSize = 0; - } - } - this.writeItemsToNBT(stack, blueprint); - if (stack.hasTagCompound()){ - if(stack.getTagCompound().getCompoundTag("Items") != null){ - stack.stackTagCompound.setBoolean("mBlueprint", true); - } - else { - //Invalid BP saved? - } - hasBP = (boolean) this.getNBT(stack, "mBlueprint"); - } - - if (output != null){ - this.setBlueprintName(stack, output.getDisplayName()); - hasBP = true; - return true; - } - return false; - } catch (final Throwable t){ - return false; - } - } - return false; - } - - @Override - public void setBlueprintName(final ItemStack stack, final String name) { - stack.stackTagCompound.setString("mName", name); - } - - @Override - public boolean hasBlueprint(final ItemStack stack) { - if (stack.hasTagCompound()){ - return (boolean) this.getNBT(stack, "mBlueprint"); - } - return false; - } - - @Override - public ItemStack[] getBlueprint(final ItemStack stack) { - ItemStack[] blueprint = new ItemStack[9]; - if (stack.hasTagCompound()){ - blueprint = this.readItemsFromNBT(stack); - } - try { - final ItemStack[] returnStack = new ItemStack[9]; - for (int o=0; o<blueprint.length; o++){ - returnStack[o] = blueprint[o]; - if (returnStack[0] != null){ - returnStack[0].stackSize = 1; - } - } - return returnStack; - } catch (final Throwable t){ - return null; - } - } - - public boolean createNBT(final ItemStack itemStack){ - if (itemStack.hasTagCompound()){ - if (!itemStack.stackTagCompound.getBoolean("mBlueprint") && !itemStack.stackTagCompound.getString("mName").equals("")){ - //No Blueprint and no name Set - Logger.WARNING("No Blueprint and no name Set"); - return false; - } - else if (itemStack.stackTagCompound.getBoolean("mBlueprint") && !itemStack.stackTagCompound.getString("mName").equals("")){ - //Has Blueprint but invalid name set - Logger.WARNING("Has Blueprint but invalid name set"); - //itemStack.stackTagCompound = null; - //createNBT(itemStack); - return false; - } - else if (!itemStack.stackTagCompound.getBoolean("mBlueprint") && itemStack.stackTagCompound.getString("mName").equals("")){ - //Has no Blueprint, but strangely has a name - Logger.WARNING("Has no Blueprint, but strangely has a name"); - //itemStack.stackTagCompound = null; - //createNBT(itemStack); - return false; - } - return false; - } - else if(!itemStack.hasTagCompound()){ - final int bpID = MathUtils.randInt(0, 1000); - final boolean hasRecipe = false; - final String recipeName = ""; - Logger.WARNING("Creating Blueprint, setting up it's NBT data. "+bpID); - itemStack.stackTagCompound = new NBTTagCompound(); - itemStack.stackTagCompound.setInteger("mID", bpID); - itemStack.stackTagCompound.setBoolean("mBlueprint", hasRecipe); - itemStack.stackTagCompound.setString("mName", recipeName); - return true; - } - else { - final int bpID = MathUtils.randInt(0, 1000); - final boolean hasRecipe = false; - final String recipeName = ""; - Logger.WARNING("Creating a Blueprint, setting up it's NBT data. "+bpID); - itemStack.stackTagCompound = new NBTTagCompound(); - itemStack.stackTagCompound.setInteger("mID", bpID); - itemStack.stackTagCompound.setBoolean("mBlueprint", hasRecipe); - itemStack.stackTagCompound.setString("mName", recipeName); - return true; - } - } - - public Object getNBT(final ItemStack itemStack, final String tagNBT){ - if (!itemStack.hasTagCompound()){ - return null; - } - Object o = null; - if (tagNBT.equals("mID")){ - o = itemStack.stackTagCompound.getInteger(tagNBT); - } - else if (tagNBT.equals("mBlueprint")){ - o = itemStack.stackTagCompound.getBoolean(tagNBT); - } - else if (tagNBT.equals("mName")){ - o = itemStack.stackTagCompound.getString(tagNBT); - } - else if (tagNBT.equals("")){ - //For More Tag Support - //o = itemStack.stackTagCompound.getInteger(tagNBT); - } - if (o != null) { - return o; - } - return null; } - -} diff --git a/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java b/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java deleted file mode 100644 index b54fc56563..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java +++ /dev/null @@ -1,259 +0,0 @@ -package gtPlusPlus.core.item.general; - -import java.util.List; - -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import baubles.api.BaubleType; -import baubles.api.IBauble; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; -import ic2.api.item.IElectricItemManager; - -@Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")}) -public class ItemCloakingDevice extends Item implements IElectricItem, IElectricItemManager, IBauble{ - - private final String unlocalizedName = "personalCloakingDevice"; - private final ItemStack thisStack; - private final static int maxValueEU = 10000*20*500; - protected double chargeEU = 0; - - public ItemCloakingDevice(final double charge){ - this.chargeEU = charge; - this.setCreativeTab(AddToCreativeTab.tabMachines); - this.setUnlocalizedName(this.unlocalizedName); - this.setMaxStackSize(1); - this.setTextureName(CORE.MODID + ":" + "personalCloakingDevice"); - this.thisStack = ItemUtils.getSimpleStack(this); - this.charge(this.thisStack, charge, 3, true, false); - if (charge == (10000*20*500)){ - this.setDamage(this.thisStack, 13); - } - GameRegistry.registerItem(this, this.unlocalizedName+"-"+charge); - } - - @Override - public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, final boolean p_77663_5_) { - if (worldObj.isRemote) { - return; - } - - if (player instanceof EntityPlayer){ - for (final ItemStack is : ((EntityPlayer) player).inventory.mainInventory) { - if (is == itemStack) { - continue; - } - if (is != null) { - if (is.getItem() instanceof IElectricItem) { - final IElectricItem electricItem = (IElectricItem) is.getItem(); - this.chargeEU = ElectricItem.manager.getCharge(is); - } - - } - } - } - - - super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_); - } - - @Override - public boolean canProvideEnergy(final ItemStack itemStack) { - return true; - } - - @Override - public Item getChargedItem(final ItemStack itemStack) { - final ItemStack x = itemStack.copy(); - x.setItemDamage(maxValueEU); - return x.getItem(); - } - - @Override - public Item getEmptyItem(final ItemStack itemStack) { - final ItemStack x = itemStack.copy(); - x.setItemDamage(0); - return x.getItem(); - } - - @Override - public double getMaxCharge(final ItemStack itemStack) { - return maxValueEU; - } - - @Override - public int getTier(final ItemStack itemStack) { - return 5; - } - - @Override - public double getTransferLimit(final ItemStack itemStack) { - return 8196; - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - - return (EnumChatFormatting.BLUE+"Personal Cloaking Device"+EnumChatFormatting.GRAY); - } - - @Override - public double getDurabilityForDisplay(final ItemStack stack) - { - //return 1.0D - getEnergyStored(stack) / this.capacity; - return 1.0D - (this.getCharge(stack) / this.getMaxCharge(stack)); - } - - @Override - public boolean showDurabilityBar(final ItemStack stack) - { - return true; - } - - public int secondsLeft(final ItemStack stack){ - double r = 0; - r = this.getCharge(stack)/(10000*20); - return (int) MathUtils.decimalRounding(r); - } - - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(""); - list.add(EnumChatFormatting.GREEN+"Worn as a Belt within Baubles."+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GREEN+"Drains 10,000EU/t to provide invisibility."+EnumChatFormatting.GRAY); - list.add(""); - list.add(EnumChatFormatting.GOLD+"IC2/EU Information"+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+this.getTier(this.thisStack)+EnumChatFormatting.GRAY+"] Input Limit: ["+EnumChatFormatting.YELLOW+this.getTransferLimit(this.thisStack)+EnumChatFormatting.GRAY +"EU/t]"); - list.add(EnumChatFormatting.GRAY+"Current Power: ["+EnumChatFormatting.YELLOW+(long) this.getCharge(stack)+EnumChatFormatting.GRAY+"EU] ["+EnumChatFormatting.YELLOW+MathUtils.findPercentage(this.getCharge(stack), this.getMaxCharge(stack))+EnumChatFormatting.GRAY +"%]"); - list.add(EnumChatFormatting.GRAY+"Time Remaining: ["+EnumChatFormatting.YELLOW+this.secondsLeft(stack)+ EnumChatFormatting.GRAY +" seconds]"); - super.addInformation(stack, aPlayer, list, bool); - } - - /*@Override - public ItemStack getContainerItem(ItemStack itemStack) - { - ItemStack newItem = itemStack.copy(); - newItem.stackSize = 1; - extractEnergy(newItem, 150000, false); - return newItem; - }*/ - - /*@Override - public boolean hasContainerItem(ItemStack stack) - { - return true; - }*/ - - /*@Override - public int getBurnTime(ItemStack fuel) { - if ((fuel == null) || (fuel.getItem() != this)) { - return 0; - } - return extractEnergy(fuel, 150000, true) / 50 / 100; - }*/ - - @Override - public double charge(final ItemStack stack, final double amount, final int tier, - final boolean ignoreTransferLimit, final boolean simulate) { - - if (!simulate) - { - ElectricItem.manager.charge(stack, amount, tier, true, simulate); - - } - return ElectricItem.manager.charge(stack, amount, tier, true, simulate); - } - - @Override - public double discharge(final ItemStack stack, final double amount, final int tier, - final boolean ignoreTransferLimit, final boolean externally, final boolean simulate) { - if (!simulate) - { - ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); - } - - return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); - } - - @Override - public double getCharge(final ItemStack stack) { - return ElectricItem.manager.getCharge(stack); - } - - @Override - public boolean canUse(final ItemStack stack, final double amount) { - return ElectricItem.manager.canUse(stack, amount); - } - - @Override - public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) { - return ElectricItem.manager.use(stack, amount, entity); - } - - @Override - public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) { - ElectricItem.manager.chargeFromArmor(stack, entity); - } - - @Override - public String getToolTip(final ItemStack stack) { - return ElectricItem.manager.getToolTip(stack); - } - - @Override - public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) { - return true; - } - - @Override - public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) { - return true; - } - - @Override - public BaubleType getBaubleType(final ItemStack arg0) { - return BaubleType.BELT; - } - - @Override //TODO - public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) { - - } - - @Override //TODO - public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) { - - } - - @Override //TODO - public void onWornTick(final ItemStack arg0, final EntityLivingBase arg1) { - //Utils.LOG_INFO("Trying to Tick Belt. 1"); - if (!arg1.worldObj.isRemote){ - if (this.getCharge(arg0) >= 10000){ - arg1.addPotionEffect(new PotionEffect(Potion.invisibility.id, 10, 2)); - this.discharge(arg0, 10000, 5, true, true, false); - } - else { - if (arg1.isPotionActive((Potion.invisibility))){ - arg1.removePotionEffect(Potion.invisibility.id); - } - } - } - } - -} diff --git a/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java b/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java deleted file mode 100644 index b74b7972be..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java +++ /dev/null @@ -1,128 +0,0 @@ -package gtPlusPlus.core.item.general; - -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; - -import gtPlusPlus.core.lib.CORE; - -public class ItemControlCore extends Item { - - public static IIcon[] icons = new IIcon[10]; - - public ItemControlCore() { - super(); - this.setHasSubtypes(true); - String unlocalizedName = "itemControlCore"; - this.setUnlocalizedName(unlocalizedName); - this.setCreativeTab(GregTech_API.TAB_GREGTECH); - //this.setCreativeTab(AddToCreativeTab.tabMisc); - GameRegistry.registerItem(this, unlocalizedName); - } - - @Override - public void registerIcons(IIconRegister reg) { - icons[0] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_0"); - icons[1] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_1"); - icons[2] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_2"); - icons[3] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_3"); - icons[4] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_4"); - icons[5] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_5"); - icons[6] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_6"); - icons[7] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_7"); - icons[8] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_8"); - icons[9] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_9"); - } - - @Override - public IIcon getIconFromDamage(int meta) { - return this.icons[meta]; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 10; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return this.getUnlocalizedName() + "_" + stack.getItemDamage(); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(EnumChatFormatting.GRAY+"Allows a Multiblock to function upto "+GT_Values.VN[stack.getItemDamage()]+""); - list.add(EnumChatFormatting.GRAY+"Required Tier is determined by the sum of the eu/t of all Energy Inputs"); - list.add(EnumChatFormatting.GRAY+"Lower tiers may be used to underclock, which is useful in some situations"); - } - - @Override - public String getItemStackDisplayName(final ItemStack tItem) { - if (tItem == null) { - return "Control Core"; - } - String aReturnValue = super.getItemStackDisplayName(tItem); - if (tItem != null) { - try { - if (aReturnValue != null) { - if (aReturnValue.toLowerCase().contains(".name")) { - aReturnValue = "Control Core"; - } - else { - return aReturnValue; - } - } - } - catch (Throwable t) {} - } - if (aReturnValue == null || !aReturnValue.toLowerCase().contains("control core") || aReturnValue.length() <= 0) { - aReturnValue = "Error"; - } - String suffixName = ""; - if (tItem.getItemDamage() == 0){ - suffixName = " [ULV]"; - } - else if (tItem.getItemDamage() == 1){ - suffixName = " [LV]"; - } - else if (tItem.getItemDamage() == 2){ - suffixName = " [MV]"; - } - else if (tItem.getItemDamage() == 3){ - suffixName = " [HV]"; - } - else if (tItem.getItemDamage() == 4){ - suffixName = " [EV]"; - } - else if (tItem.getItemDamage() == 5){ - suffixName = " [IV]"; - } - else if (tItem.getItemDamage() == 6){ - suffixName = " [LuV]"; - } - else if (tItem.getItemDamage() == 7){ - suffixName = " [ZPM]"; - } - else if (tItem.getItemDamage() == 8){ - suffixName = " [UV]"; - } - else if (tItem.getItemDamage() == 9){ - suffixName = " [MAX]"; - } - return (aReturnValue+suffixName); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/general/ItemCreativeTab.java b/src/Java/gtPlusPlus/core/item/general/ItemCreativeTab.java deleted file mode 100644 index c1a2655a03..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/ItemCreativeTab.java +++ /dev/null @@ -1,59 +0,0 @@ -package gtPlusPlus.core.item.general; - -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.GregTech_API; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -public class ItemCreativeTab extends Item { - - public IIcon[] icons = new IIcon[10]; - - public ItemCreativeTab() { - super(); - this.setHasSubtypes(true); - String unlocalizedName = "itemCreativeTabs"; - this.setUnlocalizedName(unlocalizedName); - this.setCreativeTab(GregTech_API.TAB_GREGTECH); - GameRegistry.registerItem(this, unlocalizedName); - } - - @Override - public void registerIcons(IIconRegister reg) { - this.icons[0] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_0"); - this.icons[1] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_1"); - this.icons[2] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_2"); - this.icons[3] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_3"); - this.icons[4] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_4"); - this.icons[5] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_5"); - this.icons[6] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_6"); - this.icons[7] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_7"); - this.icons[8] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_8"); - this.icons[9] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_9"); - } - - @Override - public IIcon getIconFromDamage(int meta) { - return this.icons[meta]; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 10; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return this.getUnlocalizedName() + "_" + stack.getItemDamage(); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/general/ItemEmpty.java b/src/Java/gtPlusPlus/core/item/general/ItemEmpty.java deleted file mode 100644 index c832d28bbd..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/ItemEmpty.java +++ /dev/null @@ -1,21 +0,0 @@ -package gtPlusPlus.core.item.general; - -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.CoreItem; - -public class ItemEmpty extends CoreItem{ - - public ItemEmpty() { - super("item.empty", AddToCreativeTab.tabMisc); - } - - @Override - public String getItemStackDisplayName(ItemStack tItem) { - return "Empty"; - } - - - -} diff --git a/src/Java/gtPlusPlus/core/item/general/ItemGemShards.java b/src/Java/gtPlusPlus/core/item/general/ItemGemShards.java deleted file mode 100644 index 5181a32bc7..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/ItemGemShards.java +++ /dev/null @@ -1,78 +0,0 @@ -package gtPlusPlus.core.item.general; - -import java.util.List; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import gtPlusPlus.core.item.base.BaseItemColourable; -import gtPlusPlus.core.util.Utils; - -public class ItemGemShards extends BaseItemColourable{ - - public ItemGemShards(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, - String description, EnumRarity regRarity, EnumChatFormatting colour, boolean Effect, int rgb) { - super(unlocalizedName, creativeTab, stackSize, maxDmg, description, regRarity, colour, Effect, rgb); - } - - public ItemGemShards(String unlocalizedName, String displayName, CreativeTabs creativeTab, int stackSize, - int maxDmg, String description, EnumRarity regRarity, EnumChatFormatting colour, boolean Effect, int rgb) { - super(unlocalizedName, displayName, creativeTab, stackSize, maxDmg, description, regRarity, colour, Effect, rgb); - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 4; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - - //0 - Diamond - //1 - Emerald - //2 - Ruby - //3 - Sapphire - - @Override - public String getItemStackDisplayName(final ItemStack tItem) { - String suffix = " Shards"; - String gemType = ""; - if (tItem.getItemDamage() == 0){ - gemType = "Diamond"; - } - else if (tItem.getItemDamage() == 1){ - gemType = "Emerald"; - } - else if (tItem.getItemDamage() == 2){ - gemType = "Ruby"; - } - else if (tItem.getItemDamage() == 3){ - gemType = "Sapphire"; - } - return (gemType+suffix); - - } - - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (this.getDamage(stack)==0){ - return Utils.rgbtoHexValue(150, 150, 220); - } - else if (this.getDamage(stack)==1){ - return Utils.rgbtoHexValue(75, 182, 75); - } - else if (this.getDamage(stack)==2){ - return Utils.rgbtoHexValue(182, 77, 77); - } - else { - return Utils.rgbtoHexValue(77, 75, 182); - } - } - - - - - -} diff --git a/src/Java/gtPlusPlus/core/item/general/ItemGenericToken.java b/src/Java/gtPlusPlus/core/item/general/ItemGenericToken.java deleted file mode 100644 index 21d2c6e120..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/ItemGenericToken.java +++ /dev/null @@ -1,182 +0,0 @@ -package gtPlusPlus.core.item.general; - -import java.util.HashMap; -import java.util.List; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.CoreItem; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; - -public class ItemGenericToken extends CoreItem { - - public final HashMap<Integer, String> mLocalNames; - public final HashMap<Integer, Integer> mMaxStackSizes; - public final HashMap<Integer, String[]> mDescriptionArrays; - public final HashMap<Integer, EnumRarity> mRarities; - public final HashMap<Integer, EnumChatFormatting> mCustomNameColours; - public final HashMap<Integer, IIcon> mIcons; - private final String mTextureDir; - - public ItemGenericToken() { - this("itemGenericToken", "Token", new String[] { "Can be reclaimed in some way, shape or form" }, "token"); - } - - public ItemGenericToken(String aUnlocalName, String aInternalName, String[] aBaseTooltip, String aTextureDir) { - super(aUnlocalName, aInternalName, AddToCreativeTab.tabMisc, 64, 1000, aBaseTooltip, EnumRarity.common, EnumChatFormatting.RESET, false, null); - mLocalNames = new HashMap<Integer, String>(); - mMaxStackSizes = new HashMap<Integer, Integer>(); - mDescriptionArrays = new HashMap<Integer, String[]>(); - mRarities = new HashMap<Integer, EnumRarity>(); - mCustomNameColours = new HashMap<Integer, EnumChatFormatting>(); - mIcons = new HashMap<Integer, IIcon>(); - mTextureDir = aTextureDir; - } - - public boolean register(int id, String aLocalName, int aMaxStack, String aDescript) { - return register(id, aLocalName, aMaxStack, new String[] { aDescript }); - } - - public boolean register(int id, String aLocalName, int aMaxStack, String[] aDescript) { - return register(id, aLocalName, aMaxStack, aDescript, EnumRarity.common, EnumChatFormatting.RESET); - } - - public boolean register(int id, String aLocalName, int aMaxStack, String[] aDescript, EnumRarity aRarity, - EnumChatFormatting aCustomNameColour) { - int[][] sizes = new int[2][6]; - sizes[0][0] = mLocalNames.size(); - sizes[0][1] = mMaxStackSizes.size(); - sizes[0][2] = mDescriptionArrays.size(); - sizes[0][3] = mRarities.size(); - sizes[0][4] = mCustomNameColours.size(); - //sizes[0][5] = mIcons.size(); - mLocalNames.put(id, aLocalName); - mMaxStackSizes.put(id, aMaxStack); - mDescriptionArrays.put(id, aDescript); - mRarities.put(id, aRarity); - mCustomNameColours.put(id, aCustomNameColour); - sizes[1][0] = mLocalNames.size(); - sizes[1][1] = mMaxStackSizes.size(); - sizes[1][2] = mDescriptionArrays.size(); - sizes[1][3] = mRarities.size(); - sizes[1][4] = mCustomNameColours.size(); - //sizes[1][5] = mIcons.size(); - boolean b = sizes[0][0] > sizes[1][0] && sizes[0][1] > sizes[1][1] && sizes[0][2] > sizes[1][2] - && sizes[0][3] > sizes[1][3] && sizes[0][4] > sizes[1][4]; - return b; - } - - // Handle Sub items - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(final Item var1, final CreativeTabs aCreativeTab, final List aList) { - for (int i = 0, j = mIcons.size(); i < j; i++) { - final ItemStack tStack = new ItemStack(this, 1, i); - aList.add(tStack); - } - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - super.addInformation(stack, aPlayer, list, bool); - for (String s : mDescriptionArrays.get(stack.getItemDamage())) { - list.add(s); - } - } - - @Override - public String getItemStackDisplayName(final ItemStack tItem) { - - String s = "" + mCustomNameColours.get(tItem.getItemDamage()); - String parent = super.getItemStackDisplayName(tItem); - if (mLocalNames.get(tItem.getItemDamage()).length() > 0 && parent.toLowerCase().contains(".name")) { - s = s + mLocalNames.get(tItem.getItemDamage()); - } else { - s = s + parent; - } - return s; - } - - @Override - public EnumRarity getRarity(ItemStack par1ItemStack) { - return mRarities.get(par1ItemStack.getItemDamage()); - } - - @Override - public boolean hasEffect(ItemStack par1ItemStack) { - return false; - } - - @Override - public int getMetadata(int p_77647_1_) { - return 0; - } - - @Override - public int getDisplayDamage(ItemStack stack) { - return 0; - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return false; - } - - @Override - public double getDurabilityForDisplay(ItemStack stack) { - return 0D; - } - - @Override - public boolean isDamaged(ItemStack stack) { - return false; - } - - @Override - public int getItemStackLimit() { - return 64; - } - - @Override - public int getItemStackLimit(ItemStack aStack) { - if (aStack == null) { - return getItemStackLimit(); - } - else { - Integer aSize = mMaxStackSizes.get(aStack.getItemDamage()); - if (aSize != null) { - return aSize; - } - else { - return getItemStackLimit(); - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(final IIconRegister aIconRegister) { - for (int i = 0, j = mLocalNames.size(); i < j; i++) { - mIcons.put(i, aIconRegister.registerIcon(CORE.MODID + ":" + mTextureDir + "/" + i)); - } - } - - @Override - public final IIcon getIconFromDamage(final int aMetaData) { - if (aMetaData < 0) { - return null; - } - return mIcons.get(aMetaData); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java b/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java deleted file mode 100644 index b3338bb681..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/ItemGiantEgg.java +++ /dev/null @@ -1,300 +0,0 @@ -package gtPlusPlus.core.item.general; - -import static gtPlusPlus.core.lib.CORE.RANDOM; - -import java.util.List; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.entity.item.ItemEntityGiantEgg; -import gtPlusPlus.core.item.base.BaseItemTickable; -import gtPlusPlus.core.item.general.spawn.ItemCustomSpawnEgg; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; - -public class ItemGiantEgg extends BaseItemTickable { - - private static ItemStack turnsIntoItem; - private static ItemStack mCorrectEgg; - private static ItemStack mCorrectStemCells; - - public void registerFuel(int burn){ - CORE.burnables.add(new Pair<Integer, ItemStack>(burn, ItemUtils.getSimpleStack(this, 1))); - } - - public final void registerOrdictionary(String name){ - ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), name); - } - - public ItemGiantEgg() { - this(Utils.rgbtoHexValue(255, 255, 255), Short.MAX_VALUE * Byte.MAX_VALUE, new String[] {"I had best try disassemble this.. for science!"}); - } - - private ItemGiantEgg(int colour, int maxTicks, String[] desc1) { - super(true, false, "itemBigEgg", colour, maxTicks, desc1); - setTextureName(CORE.MODID + ":itemBigEgg"); - this.setMaxStackSize(1); - registerFuel(5000); - registerOrdictionary("fuelLargeChickenEgg"); - } - - public static void postInit(ItemGiantEgg aGiantEggItem) { - ItemGiantEgg.turnsIntoItem = getSpawnEggStack(); - //new DecayableRecipe(aGiantEggItem.maxTicks, getSimpleStack(aGiantEggItem), ItemUtils.getSimpleStack(ItemGiantEgg.turnsIntoItem, 1)); - } - - private static ItemStack getSpawnEggStack() { - //Set the correct egg for future hatches - if (mCorrectEgg == null) { - /*for (int g=0;g<Byte.MAX_VALUE;g++) { - ItemStack mSpawn = ItemUtils.simpleMetaStack(Items.spawn_egg, g, 1); - if (mSpawn != null) { - //String s = ("" + StatCollector.translateToLocal(mSpawn.getUnlocalizedName() + ".name")).trim(); - String s1 = EntityList.getStringFromID(mSpawn.getItemDamage()); - if (s1 != null){ - //s = s + " " + StatCollector.translateToLocal("entity." + s1 + ".name"); - if (s1.equalsIgnoreCase("bigChickenFriendly")) { - mCorrectEgg = mSpawn; - return mCorrectEgg; - } - } - } - }*/ - ItemStack aTempEgg = ItemCustomSpawnEgg.getSpawnEggForEntityname("bigChickenFriendly", 1); - if (aTempEgg != null) { - mCorrectEgg = aTempEgg; - } - } - return mCorrectEgg; - } - - private static ItemStack getStemCellStack() { - if (mCorrectStemCells == null) { - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && Utils.getGregtechSubVersion() > 28) { - ItemStack xl = ItemUtils.getValueOfItemList("Circuit_Chip_Stemcell", 1, ItemUtils.getSimpleStack(Items.egg, 2)); - if (xl != null) { - mCorrectStemCells = xl.copy(); - } - } - else { - mCorrectStemCells = ItemUtils.getSimpleStack(Items.egg, 2); - } - } - return mCorrectStemCells; - } - - protected int getMaxTicks(ItemStack aStack) { - if (aStack != null && aStack.hasTagCompound() && aStack.getTagCompound().hasKey("mEggAge")) { - return NBTUtils.getInteger(aStack, "mEggAge"); - } - return maxTicks; - } - - @Override - public void registerIcons(final IIconRegister i) { - this.mIcon[0] = i.registerIcon(CORE.MODID + ":" + "itemBigEgg"); - } - - - @Override - protected boolean createNBT(World world, ItemStack aStack){ - - if (aStack.getTagCompound() != null && aStack.getTagCompound().hasKey("size")) { - return false; - } - Logger.INFO("Egg: "+ReflectionUtils.getMethodName(1)); - Logger.INFO("Egg: "+ReflectionUtils.getMethodName(2)); - Logger.INFO("Egg: "+ReflectionUtils.getMethodName(3)); - Logger.INFO("Egg: "+ReflectionUtils.getMethodName(4)); - Logger.INFO("Egg: "+ReflectionUtils.getMethodName(5)); - Logger.INFO("Egg: "+ReflectionUtils.getMethodName(6)); - //Logger.INFO("Creating Egg NBT."); - boolean aSuper = super.createNBT(world, aStack); - int size = MathUtils.randInt(1, 8); - NBTUtils.setInteger(aStack, "size", size); - NBTUtils.setInteger(aStack, "mEggAge", ((MathUtils.randInt(8000, 16000)*size))); - ItemStack aStemCells = getStemCellStack(); - if (aStemCells != null) { - int mSize = NBTUtils.getInteger(aStack, "size"); - float mSizeMod = (MathUtils.randInt(-5, 5)/5); - mSize += mSizeMod; - mSize = Math.max(mSize, 1); - ItemStack eggYolks[] = new ItemStack[mSize]; - for (int u=0;u<mSize;u++) { - eggYolks[u] = ItemUtils.getSimpleStack(aStemCells, MathUtils.randInt(1, 4)); - } - int mexpected = 0; - for (ItemStack e : eggYolks) { - if (e != null) { - mexpected += e.stackSize; - } - } - if (mexpected > 0) { - NBTUtils.setInteger(aStack, "mExpected", mexpected); - NBTUtils.writeItemsToGtCraftingComponents(aStack, new ItemStack[]{ ItemUtils.getSimpleStack(aStemCells, mexpected)}, true); - } - } - return aSuper; - - } - - - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - if (world == null || iStack == null) { - return; - } - if (world.isRemote) { - return; - } - if (iStack.getTagCompound() == null || !iStack.getTagCompound().hasKey("size")) { - this.createNBT(world, iStack); - Logger.INFO("Egg has no NBT, creating (onUpdate)"); - } - boolean a1, a2; - a1 = this.isTicking(world, iStack); - a2 = a1 ? tickItemTag(world, iStack) : false; - - //Logger.INFO("Is Ticking? "+a1); - //Logger.INFO("Did Tick? "+a2); - if (!a1 && !a2) { - if (entityHolding instanceof EntityPlayer){ - if (MathUtils.randInt(0, 1000) >= 990) { - if (NBTUtils.hasKey(iStack, "size")) { - if ((NBTUtils.getInteger(iStack, "size")+1) >= MathUtils.randInt(0, 9)) { - ItemStack replacement = ItemUtils.getSimpleStack(getHatchResult(), 1); - if (replacement == null) { - - } - //Logger.INFO("Replacing "+iStack.getDisplayName()+" with "+replacement.getDisplayName()+"."); - final ItemStack tempTransform = replacement.copy(); - if (iStack.stackSize > 1){ - int u = iStack.stackSize; - tempTransform.stackSize = u; - ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform)); - for (int l=0;l<u;l++){ - ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this); - } - } - else { - tempTransform.stackSize=1; - ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform)); - ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this); - } - } - } - } - } - } - } - - public ItemStack getHatchResult() { - return turnsIntoItem; - } - - @Override - public String getItemStackDisplayName(ItemStack aStack) { - String localName = super.getItemStackDisplayName(aStack); - /*if (aStack.getTagCompound() == null){ - createNBT(null, aStack); - Logger.INFO("Egg has no NBT, creating (getDisplayName)"); - }*/ - int size = 1; - if (NBTUtils.hasKey(aStack, "size")){ - size = NBTUtils.getInteger(aStack, "size"); - return ""+size+" "+localName; - } - return "?? "+localName; - } - - - @Override - public boolean hasCustomEntity(ItemStack stack) { - return true; - } - - @Override - public Entity createEntity(World world, Entity location, ItemStack itemstack) { - if (location instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) location; - if (itemstack == null) { - return null; - } - else if (itemstack.stackSize == 0) { - return null; - } - else { - ItemEntityGiantEgg entityitem = new ItemEntityGiantEgg(world, player.posX, player.posY - 0.30000001192092896D + (double)player.getEyeHeight(), player.posZ, itemstack); - entityitem.delayBeforeCanPickup = 40; - entityitem.func_145799_b(player.getCommandSenderName()); - float f = 0.1F; - float f1; - f = 0.3F; - entityitem.motionX = (double)(-MathHelper.sin(player.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float)Math.PI) * f); - entityitem.motionZ = (double)(MathHelper.cos(player.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float)Math.PI) * f); - entityitem.motionY = (double)(-MathHelper.sin(player.rotationPitch / 180.0F * (float)Math.PI) * f + 0.1F); - f = 0.02F; - f1 = RANDOM.nextFloat() * (float)Math.PI * 2.0F; - f *= RANDOM.nextFloat(); - entityitem.motionX += Math.cos((double)f1) * (double)f; - entityitem.motionY += (double)((RANDOM.nextFloat() - RANDOM.nextFloat()) * 0.1F); - entityitem.motionZ += Math.sin((double)f1) * (double)f; - return entityitem; - } - } - return null; - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - int size = 0; - long age = 0; - long life = 0; - int expected = 0; - if (this.descriptionString.length > 0) { - list.add(EnumChatFormatting.GRAY+this.descriptionString[0]); - } - if (NBTUtils.hasKey(stack, "size")){ - size = NBTUtils.getInteger(stack, "size"); - if (size > 0 && NBTUtils.hasKey(stack, "TickableItem")){ - NBTTagCompound aNBT = stack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("TickableItem"); - if (aNBT != null) { - age = aNBT.getLong("Tick"); - } - } - } - if (NBTUtils.hasKey(stack, "mEggAge")){ - life = NBTUtils.getInteger(stack, "mEggAge"); - } - if (NBTUtils.hasKey(stack, "mExpected")){ - expected = NBTUtils.getInteger(stack, "mExpected"); - } - } - String aSize = size > 0 ? ""+size : "??"; - String aExpected = expected > 0 ? ""+expected : "??"; - String aAge = age > 0 ? ""+(age/20) : "??"; - String aLife = life > 0 ? ""+(life/20) : "??"; - list.add("Egg Size: "+aSize+" ounces"); - list.add("Expected Stem Cells: "+aExpected); - list.add("Age: "+aAge+"s"+" / "+aLife+"s"); - list.add("Larger eggs take longer to hatch,"); - list.add("but have a better chance of hatching."); - - } - -} diff --git a/src/Java/gtPlusPlus/core/item/general/ItemHalfCompleteCasings.java b/src/Java/gtPlusPlus/core/item/general/ItemHalfCompleteCasings.java deleted file mode 100644 index ad9abc8ab2..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/ItemHalfCompleteCasings.java +++ /dev/null @@ -1,63 +0,0 @@ -package gtPlusPlus.core.item.general; - -import java.util.List; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import gtPlusPlus.core.item.base.BaseItemColourable; -import gtPlusPlus.core.util.Utils; - -public class ItemHalfCompleteCasings extends BaseItemColourable{ - - public ItemHalfCompleteCasings(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, - String description, EnumRarity regRarity, EnumChatFormatting colour, boolean Effect, int rgb) { - super(unlocalizedName, creativeTab, stackSize, maxDmg, description, regRarity, colour, Effect, rgb); - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 4; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public String getItemStackDisplayName(final ItemStack tItem) { - String prefix = super.getItemStackDisplayName(tItem); - String casingType = ""; - if (tItem.getItemDamage() == 0){ - casingType = " I"; - } - else if (tItem.getItemDamage() == 1){ - casingType = " II"; - } - else if (tItem.getItemDamage() == 2){ - casingType = " III"; - } - else if (tItem.getItemDamage() == 3){ - casingType = " IV"; - } - return (prefix+casingType); - } - - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (this.getDamage(stack)==0){ - return Utils.rgbtoHexValue(52, 52, 52); - } - else if (this.getDamage(stack)==1){ - return Utils.rgbtoHexValue(80, 90, 222); - } - else if (this.getDamage(stack)==2){ - return Utils.rgbtoHexValue(182, 77, 177); - } - else { - return Utils.rgbtoHexValue(77, 175, 182); - } - } - -} diff --git a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java deleted file mode 100644 index db06af8297..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java +++ /dev/null @@ -1,432 +0,0 @@ -package gtPlusPlus.core.item.general; - -import java.util.List; - -import baubles.api.BaubleType; -import baubles.api.IBauble; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.sys.KeyboardUtils; -import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; -import ic2.api.item.IElectricItemManager; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; - -@Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")}) -public class ItemHealingDevice extends Item implements IElectricItem, IElectricItemManager, IBauble{ - - private final String unlocalizedName = "personalHealingDevice"; - private final ItemStack thisStack; - private final static int maxValueEU = 1000000000; - protected double chargeEU = 0; - - public ItemHealingDevice(){ - this.setCreativeTab(AddToCreativeTab.tabMachines); - this.setUnlocalizedName(this.unlocalizedName); - this.setMaxStackSize(1); - this.setTextureName(CORE.MODID + ":" + "personalCloakingDevice"); - this.thisStack = ItemUtils.getSimpleStack(this); - GameRegistry.registerItem(this, this.unlocalizedName); - } - - @Override - public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, final boolean p_77663_5_) { - if (worldObj.isRemote) { - return; - } - super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_); - } - - @Override - public boolean canProvideEnergy(final ItemStack itemStack) { - return false; - } - - @Override - public Item getChargedItem(final ItemStack itemStack) { - final ItemStack x = itemStack.copy(); - x.setItemDamage(maxValueEU); - return x.getItem(); - } - - @Override - public Item getEmptyItem(final ItemStack itemStack) { - final ItemStack x = itemStack.copy(); - x.setItemDamage(0); - return x.getItem(); - } - - @Override - public double getMaxCharge(final ItemStack itemStack) { - return maxValueEU; - } - - @Override - public int getTier(final ItemStack itemStack) { - return 5; - } - - @Override - public double getTransferLimit(final ItemStack itemStack) { - return 32784; - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - - return (EnumChatFormatting.BLUE+"Personal Healing NanoBooster"+EnumChatFormatting.RESET); - } - - @Override - public double getDurabilityForDisplay(final ItemStack stack) - { - //return 1.0D - getEnergyStored(stack) / this.capacity; - return 1.0D - (this.getCharge(stack) / this.getMaxCharge(stack)); - } - - @Override - public boolean showDurabilityBar(final ItemStack stack) - { - return true; - } - - public double secondsLeft(final ItemStack stack){ - - double r = 0; - r = this.getCharge(stack)/(1638400/4); - return (int) r; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - - String aString1 = StatCollector.translateToLocal("GTPP.nanohealer.tooltip.1"); - String aString2 = StatCollector.translateToLocal("GTPP.nanohealer.tooltip.2"); - String aString3 = StatCollector.translateToLocal("GTPP.nanohealer.tooltip.3"); - String aString4 = StatCollector.translateToLocal("GTPP.nanohealer.tooltip.4"); - String aString5 = StatCollector.translateToLocal("GTPP.nanohealer.tooltip.5"); - String aStringTooltip = StatCollector.translateToLocal("GTPP.nanohealer.hidden"); - String aEuInfo = StatCollector.translateToLocal("GTPP.info.euInfo"); - String aTier = StatCollector.translateToLocal("GTPP.machines.tier"); - String aInputLimit = StatCollector.translateToLocal("GTPP.info.inputLimit"); - String aCurrentPower = StatCollector.translateToLocal("GTPP.info.currentPower"); - String aEU = StatCollector.translateToLocal("GTPP.info.eu"); - String aEUT = aEU+"/t"; - boolean isShowing = getShowMessages(stack); - - list.add(""); - - list.add(EnumChatFormatting.GREEN + aString1 + EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GREEN + aString2 + EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GREEN + aString3 + EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.RED + aString4 + EnumChatFormatting.GRAY); - - list.add(""); - - list.add(EnumChatFormatting.GOLD + aEuInfo + EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GRAY + aTier+": [" + EnumChatFormatting.YELLOW + this.getTier(stack) - + EnumChatFormatting.GRAY + "] "+aInputLimit+": [" + EnumChatFormatting.YELLOW - + this.getTransferLimit(stack) + EnumChatFormatting.GRAY + aEUT+"]"); - list.add(EnumChatFormatting.GRAY + aCurrentPower +": [" + EnumChatFormatting.YELLOW + (long) this.getCharge(stack) - + EnumChatFormatting.GRAY + aEU +"] [" + EnumChatFormatting.YELLOW - + MathUtils.findPercentage(this.getCharge(stack), this.getMaxCharge(stack)) + EnumChatFormatting.GRAY - + "%]"); - list.add(EnumChatFormatting.GOLD + aString5 + EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GOLD + aStringTooltip + " " + (!isShowing ? EnumChatFormatting.DARK_GREEN : EnumChatFormatting.DARK_RED) + !isShowing + EnumChatFormatting.GRAY); - super.addInformation(stack, aPlayer, list, bool); - } - - @Override - public double charge(final ItemStack stack, final double amount, final int tier, - final boolean ignoreTransferLimit, final boolean simulate) { - - if (!simulate) - { - ElectricItem.manager.charge(stack, amount, tier, true, simulate); - - } - return ElectricItem.manager.charge(stack, amount, tier, true, simulate); - } - - @Override - public double discharge(final ItemStack stack, final double amount, final int tier, - final boolean ignoreTransferLimit, final boolean externally, final boolean simulate) { - if (!simulate) - { - ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); - } - - return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); - } - - @Override - public double getCharge(final ItemStack stack) { - return ElectricItem.manager.getCharge(stack); - } - - @Override - public boolean canUse(final ItemStack stack, final double amount) { - return ElectricItem.manager.canUse(stack, amount); - } - - @Override - public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) { - return ElectricItem.manager.use(stack, amount, entity); - } - - @Override - public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) { - ElectricItem.manager.chargeFromArmor(stack, entity); - } - - @Override - public String getToolTip(final ItemStack stack) { - return ElectricItem.manager.getToolTip(stack); - } - - @Override - public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) { - return true; - } - - @Override - public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) { - return true; - } - - @Override - public BaubleType getBaubleType(final ItemStack arg0) { - return BaubleType.AMULET; - } - - @Override //TODO - public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) { - - } - - @Override //TODO - public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) { - - } - - @Override //TODO - public void onWornTick(final ItemStack aBaubleStack, final EntityLivingBase arg1) { - if (arg1 != null && arg1.worldObj != null && !arg1.worldObj.isRemote){ - - //Try Charge First - - //Inv Slots - for (final ItemStack aInvStack : ((EntityPlayer) arg1).inventory.mainInventory) { - if (aInvStack == aBaubleStack) { - continue; - } - - if (this.getCharge(aBaubleStack) == this.getMaxCharge(aBaubleStack)) { - break; - } - - if (aInvStack != null) { - if (ChargingHelper.isItemValid(aInvStack)) { - - - double aTransferRate; - double aCurrentChargeForThisBauble; - int mTier; - final IElectricItem electricItem = (IElectricItem) aInvStack.getItem(); - - if (electricItem != null) { - - aTransferRate = electricItem.getTransferLimit(aInvStack); - mTier = electricItem.getTier(aInvStack); - aCurrentChargeForThisBauble = ElectricItem.manager.getCharge(aBaubleStack); - - if (aCurrentChargeForThisBauble < maxValueEU) { - if ((ElectricItem.manager.getCharge(aInvStack) >= aTransferRate)) { - if (electricItem.canProvideEnergy(aInvStack)) { - double d = ElectricItem.manager.discharge(aInvStack, aTransferRate, mTier, false, true, false); - //Logger.INFO("Charging from "+aInvStack.getDisplayName() +" | "+d); - ElectricItem.manager.charge(aBaubleStack, d, mTier, true, false); - } - } - } - } - } - } - if (this.getCharge(aBaubleStack) <= (this.getMaxCharge(aBaubleStack) - getTransferLimit(aBaubleStack))) { - continue; - } - else { - break; - } - } - - - //Try Heal - if (this.getCharge(aBaubleStack) > 0){ - - //health Check - float hp = 0; - if (arg1.getHealth() < arg1.getMaxHealth()){ - final float rx = arg1.getMaxHealth()-arg1.getHealth(); - Logger.INFO("rx:"+rx); - arg1.heal(rx*2); - hp = rx; - this.discharge(aBaubleStack, (1638400)*rx, 6, true, true, false); - } - - //Hunger Check - int hunger = 0; - if (arg1 instanceof EntityPlayerMP) { - EntityPlayerMP g = (EntityPlayerMP) arg1; - if (g != null) { - hunger = 20 - g.getFoodStats().getFoodLevel(); - g.getFoodStats().setFoodLevel(g.getFoodStats().getFoodLevel() + hunger); - this.discharge(aBaubleStack, (1638400) * hunger, 6, true, true, false); - } - } - - //Saturation Check - float saturation = 0; - if (arg1 instanceof EntityPlayerMP) { - EntityPlayerMP g = (EntityPlayerMP) arg1; - if (g != null) { - saturation = 5f - g.getFoodStats().getSaturationLevel(); - g.getFoodStats().setFoodSaturationLevel(g.getFoodStats().getSaturationLevel() + saturation); - this.discharge(aBaubleStack, (1638400) * saturation, 6, true, true, false); - } - } - - - saturation = (int) saturation; - - //Only show Messages if they're enabled. - if (getShowMessages(aBaubleStack)) { - if (hp > 0 || hunger > 0 || saturation > 0) - PlayerUtils.messagePlayer((EntityPlayer) arg1, - "Your NanoBooster Whirs! Leaving you feeling stronger."); - - if (hp > 0) - PlayerUtils.messagePlayer((EntityPlayer) arg1, "Healed " + hp + " hp."); - - if (hunger > 0) - PlayerUtils.messagePlayer((EntityPlayer) arg1, "Healed " + hunger + " hunger."); - - if (saturation > 0) - PlayerUtils.messagePlayer((EntityPlayer) arg1, "Satured Hunger by " + saturation + "."); - - if (hp > 0 || hunger > 0 || saturation > 0) - PlayerUtils.messagePlayer((EntityPlayer) arg1, - "You check it's remaining uses, it has " + (int) this.secondsLeft(aBaubleStack) + "."); - - } - - - - - } - } - } - - - - - - - - - - - - - - - - - - - - - - - private static boolean createNBT(ItemStack rStack){ - final NBTTagCompound tagMain = new NBTTagCompound(); - tagMain.setBoolean("ShowMSG", false); - rStack.setTagCompound(tagMain); - return true; - } - - public static final boolean getShowMessages(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT == null) { - if (!createNBT(aStack)) { - return false; - } - else { - aNBT = aStack.getTagCompound(); - } - } - return aNBT.getBoolean("ShowMSG"); - - } - - public static final boolean setShowMessages(final ItemStack aStack, final boolean aShow) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT == null) { - if (!createNBT(aStack)) { - return false; - } else { - aNBT = aStack.getTagCompound(); - } - } - aNBT.setBoolean("ShowMSG", aShow); - return true; - } - - @Override - public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, - int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { - // TODO Auto-generated method stub - return super.onItemUse(p_77648_1_, p_77648_2_, p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_8_, - p_77648_9_, p_77648_10_); - } - - @Override - public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - ItemStack superStack = super.onItemRightClick(aStack, aWorld, aPlayer); - boolean isShiftHeld = KeyboardUtils.isShiftKeyDown(); - if (isShiftHeld) { - boolean oldState = getShowMessages(superStack); - boolean newState = Utils.invertBoolean(oldState); - ItemHealingDevice.setShowMessages(superStack, newState); - PlayerUtils.messagePlayer(aPlayer, (!oldState ? "Showing info messages" : "Hiding info messages")); - } - return superStack; - } - - @Override - public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player) { - return true; - } - - - - -} diff --git a/src/Java/gtPlusPlus/core/item/general/ItemLavaFilter.java b/src/Java/gtPlusPlus/core/item/general/ItemLavaFilter.java deleted file mode 100644 index c34ad9e8d3..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/ItemLavaFilter.java +++ /dev/null @@ -1,127 +0,0 @@ -package gtPlusPlus.core.item.general; - -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; - -import gregtech.api.enums.ItemList; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.CoreItem; -import gtPlusPlus.core.lib.CORE; - -public class ItemLavaFilter extends CoreItem { - - public IIcon[] mIcon = new IIcon[1]; - - public ItemLavaFilter() { - super("itemLavaFilter", AddToCreativeTab.tabMachines, 1, 100, new String[] {"Lava Filter"}, EnumRarity.common, - EnumChatFormatting.BLACK, false, null); - setGregtechItemList(); - } - - private final boolean setGregtechItemList() { - ItemList.Component_LavaFilter.set(this); - return ItemList.Component_LavaFilter.get(1) != null ? true : false; - } - - @Override - public void registerIcons(IIconRegister reg) { - this.mIcon[0] = reg.registerIcon(CORE.MODID + ":" + "itemLavaFilter"); - } - - @Override - public IIcon getIconFromDamage(int meta) { - return this.mIcon[0]; - } - - @Override - public String getItemStackDisplayName(ItemStack tItem) { - return "Lava Filter"; - } - - private static boolean createNBT(ItemStack rStack){ - final NBTTagCompound tagMain = new NBTTagCompound(); - final NBTTagCompound tagNBT = new NBTTagCompound(); - tagNBT.setLong("Damage", 0); - tagMain.setTag("LavaFilter", tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - public static final long getFilterDamage(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("LavaFilter"); - if (aNBT != null) { - return aNBT.getLong("Damage"); - } - } - else { - createNBT(aStack); - } - return 0L; - } - - public static final boolean setFilterDamage(final ItemStack aStack, final long aDamage) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("LavaFilter"); - if (aNBT != null) { - aNBT.setLong("Damage", aDamage); - return true; - } - } - else { - createNBT(aStack); - } - return false; - } - - @Override - public double getDurabilityForDisplay(ItemStack stack) { - if (stack.getTagCompound() == null){ - createNBT(stack); - } - double currentDamage = getFilterDamage(stack); - double durabilitypercent = currentDamage / 100; - return durabilitypercent; - } - - @SuppressWarnings("unchecked") - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { - list.add(EnumChatFormatting.GRAY+"Filters Lava within a Thermal Boiler."); - EnumChatFormatting durability = EnumChatFormatting.GRAY; - if (100-getFilterDamage(stack) > 80){ - durability = EnumChatFormatting.GRAY; - } - else if (100-getFilterDamage(stack) > 60){ - durability = EnumChatFormatting.GREEN; - } - else if (100-getFilterDamage(stack) > 40){ - durability = EnumChatFormatting.YELLOW; - } - else if (100-getFilterDamage(stack) > 20){ - durability = EnumChatFormatting.GOLD; - } - else if (100-getFilterDamage(stack) > 0){ - durability = EnumChatFormatting.RED; - } - list.add(durability+""+(100-getFilterDamage(stack))+EnumChatFormatting.GRAY+" / "+100); - //super.addInformation(stack, player, list, bool); - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return true; - } - - -} diff --git a/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java b/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java deleted file mode 100644 index fa008bf1a3..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java +++ /dev/null @@ -1,140 +0,0 @@ -package gtPlusPlus.core.item.general; - -import java.util.List; - -import baubles.api.BaubleType; -import baubles.api.IBauble; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.handler.events.CustomMovementHandler; -import gtPlusPlus.core.handler.events.SneakManager; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -@Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")}) -public class ItemSlowBuildingRing extends Item implements IBauble{ - - private final String unlocalizedName = "SlowBuildingRing"; - CustomMovementHandler x; - - public ItemSlowBuildingRing(){ - this.setCreativeTab(AddToCreativeTab.tabMachines); - this.setUnlocalizedName(this.unlocalizedName); - this.setMaxStackSize(1); - this.setTextureName(CORE.MODID + ":" + "itemSlowBuildersRing"); - ItemUtils.getSimpleStack(this); - GameRegistry.registerItem(this, this.unlocalizedName); - } - - @Override - public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, final boolean p_77663_5_) { - if (worldObj.isRemote) { - return; - } - super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_); - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return (EnumChatFormatting.YELLOW+"Slow Building Ring"+EnumChatFormatting.GRAY); - } - - @Override - public boolean showDurabilityBar(final ItemStack stack) - { - return false; - } - - @SuppressWarnings("unchecked") - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(""); - list.add(EnumChatFormatting.GREEN+"Worn as a Ring within Baubles. Prevents you from sprinting."+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GREEN+"Movement speed reduced to crouch speed."+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GREEN+"Press shift while worn to toggle crouch on/off."+EnumChatFormatting.GRAY); - list.add(""); - super.addInformation(stack, aPlayer, list, bool); - } - - @Override - public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) { - return true; - } - - @Override - public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) { - return true; - } - - @Override - public BaubleType getBaubleType(final ItemStack arg0) { - return BaubleType.RING; - } - - @Override //TODO - public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) { - try { - EntityPlayer aPlayer; - if (arg1 instanceof EntityPlayer) { - aPlayer = (EntityPlayer) arg1; - SneakManager s = SneakManager.get(aPlayer); - s.putRingOn(); - } - } - catch (Throwable t) { - t.printStackTrace(); - } - } - - @Override //TODO - public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) { - try { - EntityPlayer aPlayer; - if (arg1 instanceof EntityPlayer) { - aPlayer = (EntityPlayer) arg1; - SneakManager s = SneakManager.get(aPlayer); - s.takeRingOff(); - } - } - catch (Throwable t) { - t.printStackTrace(); - } - } - - @Override //TODO - public void onWornTick(final ItemStack arg0, final EntityLivingBase arg1) { - doEffect(arg1); - } - - private static void doEffect(final EntityLivingBase arg1){ - try { - // Get World - World aWorld = arg1.worldObj; - if (aWorld != null && !aWorld.isRemote) { - EntityPlayer aPlayer; - if (arg1 instanceof EntityPlayer) { - aPlayer = (EntityPlayer) arg1; - SneakManager s = SneakManager.get(aPlayer); - if (!aPlayer.isSneaking()){ - aPlayer.setSneaking(true); - } - if (aPlayer.isSprinting()) { - aPlayer.setSprinting(false); - } - } - } - } - catch (Throwable t) { - t.printStackTrace(); - } - } - -} diff --git a/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java b/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java deleted file mode 100644 index 9feea3c91a..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java +++ /dev/null @@ -1,211 +0,0 @@ -package gtPlusPlus.core.item.general; - -import cpw.mods.fml.common.eventhandler.Event; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; - -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.player.FillBucketEvent; - -public class NuclearFuelRodBase extends Item -{ - /** field for checking if the bucket has been filled. */ - private final Block isFull; - public NuclearFuelRodBase(final Block p_i45331_1_) - { - this.maxStackSize = 1; - this.isFull = p_i45331_1_; - this.setCreativeTab(CreativeTabs.tabMisc); - } - - /** - * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer - */ - @Override - public ItemStack onItemRightClick(final ItemStack p_77659_1_, final World p_77659_2_, final EntityPlayer p_77659_3_) - { - final boolean flag = this.isFull == Blocks.air; - final MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(p_77659_2_, p_77659_3_, flag); - - if (movingobjectposition == null) - { - return p_77659_1_; - } - final FillBucketEvent event = new FillBucketEvent(p_77659_3_, p_77659_1_, p_77659_2_, movingobjectposition); - if (MinecraftForge.EVENT_BUS.post(event)) - { - return p_77659_1_; - } - - if (event.getResult() == Event.Result.ALLOW) - { - if (p_77659_3_.capabilities.isCreativeMode) - { - return p_77659_1_; - } - - if (--p_77659_1_.stackSize <= 0) - { - return event.result; - } - - if (!p_77659_3_.inventory.addItemStackToInventory(event.result)) - { - p_77659_3_.dropPlayerItemWithRandomChoice(event.result, false); - } - - return p_77659_1_; - } - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; - - if (!p_77659_2_.canMineBlock(p_77659_3_, i, j, k)) - { - return p_77659_1_; - } - - if (flag) - { - if (!p_77659_3_.canPlayerEdit(i, j, k, movingobjectposition.sideHit, p_77659_1_)) - { - return p_77659_1_; - } - - final Material material = p_77659_2_.getBlock(i, j, k).getMaterial(); - final int l = p_77659_2_.getBlockMetadata(i, j, k); - - if ((material == Material.water) && (l == 0)) - { - p_77659_2_.setBlockToAir(i, j, k); - return this.func_150910_a(p_77659_1_, p_77659_3_, Items.water_bucket); - } - - if ((material == Material.lava) && (l == 0)) - { - p_77659_2_.setBlockToAir(i, j, k); - return this.func_150910_a(p_77659_1_, p_77659_3_, Items.lava_bucket); - } - } - else - { - if (this.isFull == Blocks.air) - { - return new ItemStack(Items.bucket); - } - - if (movingobjectposition.sideHit == 0) - { - --j; - } - - if (movingobjectposition.sideHit == 1) - { - ++j; - } - - if (movingobjectposition.sideHit == 2) - { - --k; - } - - if (movingobjectposition.sideHit == 3) - { - ++k; - } - - if (movingobjectposition.sideHit == 4) - { - --i; - } - - if (movingobjectposition.sideHit == 5) - { - ++i; - } - - if (!p_77659_3_.canPlayerEdit(i, j, k, movingobjectposition.sideHit, p_77659_1_)) - { - return p_77659_1_; - } - - if (this.tryPlaceContainedLiquid(p_77659_2_, i, j, k) && !p_77659_3_.capabilities.isCreativeMode) - { - return new ItemStack(Items.bucket); - } - } - } - - return p_77659_1_; - } - - private ItemStack func_150910_a(final ItemStack p_150910_1_, final EntityPlayer p_150910_2_, final Item p_150910_3_) - { - if (p_150910_2_.capabilities.isCreativeMode) - { - return p_150910_1_; - } - else if (--p_150910_1_.stackSize <= 0) - { - return new ItemStack(p_150910_3_); - } - else - { - if (!p_150910_2_.inventory.addItemStackToInventory(new ItemStack(p_150910_3_))) - { - p_150910_2_.dropPlayerItemWithRandomChoice(new ItemStack(p_150910_3_, 1, 0), false); - } - - return p_150910_1_; - } - } - - /** - * Attempts to place the liquid contained inside the bucket. - */ - public boolean tryPlaceContainedLiquid(final World p_77875_1_, final int p_77875_2_, final int p_77875_3_, final int p_77875_4_) - { - if (this.isFull == Blocks.air) - { - return false; - } - final Material material = p_77875_1_.getBlock(p_77875_2_, p_77875_3_, p_77875_4_).getMaterial(); - final boolean flag = !material.isSolid(); - - if (!p_77875_1_.isAirBlock(p_77875_2_, p_77875_3_, p_77875_4_) && !flag) - { - return false; - } - if (p_77875_1_.provider.isHellWorld && (this.isFull == Blocks.flowing_water)) - { - p_77875_1_.playSoundEffect(p_77875_2_ + 0.5F, p_77875_3_ + 0.5F, p_77875_4_ + 0.5F, "random.fizz", 0.5F, 2.6F + ((p_77875_1_.rand.nextFloat() - p_77875_1_.rand.nextFloat()) * 0.8F)); - - for (int l = 0; l < 8; ++l) - { - p_77875_1_.spawnParticle("largesmoke", p_77875_2_ + Math.random(), p_77875_3_ + Math.random(), p_77875_4_ + Math.random(), 0.0D, 0.0D, 0.0D); - } - } - else - { - if (!p_77875_1_.isRemote && flag && !material.isLiquid()) - { - p_77875_1_.func_147480_a(p_77875_2_, p_77875_3_, p_77875_4_, true); - } - - p_77875_1_.setBlock(p_77875_2_, p_77875_3_, p_77875_4_, this.isFull, 0, 3); - } - - return true; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java b/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java deleted file mode 100644 index 5ff5b5a62b..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java +++ /dev/null @@ -1,315 +0,0 @@ -package gtPlusPlus.core.item.general; - -import java.util.List; - -import cofh.api.energy.ItemEnergyContainer; -import cpw.mods.fml.common.IFuelHandler; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -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.util.MathHelper; -import net.minecraft.world.World; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; -import ic2.api.item.IElectricItemManager; - -public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, IElectricItemManager, IFuelHandler{ - - public static double rfPerEU = 3.4; - private final String unlocalizedName = "rfEUBattery"; - private final ItemStack thisStack; - private final static int maxValueEU = 100000000; - private final static int maxValueRF = (int) (maxValueEU * rfPerEU); - protected double chargeEU = 0; - - public RF2EU_Battery(){ - super(maxValueRF); - GameRegistry.registerFuelHandler(this); - //this.setMaxDamage(Integer.MAX_VALUE); - //this.setDamage(UtilsItems.getSimpleStack(this), 0); - this.setCreativeTab(AddToCreativeTab.tabMachines); - this.setUnlocalizedName(this.unlocalizedName); - this.setMaxStackSize(1); - this.setTextureName(CORE.MODID + ":" + "itemIngot"); - this.thisStack = ItemUtils.getSimpleStack(this); - GameRegistry.registerItem(this, this.unlocalizedName); - } - - @Override - public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, final boolean p_77663_5_) { - this.getEnergyStored(itemStack); - if (worldObj.isRemote) { - return; - } - - if (player instanceof EntityPlayer){ - for (final ItemStack is : ((EntityPlayer) player).inventory.mainInventory) { - if (is == itemStack) { - continue; - } - if (is != null) { - if (is.getItem() instanceof IElectricItem) { - final IElectricItem electricItem = (IElectricItem) is.getItem(); - this.chargeEU = ElectricItem.manager.getCharge(is); - } - - } - } - } - - - super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_); - } - - @Override - public boolean canProvideEnergy(final ItemStack itemStack) { - return true; - } - - @Override - public Item getChargedItem(final ItemStack itemStack) { - final ItemStack x = itemStack.copy(); - x.setItemDamage(maxValueEU); - return x.getItem(); - } - - @Override - public Item getEmptyItem(final ItemStack itemStack) { - final ItemStack x = itemStack.copy(); - x.setItemDamage(0); - return x.getItem(); - } - - @Override - public double getMaxCharge(final ItemStack itemStack) { - return maxValueEU; - } - - @Override - public int getTier(final ItemStack itemStack) { - return 3; - } - - @Override - public double getTransferLimit(final ItemStack itemStack) { - return 8196; - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - - return ("Universally Chargeable Battery"); - } - - @Override - public double getDurabilityForDisplay(final ItemStack stack) - { - //return 1.0D - getEnergyStored(stack) / this.capacity; - return MathUtils.findPercentage(this.getEnergyStored(stack), this.getMaxEnergyStored(stack)); - } - - @Override - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(final ItemStack par1ItemStack, final int par2) - { - final int i = 30; - - final float f13 = (((Minecraft.getSystemTime() % 6000L) / 3000.0F) * CORE.PI * 2.0F); - - final float t = 0.9F + (0.1F * MathHelper.cos(f13)); - - final double v = 1.0D - this.getDurabilityForDisplay(par1ItemStack); - - int r = i + (int)(v * (255 - i) * t); - if (r > 255) { - r = 255; - } - final int g = i + (int)(v * (64 - i) * t); - - return (r << 16) | (g << 8) | i; - } - - @Override - public boolean showDurabilityBar(final ItemStack stack) - { - return false; - } - - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(EnumChatFormatting.YELLOW+"IC2/EU Information"+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+this.getTier(this.thisStack)+EnumChatFormatting.GRAY+"] Current Power: ["+EnumChatFormatting.YELLOW+(long) this.getCharge(stack)+EnumChatFormatting.GRAY+"/EU]"); - list.add(EnumChatFormatting.GRAY+"Transfer Limit: ["+EnumChatFormatting.YELLOW+this.getTransferLimit(this.thisStack)+ EnumChatFormatting.GRAY +"Eu/t]" +"Burn Time: ["+EnumChatFormatting.YELLOW+(this.getBurnTime(stack)/20)+EnumChatFormatting.GRAY+"s]"); - list.add(""); - list.add(EnumChatFormatting.RED+"RF Information"); - list.add(EnumChatFormatting.GRAY+"Extraction Rate: [" +EnumChatFormatting.RED+ this.maxExtract + EnumChatFormatting.GRAY + "Rf/t]" + " Insert Rate: [" +EnumChatFormatting.RED+ this.maxReceive+EnumChatFormatting.GRAY+"Rf/t]"); - list.add(EnumChatFormatting.GRAY+"Current Charge: ["+EnumChatFormatting.RED+this.getEnergyStored(stack) + EnumChatFormatting.GRAY + "Rf / " + this.getMaxEnergyStored(stack)+"Rf] "+EnumChatFormatting.RED+MathUtils.findPercentage(this.getEnergyStored(stack), this.getMaxEnergyStored(stack))+EnumChatFormatting.GRAY+"%"); - super.addInformation(stack, aPlayer, list, bool); - } - - @Override - public ItemStack getContainerItem(final ItemStack itemStack) - { - final ItemStack newItem = itemStack.copy(); - newItem.stackSize = 1; - this.extractEnergy(newItem, 150000, false); - return newItem; - } - - @Override - public boolean hasContainerItem(final ItemStack stack) - { - return true; - } - - @Override - public int getBurnTime(final ItemStack fuel) { - if ((fuel == null) || (fuel.getItem() != this)) { - return 0; - } - return this.extractEnergy(fuel, 150000, true) / 50 / 100; - } - - @Override - public double charge(final ItemStack stack, final double amount, final int tier, - final boolean ignoreTransferLimit, final boolean simulate) { - if (stack.stackTagCompound == null) { - stack.stackTagCompound = new NBTTagCompound(); - } - int energy = stack.stackTagCompound.getInteger("Energy"); - final int energyReceived = Math.min(this.capacity - energy, Math.min(this.maxReceive, this.maxReceive)); - if (!simulate) - { - energy += energyReceived; - stack.stackTagCompound.setInteger("Energy", energy); - ElectricItem.manager.discharge(stack, ElectricItem.manager.getCharge(stack), 3, true, true, false); - ElectricItem.manager.charge(stack, energy/rfPerEU, 3, true, false); - - } - return ElectricItem.manager.charge(stack, amount, tier, ignoreTransferLimit, simulate); - } - - @Override - public double discharge(final ItemStack stack, final double amount, final int tier, - final boolean ignoreTransferLimit, final boolean externally, final boolean simulate) { - if ((stack.stackTagCompound == null) || (!stack.stackTagCompound.hasKey("Energy"))) { - final double euCharge = this.getCharge(ItemUtils.getSimpleStack(this)); - if ((euCharge != 0) && (euCharge >= 1)){ - return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU)); - } - return 0; - } - int energy = stack.stackTagCompound.getInteger("Energy"); - final int energyExtracted = Math.min(energy, Math.min(this.maxExtract, this.maxExtract)); - if (!simulate) - { - energy -= energyExtracted; - stack.stackTagCompound.setInteger("Energy", energy); - ElectricItem.manager.discharge(stack, ElectricItem.manager.getCharge(stack), 3, true, true, false); - ElectricItem.manager.charge(stack, energy/rfPerEU, 3, true, false); - } - - return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); - } - - @Override - public double getCharge(final ItemStack stack) { - return ElectricItem.manager.getCharge(stack); - } - - @Override - public boolean canUse(final ItemStack stack, final double amount) { - return ElectricItem.manager.canUse(stack, amount); - } - - @Override - public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) { - return ElectricItem.manager.use(stack, amount, entity); - } - - @Override - public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) { - ElectricItem.manager.chargeFromArmor(stack, entity); - } - - @Override - public String getToolTip(final ItemStack stack) { - return ElectricItem.manager.getToolTip(stack); - } - - @Override - public int receiveEnergy(final ItemStack container, final int maxReceive, final boolean simulate) - { - if ((container.stackTagCompound == null) || (!container.stackTagCompound.hasKey("Energy"))) { - final double euCharge = this.getCharge(ItemUtils.getSimpleStack(this)); - if ((euCharge != 0) && (euCharge >= 1)){ - return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU)); - } - return 0; - } - int energy = container.stackTagCompound.getInteger("Energy"); - final int energyReceived = Math.min(this.capacity - energy, Math.min(this.maxReceive, maxReceive)); - if (!simulate) - { - energy += energyReceived; - container.stackTagCompound.setInteger("Energy", energy); - ElectricItem.manager.discharge(container, ElectricItem.manager.getCharge(container), 3, true, true, false); - ElectricItem.manager.charge(container, energy/rfPerEU, 3, true, false); - - } - return energyReceived; - } - - @Override - public int extractEnergy(final ItemStack container, final int maxExtract, final boolean simulate) - { - if ((container.stackTagCompound == null) || (!container.stackTagCompound.hasKey("Energy"))) { - final double euCharge = this.getCharge(ItemUtils.getSimpleStack(this)); - if ((euCharge != 0) && (euCharge >= 1)){ - return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU)); - } - return 0; - } - int energy = container.stackTagCompound.getInteger("Energy"); - final int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); - if (!simulate) - { - energy -= energyExtracted; - container.stackTagCompound.setInteger("Energy", energy); - ElectricItem.manager.discharge(container, ElectricItem.manager.getCharge(container), 3, true, true, false); - ElectricItem.manager.charge(container, energy/rfPerEU, 3, true, false); - } - return energyExtracted; - } - - @Override - public int getEnergyStored(final ItemStack container) - { - if ((container.stackTagCompound == null) || (!container.stackTagCompound.hasKey("Energy"))) { - final double euCharge = this.getCharge(ItemUtils.getSimpleStack(this)); - if ((euCharge != 0) && (euCharge >= 1)){ - return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU)); - } - return 0; - } - final int energy = container.stackTagCompound.getInteger("Energy"); - ElectricItem.manager.discharge(container, ElectricItem.manager.getCharge(container), 3, true, true, false); - ElectricItem.manager.charge(container, energy/rfPerEU, 3, true, false); - return energy; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/general/books/ItemBaseBook.java b/src/Java/gtPlusPlus/core/item/general/books/ItemBaseBook.java deleted file mode 100644 index 9ac09b92e4..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/books/ItemBaseBook.java +++ /dev/null @@ -1,130 +0,0 @@ -package gtPlusPlus.core.item.general.books; - -import static gtPlusPlus.core.handler.BookHandler.mBookMap; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemWritableBook; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.handler.BookHandler; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class ItemBaseBook extends ItemWritableBook{ - - public ItemBaseBook(){ - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setMaxStackSize(1); - this.setTextureName(CORE.MODID+":"+"itemBook"); - this.setUnlocalizedName("itembookgt"); - GameRegistry.registerItem(this, "bookGT"); - - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < BookHandler.mBookMap.size(); i ++) { - ItemStack bookstack = new ItemStack(item, 1, i); - - /*bookstack = Utils.getWrittenBook( - bookstack, - i, - mBookMap.get(i).mMapping, - mBookMap.get(i).mTitle, - mBookMap.get(i).mAuthor, - mBookMap.get(i).mPages);*/ - - NBTUtils.createIntegerTagCompound(bookstack, "stats", "mMeta", i); - list.add(bookstack); - } - } - - @Override - public String getItemStackDisplayName(final ItemStack tItem) { - if (NBTUtils.hasKey(tItem, "title")){ - return NBTUtils.getString(tItem, "title"); - } - else if (tItem.getItemDamage() > -1 && tItem.getItemDamage() <= mBookMap.size()){ - return EnumChatFormatting.ITALIC+""+mBookMap.get(tItem.getItemDamage()).mTitle; - } - //NBTUtils.tryIterateNBTData(tItem); - return "GT++ Storybook"; - } - - @Override - public void addInformation(ItemStack tItem, EntityPlayer player, List list, boolean bool) { - // TODO Auto-generated method stub - if (NBTUtils.hasKey(tItem, "author")){ - list.add(EnumChatFormatting.GRAY+"Author: "+NBTUtils.getString(tItem, "author")); - } - else if (mBookMap.get(tItem.getItemDamage()).mAuthor != null){ - list.add(EnumChatFormatting.WHITE+"Author: "+mBookMap.get(tItem.getItemDamage()).mAuthor); - } - if (NBTUtils.hasKey(tItem, "title")){ - list.add(EnumChatFormatting.GRAY+"Pages: "+NBTUtils.getString(tItem, "pages")); - } - else if (mBookMap.get(tItem.getItemDamage()).mPages != null){ - list.add(EnumChatFormatting.WHITE+"Pages: "+mBookMap.get(tItem.getItemDamage()).mPages.length); - } - //super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_); - } - - @Override - public boolean isRepairable() { - return false; - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { - //player.displayGUIBook(item); - int i = item.getItemDamage(); - ItemStack bookstack = Utils.getWrittenBook( - null, - mBookMap.get(i).mMeta, - mBookMap.get(i).mMapping, - mBookMap.get(i).mTitle, - mBookMap.get(i).mAuthor, - mBookMap.get(i).mPages); - - if (player.worldObj.isRemote){ - try { - Class<?> clazz = ReflectionUtils.getClass("net.minecraft.client.gui.GuiScreenBook"); - Constructor<?> ctor = clazz.getConstructor(EntityPlayer.class, ItemStack.class, boolean.class); - Object object = ctor.newInstance(new Object[] { player, bookstack, false }); - Minecraft.getMinecraft().displayGuiScreen((GuiScreen) object); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - //Minecraft.getMinecraft().displayGuiScreen(new GuiScreenBook(player, bookstack, false)); - } - return item; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/general/capture/ItemEntityCatcher.java b/src/Java/gtPlusPlus/core/item/general/capture/ItemEntityCatcher.java deleted file mode 100644 index a95fab4b6c..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/capture/ItemEntityCatcher.java +++ /dev/null @@ -1,246 +0,0 @@ -package gtPlusPlus.core.item.general.capture; - -import java.util.List; -import java.util.UUID; - -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.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; - -import gtPlusPlus.api.interfaces.IEntityCatcher; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class ItemEntityCatcher extends Item implements IEntityCatcher { - - // PlayerInteractEvent.EntityInteract; - - - public ItemEntityCatcher() { - //Probably won't ever need this event handler. - //Utils.registerEvent(this); - this.setUnlocalizedName("itemDragonJar"); - this.setTextureName(CORE.MODID + ":" + getUnlocalizedName()); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setMaxStackSize(16); - this.setMaxDamage(0); - GameRegistry.registerItem(this, getUnlocalizedName()); - } - - @Override - public boolean hasEntity(ItemStack aStack) { - if (NBTUtils.hasKey(aStack, "mHasEntity")) { - return NBTUtils.getBoolean(aStack, "mHasEntity"); - } - return false; - } - - @Override - public Entity getStoredEntity(World aWorld, ItemStack aStack) { - if (aStack == null || !hasEntity(aStack)) { - Logger.INFO("Cannot get stored entity."); - return null; - } - - Entity mEntityToSpawn; - int mEntityID; - Logger.WARNING("getStoredEntity(1)"); - - mEntityID = NBTUtils.getInteger(aStack, "mEntityID"); - mEntityToSpawn = EntityList.createEntityByID(mEntityID, aWorld); - if (mEntityToSpawn != null) { - Logger.WARNING("getStoredEntity(2)"); - return mEntityToSpawn; - } - - Logger.INFO("Failed to get stored entity. - getStoredEntity()"); - return null; - } - - @Override - public boolean setStoredEntity(World aWorld, ItemStack aStack, Entity aEntity) { - if (aEntity == null) { - NBTUtils.setBoolean(aStack, "mHasEntity", false); - Logger.INFO("Bad Entity being stored."); - return false; - } - - Logger.WARNING("setStoredEntity(1)"); - - NBTTagCompound mEntityData; - Class<? extends Entity> mEntityClass; - String mClassName; - String mEntityName; - int mEntityID, mEntityHashcode; - UUID mUuidPersistent, mUuidUnique; - Logger.WARNING("setStoredEntity(2)"); - - mEntityData = aEntity.getEntityData(); - mEntityClass = aEntity.getClass(); - mClassName = mEntityClass.getName(); - mEntityName = aEntity.getCommandSenderName(); - // mEntityID = aEntity.getEntityId(); - mEntityID = EntityList.getEntityID(aEntity); - mEntityHashcode = aEntity.hashCode(); - mUuidPersistent = aEntity.getPersistentID(); - mUuidUnique = aEntity.getUniqueID(); - Logger.WARNING("setStoredEntity(3)"); - - NBTUtils.createTagCompound(aStack, "mEntityData", mEntityData); - NBTUtils.setString(aStack,"mEntityName", mEntityName); - NBTUtils.setInteger(aStack,"mEntityID", mEntityID); - NBTUtils.setString(aStack,"mClassName", mClassName); - NBTUtils.setString(aStack,"mUuidPersistent", mUuidPersistent.toString()); - NBTUtils.setString(aStack,"mUuidUnique", mUuidUnique.toString()); - NBTUtils.setInteger(aStack,"mEntityHashcode", mEntityHashcode); - NBTUtils.setBoolean(aStack,"mHasEntity", true); - Logger.WARNING("setStoredEntity(4)"); - return true; - } - - @SuppressWarnings("unchecked") - @Override - public Class<? extends Entity> getStoredEntityClass(ItemStack aStack) { - if (aStack == null || !hasEntity(aStack)) { - return null; - } - Class<? extends Entity> mEntityClass; - String mClassName; - mClassName = NBTUtils.getString(aStack, "mClassName"); - mEntityClass = (Class<? extends Entity>) ReflectionUtils.getClass(mClassName); - if (mEntityClass != null) { - return mEntityClass; - } - return null; - } - - @Override - public boolean spawnStoredEntity(World aWorld, ItemStack aStack, BlockPos aPos) { - if (aStack == null || !hasEntity(aStack)) { - Logger.INFO("Cannot release, either invalid Itemstack or no entity stored."); - return false; - } - - NBTTagCompound mEntityData = NBTUtils.getTagCompound(aStack, "mEntityData"); - - int mEntityID = NBTUtils.getInteger(aStack,"mEntityID"); - String mClassName = NBTUtils.getString(aStack,"mClassName"); - UUID mUuidPersistent = UUID.fromString(NBTUtils.getString(aStack,"mUuidPersistent")); - UUID mUuidUnique = UUID.fromString(NBTUtils.getString(aStack,"mUuidUnique")); - int mEntityHashcode = NBTUtils.getInteger(aStack,"mEntityHashcode"); - - EntityLiving mEntityToSpawn = (EntityLiving) getStoredEntity(aWorld, aStack); - Class<? extends Entity> mEntityClass = getStoredEntityClass(aStack); - - Logger.WARNING("spawnStoredEntity(1)"); - - if (mEntityToSpawn != null && mEntityClass != null) { - Logger.WARNING("spawnStoredEntity(2)"); - if (mEntityToSpawn.getEntityData() != mEntityData) { - Logger.WARNING("spawnStoredEntity(x)"); - NBTUtils.setEntityCustomData(mEntityToSpawn, mEntityData); - } - - mEntityToSpawn.setLocationAndAngles(aPos.xPos, aPos.yPos, aPos.zPos, aWorld.rand.nextFloat() * 360.0F, - 0.0F); - if (mEntityToSpawn != null) { - mEntityToSpawn.onSpawnWithEgg(null); - aWorld.spawnEntityInWorld(mEntityToSpawn); - Logger.WARNING("spawnStoredEntity(3)"); - } - if (mEntityToSpawn != null) { - mEntityToSpawn.playLivingSound(); - Logger.WARNING("spawnStoredEntity(4)"); - } - Logger.WARNING("spawnStoredEntity(5)"); - NBTUtils.setBoolean(aStack,"mHasEntity", false); - return true; - } - Logger.INFO("Failed to spawn stored entity. - spawnStoredEntity()"); - return false; - } - - @Override - public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - return super.onItemRightClick(aStack, aWorld, aPlayer); - } - - @Override - public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) { - if (hasEntity(p_77624_1_)){ - String mName = NBTUtils.getString(p_77624_1_,"mEntityName"); - if (mName != null && !mName.equals("")){ - p_77624_3_.add(EnumChatFormatting.GRAY+"Contains a "+mName+"."); - } - } - else { - p_77624_3_.add(EnumChatFormatting.GRAY+"Does not contain anything."); - } - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return false; - } - - @Override - public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, - float xOffset, float yOffset, float zOffset) { - if (Utils.isServer()) { - Logger.WARNING("Trying to release (1)"); - if (NBTUtils.hasKey(itemstack,"mHasEntity") - && NBTUtils.getBoolean(itemstack,"mHasEntity")) { - Logger.WARNING("Trying to release (2)"); - boolean mDidSpawn = spawnStoredEntity(world, itemstack, new BlockPos(x, y+1, z, world)); - - if (!mDidSpawn){ - PlayerUtils.messagePlayer(player, "You failed to release a "+NBTUtils.getString(itemstack,"mEntityName")+"."); - } - - return mDidSpawn; - - } - } - return super.onItemUse(itemstack, player, world, x, y, z, side, xOffset, yOffset, zOffset); - - } - - @Override - public boolean itemInteractionForEntity(ItemStack aStack, EntityPlayer aPlayer, EntityLivingBase aEntity) { - if (Utils.isServer()) { - Logger.WARNING("Trying to catch (1)"); - if (!hasEntity(aStack)) { - Logger.WARNING("Trying to catch (2)"); - boolean mStored = setStoredEntity(aPlayer.worldObj, aStack, aEntity); - if (mStored) { - Logger.WARNING("Trying to catch (3)"); - aEntity.setDead(); - PlayerUtils.messagePlayer(aPlayer, "You have captured a "+NBTUtils.getString(aStack,"mEntityName")+" in the Jar."); - //NBTUtils.tryIterateNBTData(aStack); - } - } - } - return super.itemInteractionForEntity(aStack, aPlayer, aEntity); - } - - @Override - public String getItemStackDisplayName(ItemStack aStack) { - if (hasEntity(aStack)){ - return "Captured Dragon Jar"; - } - return "Dragon Capture Jar"; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/general/chassis/ItemBoilerChassis.java b/src/Java/gtPlusPlus/core/item/general/chassis/ItemBoilerChassis.java deleted file mode 100644 index 86c52cc048..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/chassis/ItemBoilerChassis.java +++ /dev/null @@ -1,86 +0,0 @@ -package gtPlusPlus.core.item.general.chassis; -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; - -public class ItemBoilerChassis extends Item { - - public IIcon[] icons = new IIcon[1]; - - public ItemBoilerChassis() { - super(); - this.setHasSubtypes(true); - String unlocalizedName = "itemBoilerChassis"; - this.setUnlocalizedName(unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabMisc); - GameRegistry.registerItem(this, unlocalizedName); - } - - @Override - public void registerIcons(IIconRegister reg) { - this.icons[0] = reg.registerIcon(CORE.MODID + ":" + "itemBoilerChassis"); - } - - @Override - public IIcon getIconFromDamage(int meta) { - return this.icons[0]; - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 3; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return this.getUnlocalizedName() + "_" + stack.getItemDamage(); - } - - @Override - public String getItemStackDisplayName(final ItemStack tItem) { - String itemName = "Advanced Boiler Chassis"; - String suffixName = ""; - if (tItem.getItemDamage() == 0){ - suffixName = " [Tier 1]"; - } - else if (tItem.getItemDamage() == 1){ - suffixName = " [Tier 2]"; - } - else if (tItem.getItemDamage() == 2){ - suffixName = " [Tier 3]"; - } - return (itemName+suffixName); - - } - - @Override //TODO - public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { - int meta = stack.getItemDamage(); - if (meta == 0){ - HEX_OxFFFFFF = Utils.rgbtoHexValue(10,110,30); - } - else if (meta == 1){ - HEX_OxFFFFFF = Utils.rgbtoHexValue(150,180,35); - } - else if (meta == 2){ - HEX_OxFFFFFF = Utils.rgbtoHexValue(200,85,40); - } - else if (meta == 3){ - HEX_OxFFFFFF = Utils.rgbtoHexValue(255,100,50); - } - return HEX_OxFFFFFF; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/general/chassis/ItemDehydratorCoil.java b/src/Java/gtPlusPlus/core/item/general/chassis/ItemDehydratorCoil.java deleted file mode 100644 index be1fdfc491..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/chassis/ItemDehydratorCoil.java +++ /dev/null @@ -1,93 +0,0 @@ -package gtPlusPlus.core.item.general.chassis; - -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; - -public class ItemDehydratorCoil extends Item { - - public IIcon[] icons = new IIcon[4]; - - public ItemDehydratorCoil() { - super(); - this.setHasSubtypes(true); - String unlocalizedName = "itemDehydratorCoil"; - this.setUnlocalizedName(unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabMisc); - GameRegistry.registerItem(this, unlocalizedName); - } - - @Override - public void registerIcons(IIconRegister reg) { - this.icons[0] = reg.registerIcon(CORE.MODID + ":" + "dehydrator/itemDehydratorCoil_0"); - this.icons[1] = reg.registerIcon(CORE.MODID + ":" + "dehydrator/itemDehydratorCoil_1"); - this.icons[2] = reg.registerIcon(CORE.MODID + ":" + "dehydrator/itemDehydratorCoil_2"); - this.icons[3] = reg.registerIcon(CORE.MODID + ":" + "dehydrator/itemDehydratorCoil_3"); - } - - @Override - public IIcon getIconFromDamage(int meta) { - return this.icons[meta]; - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 4; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return this.getUnlocalizedName() + "_" + stack.getItemDamage(); - } - - @Override - public String getItemStackDisplayName(final ItemStack tItem) { - String itemName = "Dehydrator Coil"; - String suffixName = ""; - if (tItem.getItemDamage() == 0){ - suffixName = " [EV]"; - } - else if (tItem.getItemDamage() == 1){ - suffixName = " [IV]"; - } - else if (tItem.getItemDamage() == 2){ - suffixName = " [LuV]"; - } - else if (tItem.getItemDamage() == 3){ - suffixName = " [ZPM]"; - } - return (itemName+suffixName); - - } - - /*@Override - public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { - int meta = stack.getItemDamage(); - if (meta == 0){ - HEX_OxFFFFFF = Utils.rgbtoHexValue(10,110,30); - } - else if (meta == 1){ - HEX_OxFFFFFF = Utils.rgbtoHexValue(150,180,35); - } - else if (meta == 2){ - HEX_OxFFFFFF = Utils.rgbtoHexValue(200,85,40); - } - else if (meta == 3){ - HEX_OxFFFFFF = Utils.rgbtoHexValue(255,150,50); - } - return HEX_OxFFFFFF; - }*/ - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/general/chassis/ItemDehydratorCoilWire.java b/src/Java/gtPlusPlus/core/item/general/chassis/ItemDehydratorCoilWire.java deleted file mode 100644 index 99d4a139dd..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/chassis/ItemDehydratorCoilWire.java +++ /dev/null @@ -1,93 +0,0 @@ -package gtPlusPlus.core.item.general.chassis; - -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; - -public class ItemDehydratorCoilWire extends Item { - - public IIcon[] icons = new IIcon[4]; - - public ItemDehydratorCoilWire() { - super(); - this.setHasSubtypes(true); - String unlocalizedName = "itemDehydratorCoilWire"; - this.setUnlocalizedName(unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabMisc); - GameRegistry.registerItem(this, unlocalizedName); - } - - @Override - public void registerIcons(IIconRegister reg) { - this.icons[0] = reg.registerIcon(CORE.MODID + ":" + "dehydrator/itemDehydratorCoilWire_0"); - this.icons[1] = reg.registerIcon(CORE.MODID + ":" + "dehydrator/itemDehydratorCoilWire_1"); - this.icons[2] = reg.registerIcon(CORE.MODID + ":" + "dehydrator/itemDehydratorCoilWire_2"); - this.icons[3] = reg.registerIcon(CORE.MODID + ":" + "dehydrator/itemDehydratorCoilWire_3"); - } - - @Override - public IIcon getIconFromDamage(int meta) { - return this.icons[meta]; - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 4; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return this.getUnlocalizedName() + "_" + stack.getItemDamage(); - } - - @Override - public String getItemStackDisplayName(final ItemStack tItem) { - String itemName = "Coil Wire"; - String suffixName = ""; - if (tItem.getItemDamage() == 0){ - suffixName = " [EV]"; - } - else if (tItem.getItemDamage() == 1){ - suffixName = " [IV]"; - } - else if (tItem.getItemDamage() == 2){ - suffixName = " [LuV]"; - } - else if (tItem.getItemDamage() == 3){ - suffixName = " [ZPM]"; - } - return (itemName+suffixName); - - } - -/* @Override - public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { - int meta = stack.getItemDamage(); - if (meta == 0){ - HEX_OxFFFFFF = Utils.rgbtoHexValue(10,110,30); - } - else if (meta == 1){ - HEX_OxFFFFFF = Utils.rgbtoHexValue(150,180,35); - } - else if (meta == 2){ - HEX_OxFFFFFF = Utils.rgbtoHexValue(200,85,40); - } - else if (meta == 3){ - HEX_OxFFFFFF = Utils.rgbtoHexValue(255,150,50); - } - return HEX_OxFFFFFF; - }*/ - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java b/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java deleted file mode 100644 index 628fba9291..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java +++ /dev/null @@ -1,223 +0,0 @@ -package gtPlusPlus.core.item.general.fuelrods; - -import java.util.List; - -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; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; - -public class FuelRod_Base extends Item{ - - public int fuelRemaining = 0; - public int maximumFuel = 0; - public String fuelType = ""; - public float heat = 0; - public float maxHeat = this.getMaxHeat(); - public FuelRod_Base(final String unlocalizedName, final String type, final int fuelLeft, final int maxFuel) { - this.setUnlocalizedName(unlocalizedName); - this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setMaxStackSize(1); - this.setMaxDamage(maxFuel); - this.maximumFuel = maxFuel; - this.fuelRemaining = fuelLeft; - this.fuelType = type; - this.setCreativeTab(AddToCreativeTab.tabMachines); - } - - private float getMaxHeat(){ - float tempvar; - if (this.fuelType == "Thorium"){ - tempvar = 2500; - } - - else if (this.fuelType == "Uranium"){ - tempvar = 5000; - } - - else if (this.fuelType == "Plutonium"){ - tempvar = 10000; - } - - else { - tempvar = 5000; - } - return tempvar; - - } - - private void updateVars(final ItemStack stack){ - if (stack.stackTagCompound != null) { - this.heat = stack.stackTagCompound.getFloat("heat"); - this.fuelRemaining = stack.stackTagCompound.getInteger("fuelRemaining"); - } - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - - Float NBT_Heat = this.heat; - Float NBT_MaxHeat = this.maxHeat; - int NBT_Fuel = this.fuelRemaining; - String NBT_Type= this.fuelType; - - 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"); - } - - final String tempHeat = String.valueOf(NBT_Heat); - final String tempMaxHeat = String.valueOf(NBT_MaxHeat); - final String tempFuel = String.valueOf(NBT_Fuel); - final String formattedType = EnumChatFormatting.DARK_RED+NBT_Type+EnumChatFormatting.GRAY; - String formattedHeat = EnumChatFormatting.RED+tempHeat+EnumChatFormatting.GRAY; - final String formattedMaxHeat = EnumChatFormatting.RED+tempMaxHeat+EnumChatFormatting.GRAY; - String formattedFuelLeft = tempFuel+EnumChatFormatting.GRAY; - - final int tempMax = this.maximumFuel; - final float tempCurrentHeat = this.heat; - final int tempFuelLeft = this.fuelRemaining; - - //Fuel Usage Formatting - if (tempFuelLeft <= (this.maximumFuel/3)){ - formattedFuelLeft = EnumChatFormatting.RED+tempFuel+EnumChatFormatting.GRAY; - } - else if ((tempFuelLeft >= (this.maximumFuel/3)) && (tempFuelLeft <= ((this.maximumFuel/3)*2))){ - formattedFuelLeft = EnumChatFormatting.YELLOW+tempFuel+EnumChatFormatting.GRAY; - } - else if ((tempFuelLeft >= ((this.maximumFuel/3)*2)) && (tempFuelLeft <= this.maximumFuel)){ - formattedFuelLeft = EnumChatFormatting.GREEN+tempFuel+EnumChatFormatting.GRAY; - } - else { - formattedFuelLeft = EnumChatFormatting.GRAY+tempFuel+EnumChatFormatting.GRAY; - } - - //Heat Formatting - if ((tempCurrentHeat <= 200) && (tempCurrentHeat >= 0)){ - formattedHeat = EnumChatFormatting.GRAY+tempHeat+EnumChatFormatting.GRAY; - } - else if ((tempCurrentHeat <= (this.maxHeat/3)) && (tempCurrentHeat > 200)){ - formattedHeat = EnumChatFormatting.YELLOW+tempHeat+EnumChatFormatting.GRAY; - } - else if ((tempCurrentHeat >= (this.maxHeat/3)) && (tempMax < ((this.maxHeat/3)*2)) && (tempCurrentHeat != 0)){ - formattedHeat = EnumChatFormatting.GOLD+tempHeat+EnumChatFormatting.GRAY; - } - else if ((tempCurrentHeat >= ((this.maxHeat/3)*2)) && (tempMax <= this.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(final ItemStack stack){ - if (stack.stackTagCompound != null){ - return stack.stackTagCompound.getString("fuelType"); - } - return this.fuelType; - } - - public int getFuelRemaining(final ItemStack stack){ - if (stack.stackTagCompound != null){ - return stack.stackTagCompound.getInteger("fuelRemaining"); - } - return 0; - } - - public int getMaxFuel(){ - return this.maximumFuel; - } - - public int getFuel(final ItemStack stack){ - if (stack != null){ - final int i = stack.getItemDamage(); - final int r = this.maximumFuel - i; - return r; - } - return 0; - } - - public boolean setFuelRemainingExplicitly(final int i){ - final int tempFuel = this.fuelRemaining; - this.fuelRemaining = i; - if (i != tempFuel){ - return true; - } - return false; - } - - public boolean addFuel(final int i){ - final int tempFuel = this.fuelRemaining; - this.fuelRemaining = tempFuel+i; - if (this.fuelRemaining != tempFuel){ - return true; - } - return false; - } - - public float getHeat(final ItemStack value){ - if (value.stackTagCompound != null){ - return value.stackTagCompound.getFloat("heat"); - } - return 0f; - } - - public boolean addHeat(final float i){ - final float tempFuel = this.heat; - this.heat = tempFuel+i; - if (this.heat != tempFuel){ - return true; - } - return false; - } - - - //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(final ItemStack itemStack, final World world, final EntityPlayer player) { - itemStack.stackTagCompound = new NBTTagCompound(); - itemStack.stackTagCompound.setInteger("fuelRemaining", this.getFuelRemaining(itemStack)); - itemStack.stackTagCompound.setInteger("maximumFuel", this.maximumFuel); - itemStack.stackTagCompound.setFloat("heat", this.getHeat(itemStack)); - itemStack.stackTagCompound.setFloat("maxHeat", this.getMaxHeat()); - itemStack.stackTagCompound.setString("fuelType", this.getType(itemStack)); - this.updateVars(itemStack); - } - - @Override - public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4, final boolean par5) { - itemStack.stackTagCompound = new NBTTagCompound(); - itemStack.stackTagCompound.setInteger("fuelRemaining", this.getFuelRemaining(itemStack)); - itemStack.stackTagCompound.setInteger("maximumFuel", this.maximumFuel); - itemStack.stackTagCompound.setFloat("heat", this.getHeat(itemStack)); - itemStack.stackTagCompound.setFloat("maxHeat", this.getMaxHeat()); - itemStack.stackTagCompound.setString("fuelType", this.getType(itemStack)); - this.updateVars(itemStack); - } - - - -} diff --git a/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java b/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java deleted file mode 100644 index dbf1209b50..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java +++ /dev/null @@ -1,13 +0,0 @@ -package gtPlusPlus.core.item.general.fuelrods; - -public class FuelRod_Thorium extends FuelRod_Base{ - - public FuelRod_Thorium(final String unlocalizedName, final String type, final int fuelLeft, final int maxFuel) { - super(unlocalizedName, type, fuelLeft, maxFuel); - this.setMaxDamage(maxFuel); - this.maximumFuel = maxFuel; - this.fuelRemaining = fuelLeft; - this.fuelType = type; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/general/rfchargingpack/ChargingPackBase.java b/src/Java/gtPlusPlus/core/item/general/rfchargingpack/ChargingPackBase.java deleted file mode 100644 index 238e765384..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/rfchargingpack/ChargingPackBase.java +++ /dev/null @@ -1,84 +0,0 @@ -package gtPlusPlus.core.item.general.rfchargingpack; - -import java.util.List; - -import cofh.api.energy.ItemEnergyContainer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import gtPlusPlus.core.util.math.MathUtils; - -public class ChargingPackBase extends ItemEnergyContainer { - - protected final int mCapacityMax; - protected final byte mTier; - - public ChargingPackBase(byte tier) { - this(tier, (tier == 1 ? 4000000 : tier == 2 ? 8000000 : tier == 3 ? 16000000 : tier == 4 ? 32000000 : 64000000)); - } - - private ChargingPackBase(byte tier, int maxStorage) { - super(maxStorage); - mTier = tier; - mCapacityMax = maxStorage; - } - - public int getMaxEnergyInput(ItemStack container) - { - return this.maxReceive; - } - - public int getMaxEnergyExtracted(ItemStack container) - { - return this.maxExtract; - } - - @Override - public void onUpdate(ItemStack aStack, World aWorld, Entity aEnt, int p_77663_4_, boolean p_77663_5_) { - super.onUpdate(aStack, aWorld, aEnt, p_77663_4_, p_77663_5_); - - ItemEnergyContainer current = this; - int currentStored = 0; - if (current != null) { - currentStored = current.getEnergyStored(aStack); - } - if (currentStored > 0) { - if (aEnt instanceof EntityPlayer) { - if (((EntityPlayer) aEnt).inventory != null) { - for (ItemStack invStack : ((EntityPlayer) aEnt).inventory.mainInventory) { - if (invStack != null) { - if (invStack.getItem() instanceof ItemEnergyContainer) { - if (current != null) { - currentStored = current.getEnergyStored(aStack); - if (currentStored > 0) { - int mTransLimit; - int mMaxStorage; - int mCurrent; - mTransLimit = getMaxEnergyInput(invStack); - mMaxStorage = current.getMaxEnergyStored(invStack); - mCurrent = current.getEnergyStored(invStack); - if (mCurrent+mTransLimit <= mMaxStorage) { - current.extractEnergy(aStack, current.receiveEnergy(invStack, mTransLimit, false), false); - } - } - } - } - } - } - } - } - } - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) { - list.add(EnumChatFormatting.RED+"RF Information"); - list.add(EnumChatFormatting.GRAY+"Extraction Rate: [" +EnumChatFormatting.RED+ this.maxExtract + EnumChatFormatting.GRAY + "Rf/t]" + " Insert Rate: [" +EnumChatFormatting.RED+ this.maxReceive+EnumChatFormatting.GRAY+"Rf/t]"); - list.add(EnumChatFormatting.GRAY+"Current Charge: ["+EnumChatFormatting.RED+this.getEnergyStored(stack) + EnumChatFormatting.GRAY + "Rf / " + this.getMaxEnergyStored(stack)+"Rf] "+EnumChatFormatting.RED+MathUtils.findPercentage(this.getEnergyStored(stack), this.getMaxEnergyStored(stack))+EnumChatFormatting.GRAY+"%"); - super.addInformation(stack, p_77624_2_, list, p_77624_4_); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/general/spawn/ItemCustomSpawnEgg.java b/src/Java/gtPlusPlus/core/item/general/spawn/ItemCustomSpawnEgg.java deleted file mode 100644 index 727b933fa7..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/spawn/ItemCustomSpawnEgg.java +++ /dev/null @@ -1,285 +0,0 @@ -package gtPlusPlus.core.item.general.spawn; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.block.Block; -import net.minecraft.block.BlockLiquid; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.*; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.*; -import net.minecraft.util.*; -import net.minecraft.world.World; - -public class ItemCustomSpawnEgg extends ItemMonsterPlacer { - - private static final HashMap<Integer, IIcon> mIconMap = new HashMap<Integer, IIcon>(); - private static int mTotalMetaItems = 0; - - private static final HashMap<Integer, Integer> mMaxStackSizeMap = new HashMap<Integer, Integer>(); - private static final HashMap<Integer, EnumRarity> mRarityMap = new HashMap<Integer, EnumRarity>(); - private static final HashMap<Integer, ArrayList<String>> mOreDictNames = new HashMap<Integer, ArrayList<String>>(); - - private static final HashMap<Integer, Integer> mColourBaseMap = new HashMap<Integer, Integer>(); - private static final HashMap<Integer, Integer> mColourSpotsMap = new HashMap<Integer, Integer>(); - private static final HashMap<Integer, String> mEntityNameMap = new HashMap<Integer, String>(); - private static final HashMap<Integer, String> mEntityFullNameMap = new HashMap<Integer, String>(); - - private static final HashMap<String, Integer> mReverseEntityMap = new HashMap<String, Integer>(); - - protected EntityLiving entityToSpawn = null; - - public static ItemStack getSpawnEggForEntityname(String aEntityName, int aSize) { - return ItemUtils.simpleMetaStack(ModItems.itemCustomSpawnEgg, mReverseEntityMap.get(aEntityName), aSize); - } - - public static void registerEntityForSpawnEgg(final int aMetaID, String parEntityToSpawnName, int aPrimaryColor, int aSecondaryColor) { - registerEntityForSpawnEgg(aMetaID, parEntityToSpawnName, aPrimaryColor, aSecondaryColor, EnumRarity.common, new ArrayList<String>()); - } - - public static void registerEntityForSpawnEgg(final int aMetaID, String parEntityToSpawnName, int aPrimaryColor, int aSecondaryColor, EnumRarity aRarity, final ArrayList<String> aOreDictNames) { - mTotalMetaItems++; - mMaxStackSizeMap.put(aMetaID, 64); - mRarityMap.put(aMetaID, aRarity); - mOreDictNames.put(aMetaID, aOreDictNames); - mColourBaseMap.put(aMetaID, aPrimaryColor); - mColourSpotsMap.put(aMetaID, aSecondaryColor); - mReverseEntityMap.put(parEntityToSpawnName, aMetaID); - setEntityToSpawnName(aMetaID, parEntityToSpawnName); - } - - public static void registerEggsToOreDict() { - for (int aMetaID = 0; aMetaID < mTotalMetaItems; aMetaID++) { - ArrayList<String> aOreDictNames = mOreDictNames.get(aMetaID); - if (aOreDictNames != null && !aOreDictNames.isEmpty()) { - ItemStack aFoodStack = ItemUtils.simpleMetaStack(ModItems.itemCustomSpawnEgg, aMetaID, 1 - ); - for (String aOreName : aOreDictNames) { - ItemUtils.addItemToOreDictionary(aFoodStack, aOreName); - } - } - } - } - - public ItemCustomSpawnEgg() { - super(); - this.setNoRepair(); - this.setMaxStackSize(64); - this.setMaxDamage(0); - this.setUnlocalizedName("BasicMetaSpawnEgg"); - GameRegistry.registerItem(this, this.getUnlocalizedName()); - } - - /** - * Callback for item usage. If the item does something special on right - * clicking, - * - * he will have one of those. Return True if something happen and false if - * it don't. This is for ITEMS, not BLOCKS - */ - @Override - public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10){ - if (par3World.isRemote) { - return true; - } - else { - Block block = par3World.getBlock(par4, par5, par6); - par4 += Facing.offsetsXForSide[par7]; - par5 += Facing.offsetsYForSide[par7]; - par6 += Facing.offsetsZForSide[par7]; - double d0 = 0.0D; - - if (par7 == 1 && block.getRenderType() == 11) { - d0 = 0.5D; - } - - Entity entity = spawnEntity(par1ItemStack, par3World, par4 + 0.5D, par5 + d0, par6 + 0.5D); - - if (entity != null) { - if (entity instanceof EntityLivingBase - && par1ItemStack.hasDisplayName()) { - ((EntityLiving) entity).setCustomNameTag( - par1ItemStack.getDisplayName() - ); - } - - if (!par2EntityPlayer.capabilities.isCreativeMode) { - --par1ItemStack.stackSize; - } - } - - return true; - } - } - - /** - * Called whenever this item is equipped and the right mouse button is - * pressed. - * - * Args: itemStack, world, entityPlayer - */ - @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { - if (par2World.isRemote) { - return par1ItemStack; - } - else { - MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true); - - if (movingobjectposition == null) { - return par1ItemStack; - } - else { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; - - if (!par2World.canMineBlock(par3EntityPlayer, i, j, k)) { - return par1ItemStack; - } - - if (!par3EntityPlayer.canPlayerEdit( - i, j, k, movingobjectposition - - .sideHit, par1ItemStack - )) { - return par1ItemStack; - } - - if (par2World.getBlock(i, j, k) instanceof BlockLiquid) { - Entity entity = spawnEntity(par1ItemStack, par2World, i, j, k); - - if (entity != null) { - if (entity instanceof EntityLivingBase - && par1ItemStack - - .hasDisplayName()) { - ((EntityLiving) entity).setCustomNameTag( - par1ItemStack - - .getDisplayName() - ); - } - - if (!par3EntityPlayer.capabilities.isCreativeMode) { - --par1ItemStack.stackSize; - } - } - } - } - - return par1ItemStack; - } - } - } - - /** - * Spawns the creature specified by the egg's type in the location specified - * by - * - * the last three parameters. Parameters: world, entityID, x, y, z. - * @param par1ItemStack - */ - public Entity spawnEntity(ItemStack par1ItemStack, World parWorld, double parX, double parY, double parZ) { - - if (!parWorld.isRemote) // never spawn entity on client side - { - int aDamage = par1ItemStack.getItemDamage(); - String entityToSpawnNameFull = mEntityFullNameMap.get(aDamage); - String entityToSpawnName = mEntityNameMap.get(aDamage); - //entityToSpawnNameFull = WildAnimals.MODID + "." + entityToSpawnName; - if (EntityList.stringToClassMapping.containsKey(entityToSpawnNameFull)) { - entityToSpawn = (EntityLiving) EntityList.createEntityByName(entityToSpawnNameFull, parWorld); - entityToSpawn.setLocationAndAngles(parX, parY, parZ, MathHelper.wrapAngleTo180_float(parWorld.rand.nextFloat() * 360.0F), 0.0F); - parWorld.spawnEntityInWorld(entityToSpawn); - entityToSpawn.onSpawnWithEgg((IEntityLivingData) null); - entityToSpawn.playLivingSound(); - } - else { - // DEBUG - System.out.println("Entity not found " + entityToSpawnName); - } - } - - return entityToSpawn; - } - - /** - * returns a list of items with the same ID, but different meta (eg: dye - * returns 16 items) - */ - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) { - for (int aMeta : mReverseEntityMap.values()) { - aList.add(ItemUtils.simpleMetaStack(aItem, aMeta, 1)); - } - } - - @Override - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack par1ItemStack, int parColorType) { - int aID = par1ItemStack.getItemDamage(); - return (parColorType == 0) ? mColourBaseMap.get(aID) : mColourSpotsMap.get(aID); - } - - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() { - return true; - } - - @Override - // Doing this override means that there is no localization for language - // unless you specifically check for localization here and convert - public String getItemStackDisplayName(ItemStack par1ItemStack) { - return "Spawn " + mEntityNameMap.get(par1ItemStack.getItemDamage()); - } - - - @Override - public void registerIcons(final IIconRegister u) { - mIconMap.put(0, u.registerIcon(CORE.MODID + ":" + "spawn_egg")); - mIconMap.put(1, u.registerIcon(CORE.MODID + ":" + "spawn_egg_overlay")); - } - - @Override - public IIcon getIconFromDamageForRenderPass(final int damage, final int renderPass) { - return mIconMap.get(renderPass); - } - - @Override - public IIcon getIconFromDamage(int damage) { - return getIconFromDamageForRenderPass(0, 0); - } - - @Override - public IIcon getIcon(ItemStack aStack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { - return getIconFromDamageForRenderPass(0, renderPass); - } - - @Override - public IIcon getIcon(ItemStack aStack, int renderPass) { - return getIconFromDamageForRenderPass(0, renderPass); - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName() + "." + stack.getItemDamage(); - } - - public static void setEntityToSpawnName(int aMetaID, String parEntityToSpawnName) { - mEntityNameMap.put(aMetaID, parEntityToSpawnName); - mEntityFullNameMap.put(aMetaID, CORE.MODID + "." + parEntityToSpawnName); - } -} diff --git a/src/Java/gtPlusPlus/core/item/general/throwables/ItemHydrofluoricAcidPotion.java b/src/Java/gtPlusPlus/core/item/general/throwables/ItemHydrofluoricAcidPotion.java deleted file mode 100644 index 57cf8986fa..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/throwables/ItemHydrofluoricAcidPotion.java +++ /dev/null @@ -1,30 +0,0 @@ -package gtPlusPlus.core.item.general.throwables; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.entity.projectile.EntityHydrofluoricAcidPotion; -import gtPlusPlus.core.item.base.CoreItem; - -public class ItemHydrofluoricAcidPotion extends CoreItem { - - public ItemHydrofluoricAcidPotion(String unlocalizedName, String displayName, String description) { - super(unlocalizedName, displayName, AddToCreativeTab.tabMisc, 16, 0, new String[] {description}, EnumRarity.uncommon, EnumChatFormatting.GRAY, false, null); - } - - @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { - if (!player.capabilities.isCreativeMode) { - --item.stackSize; - } - world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); - if (!world.isRemote) { - world.spawnEntityInWorld(new EntityHydrofluoricAcidPotion(world, player)); - } - return item; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/general/throwables/ItemSulfuricAcidPotion.java b/src/Java/gtPlusPlus/core/item/general/throwables/ItemSulfuricAcidPotion.java deleted file mode 100644 index 27b35e48d1..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/throwables/ItemSulfuricAcidPotion.java +++ /dev/null @@ -1,30 +0,0 @@ -package gtPlusPlus.core.item.general.throwables; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.entity.projectile.EntitySulfuricAcidPotion; -import gtPlusPlus.core.item.base.CoreItem; - -public class ItemSulfuricAcidPotion extends CoreItem { - - public ItemSulfuricAcidPotion(String unlocalizedName, String displayName, String description) { - super(unlocalizedName, displayName, AddToCreativeTab.tabMisc, 16, 0, new String[] {description}, EnumRarity.common, EnumChatFormatting.GRAY, false, null); - } - - @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { - if (!player.capabilities.isCreativeMode) { - --item.stackSize; - } - world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); - if (!world.isRemote) { - world.spawnEntityInWorld(new EntitySulfuricAcidPotion(world, player)); - } - return item; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/general/throwables/ItemThrowableBomb.java b/src/Java/gtPlusPlus/core/item/general/throwables/ItemThrowableBomb.java deleted file mode 100644 index e8f76ce64c..0000000000 --- a/src/Java/gtPlusPlus/core/item/general/throwables/ItemThrowableBomb.java +++ /dev/null @@ -1,124 +0,0 @@ -package gtPlusPlus.core.item.general.throwables; - -import java.util.List; - -import gregtech.api.enums.ItemList; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.entity.projectile.EntityThrowableBomb; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.item.base.CoreItem; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -public class ItemThrowableBomb extends CoreItem { - - private static AutoMap<ItemStack> mLighters = new AutoMap<ItemStack>(); - public static IIcon[] icons = new IIcon[10]; - - public ItemThrowableBomb() { - super("gtpp.throwable.bomb", "Bomb", AddToCreativeTab.tabMisc, 16, 0, new String[] {"Just like Bomberman", "Have a fire source in inventory to prime"}, EnumRarity.uncommon, EnumChatFormatting.GRAY, false, null); - this.setHasSubtypes(true); - } - - @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { - - if (mLighters.isEmpty()) { - mLighters.put(ItemUtils.getSimpleStack(Items.flint_and_steel)); - mLighters.put(ItemList.Tool_Lighter_Invar_Full.get(1)); - mLighters.put(ItemList.Tool_Lighter_Invar_Used.get(1)); - mLighters.put(ItemList.Tool_Lighter_Platinum_Full.get(1)); - mLighters.put(ItemList.Tool_Lighter_Platinum_Used.get(1)); - mLighters.put(ItemUtils.getSimpleStack(ModItems.itemBasicFireMaker)); - } - - //Unlit - if (item.getItemDamage() == 0) { - boolean hasLighter = false; - for (ItemStack aPlaySlot : player.inventory.mainInventory) { - if (aPlaySlot != null) { - for (ItemStack aLighter : mLighters) { - if (GT_Utility.areStacksEqual(aPlaySlot, aLighter) || (aPlaySlot.getItem() instanceof MetaGeneratedGregtechTools && aPlaySlot.getItemDamage() == MetaGeneratedGregtechTools.ELECTRIC_LIGHTER)) { - hasLighter = true; - break; - } - } - } - } - if (hasLighter) { - item.setItemDamage(1); - } - } - //Lit - else if (item.getItemDamage() == 1) { - if (!player.capabilities.isCreativeMode) { - --item.stackSize; - } - world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); - if (!world.isRemote) { - world.spawnEntityInWorld(new EntityThrowableBomb(world, player)); - } - /*if (item.stackSize <= 0) { - item = null; - }*/ - } - return item; - } - - - - @Override - public void registerIcons(IIconRegister reg) { - icons[0] = reg.registerIcon(CORE.MODID + ":" + "bomb"); - icons[1] = reg.registerIcon(CORE.MODID + ":" + "bomb_lit"); - } - - @Override - public IIcon getIconFromDamage(int meta) { - return this.icons[meta]; - } - - @SuppressWarnings({ "unchecked" }) - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 2; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - String aLitStatus = "unlit"; - if (stack.getItemDamage() == 0) { - aLitStatus = EnumChatFormatting.BLUE+"Unlit"; - } - else if (stack.getItemDamage() == 1) { - aLitStatus = EnumChatFormatting.RED+"Lit"; - } - list.add(EnumChatFormatting.GOLD+"Fuse Status: "+aLitStatus); - super.addInformation(stack, aPlayer, list, bool); - } - - @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - // TODO Auto-generated method stub - return super.getItemStackDisplayName(p_77653_1_); - } - - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java b/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java deleted file mode 100644 index e5c403c503..0000000000 --- a/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java +++ /dev/null @@ -1,80 +0,0 @@ -package gtPlusPlus.core.item.init; - -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.item.base.foods.BaseItemFood; -import gtPlusPlus.core.item.base.foods.BaseItemHotFood; -import gtPlusPlus.core.item.food.BaseItemMetaFood; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; -import net.minecraft.entity.monster.EntityBlaze; -import net.minecraft.entity.passive.EntityHorse; -import net.minecraft.entity.passive.EntityOcelot; -import net.minecraft.entity.passive.EntityVillager; -import net.minecraft.entity.passive.EntityWolf; -import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; - -public class ItemsFoods { - - public static void load(){ - run(); - } - - private static void run(){ - - //Raisin Bread - ModItems.itemIngotRaisinBread = new BaseItemFood("itemIngotRaisinBread", "Raisin Bread", 3, 1.5f, false, new PotionEffect(Potion.weakness.id, 40, 1)).setAlwaysEdible(); - GT_OreDictUnificator.registerOre("foodRaisinBread", ItemUtils.getItemStackFromFQRN(CORE.MODID+":itemIngotRaisinBread", 1)); - //Hot Raisin Bread - ModItems.itemHotIngotRaisinBread = new BaseItemHotFood("itemHotIngotRaisinBread", 1, 0.5f, "Raisin Bread", 120, ModItems.itemIngotRaisinBread); - GT_OreDictUnificator.registerOre("foodHotRaisinBread", ItemUtils.getItemStackFromFQRN(CORE.MODID+":itemHotIngotRaisinBread", 1)); - - //Raisin Bread - ModItems.itemFoodRaisinToast = new BaseItemFood("itemFoodRaisinToast", "Raisin Toast", 1, 0.5f, false).setAlwaysEdible(); - GT_OreDictUnificator.registerOre("foodRaisinToast", ItemUtils.getItemStackFromFQRN(CORE.MODID+":itemFoodRaisinToast", 1)); - //Hot Raisin Bread - ModItems.itemHotFoodRaisinToast = new BaseItemHotFood("itemHotFoodRaisinToast", 1, 0.5f, "Raisin Toast", 20, ModItems.itemFoodRaisinToast); - GT_OreDictUnificator.registerOre("foodHotRaisinToast", ItemUtils.getItemStackFromFQRN(CORE.MODID+":itemHotFoodRaisinToast", 1)); - - //Raisin Bread - ModItems.itemFoodCurriedSausages = new BaseItemFood("itemFoodCurriedSausages", "Curried Sausages", 5, 2f, false); - GT_OreDictUnificator.registerOre("foodCurriedSausages", ItemUtils.getItemStackFromFQRN(CORE.MODID+":itemFoodCurriedSausages", 1)); - //Hot Raisin Bread - ModItems.itemHotFoodCurriedSausages = new BaseItemHotFood("itemHotFoodCurriedSausages", 1, 0.5f, "Curried Sausages", 240, ModItems.itemFoodCurriedSausages); - GT_OreDictUnificator.registerOre("foodHotCurriedSausages", ItemUtils.getItemStackFromFQRN(CORE.MODID+":itemHotFoodCurriedSausages", 1)); - - ModItems.itemMetaFood = new BaseItemMetaFood(); - BaseItemMetaFood.registerFoodsToOreDict(); - addCookingRecipes(); - addFoodDropsToMobs(); - - } - - private static ItemStack getMetaFoodStack(int aID) { - return ItemUtils.simpleMetaStack(ModItems.itemMetaFood, aID, 1); - } - - private static void addCookingRecipes() { - - RecipeUtils.addSmeltingRecipe(getMetaFoodStack(0), getMetaFoodStack(1), 0.4F); - RecipeUtils.addSmeltingRecipe(getMetaFoodStack(2), getMetaFoodStack(3), 0.35F); - RecipeUtils.addSmeltingRecipe(getMetaFoodStack(4), getMetaFoodStack(5), 0.35F); - RecipeUtils.addSmeltingRecipe(getMetaFoodStack(6), getMetaFoodStack(7), 0.35F); - - } - - private static void addFoodDropsToMobs() { - - EntityUtils.registerDropsForMob(EntityVillager.class, getMetaFoodStack(0), 2, 1500); - EntityUtils.registerDropsForMob(EntityHorse.class, getMetaFoodStack(2), 4, 4000); - EntityUtils.registerDropsForMob(EntityWolf.class, getMetaFoodStack(4), 2, 4000); - EntityUtils.registerDropsForMob(EntityOcelot.class, getMetaFoodStack(6), 2, 4000); - EntityUtils.registerDropsForMob(EntityBlaze.class, getMetaFoodStack(8), 1, 500); - - } - -} diff --git a/src/Java/gtPlusPlus/core/item/init/ItemsMultiTools.java b/src/Java/gtPlusPlus/core/item/init/ItemsMultiTools.java deleted file mode 100644 index 9f87408b56..0000000000 --- a/src/Java/gtPlusPlus/core/item/init/ItemsMultiTools.java +++ /dev/null @@ -1,74 +0,0 @@ -package gtPlusPlus.core.item.init; - -import gregtech.api.enums.Materials; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class ItemsMultiTools { - - public static void load(){ - run(); - } - - private static void run(){ - - //Load Multitools - final boolean gtStyleTools = LoadedMods.Gregtech; - if (CORE.ConfigSwitches.enableMultiSizeTools){ - - //GT Materials - final Materials[] rm = Materials.values(); - for (final Materials m : rm){ - toolFactoryGT(m, gtStyleTools); - } - - //GT++ Materials - toolFactory(ALLOY.HASTELLOY_C276); - toolFactory(ALLOY.HASTELLOY_N); - toolFactory(ALLOY.HASTELLOY_W); - toolFactory(ALLOY.HASTELLOY_X); - toolFactory(ALLOY.INCOLOY_020); - toolFactory(ALLOY.INCOLOY_DS); - toolFactory(ALLOY.INCOLOY_MA956); - toolFactory(ALLOY.INCONEL_625); - toolFactory(ALLOY.INCONEL_690); - toolFactory(ALLOY.INCONEL_792); - toolFactory(ALLOY.LEAGRISIUM); - toolFactory(ALLOY.TANTALLOY_60); - toolFactory(ALLOY.TANTALLOY_61); - toolFactory(ALLOY.STABALLOY); - toolFactory(ALLOY.QUANTUM); - //toolFactory(ALLOY.BEDROCKIUM); - toolFactory(ALLOY.POTIN); - toolFactory(ALLOY.TUMBAGA); - toolFactory(ALLOY.TALONITE); - toolFactory(ALLOY.STELLITE); - toolFactory(ALLOY.TUNGSTEN_CARBIDE); - toolFactory(ALLOY.TANTALUM_CARBIDE); - - - } - - } - - - private static boolean toolFactoryGT(final Materials m, final boolean b){ - ModItems.MP_GTMATERIAL = ItemUtils.generateMultiPick(b, m); - ModItems.MS_GTMATERIAL = ItemUtils.generateMultiShovel(b, m); - return true; - } - - private static boolean toolFactory(final Material m){ - Logger.WARNING("Generating Multi-Tools for "+m.getLocalizedName()); - ModItems.MP_GTMATERIAL = ItemUtils.generateMultiPick(m); - ModItems.MS_GTMATERIAL = ItemUtils.generateMultiShovel(m); - return true; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java b/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java deleted file mode 100644 index d42ac85012..0000000000 --- a/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java +++ /dev/null @@ -1,97 +0,0 @@ -package gtPlusPlus.core.item.materials; - -import static gtPlusPlus.core.util.minecraft.ItemUtils.getSimpleStack; - -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.core.handler.Recipes.DecayableRecipe; -import gtPlusPlus.core.item.base.BaseItemTickable; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class DustDecayable extends BaseItemTickable { - - private final Item turnsIntoItem; - private final int radLevel; - - public DustDecayable(String unlocal, int colour, int maxTicks, String[] desc1, Item turnsInto, int radLevel) { - super(true, true, unlocal, colour, (maxTicks/1), desc1); - this.turnsIntoItem = turnsInto; - this.radLevel = radLevel; - GT_OreDictUnificator.registerOre(unlocal, ItemUtils.getSimpleStack(this)); - new DecayableRecipe(maxTicks, getSimpleStack(this), getSimpleStack(turnsInto)); - } - - @Override - public void registerIcons(IIconRegister reg) { - String gt = "gregtech" + ":" + "materialicons/"+"NUCLEAR"+"/" + "dust"; - this.mIcon[0] = reg.registerIcon(gt); - String gt2 = "gregtech" + ":" + "materialicons/"+"NUCLEAR"+"/" + "dust" + "_OVERLAY"; - this.mIcon[1] = reg.registerIcon(gt2); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { - super.addInformation(stack, player, list, bool); - if (this.radLevel > 0) { - list.add(CORE.GT_Tooltip_Radioactive); - } - } - - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - if (world == null || iStack == null) { - return; - } - if (world.isRemote) { - return; - } - - if (entityHolding instanceof EntityPlayer){ - if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){ - EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.radLevel, world, entityHolding); - } - } - boolean a1, a2; - - a1 = this.isTicking(world, iStack); - a2 = tickItemTag(world, iStack); - - if (!a1 && !a2) { - if (entityHolding instanceof EntityPlayer){ - ItemStack replacement = ItemUtils.getSimpleStack(getDecayResult()); - //Logger.INFO("Replacing "+iStack.getDisplayName()+" with "+replacement.getDisplayName()+"."); - final ItemStack tempTransform = replacement; - if (iStack.stackSize > 1){ - int u = iStack.stackSize; - tempTransform.stackSize = u; - ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform)); - for (int l=0;l<u;l++){ - ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this); - } - - } - else { - tempTransform.stackSize=1; - ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform)); - ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this); - } - } - } - } - - public Item getDecayResult() { - return turnsIntoItem; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/materials/MaterialHandler.java b/src/Java/gtPlusPlus/core/item/materials/MaterialHandler.java deleted file mode 100644 index 40fc6539e6..0000000000 --- a/src/Java/gtPlusPlus/core/item/materials/MaterialHandler.java +++ /dev/null @@ -1,10 +0,0 @@ -package gtPlusPlus.core.item.materials; - -public class MaterialHandler { - - @SuppressWarnings("unused") - private String Staballoy; - - - -} diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/ConnectedBlockFinder.java b/src/Java/gtPlusPlus/core/item/tool/misc/ConnectedBlockFinder.java deleted file mode 100644 index 555635741e..0000000000 --- a/src/Java/gtPlusPlus/core/item/tool/misc/ConnectedBlockFinder.java +++ /dev/null @@ -1,142 +0,0 @@ -package gtPlusPlus.core.item.tool.misc; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.BaseItemWithDamageValue; - -public class ConnectedBlockFinder extends BaseItemWithDamageValue{ - - public ConnectedBlockFinder() { - super("item.test.connector"); - this.setTextureName("stick"); - this.setMaxStackSize(1); - this.setMaxDamage(10000); - setCreativeTab(AddToCreativeTab.tabTools); - GameRegistry.registerItem(this, getUnlocalizedName()); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(EnumChatFormatting.GRAY+"Finds connected blocks, turns them to Glass once found."); - super.addInformation(stack, aPlayer, list, bool); - } - - @Override - public boolean doesContainerItemLeaveCraftingGrid(final ItemStack itemStack){ - return false; - } - - @Override - public boolean getShareTag(){ - return true; - } - - @Override - public boolean hasContainerItem(final ItemStack itemStack){ - return true; - } - @Override - public ItemStack getContainerItem(final ItemStack itemStack){ - return itemStack; - } - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack){ - return EnumRarity.uncommon; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack){ - return false; - } - - - @Override - public boolean onItemUse( - ItemStack stack, EntityPlayer player, World world, - int x, int y, int z, int side, - float hitX, float hitY, float hitZ) { - - BlockPos mStartPoint = new BlockPos(x,y,z, world); - Block mBlockType = world.getBlock(x, y, z); - int mBlockMeta = mBlockType.getDamageValue(world, x, y, z); - - //Return if Air. - if (world.isAirBlock(x, y, z)) { - return false; - } - - int breaker = 0; - Set<BlockPos> mTotalIndex = new HashSet<BlockPos>(); - - Set<BlockPos> mFirstSearch = new HashSet<BlockPos>(); - Set<BlockPos> mSearch_A = new HashSet<BlockPos>(); - - Set<BlockPos> mSearch_B = new HashSet<BlockPos>(); - Set<BlockPos> mSearch_C = new HashSet<BlockPos>(); - Set<BlockPos> mSearch_D = new HashSet<BlockPos>(); - - mFirstSearch.add(mStartPoint); - mTotalIndex.add(mStartPoint); - - - - - for (BlockPos G : mSearch_D) { - if (!world.isAirBlock(G.xPos, G.yPos, G.zPos)) { - world.setBlock(G.xPos, G.yPos, G.zPos, Blocks.diamond_ore); - } - } - - - - return super.onItemUse(stack, player, world, x, y, z, side, hitX, hitY, hitZ); - } - - public Set<BlockPos> getValidNeighboursForSet(Set<BlockPos> set){ - Set<BlockPos> results = set; - for (BlockPos F : set) { - results.addAll(F.getValidNeighboursAndSelf()); - } - return results; - } - - public Set<BlockPos> getExtraNeighboursForSet(Set<BlockPos> set){ - Set<BlockPos> results = set; - for (BlockPos F : set) { - results.addAll(F.getValidNeighboursAndSelf()); - } - return results; - } - - @Override - public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) { - // TODO Auto-generated method stub - return super.onItemRightClick(p_77659_1_, p_77659_2_, p_77659_3_); - } - - - - - - - -} diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/DebugScanner.java b/src/Java/gtPlusPlus/core/item/tool/misc/DebugScanner.java deleted file mode 100644 index 0170df0dc7..0000000000 --- a/src/Java/gtPlusPlus/core/item/tool/misc/DebugScanner.java +++ /dev/null @@ -1,104 +0,0 @@ -package gtPlusPlus.core.item.tool.misc; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.CoreItem; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public class DebugScanner extends CoreItem { - - public DebugScanner() { - super("gtpp.debug.scanner", AddToCreativeTab.tabTools, 1, 0, - new String[] { - "Used to obtain information from GT/GT++ content", - "Right Click to use", - }, - EnumRarity.epic); - setTextureName(CORE.MODID + ":itemStickyRubber"); - } - - @Override - public boolean isDamageable() { - return false; - } - - @Override - public boolean onItemUse(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int p_77648_4_, - int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { - // TODO Auto-generated method stub - return super.onItemUse(aStack, aPlayer, aWorld, p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_8_, - p_77648_9_, p_77648_10_); - } - - @Override - public boolean isRepairable() { - return false; - } - - @Override - public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) { - // TODO Auto-generated method stub - return super.onItemRightClick(p_77659_1_, p_77659_2_, p_77659_3_); - } - - @Override - public float getDigSpeed(ItemStack itemstack, Block block, int metadata) { - return 0f; - } - - @Override - public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { - if (entity != null && player != null) { - PlayerUtils.messagePlayer(player, "Entity ID: "+entity.getEntityId()); - PlayerUtils.messagePlayer(player, "UUID: "+entity.getUniqueID()); - PlayerUtils.messagePlayer(player, "Invulnerable? "+entity.isEntityInvulnerable()); - PlayerUtils.messagePlayer(player, "Invisible? "+entity.isInvisible()); - PlayerUtils.messagePlayer(player, "Age: "+entity.ticksExisted); - - if (entity instanceof EntityLivingBase) { - EntityLivingBase g = (EntityLivingBase) entity; - PlayerUtils.messagePlayer(player, "Health: "+g.getHealth()+"/"+g.getMaxHealth()); - PlayerUtils.messagePlayer(player, "On ground? "+g.onGround); - PlayerUtils.messagePlayer(player, "Child? "+g.isChild()); - } - if (entity instanceof EntityLiving) { - EntityLiving g = (EntityLiving) entity; - PlayerUtils.messagePlayer(player, "Can Loot? "+g.canPickUpLoot()); - - } - if (entity instanceof EntityPlayer) { - EntityPlayer y = (EntityPlayer) entity; - PlayerUtils.messagePlayer(player, "Experience: "+y.experience); - PlayerUtils.messagePlayer(player, "Name: "+y.getCommandSenderName()); - } - - } - return true; - } - - @Override - public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player) { - return false; - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return true; - } - - @Override - public int getHarvestLevel(ItemStack stack, String toolClass) { - return 0; - } - - - -} diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/FakeGregtechTool.java b/src/Java/gtPlusPlus/core/item/tool/misc/FakeGregtechTool.java deleted file mode 100644 index 47856b44c0..0000000000 --- a/src/Java/gtPlusPlus/core/item/tool/misc/FakeGregtechTool.java +++ /dev/null @@ -1,74 +0,0 @@ -package gtPlusPlus.core.item.tool.misc; - -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -import gregtech.api.enums.Materials; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.CoreItem; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; - -public class FakeGregtechTool extends CoreItem{ - - public final int componentColour; - public Object extraData; - - protected IIcon base[] = new IIcon[6]; - protected IIcon overlay[] = new IIcon[6]; - - public FakeGregtechTool() { - super("GregeriousT's Display Tool", AddToCreativeTab.tabTools, 1); - short[] tempCol = Materials.TungstenSteel.getRGBA(); - this.componentColour = Utils.rgbtoHexValue(tempCol[0], tempCol[1], tempCol[2]); - } - - @Override - public void registerIcons(final IIconRegister i) { - //ScrewDriver - this.base[0] = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "toolHeadScrewdriver"); - this.overlay[0] = i.registerIcon("gregtech" + ":" + "iconsets/" + "HANDLE_SCREWDRIVER"); - //Soldering iron - this.base[1] = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "toolHeadSoldering"); - this.overlay[1] = i.registerIcon("gregtech" + ":" + "iconsets/" + "HANDLE_SOLDERING"); - //Mallet - this.base[2] = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "handleMallet"); - this.overlay[2] = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "toolHeadMallet"); - //Hammer - this.base[3] = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "stick"); - this.overlay[3] = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "toolHeadHammer"); - //Wrench - this.base[4] = i.registerIcon("gregtech" + ":" + "iconsets/" + "WRENCH"); - this.overlay[4] = i.registerIcon("gregtech" + ":" + "iconsets/" + "WRENCH_OVERLAY"); - //Crowbar - this.base[5] = i.registerIcon("gregtech" + ":" + "iconsets/" + "CROWBAR"); - this.overlay[5] = i.registerIcon("gregtech" + ":" + "iconsets/" + "CROWBAR_OVERLAY"); - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int renderPass) { - if (renderPass == 1){ - return Utils.rgbtoHexValue(230, 230, 230); - } - return this.componentColour; - } - - @Override - public boolean requiresMultipleRenderPasses() { - return true; - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 6; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - -} diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java b/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java deleted file mode 100644 index e43dc8546b..0000000000 --- a/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java +++ /dev/null @@ -1,1302 +0,0 @@ -package gtPlusPlus.core.item.tool.misc; - -import static gregtech.api.enums.GT_Values.V; - -import java.util.ArrayList; -import java.util.BitSet; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.SubTag; -import gregtech.api.enums.TC_Aspects.TC_AspectStack; -import gregtech.api.interfaces.IItemBehaviour; -import gregtech.api.interfaces.IItemContainer; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; -import gregtech.api.objects.ItemData; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; -import ic2.api.item.IElectricItemManager; -import ic2.api.item.ISpecialElectricItem; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidContainerItem; -import net.minecraftforge.fluids.IFluidHandler; -import net.minecraftforge.fluids.IFluidTank; - -public class GregtechPump extends Item implements ISpecialElectricItem, IElectricItemManager, IFluidContainerItem { - - /** - * Right Click Functions - */ - - @Override - public boolean onItemUse(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int a4, - float p_77648_8_, float p_77648_9_, float p_77648_10_) { - if (aStack == null || aPlayer == null || aWorld == null || aWorld.isRemote) { - return false; - } - if (!aWorld.isRemote && tryDrainTile(aStack, aWorld, aPlayer, aX, aY, aZ)) { - return true; - } else { - //return super.onItemUse(aStack, aPlayer, aWorld, aX, aY, aZ, a4, p_77648_8_, p_77648_9_, p_77648_10_); - return false; - } - } - - @Override - public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) { - return p_77659_1_; - } - - /** - * GT Code - */ - - /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ - private final HashMap<Short, ArrayList<IItemBehaviour<GregtechPump>>> mItemBehaviors = new HashMap<>(); - public final short mOffset, mItemAmount; - public final BitSet mEnabledItems; - public final BitSet mVisibleItems; - /** The unlocalized name of this item. */ - private String unlocalizedName; - - private final HashMap<Integer, IIcon> mIconMap = new LinkedHashMap<Integer, IIcon>(); - private final HashMap<Integer, EnumRarity> rarity = new LinkedHashMap<Integer, EnumRarity>(); - private final HashMap<Integer, EnumChatFormatting> descColour = new LinkedHashMap<Integer, EnumChatFormatting>(); - private final HashMap<Integer, String> itemName = new LinkedHashMap<Integer, String>(); - private final HashMap<Integer, String> itemDescription = new LinkedHashMap<Integer, String>(); - private final HashMap<Integer, Boolean> hasEffect = new LinkedHashMap<Integer, Boolean>(); - - public final HashMap<Short, Long[]> mElectricStats = new LinkedHashMap<Short, Long[]>(); - public final HashMap<Short, Short> mBurnValues = new LinkedHashMap<Short, Short>(); - - public void registerPumpType(final int aID, final String aPumpName, final int aEuMax, final int aTier) { - ModItems.toolGregtechPump.registerItem(aID, // ID - aPumpName, // Name - aEuMax, // Eu Storage - (short) aTier, // Tier - "Can be used to remove fluids from GT machine input & output slots.", // Tooltip - aTier <= 0 ? EnumRarity.common : aTier == 1 ? EnumRarity.uncommon : aTier == 2 ? EnumRarity.rare : aTier == 3 ? EnumRarity.epic : EnumRarity.common, // Rarity - EnumChatFormatting.GRAY, // Desc colour - false // Effect? - ); - } - - public GregtechPump() { - this("MU-metatool.01", AddToCreativeTab.tabTools, (short) 1000, (short) 31766); - } - - public GregtechPump(final String unlocalizedName, final CreativeTabs creativeTab, final short aOffset, - final short aItemAmount) { - this.mEnabledItems = new BitSet(aItemAmount); - this.mVisibleItems = new BitSet(aItemAmount); - this.mOffset = (short) Math.min(32766, aOffset); - this.mItemAmount = (short) Math.min(aItemAmount, 32766 - this.mOffset); - this.setHasSubtypes(true); - this.setMaxDamage(0); - this.setUnlocalizedName(unlocalizedName); - this.setCreativeTab(creativeTab); - this.setMaxStackSize(1); - if (GameRegistry.findItem(CORE.MODID, unlocalizedName) == null) { - GameRegistry.registerItem(this, unlocalizedName); - } - - } - - public void registerItem(final int id, final String localizedName, final long euStorage, final int tier, - final String description) { - this.registerItem(id, localizedName, euStorage, (short) tier, description, EnumRarity.common, - EnumChatFormatting.GRAY, false); - } - - public void registerItem(final int id, final String localizedName, final long euStorage, final int tier, - final String description, final int burnTime) { - this.registerItem(id, localizedName, euStorage, (short) tier, description, EnumRarity.common, - EnumChatFormatting.GRAY, false); - this.setBurnValue(id, burnTime); - } - - public void registerItem(final int id, final String localizedName, final long euStorage, final short tier, - final String description, final EnumRarity regRarity, final EnumChatFormatting colour, - final boolean Effect) { - this.addItem(id, localizedName, EnumChatFormatting.YELLOW + "Electric", new Object[] {}); - if (euStorage > 0 && tier > 0) - this.setElectricStats(this.mOffset + id, euStorage, GT_Values.V[tier], tier, -3L, true); - this.rarity.put(id, regRarity); - this.itemName.put(id, localizedName); - this.itemDescription.put(id, description); - this.descColour.put(id, colour); - this.hasEffect.put(id, Effect); - } - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack) { - int h = getCorrectMetaForItemstack(par1ItemStack); - if (this.rarity.get(h) != null) { - return this.rarity.get(h); - } - return EnumRarity.common; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack) { - int h = getCorrectMetaForItemstack(par1ItemStack); - if (this.hasEffect.get(h) != null) { - return this.hasEffect.get(h); - } - return false; - } - - @SuppressWarnings({ "unchecked" }) - @Override - public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, List aList, final boolean aF3_H) { - // aList.add("Meta: "+(aStack.getItemDamage()-mOffset)); - - int aOffsetMeta = getCorrectMetaForItemstack(aStack); - - if ((this.descColour.get(aOffsetMeta) != null) - && (this.itemDescription.get(aOffsetMeta) != null)) { - aList.add(this.descColour.get(aOffsetMeta) - + this.itemDescription.get(aOffsetMeta)); - } - - - if (aOffsetMeta <= 3) { - FluidStack f = getFluid(aStack); - aList.add("Cannot drain any other standard fluid container block"); - aList.add("Cannot be emptied via RMB, use inside a tank with GUI"); - aList.add(EnumChatFormatting.DARK_GRAY+"This is technically just a fancy fluid cell"); - aList.add(EnumChatFormatting.BLUE + (f != null ? f.getLocalizedName() : "No Fluids Contained")); - aList.add(EnumChatFormatting.BLUE + (f != null ? ""+f.amount : ""+0) + "L" + " / " + getCapacity(aStack) + "L"); - } - - final Long[] tStats = this.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 { - final long tCharge = this.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); - } - } - } - - final ArrayList<IItemBehaviour<GregtechPump>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); - if (tList != null) { - for (final IItemBehaviour<GregtechPump> tBehavior : tList) { - aList = tBehavior.getAdditionalToolTips(this, aList, aStack); - } - } - } - - @Override - public final Item getChargedItem(final ItemStack itemStack) { - return this; - } - - @Override - public final Item getEmptyItem(final ItemStack itemStack) { - return this; - } - - @Override - public final double getMaxCharge(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - if (tStats == null) { - return 0; - } - return Math.abs(tStats[0]); - } - - @Override - public final double getTransferLimit(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - if (tStats == null) { - return 0; - } - return Math.max(tStats[1], tStats[3]); - } - - @Override - public final int getTier(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - return (int) (tStats == null ? Integer.MAX_VALUE : tStats[2]); - } - - @Override - public final double charge(final ItemStack aStack, final double aCharge, final int aTier, - final boolean aIgnoreTransferLimit, final boolean aSimulate) { - final Long[] tStats = this.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; - } - final long tChargeBefore = this.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) { - this.setCharge(aStack, tNewCharge); - } - return tNewCharge - tChargeBefore; - } - - @Override - public final double discharge(final ItemStack aStack, final double aCharge, final int aTier, - final boolean aIgnoreTransferLimit, final boolean aBatteryAlike, final boolean aSimulate) { - final Long[] tStats = this.getElectricStats(aStack); - if ((tStats == null) || (tStats[2] > aTier)) { - return 0; - } - if (aBatteryAlike && !this.canProvideEnergy(aStack)) { - return 0; - } - if (tStats[3] > 0) { - if ((aCharge < tStats[3]) || (aStack.stackSize < 1)) { - return 0; - } - if (!aSimulate) { - aStack.stackSize--; - } - return tStats[3]; - } - final long tChargeBefore = this.getRealCharge(aStack), tNewCharge = Math.max(0, - tChargeBefore - (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); - if (!aSimulate) { - this.setCharge(aStack, tNewCharge); - } - return tChargeBefore - tNewCharge; - } - - @Override - public final double getCharge(final ItemStack aStack) { - return this.getRealCharge(aStack); - } - - @Override - public final boolean canUse(final ItemStack aStack, final double aAmount) { - return this.getRealCharge(aStack) >= aAmount; - } - - @Override - public final boolean use(final ItemStack aStack, final double aAmount, final EntityLivingBase aPlayer) { - this.chargeFromArmor(aStack, aPlayer); - if ((aPlayer instanceof EntityPlayer) && ((EntityPlayer) aPlayer).capabilities.isCreativeMode) { - return true; - } - final double tTransfer = this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, true); - if (tTransfer == aAmount) { - this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); - this.chargeFromArmor(aStack, aPlayer); - return true; - } - this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); - this.chargeFromArmor(aStack, aPlayer); - return false; - } - - @Override - public final boolean canProvideEnergy(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - if (tStats == null) { - return false; - } - return (tStats[3] > 0) || ((aStack.stackSize == 1) && ((tStats[3] == -2) || (tStats[3] == -3))); - } - - @Override - public final void chargeFromArmor(final ItemStack aStack, final EntityLivingBase aPlayer) { - if ((aPlayer == null) || aPlayer.worldObj.isRemote) { - return; - } - for (int i = 1; i < 5; i++) { - final ItemStack tArmor = aPlayer.getEquipmentInSlot(i); - if (GT_ModHandler.isElectricItem(tArmor)) { - final IElectricItem tArmorItem = (IElectricItem) tArmor.getItem(); - if (tArmorItem.canProvideEnergy(tArmor) && (tArmorItem.getTier(tArmor) >= this.getTier(aStack))) { - final double tCharge = ElectricItem.manager.discharge(tArmor, - this.charge(aStack, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, true, true), - Integer.MAX_VALUE, true, true, false); - if (tCharge > 0) { - this.charge(aStack, tCharge, Integer.MAX_VALUE, true, false); - if (aPlayer instanceof EntityPlayer) { - final Container tContainer = ((EntityPlayer) aPlayer).openContainer; - if (tContainer != null) { - tContainer.detectAndSendChanges(); - } - } - } - } - } - } - } - - public final long getRealCharge(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - if (tStats == null) { - return 0; - } - if (tStats[3] > 0) { - return (int) (long) tStats[3]; - } - final NBTTagCompound tNBT = aStack.getTagCompound(); - return tNBT == null ? 0 : tNBT.getLong("GT.ItemCharge"); - } - - public final boolean setCharge(final ItemStack aStack, long aCharge) { - final Long[] tStats = this.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(this.getChargedMetaData(aStack)); - tNBT.setLong("GT.ItemCharge", aCharge); - } else { - aStack.setItemDamage(this.getEmptyMetaData(aStack)); - } - if (tNBT.hasNoTags()) { - aStack.setTagCompound(null); - } else { - aStack.setTagCompound(tNBT); - } - this.isItemStackUsable(aStack); - return true; - } - - public short getChargedMetaData(final ItemStack aStack) { - return (short) aStack.getItemDamage(); - } - - public short getEmptyMetaData(final ItemStack aStack) { - return (short) aStack.getItemDamage(); - } - - public boolean isItemStackUsable(final ItemStack aStack) { - final ArrayList<IItemBehaviour<GregtechPump>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); - if (tList != null) { - for (final IItemBehaviour<GregtechPump> tBehavior : tList) { - if (!tBehavior.isItemStackUsable(this, aStack)) { - return false; - } - } - } - return true; - } - - @Override - public final String getToolTip(final 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(final ItemStack aStack) { - return this; - } // We are our own Manager - - /** - * 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 GregtechPump setBurnValue(final int aMetaValue, final int aValue) { - if ((aMetaValue < 0) || (aValue < 0)) { - return this; - } - if (aValue == 0) { - this.mBurnValues.remove((short) aMetaValue); - } else { - this.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 GregtechPump setElectricStats(final int aMetaValue, final long aMaxCharge, final long aTransferLimit, - final long aTier, final long aSpecialData, final boolean aUseAnimations) { - if (aMetaValue < 0) { - return this; - } - if (aMaxCharge == 0) { - this.mElectricStats.remove((short) aMetaValue); - } else { - this.mElectricStats.put((short) aMetaValue, - new Long[] { aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData }); - } - return this; - } - - @SuppressWarnings({ "unchecked" }) - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(final Item var1, final CreativeTabs aCreativeTab, final List aList) { - for (int i = 0, j = this.mEnabledItems.length(); i < j; i++) { - if (this.mVisibleItems.get(i) || (GT_Values.D1 && this.mEnabledItems.get(i))) { - final Long[] tStats = this.mElectricStats.get((short) (this.mOffset + i)); - if ((tStats != null) && (tStats[3] < 0)) { - final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i); - this.setCharge(tStack, Math.abs(tStats[0])); - this.isItemStackUsable(tStack); - aList.add(tStack); - } - if ((tStats == null) || (tStats[3] != -2)) { - final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i); - this.isItemStackUsable(tStack); - aList.add(tStack); - } - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public final void registerIcons(final IIconRegister aIconRegister) { - for (short i = 0, j = (short) this.mEnabledItems.length(); i < j; i++) { - if (this.mEnabledItems.get(i)) { - mIconMap.put((int) i, aIconRegister.registerIcon(CORE.MODID + ":" + (this.getUnlocalizedName() + "/" + i))); - } - } - } - - @Override - public final IIcon getIconFromDamage(final int aMetaData) { - if (aMetaData < 0) { - return null; - } - if (aMetaData < this.mOffset) { - return mIconMap.get(0); - } - else { - int newMeta = aMetaData - this.mOffset; - newMeta = (Math.max(0, Math.min(3, newMeta))); - return mIconMap.get(newMeta); - } - } - - /** - * Sets the unlocalized name of this item to the string passed as the parameter" - */ - @Override - public Item setUnlocalizedName(final String p_77655_1_) { - this.unlocalizedName = p_77655_1_; - super.setUnlocalizedName(p_77655_1_); - return this; - } - - /** - * Returns the unlocalized name of this item. - */ - @Override - public String getUnlocalizedName() { - return this.unlocalizedName; - } - - public final Long[] getElectricStats(final ItemStack aStack) { - return this.mElectricStats.get((short) aStack.getItemDamage()); - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public boolean isBookEnchantable(final ItemStack aStack, final ItemStack aBook) { - return false; - } - - @Override - public boolean getIsRepairable(final ItemStack aStack, final ItemStack aMaterial) { - return false; - } - - /** - * Adds a special Item Behaviour to the Item. - * <p/> - * 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 GregtechPump addItemBehavior(final int aMetaValue, final IItemBehaviour<GregtechPump> aBehavior) { - if ((aMetaValue < 0) || (aMetaValue >= 32766) || (aBehavior == null)) { - return this; - } - ArrayList<IItemBehaviour<GregtechPump>> tList = this.mItemBehaviors.get((short) aMetaValue); - if (tList == null) { - tList = new ArrayList<>(1); - this.mItemBehaviors.put((short) aMetaValue, tList); - } - tList.add(aBehavior); - return 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. - */ - @SuppressWarnings("unchecked") - public final ItemStack addItem(final int aID, final String aEnglish, String aToolTip, final Object... aRandomData) { - if (aToolTip == null) { - aToolTip = ""; - } - if ((aID >= 0) && (aID < this.mItemAmount)) { - final ItemStack rStack = new ItemStack(this, 1, this.mOffset + aID); - this.mEnabledItems.set(aID); - this.mVisibleItems.set(aID); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".name", aEnglish); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".tooltip", aToolTip); - final List<TC_AspectStack> tAspects = new ArrayList<>(); - // Important Stuff to do first - for (final Object tRandomData : aRandomData) { - if (tRandomData instanceof SubTag) { - if (tRandomData == SubTag.INVISIBLE) { - this.mVisibleItems.set(aID, false); - continue; - } - if (tRandomData == SubTag.NO_UNIFICATION) { - GT_OreDictUnificator.addToBlacklist(rStack); - continue; - } - } - } - // now check for the rest - for (final Object tRandomData : aRandomData) { - if (tRandomData != null) { - boolean tUseOreDict = true; - if (tRandomData instanceof IItemBehaviour) { - this.addItemBehavior(this.mOffset + aID, (IItemBehaviour<GregtechPump>) 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; - } - - @Override - public String getItemStackDisplayName(final ItemStack aStack) { - int keyValue = (getCorrectMetaForItemstack(aStack)); - if (keyValue < 0 || keyValue > 3) { - keyValue = 0; - } - return this.itemName.get(keyValue); - } - - /** - * Fluid Handling - */ - - /* - * IFluidContainer Functions - */ - - public void emptyStoredFluid(ItemStack aStack) { - if (aStack.hasTagCompound()) { - NBTTagCompound t = aStack.getTagCompound(); - if (t.hasKey("mInit")) { - t.removeTag("mInit"); - } - if (t.hasKey("mFluid")) { - t.removeTag("mFluid"); - } - if (t.hasKey("mFluidAmount")) { - t.removeTag("mFluidAmount"); - } - } - } - - public void storeFluid(ItemStack aStack, FluidStack aFluid) { - if (aFluid == null) { - return; - } else { - String fluidname = aFluid.getFluid().getName(); - int amount = aFluid.amount; - if (fluidname != null && fluidname.length() > 0 && amount > 0) { - NBTUtils.setString(aStack, "mFluid", fluidname); - NBTUtils.setInteger(aStack, "mFluidAmount", amount); - } - } - } - - @Override - public FluidStack getFluid(ItemStack container) { - if (!container.hasTagCompound() || !container.getTagCompound().hasKey("mInit")) { - initNBT(container); - } - if (container.getTagCompound().hasKey("mInit") && container.getTagCompound().getBoolean("mInit")) { - String fluidname; - Integer amount = 0; - fluidname = NBTUtils.getString(container, "mFluid"); - amount = NBTUtils.getInteger(container, "mFluidAmount"); - if (fluidname != null && amount != null && amount > 0) { - return FluidUtils.getFluidStack(fluidname, amount); - } else { - return null; - } - } - return null; - } - - @Override - public int getCapacity(ItemStack container) { - if (!container.hasTagCompound() || !container.getTagCompound().hasKey("mInit")) { - initNBT(container); - } - if (container.getTagCompound().hasKey("mInit") && container.getTagCompound().getBoolean("mInit")) { - return container.getTagCompound().getInteger("mCapacity"); - } - int aMeta = this.getCorrectMetaForItemstack(container); - int aCapacity = (aMeta == 0 ? 2000 : (aMeta == 1 ? 8000 : (aMeta == 2 ? 32000 : 128000))); - return aCapacity; - } - - public int fill(ItemStack container, FluidStack resource) { - return fill(container, resource, true); - } - - @Override - public int fill(ItemStack container, FluidStack resource, boolean doFill) { - if (!doFill || resource == null) { - return 0; - } - - if (!container.hasTagCompound() || !container.getTagCompound().hasKey("mInit")) { - initNBT(container); - } - if (container.getTagCompound().hasKey("mInit") && container.getTagCompound().getBoolean("mInit")) { - String aStored; - int aStoredAmount = 0; - int aCapacity = getCapacity(container); - FluidStack aStoredFluid = getFluid(container); - if (aStoredFluid != null) { - aStored = aStoredFluid.getFluid().getName(); - aStoredAmount = aStoredFluid.amount; - if (aStoredAmount == aCapacity) { - return 0; - } - } - // Handle no stored fluid first - if (aStoredFluid == null) { - Logger.INFO("Pump is empty, filling with tank fluids."); - FluidStack toConsume; - int amountToConsume = 0; - if (resource.amount >= aCapacity) { - amountToConsume = aCapacity; - } else { - amountToConsume = resource.amount; - } - toConsume = FluidUtils.getFluidStack(resource, amountToConsume); - if (toConsume != null && amountToConsume > 0) { - storeFluid(container, toConsume); - return amountToConsume; - } - } else { - Logger.INFO("Pump is Partially full, filling with tank fluids."); - if (aStoredFluid.isFluidEqual(resource)) { - Logger.INFO("Found matching fluids."); - int aSpaceLeft = (aCapacity - aStoredAmount); - Logger.INFO( - "Capacity: " + aCapacity + " | Stored: " + aStoredAmount + " | Space left: " + aSpaceLeft); - FluidStack toConsume; - int amountToConsume = 0; - if (resource.amount >= aSpaceLeft) { - amountToConsume = aSpaceLeft; - Logger.INFO("More or equal fluid amount to pump container space."); - } else { - amountToConsume = resource.amount; - Logger.INFO("Less fluid than container space"); - } - Logger.INFO("Amount to consume: " + amountToConsume); - toConsume = FluidUtils.getFluidStack(resource, (aStoredAmount + amountToConsume)); - if (toConsume != null && amountToConsume > 0) { - Logger.INFO("Storing Fluid"); - storeFluid(container, toConsume); - return amountToConsume; - } else { - Logger.INFO("Not storing fluid"); - } - } else { - Logger.INFO("Fluids did not match."); - } - } - } - return 0; - } - - public FluidStack drain(ItemStack container, int drainAmt) { - return drain(container, drainAmt, true); - } - - @Override - public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain) { - if (!doDrain || maxDrain == 0) { - return null; - } - if (!container.hasTagCompound() || !container.getTagCompound().hasKey("mInit")) { - initNBT(container); - } - if (container.getTagCompound().hasKey("mInit") && container.getTagCompound().getBoolean("mInit")) { - - String aStored; - int aStoredAmount = 0; - FluidStack aStoredFluid = getFluid(container); - - if (aStoredFluid != null) { - aStored = aStoredFluid.getFluid().getName(); - aStoredAmount = aStoredFluid.amount; - } - // We cannot drain this if it's empty. - else if (aStoredFluid == null) { - return null; - } - - if (maxDrain >= aStoredAmount) { - emptyStoredFluid(container); - return aStoredFluid; - } else { - // Handle Partial removal - int amountRemaining = (aStoredAmount - maxDrain); - if (amountRemaining == 0) { - emptyStoredFluid(container); - } else { - FluidStack newAmount = FluidUtils.getFluidStack(aStoredFluid, amountRemaining); - FluidStack drained = FluidUtils.getFluidStack(aStoredFluid, maxDrain); - if (newAmount != null && drained != null) { - storeFluid(container, newAmount); - return drained; - } - } - } - } - return null; - } - - /* - * Handle ItemStack NBT - */ - - public void initNBT(ItemStack aStack) { - NBTTagCompound aNewNBT; - if (!aStack.hasTagCompound()) { - aNewNBT = new NBTTagCompound(); - } else { - aNewNBT = aStack.getTagCompound(); - } - - if (!aNewNBT.hasKey("mInit")) { - int aMeta = this.getCorrectMetaForItemstack(aStack); - aNewNBT.setInteger("mMeta", aMeta); - aNewNBT.setBoolean("mInit", true); - aNewNBT.setString("mFluid", "@@@@@"); - aNewNBT.setInteger("mFluidAmount", 0); - int aCapacity = (aMeta == 0 ? 2000 : (aMeta == 1 ? 8000 : (aMeta == 2 ? 32000 : 128000))); - aNewNBT.setInteger("mCapacity", aCapacity); - aStack.setTagCompound(aNewNBT); - } - } - - /** - * Tile Handling - */ - - /* - * Custom Fluid Handling for Tiles and GT Tiles. - */ - - public boolean tryDrainTile(ItemStack aStack, World aWorld, EntityPlayer aPlayer, int aX, int aY, int aZ) { - try { - if (aWorld.isRemote || aStack == null) { - return false; - } else { - int aTier = (aStack.getItemDamage() - 1000); - int removal; - if (aTier == 0) { - removal = 0; - } else if (aTier == 1) { - removal = 32; - } else if (aTier == 2) { - removal = 128; - } else if (aTier == 3) { - removal = 512; - } else { - removal = 8; - } - if (!canUse(aStack, removal) && aTier > 0) { - PlayerUtils.messagePlayer(aPlayer, "Not enough power."); - Logger.INFO("No Power"); - return false; - } - - final Block aBlock = aWorld.getBlock(aX, aY, aZ); - if (aBlock == null) { - return false; - } - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity == null) { - return false; - } else { - double aCharge = this.getCharge(aStack); - boolean didDrain = false; - if (aTier > 0 && aCharge > 0) { - if (discharge(aStack, removal, aTier, true, true, false) > 0) { - didDrain = true; - } - } else if (aTier == 0) { - didDrain = true; - } else { - didDrain = false; - } - - if (didDrain) { - if ((tTileEntity instanceof IGregTechTileEntity)) { - return this.drainTankGT(tTileEntity, aStack, aWorld, aPlayer, aX, aY, aZ); - } - //Try support Standard Fluid Tanks too (May disable if dupes appear again) - else if ((tTileEntity instanceof IFluidTank || tTileEntity instanceof IFluidHandler)) { - //return this.drainIFluidTank(tTileEntity, aStack, aWorld, aPlayer, aX, aY, aZ); - return false; - } - } - } - } - } catch (Throwable t) { - } - return false; - } - - /* - * Vanilla IFluidTank - */ - - public boolean drainIFluidTank(TileEntity tTileEntity, ItemStack aStack, World aWorld, EntityPlayer aPlayer, int aX, - int aY, int aZ) { - if (tTileEntity == null) { - Logger.INFO("Invalid Tile, somehow."); - return false; - } - if ((tTileEntity instanceof IFluidTank || tTileEntity instanceof IFluidHandler)) { - if (this.getFluid(aStack) == null || (this.getFluid(aStack) != null && this.getFluid(aStack).amount < this.getCapacity(aStack))) { - Logger.INFO("Trying to find Stored Fluid - Behaviour Class."); - FluidStack aStored = getStoredFluidOfVanillaTank(tTileEntity); - if (aStored != null) { - int mAmountInserted = fill(aStack, aStored); - FluidStack newStackRemainingInTank; - if (mAmountInserted > 0) { - if (mAmountInserted == aStored.amount) { - newStackRemainingInTank = null; - } else { - newStackRemainingInTank = FluidUtils.getFluidStack(aStored, (aStored.amount - mAmountInserted)); - } - boolean b = setStoredFluidOfVanillaTank(tTileEntity, newStackRemainingInTank); - Logger.INFO("Cleared Tank? " + b + " | mAmountInserted: " + mAmountInserted); - Logger.INFO("Returning " + b + " - drainTankVanilla."); - if (b) { - PlayerUtils.messagePlayer(aPlayer, "Drained "+mAmountInserted+"L of "+aStored.getLocalizedName()+"."); - } - return b; - } - } else { - Logger.INFO("Found no valid Fluidstack - drainTankVanilla."); - } - } - else { - Logger.INFO("Pump is full."); - } - } - Logger.INFO("Could not drain vanilla tank."); - return false; - } - - /* - * GT Tanks - */ - - public boolean drainTankGT(TileEntity tTileEntity, ItemStack aStack, World aWorld, EntityPlayer aPlayer, int aX, - int aY, int aZ) { - if (tTileEntity == null) { - return false; - } - if ((tTileEntity instanceof IGregTechTileEntity)) { - Logger.INFO("Right Clicking on GT Tile - drainTankGT."); - if (((IGregTechTileEntity) tTileEntity).getTimer() < 50L) { - Logger.INFO("Returning False - Behaviour Class. Timer < 50"); - return false; - } else if ((!aWorld.isRemote) && (!((IGregTechTileEntity) tTileEntity).isUseableByPlayer(aPlayer))) { - Logger.INFO("Returning True - drainTankGT. NotUsable()"); - return true; - } else { - if (this.getFluid(aStack) == null || (this.getFluid(aStack) != null && this.getFluid(aStack).amount < this.getCapacity(aStack))) { - Logger.INFO("Trying to find Stored Fluid - drainTankGT."); - FluidStack aStored = getStoredFluidOfGTMachine((IGregTechTileEntity) tTileEntity); - if (aStored != null) { - int mAmountInserted = fill(aStack, aStored); - FluidStack newStackRemainingInTank; - if (mAmountInserted > 0) { - if (mAmountInserted == aStored.amount) { - newStackRemainingInTank = null; - } else { - newStackRemainingInTank = FluidUtils.getFluidStack(aStored, (aStored.amount - mAmountInserted)); - } - boolean b = setStoredFluidOfGTMachine((IGregTechTileEntity) tTileEntity, newStackRemainingInTank); - Logger.INFO("Cleared Tank? " + b + " | mAmountInserted: " + mAmountInserted); - Logger.INFO("Returning " + b + " - drainTankGT."); - if (b) { - PlayerUtils.messagePlayer(aPlayer, "Drained "+mAmountInserted+"L of "+aStored.getLocalizedName()+"."); - } - return b; - } - } else { - Logger.INFO("Found no valid Fluidstack - drainTankGT."); - } - } - else { - Logger.INFO("Pump is full."); - } - } - } - Logger.INFO("Could not drain GT tank."); - return false; - } - - /* - * Vanilla Tanks - */ - - public FluidStack getStoredFluidOfVanillaTank(TileEntity aTileEntity) { - if (aTileEntity == null) { - return null; - } else if ((aTileEntity instanceof IFluidTank || aTileEntity instanceof IFluidHandler)) { - if (aTileEntity instanceof IFluidTank) { - return getStoredFluidOfVanillaTank((IFluidTank) aTileEntity); - } else { - return getStoredFluidOfVanillaTank((IFluidHandler) aTileEntity); - } - } else { - return null; - } - } - - public FluidStack getStoredFluidOfVanillaTank(IFluidTank aTileEntity) { - FluidStack f = aTileEntity.getFluid(); - Logger.INFO("Returning Fluid stack from tile. Found: " - + (f != null ? f.getLocalizedName() + " - " + f.amount + "L" : "Nothing")); - return f; - } - - public FluidStack getStoredFluidOfVanillaTank(IFluidHandler aTileEntity) { - if (aTileEntity instanceof IFluidTank) { - return getStoredFluidOfVanillaTank((IFluidTank) aTileEntity); - } - FluidStack f; - AutoMap<FluidTankInfo[]> m = new AutoMap<FluidTankInfo[]>(); - for (int i = 0; i < 6; i++) { - m.put(aTileEntity.getTankInfo(ForgeDirection.getOrientation(i))); - } - if (m.get(0) != null && m.get(0)[0] != null && m.get(0)[0].fluid != null) { - return m.get(0)[0].fluid; - } else { - return null; - } - } - - public boolean setStoredFluidOfVanillaTank(TileEntity aTileEntity, FluidStack aSetFluid) { - Logger.INFO("Trying to clear Tile's tank. - Behaviour Class. [1]"); - - if (aTileEntity == null) { - return false; - } - else if ((aTileEntity instanceof IFluidTank || aTileEntity instanceof IFluidHandler)) { - if (aTileEntity instanceof IFluidTank) { - Logger.INFO("Tile Was instanceof IFluidTank."); - FluidStack f = ((IFluidTank) aTileEntity).getFluid(); - if (aSetFluid == null) { - aSetFluid = f; - aSetFluid.amount = f.amount; - } - int toDrain = (f.amount - aSetFluid.amount); - FluidStack newStack; - if (toDrain <= 0) { - newStack = f; - } else { - newStack = ((IFluidTank) aTileEntity).drain(toDrain, true); - } - - if (newStack.isFluidEqual(aSetFluid) && newStack.amount == aSetFluid.amount) { - Logger.INFO("Removed fluid from vanilla IFluidTank successfully."); - return true; - } else { - Logger.INFO("Failed trying to remove fluid from vanilla IFluidTank."); - return false; - } - } - else { - - //Rewrite Fluid handling for Vanilla type tanks - if (!IFluidHandler.class.isInstance(aTileEntity)) { - Logger.INFO("Tile Was not an instance of IFluidHandler."); - return false; - } - - - IFluidHandler aTank = (IFluidHandler) aTileEntity; - FluidStack aTankContents = null; - FluidTankInfo[] a1 = aTank.getTankInfo(ForgeDirection.UNKNOWN); - if (a1 != null) { - if (a1[0] != null) { - aTankContents = a1[0].fluid; - Logger.INFO("Found Fluid in Tank. "+aTankContents.getLocalizedName()+" - "+aTankContents.amount); - } - } - if (aSetFluid == null) { - Logger.INFO("Setting fluid to tank contents, as we're going to empty it totally."); - aSetFluid = aTankContents.copy(); - } - else { - Logger.INFO("Setting fluid to tank contents, as we're going to empty it totally."); - } - Logger.INFO("Tile Was instance of IFluidHandler. Trying to Drain "+aSetFluid.getLocalizedName()+" - "+aSetFluid.amount); - - if (a1 == null || aTankContents == null) { - Logger.INFO("Tank is empty."); - return false; - } - //Found some Fluid in the tank - else { - FluidStack aDrainedStack = aTank.drain(ForgeDirection.UNKNOWN, aSetFluid, true); - if (aDrainedStack.isFluidStackIdentical(aSetFluid)) { - Logger.INFO("Drained!"); - return true; - } - else { - Logger.INFO("Partially Drained! This is probably an error."); - return true; - } - } - } - } else { - Logger.INFO("Bad Tank Tile to drain."); - return false; - } - - } - - /* - * GT Tanks - */ - - public FluidStack getStoredFluidOfGTMachine(IGregTechTileEntity aTileEntity) { - if (aTileEntity == null) { - return null; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - ; - if (aMetaTileEntity == null) { - return null; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_BasicTank) { - Logger.INFO("Tile Was Instanceof BasicTank."); - return getStoredFluidOfGTMachine((GT_MetaTileEntity_BasicTank) aMetaTileEntity); - } else { - return null; - } - } - - public FluidStack getStoredFluidOfGTMachine(GT_MetaTileEntity_BasicTank aTileEntity) { - FluidStack f = aTileEntity.mFluid; - - //Let's see if this machine has output fluid too - /* - * if (f == null) { - * Logger.INFO("Could not find any input fluid, checking output if possible."); - * if (aTileEntity instanceof GT_MetaTileEntity_BasicMachine) { - * GT_MetaTileEntity_BasicMachine g = (GT_MetaTileEntity_BasicMachine) - * aTileEntity; - * Logger.INFO("Tile is a Basic Machine of some sort - "+g.mNEIName); if (g != - * null) { f = g.mOutputFluid; if (f != null) { - * Logger.INFO("Found output fluid! "+f.getLocalizedName()); } else { - * Logger.INFO("Did not find anything!"); f = g.getFluid(); if (f != null) { - * Logger.INFO("Found fluid! "+f.getLocalizedName()); } else { - * Logger.INFO("Did not find anything!"); f = g.getFluid(); } } } } } - */ - - Logger.INFO("Returning Fluid stack from tile. Found: " - + (f != null ? f.getLocalizedName() + " - " + f.amount + "L" : "Nothing")); - return f; - } - - public boolean setStoredFluidOfGTMachine(IGregTechTileEntity aTileEntity, FluidStack aSetFluid) { - Logger.INFO("Trying to clear Tile's tank. - Behaviour Class. [1]"); - if (aTileEntity == null) { - return false; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_BasicTank) { - Logger.INFO("Trying to clear Tile's tank. - Behaviour Class. [2]"); - return setStoredFluidOfGTMachine((GT_MetaTileEntity_BasicTank) aMetaTileEntity, aSetFluid); - } else { - return false; - } - } - - public boolean setStoredFluidOfGTMachine(GT_MetaTileEntity_BasicTank aTileEntity, FluidStack aSetFluid) { - try { - - //Try Handle Outputs First - /* - * if (aTileEntity.setDrainableStack(aSetFluid) != null) { return true; } - */ - - aTileEntity.mFluid = aSetFluid; - boolean b = aTileEntity.mFluid == aSetFluid; - Logger.INFO("Trying to set Tile's tank. - Behaviour Class. [3] " + b); - return b; - } catch (Throwable t) { - Logger.INFO("Trying to clear Tile's tank. FAILED - Behaviour Class. [x]"); - return false; - } - } - - - public int getCorrectMetaForItemstack(ItemStack aStack) { - if (aStack == null) { - return 0; - } - else { - if (aStack.getItemDamage() < this.mOffset) { - return 0; - } - else { - int newMeta = aStack.getItemDamage() - this.mOffset; - newMeta = (Math.max(0, Math.min(3, newMeta))); - return newMeta; - } - } - - - - - } - -} diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java b/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java deleted file mode 100644 index 555fc0f23f..0000000000 --- a/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java +++ /dev/null @@ -1,80 +0,0 @@ -package gtPlusPlus.core.item.tool.misc; - -import java.util.List; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import gtPlusPlus.core.item.base.BaseItemWithDamageValue; -import gtPlusPlus.core.lib.CORE; - -public class SandstoneHammer extends BaseItemWithDamageValue{ - - /* (non-Javadoc) - * @see net.minecraft.item.Item#getColorFromItemStack(net.minecraft.item.ItemStack, int) - */ - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - //Figure Out Damage - - - return super.getColorFromItemStack(stack, HEX_OxFFFFFF); - } - - public SandstoneHammer(final String unlocalizedName) { - super(unlocalizedName); - this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setMaxStackSize(1); - this.setMaxDamage(2500); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(EnumChatFormatting.GRAY+"Allows you to craft sand from cobble, or sandstone from sand."); - super.addInformation(stack, aPlayer, list, bool); - } - - @Override - public boolean doesContainerItemLeaveCraftingGrid(final ItemStack itemStack) - { - return false; - } - - @Override - public boolean getShareTag() - { - return true; - } - - @Override - public boolean hasContainerItem(final ItemStack itemStack) - { - return true; - } - @Override - public ItemStack getContainerItem(final ItemStack itemStack) - { - itemStack.setItemDamage(itemStack.getItemDamage() + 8); - - return itemStack; - } - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack){ - return EnumRarity.uncommon; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack){ - return false; - } - - -} diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/box/AutoLunchBox.java b/src/Java/gtPlusPlus/core/item/tool/misc/box/AutoLunchBox.java deleted file mode 100644 index baed16db03..0000000000 --- a/src/Java/gtPlusPlus/core/item/tool/misc/box/AutoLunchBox.java +++ /dev/null @@ -1,11 +0,0 @@ -package gtPlusPlus.core.item.tool.misc.box; - -public class AutoLunchBox extends BaseBoxItem { - - public final static int SLOTS = 9; - - public AutoLunchBox(String displayName) { - super(displayName, new String[] {"Stores 9 pieces of food", "Food will automatically be eaten from slot 1, through to "+gtPlusPlus.core.item.tool.misc.box.AutoLunchBox.SLOTS}, gtPlusPlus.core.item.tool.misc.box.AutoLunchBox.SLOTS); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/box/BaseBoxItem.java b/src/Java/gtPlusPlus/core/item/tool/misc/box/BaseBoxItem.java deleted file mode 100644 index 10a3ae5804..0000000000 --- a/src/Java/gtPlusPlus/core/item/tool/misc/box/BaseBoxItem.java +++ /dev/null @@ -1,59 +0,0 @@ -package gtPlusPlus.core.item.tool.misc.box; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.CoreItem; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -public class BaseBoxItem extends CoreItem { - - private final int GUI; - - public BaseBoxItem(String displayName, String[] description, int GUI_ID) { - super("item." + Utils.sanitizeString(displayName), displayName, AddToCreativeTab.tabTools, 1, 0, - modifyDescriptionStringArray(description), EnumRarity.uncommon, EnumChatFormatting.GRAY, false, null); - GUI = GUI_ID; - } - - private static String[] modifyDescriptionStringArray(String[] array) { - String[] a = new String[array.length + 1]; - for (int b = 0; b < array.length; b++) { - a[b] = array[b]; - } - a[a.length - 1] = "Right Click to open"; - return a; - } - - // Without this method, your inventory will NOT work!!! - @Override - public int getMaxItemUseDuration(ItemStack stack) { - return 1; // return any value greater than zero - } - - @Override - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { - if (!world.isRemote) { - // If player not sneaking, open the inventory gui - if (!player.isSneaking()) { - player.openGui(GTplusplus.instance, GUI, world, (int) player.posX, (int) player.posY, - (int) player.posZ); - } - } - return itemstack; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) { - this.itemIcon = iconRegister.registerIcon(CORE.MODID + ":" + this.getUnlocalizedName().substring(5)); - } -} diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/box/ContainerBoxBase.java b/src/Java/gtPlusPlus/core/item/tool/misc/box/ContainerBoxBase.java deleted file mode 100644 index 035859c388..0000000000 --- a/src/Java/gtPlusPlus/core/item/tool/misc/box/ContainerBoxBase.java +++ /dev/null @@ -1,328 +0,0 @@ -package gtPlusPlus.core.item.tool.misc.box; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -import gregtech.api.enums.Materials; -import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class ContainerBoxBase extends Container { - - /* - * Finally, in your Container class, you will need to check if the currently - * opened inventory's uniqueID is equal to the itemstack's uniqueID in the - * method 'transferStackInSlot' as well as check if the itemstack is the - * currently equipped item in the method 'slotClick'. In both cases, you'll need - * to prevent the itemstack from being moved or it will cause bad things to - * happen. - */ - - /** - * Step 3: Create a custom Container for your Inventory - */ - - /* - * There's a LOT of code in this one, but read through all of the comments - * carefully and it should become clear what everything does. As a bonus, one of - * my previous tutorials is included within! - * "How to Properly Override Shift-Clicking" is here and better than ever! At - * least in my opinion. If you're like me, and you find no end of frustration - * trying to figure out which f-ing index you should use for which slots in your - * container when overriding transferStackInSlot, or if your following the - * original tutorial, then read on. - */ - - /** - * The Item Inventory for this Container, only needed if you want to reference - * isUseableByPlayer - */ - private final CustomBoxInventory inventory; - /** - * Using these will make transferStackInSlot easier to understand and implement - * INV_START is the index of the first slot in the Player's Inventory, so our - * CustomBoxInventory's number of slots (e.g. 5 slots is array indices 0-4, so - * start at 5) Notice how we don't have to remember how many slots we made? We - * can just use CustomBoxInventory.INV_SIZE and if we ever change it, the - * Container updates automatically. - */ - private final int INV_START, INV_END, HOTBAR_START, HOTBAR_END; - - // If you're planning to add armor slots, put those first like this: - // ARMOR_START = CustomBoxInventory.INV_SIZE, ARMOR_END = ARMOR_START+3, - // INV_START = ARMOR_END+1, and then carry on like above. - - private Slot generateSlot(final Constructor<?> aClazz, final IInventory base, final int id, final int x, - final int y) { - Slot aSlot; - try { - aSlot = (Slot) aClazz.newInstance(base, id, x, y); - if (aSlot != null) { - return aSlot; - } - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException e) { - e.printStackTrace(); - } - return null; - } - - public ContainerBoxBase(EntityPlayer par1Player, InventoryPlayer inventoryPlayer, - CustomBoxInventory CustomBoxInventory, Class<?> aClazz, int aSlotCount) { - - INV_START = aSlotCount; - INV_END = INV_START + 26; - HOTBAR_START = INV_END + 1; - HOTBAR_END = HOTBAR_START + 8; - - this.inventory = CustomBoxInventory; - try { - - Constructor<?> constructor; - constructor = aClazz.getConstructor(IInventory.class, int.class, int.class, int.class); - - int i; - - // ITEM INVENTORY - you'll need to adjust the slot locations to match your - // texture file - // I have them set vertically in columns of 4 to the right of the player model - for (i = 0; i < CustomBoxInventory.INV_SIZE; ++i) { - // You can make a custom Slot if you need different behavior, - // such as only certain item types can be put into this slot - // We made a custom slot to prevent our inventory-storing item - // from being stored within itself, but if you want to allow that and - // you followed my advice at the end of the above step, then you - // could get away with using the vanilla Slot class - this.addSlotToContainer(generateSlot(constructor, this.getInventoryObject(), i, - 80 + (18 * (int) (i / 4)), 8 + (18 * (i % 4)))); - } - - // If you want, you can add ARMOR SLOTS here as well, but you need to - // make a public version of SlotArmor. I won't be doing that in this tutorial. - /* - * for (i = 0; i < 4; ++i) { // These are the standard positions for survival - * inventory layout this.addSlotToContainer(new SlotArmor(this.player, - * inventoryPlayer, inventoryPlayer.getSizeInventory() - 1 - i, 8, 8 + i * 18, - * i)); } - */ - - // PLAYER INVENTORY - uses default locations for standard inventory texture file - for (i = 0; i < 3; ++i) { - for (int j = 0; j < 9; ++j) { - this.addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - // PLAYER ACTION BAR - uses default locations for standard action bar texture - // file - for (i = 0; i < 9; ++i) { - this.addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142)); - } - - } catch (NoSuchMethodException | SecurityException e) { - e.printStackTrace(); - } - } - - @Override - public boolean canInteractWith(EntityPlayer entityplayer) { - // be sure to return the inventory's isUseableByPlayer method - // if you defined special behavior there: - return getInventoryObject().isUseableByPlayer(entityplayer); - } - - /** - * Called when a player shift-clicks on a slot. You must override this or you - * will crash when someone does that. - */ - public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int index) { - ItemStack itemstack = null; - Slot slot = (Slot) this.inventorySlots.get(index); - - if (slot != null && slot.getHasStack()) { - ItemStack itemstack1 = slot.getStack(); - itemstack = itemstack1.copy(); - - // If item is in our custom Inventory or armor slot - if (index < INV_START) { - // try to place in player inventory / action bar - if (!this.mergeItemStack(itemstack1, INV_START, HOTBAR_END + 1, true)) { - return null; - } - - slot.onSlotChange(itemstack1, itemstack); - } - // Item is in inventory / hotbar, try to place in custom inventory or armor - // slots - else { - /* - * If your inventory only stores certain instances of Items, you can implement - * shift-clicking to your inventory like this: - * - * // Check that the item is the right type if (itemstack1.getItem() instanceof - * ItemCustom) { // Try to merge into your custom inventory slots // We use - * 'CustomBoxInventory.INV_SIZE' instead of INV_START just in case // you also - * add armor or other custom slots if (!this.mergeItemStack(itemstack1, 0, - * CustomBoxInventory.INV_SIZE, false)) { return null; } } // If you added armor - * slots, check them here as well: // Item being shift-clicked is armor - try to - * put in armor slot if (itemstack1.getItem() instanceof ItemArmor) { int type = - * ((ItemArmor) itemstack1.getItem()).armorType; if - * (!this.mergeItemStack(itemstack1, ARMOR_START + type, ARMOR_START + type + 1, - * false)) { return null; } } Otherwise, you have basically 2 choices: 1. - * shift-clicking between player inventory and custom inventory 2. - * shift-clicking between action bar and inventory - * - * Be sure to choose only ONE of the following implementations!!! - */ - /** - * Implementation number 1: Shift-click into your custom inventory - */ - if (index >= INV_START) { - // place in custom inventory - if (!this.mergeItemStack(itemstack1, 0, INV_START, false)) { - return null; - } - } - - /** - * Implementation number 2: Shift-click items between action bar and inventory - */ - // item is in player's inventory, but not in action bar - if (index >= INV_START && index < HOTBAR_START) { - // place in action bar - if (!this.mergeItemStack(itemstack1, HOTBAR_START, HOTBAR_END + 1, false)) { - return null; - } - } - // item in action bar - place in player inventory - else if (index >= HOTBAR_START && index < HOTBAR_END + 1) { - if (!this.mergeItemStack(itemstack1, INV_START, INV_END + 1, false)) { - return null; - } - } - } - - if (itemstack1.stackSize == 0) { - slot.putStack((ItemStack) null); - } else { - slot.onSlotChanged(); - } - - if (itemstack1.stackSize == itemstack.stackSize) { - return null; - } - - slot.onPickupFromSlot(par1EntityPlayer, itemstack1); - } - - return itemstack; - } - - /** - * You should override this method to prevent the player from moving the stack - * that opened the inventory, otherwise if the player moves it, the inventory - * will not be able to save properly - */ - @Override - public ItemStack slotClick(int slot, int button, int flag, EntityPlayer player) { - // this will prevent the player from interacting with the item that opened the - // inventory: - if (slot >= 0 && getSlot(slot) != null && getSlot(slot).getStack() == player.getHeldItem()) { - return null; - } - return super.slotClick(slot, button, flag, player); - } - - /* - * Special note: If your custom inventory's stack limit is 1 and you allow - * shift-clicking itemstacks into it, you will need to override mergeStackInSlot - * to avoid losing all the items but one in a stack when you shift-click. - */ - /** - * Vanilla mergeItemStack method doesn't correctly handle inventories whose max - * stack size is 1 when you shift-click into the inventory. This is a modified - * method I wrote to handle such cases. Note you only need it if your slot / - * inventory's max stack size is 1 - */ - @Override - protected boolean mergeItemStack(ItemStack stack, int start, int end, boolean backwards) { - boolean flag1 = false; - int k = (backwards ? end - 1 : start); - Slot slot; - ItemStack itemstack1; - - if (stack.isStackable()) { - while (stack.stackSize > 0 && (!backwards && k < end || backwards && k >= start)) { - slot = (Slot) inventorySlots.get(k); - itemstack1 = slot.getStack(); - - if (!slot.isItemValid(stack)) { - k += (backwards ? -1 : 1); - continue; - } - - if (itemstack1 != null && itemstack1.getItem() == stack.getItem() - && (!stack.getHasSubtypes() || stack.getItemDamage() == itemstack1.getItemDamage()) - && ItemStack.areItemStackTagsEqual(stack, itemstack1)) { - int l = itemstack1.stackSize + stack.stackSize; - - if (l <= stack.getMaxStackSize() && l <= slot.getSlotStackLimit()) { - stack.stackSize = 0; - itemstack1.stackSize = l; - getInventoryObject().markDirty(); - flag1 = true; - } else if (itemstack1.stackSize < stack.getMaxStackSize() && l < slot.getSlotStackLimit()) { - stack.stackSize -= stack.getMaxStackSize() - itemstack1.stackSize; - itemstack1.stackSize = stack.getMaxStackSize(); - getInventoryObject().markDirty(); - flag1 = true; - } - } - - k += (backwards ? -1 : 1); - } - } - if (stack.stackSize > 0) { - k = (backwards ? end - 1 : start); - while (!backwards && k < end || backwards && k >= start) { - slot = (Slot) inventorySlots.get(k); - itemstack1 = slot.getStack(); - - if (!slot.isItemValid(stack)) { - k += (backwards ? -1 : 1); - continue; - } - - if (itemstack1 == null) { - int l = stack.stackSize; - if (l <= slot.getSlotStackLimit()) { - slot.putStack(stack.copy()); - stack.stackSize = 0; - getInventoryObject().markDirty(); - flag1 = true; - break; - } else { - putStackInSlot(k, - new ItemStack(stack.getItem(), slot.getSlotStackLimit(), stack.getItemDamage())); - stack.stackSize -= slot.getSlotStackLimit(); - getInventoryObject().markDirty(); - flag1 = true; - } - } - - k += (backwards ? -1 : 1); - } - } - - return flag1; - } - - public CustomBoxInventory getInventoryObject() { - return inventory; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/box/CustomBoxInventory.java b/src/Java/gtPlusPlus/core/item/tool/misc/box/CustomBoxInventory.java deleted file mode 100644 index 0737e463d8..0000000000 --- a/src/Java/gtPlusPlus/core/item/tool/misc/box/CustomBoxInventory.java +++ /dev/null @@ -1,243 +0,0 @@ -package gtPlusPlus.core.item.tool.misc.box; - -import java.util.UUID; - -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.minecraftforge.common.util.Constants; - -public abstract class CustomBoxInventory implements IInventory { - - private final String name; - protected String uniqueID; - - /** Provides NBT Tag Compound to reference */ - private final ItemStack invItem; - - /** Defining your inventory size this way is handy */ - public final int INV_SIZE; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory; - - /** - * @param itemstack - the ItemStack to which this inventory belongs - */ - public CustomBoxInventory(ItemStack stack, String name2){ - this(stack, name2, 8); - } - - /** - * @param itemstack - the ItemStack to which this inventory belongs - */ - public CustomBoxInventory(ItemStack stack, String name2, int slots) - { - invItem = stack; - name = name2; - INV_SIZE = slots; - inventory = new ItemStack[INV_SIZE]; - - /** initialize variable within the constructor: */ - uniqueID = ""; - - if (!stack.hasTagCompound()) - { - stack.setTagCompound(new NBTTagCompound()); - // no tag compound means the itemstack does not yet have a UUID, so assign one: - uniqueID = UUID.randomUUID().toString(); - } - - /** When reading from NBT: */ - if ("".equals(uniqueID)) - { - // try to read unique ID from NBT - uniqueID = stack.getTagCompound().getString("uniqueID"); - // if it's still "", assign a new one: - if ("".equals(uniqueID)) - { - uniqueID = UUID.randomUUID().toString(); - } - } - - /** Writing to NBT: */ - // just add this line: - stack.getTagCompound().setString("uniqueID", this.uniqueID); - - // note that it's okay to use stack instead of invItem right there - // both reference the same memory location, so whatever you change using - // either reference will change in the other - - // Read the inventory contents from NBT - readFromNBT(stack.getTagCompound()); - } - - @Override - public int getSizeInventory() - { - return inventory.length; - } - - @Override - public ItemStack getStackInSlot(int slot) - { - return inventory[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int amount) - { - ItemStack stack = getStackInSlot(slot); - if(stack != null) - { - if(stack.stackSize > amount) - { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - markDirty(); - } - else - { - // this method also calls onInventoryChanged, so we don't need to call it again - setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(int slot) - { - ItemStack stack = getStackInSlot(slot); - setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack stack) - { - inventory[slot] = stack; - - if (stack != null && stack.stackSize > getInventoryStackLimit()) - { - stack.stackSize = getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() - { - return name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() - { - return name.length() > 0; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) - * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also - * let you change things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() - { - for (int i = 0; i < getSizeInventory(); ++i) - { - if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) { - inventory[i] = null; - } - } - - // This line here does the work: - writeToNBT(invItem.getTagCompound()); - } - - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) - { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as - * items can still be left-clicked and placed in the inventory - * even when this returns false - */ - @Override - public abstract boolean isItemValidForSlot(int slot, ItemStack itemstack); - - /** - * A custom method to read our inventory from an ItemStack's NBT compound - */ - public void readFromNBT(NBTTagCompound compound) - { - // Gets the custom taglist we wrote to this compound, if any - // 1.7.2+ change to compound.getTagList("ItemInventory", Constants.NBT.TAG_COMPOUND); - NBTTagList items = compound.getTagList("ItemInventory", Constants.NBT.TAG_COMPOUND); - - for (int i = 0; i < items.tagCount(); ++i) - { - // 1.7.2+ change to items.getCompoundTagAt(i) - NBTTagCompound item = (NBTTagCompound) items.getCompoundTagAt(i); - int slot = item.getInteger("Slot"); - - // Just double-checking that the saved slot index is within our inventory array bounds - if (slot >= 0 && slot < getSizeInventory()) { - inventory[slot] = ItemStack.loadItemStackFromNBT(item); - } - } - } - - /** - * A custom method to write our inventory to an ItemStack's NBT compound - */ - public void writeToNBT(NBTTagCompound tagcompound) - { - // Create a new NBT Tag List to store itemstacks as NBT Tags - NBTTagList items = new NBTTagList(); - - for (int i = 0; i < getSizeInventory(); ++i) - { - // Only write stacks that contain items - if (getStackInSlot(i) != null) - { - // Make a new NBT Tag Compound to write the itemstack and slot index to - NBTTagCompound item = new NBTTagCompound(); - item.setInteger("Slot", i); - // Writes the itemstack in slot(i) to the Tag Compound we just made - getStackInSlot(i).writeToNBT(item); - - // add the tag compound to our tag list - items.appendTag(item); - } - } - // Add the TagList to the ItemStack's Tag Compound with the name "ItemInventory" - tagcompound.setTag("ItemInventory", items); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/box/MagicToolBag.java b/src/Java/gtPlusPlus/core/item/tool/misc/box/MagicToolBag.java deleted file mode 100644 index 65b884bd51..0000000000 --- a/src/Java/gtPlusPlus/core/item/tool/misc/box/MagicToolBag.java +++ /dev/null @@ -1,11 +0,0 @@ -package gtPlusPlus.core.item.tool.misc.box; - -public class MagicToolBag extends BaseBoxItem { - - public final static int SLOTS = 24; - - public MagicToolBag(String displayName) { - super(displayName, new String[] {"Can store magic tools from TC, BM, etc", "Please ask for additional mod support on Github"}, gtPlusPlus.core.item.tool.misc.box.MagicToolBag.SLOTS); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/box/UniversalToolBox.java b/src/Java/gtPlusPlus/core/item/tool/misc/box/UniversalToolBox.java deleted file mode 100644 index 92b1382e01..0000000000 --- a/src/Java/gtPlusPlus/core/item/tool/misc/box/UniversalToolBox.java +++ /dev/null @@ -1,13 +0,0 @@ -package gtPlusPlus.core.item.tool.misc.box; - -import gtPlusPlus.core.handler.GuiHandler; - -public class UniversalToolBox extends BaseBoxItem { - - public final static int SLOTS = 16; - - public UniversalToolBox(String displayName) { - super(displayName, new String[] {"Can store tools from Gregtech, IC2, BC, Forestry", "Please ask for additional mod support on Github"}, GuiHandler.GUI10); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java deleted file mode 100644 index 2c2441064b..0000000000 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java +++ /dev/null @@ -1,311 +0,0 @@ -package gtPlusPlus.core.item.tool.staballoy; - -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.Block; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; - -public class MultiPickaxeBase extends StaballoyPickaxe{ - - /* (non-Javadoc) - * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.ItemStack) - */ - @Override - public double getDurabilityForDisplay(final ItemStack stack) { - if (super.getDurabilityForDisplay(stack) > 0){ - return super.getDurabilityForDisplay(stack);} - return 0; - } - - protected boolean canBreak = true; - protected final int colour; - protected final String materialName; - protected final String displayName; - public boolean isValid = true; - private final Pair<?, ?> enchantment; - - public MultiPickaxeBase(final String unlocalizedName, final ToolMaterial material, final long materialDurability, final int colour, final Object enchant) { - super(Utils.sanitizeString(unlocalizedName), material); - this.setUnlocalizedName(Utils.sanitizeString(unlocalizedName)); - //this.setTextureName(CORE.MODID + ":" + "itemPickaxe"); - this.setTextureName("minecraft"+":"+"iron_pickaxe"); - this.setMaxStackSize(1); - if ((materialDurability*3) <= Integer.MAX_VALUE){ - this.setMaxDamage((int) (materialDurability*3)); - } - else { - this.setMaxDamage(Integer.MAX_VALUE); - this.canBreak = false; - } - this.colour = colour; - this.materialName = material.name(); - this.displayName = unlocalizedName; - this.setCreativeTab(AddToCreativeTab.tabTools); - this.miningLevel = material.getHarvestLevel(); - - - - if (enchant != null){ - if (enchant instanceof Pair){ - this.enchantment = (Pair<?, ?>) enchant; - } - else { - this.enchantment = null; - } - } - else { - this.enchantment = null; - } - - try {this.isValid = this.addRecipe();} catch (final Throwable e){} - if ((colour != 0) && this.isValid && (materialDurability > 10000)){ - if (GameRegistry.findItem(CORE.MODID, Utils.sanitizeString(unlocalizedName)) == null){ - GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName)); - } - } - - } - - /* - * - * - * - * Methods - * - * - * - */ - - private boolean addRecipe(){ - - final String cleanName = Utils.sanitizeString(this.materialName); - - final String plateDense = "plateDense"+cleanName; - final String plateDouble = "plateDouble"+cleanName; - final String rodLong = "stickLong"+cleanName; - final String toolHammer = "craftingToolHardHammer"; - final String toolWrench = "craftingToolWrench"; - final String toolFile = "craftingToolFile"; - final String toolScrewDriver = "craftingToolScrewdriver"; - - if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)){ - Logger.WARNING("stickLong of "+cleanName+" does not exist."); - return false; - } - if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDense, 1)){ - Logger.WARNING("plateDense of "+cleanName+" does not exist."); - if (null != ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDouble, 1)){ - Logger.WARNING("plateDouble of "+cleanName+" does exist. Using it instead."); - RecipeUtils.recipeBuilder( - plateDouble, plateDouble, plateDouble, - toolFile, rodLong, toolHammer, - toolWrench, rodLong, toolScrewDriver, - ItemUtils.getSimpleStack(this)); - - return true; - } - Logger.WARNING("plateDouble of "+cleanName+" does not exist."); - return false; - } - - RecipeUtils.recipeBuilder( - plateDense, plateDense, plateDense, - toolFile, rodLong, toolHammer, - toolWrench, rodLong, toolScrewDriver, - ItemUtils.getSimpleStack(this)); - - return true; - } - - public final String getMaterialName() { - return this.materialName; - } - - @Override - public String getItemStackDisplayName(final ItemStack iStack) { - return this.displayName; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - if (this.colour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return this.colour; - - } - - private float calculateDurabilityLoss(final World world, final int X, final int Y, final int Z){ - float bDurabilityLoss = 0; - Boolean correctTool = false; - float bHardness = 0; - if (!world.isRemote){ - try { - final Block removalist = world.getBlock(X, Y, Z); - //Utils.LOG_WARNING(removalist.toString()); - - bHardness = removalist.getBlockHardness(world, X, Y, Z)*100; - Logger.INFO("Hardness: "+bHardness); - - bDurabilityLoss = 100; - //Utils.LOG_WARNING("Durability Loss: "+bDurabilityLoss); - - correctTool = this.canPickaxeBlock(removalist, world, new int[]{X,Y,Z}); - Logger.WARNING(""+correctTool); - - if (!correctTool){ - return 0; - } - - } catch (final NullPointerException e){ - - } - } - return bDurabilityLoss; - } - - //Should clear up blocks quicker if I chain it. - /*@Override - public void removeBlockAndDropAsItem(World world, int X, int Y, int Z, ItemStack heldItem){ - localWorld = world; - try { - Block block = world.getBlock(X, Y, Z); - float dur = calculateDurabilityLoss(world, X, Y, Z); - Utils.LOG_WARNING(block.toString()); - String removalTool = ""; - removalTool = block.getHarvestTool(1); - - if (removalTool.equals("pickaxe") || UtilsMining.getBlockType(block, world, new int[]{X,Y,Z}, miningLevel)){ - if (canPickaxeBlock(block, world, new int[]{X,Y,Z})){ - if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) != -1) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ - - if (heldItem.getItemDamage() <= (heldItem.getMaxDamage()-dur)){ - - block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0); - world.setBlockToAir(X, Y, Z); - - } - else { - return; - } - - } - } - else { - Utils.LOG_WARNING("Incorrect Tool for mining this block."); - } - } - } catch (NullPointerException e){ - - } - }*/ - - @Override - public void damageItem(final ItemStack item, final int damage, final EntityPlayer localPlayer){ - if (this.canBreak){ - item.damageItem(damage, localPlayer); - } - } - - @Override - public void setItemDamage(final ItemStack item, final int damage){ - if (this.canBreak){ - item.setItemDamage(damage-1); - } - } - - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack){ - return EnumRarity.uncommon; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack){ - return false; - } - - @Override - public void onCreated(final ItemStack mThisItem, final World mWorld, final EntityPlayer mPlayer) { - Enchantment enchant = null; - int enchantmentLevel = 0; - final Pair<?, ?> Y = this.enchantment; - if (Y != null){ - if (Y.getKey() != null){ - enchant = (Enchantment) this.enchantment.getKey(); - } - if (Y.getValue() != null){ - enchantmentLevel = ((Integer) this.enchantment.getValue()).intValue(); - } - } - final ItemStack itemToEnchant = mThisItem; - if ((enchant != null) && (enchantmentLevel != 0) && (enchantmentLevel >= 1)){ - itemToEnchant.addEnchantment(enchant, enchantmentLevel); - } - super.onCreated(itemToEnchant, mWorld, mPlayer); - } - - @Override - public void getSubItems(final Item mItem, final CreativeTabs mCreativeTab, final List mList) { - Enchantment enchant = null; - int enchantmentLevel = 0; - final Pair<?, ?> Y = this.enchantment; - if (Y != null){ - if (Y.getKey() != null){ - enchant = (Enchantment) this.enchantment.getKey(); - } - if (Y.getValue() != null){ - enchantmentLevel = ((Integer) this.enchantment.getValue()).intValue(); - } - } - - final Item thisItem = mItem; - final ItemStack itemToEnchant = ItemUtils.getSimpleStack(thisItem); - if ((enchant != null) && (enchantmentLevel != 0) && (enchantmentLevel >= 1)){ - itemToEnchant.addEnchantment(enchant, enchantmentLevel); - mList.add(itemToEnchant); - } - else { - mList.add(new ItemStack(thisItem, 1, 0)); - } - - } - - - /** - * - * Time to Override Minecraft stupid mechanics, allowing unbreakable stuff. - * - */ - - @Override - public boolean isDamageable(){ - if (this.getMaxDamage() > 0 && !this.hasSubtypes){ - if (this.canBreak){ - return true; - } - } - return false; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java deleted file mode 100644 index d01b400fab..0000000000 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java +++ /dev/null @@ -1,126 +0,0 @@ -package gtPlusPlus.core.item.tool.staballoy; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; - -public class MultiSpadeBase extends StaballoySpade{ - - /* (non-Javadoc) - * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.ItemStack) - */ - @Override - public double getDurabilityForDisplay(final ItemStack stack) { - if (super.getDurabilityForDisplay(stack) > 0){ - return super.getDurabilityForDisplay(stack);} - return 0; - } - - protected final int colour; - protected final String materialName; - protected final String displayName; - public boolean isValid = true; - - public MultiSpadeBase(final String unlocalizedName, final ToolMaterial material, final int materialDurability, final int colour) { - super(Utils.sanitizeString(unlocalizedName), material); - this.setUnlocalizedName(Utils.sanitizeString(unlocalizedName)); - //this.setTextureName(CORE.MODID + ":" + "itemShovel"); - this.setTextureName("minecraft"+":"+"iron_shovel"); - this.setMaxStackSize(1); - this.setMaxDamage(materialDurability*3); - this.colour = colour; - this.materialName = material.name(); - this.displayName = unlocalizedName; - this.setCreativeTab(AddToCreativeTab.tabTools); - try { - this.isValid = this.addRecipe(); - } - catch (final Throwable e){} - if ((colour != 0) && this.isValid){ - if (GameRegistry.findItem(CORE.MODID, Utils.sanitizeString(unlocalizedName)) == null) { - GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName)); - } - } - } - - private boolean addRecipe(){ - final String cleanName = Utils.sanitizeString(this.materialName); - final String plateDense = "plateDense"+cleanName; - final String plateDouble = "plateDouble"+cleanName; - final String rodLong = "stickLong"+cleanName; - final String toolHammer = "craftingToolHardHammer"; - final String toolWrench = "craftingToolWrench"; - final String toolFile = "craftingToolFile"; - final String toolScrewDriver = "craftingToolScrewdriver"; - - if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)){ - return false; - } - if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDense, 1)){ - if (null != ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDouble, 1)){ - RecipeUtils.recipeBuilder( - toolFile, plateDouble, toolHammer, - null, rodLong, null, - toolWrench, rodLong, toolScrewDriver, - ItemUtils.getSimpleStack(this)); - - return true; - } - return false; - } - - RecipeUtils.recipeBuilder( - toolFile, plateDense, toolHammer, - null, rodLong, null, - toolWrench, rodLong, toolScrewDriver, - ItemUtils.getSimpleStack(this)); - - return true; - } - - public final String getMaterialName() { - return this.materialName; - } - - @Override - public String getItemStackDisplayName(final ItemStack iStack) { - return this.displayName; - /*String name; - if (getUnlocalizedName().toLowerCase().contains("wood")){ - name = "Wooden"; - } - else { - } - return "Big "+name+" Spade";*/ - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - if (this.colour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return this.colour; - } - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack){ - return EnumRarity.uncommon; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack){ - return false; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java deleted file mode 100644 index 153a417d7b..0000000000 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java +++ /dev/null @@ -1,345 +0,0 @@ -package gtPlusPlus.core.item.tool.staballoy; - -import java.util.List; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.*; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemAxe; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import gtPlusPlus.core.lib.CORE; - -public class StaballoyAxe extends ItemAxe{ - public String mat; - - public StaballoyAxe(final String unlocalizedName, final ToolMaterial material) { - super(material); - this.setUnlocalizedName(unlocalizedName); - this.setTextureName(CORE.MODID + ":" + unlocalizedName); - } - - // EXPLODE TREE - byte[] tre= new byte[32000]; - byte unchecked=0; - byte needcheck=1; - byte ignore =2; - byte harvest =3; - - private boolean setcheck(final int x, final int y, final int z) { - if((x<0) || (x>19) || (z<0) || (z>19) || (y<0) || (y>79)) { - return false; - } - final int o=x+(z*20)+(y*400); - if (this.tre[o]==this.unchecked) { - this.tre[o]=this.needcheck; - } - return true; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(EnumChatFormatting.GOLD+"Fells entire trees in a single swipe!.."); - list.add(EnumChatFormatting.GRAY+"Ask Alkalus for new trees to be supported."); - super.addInformation(stack, aPlayer, list, bool); - } - - public static boolean canIgnore(final Block bit){ - if (bit instanceof BlockAir) { - return true; - } - if (bit instanceof BlockGrass) { - return true; - } - if (bit instanceof BlockSand) { - return true; - } - if (bit instanceof BlockDirt) { - return true; - } - if (bit instanceof BlockCocoa) { - return true; - } - if (bit instanceof BlockVine) { - return true; - } - if (bit instanceof BlockMushroom) { - return true; - } - if (bit instanceof BlockSnow) { - return true; - } - if (bit instanceof BlockSnowBlock) { - return true; - } - if (bit instanceof BlockFlower) { - return true; - } - if (bit instanceof BlockTallGrass) { - return true; - } - if (bit instanceof BlockDoublePlant) { - return true; - } - - //LoonTools.log("Found uncuttable "+bit.getClass().getSimpleName()); - return false; - } - - private int check(final World par1World, final int x, final int y, final int z, final int xo, final int yo,final int zo) { - int f=0; - final int o=x+(z*20)+(y*400); - if (this.tre[o]==this.needcheck){ - this.tre[o]=this.ignore; - final Block bit = par1World.getBlock(x+xo, y+yo, z+zo); - if ((bit instanceof BlockLog)||(bit instanceof BlockLeavesBase)||(bit instanceof BlockHugeMushroom) || (bit.getUnlocalizedName().toLowerCase().contains("log")) || (bit.getUnlocalizedName().toLowerCase().contains("wood"))){ - f=1; - this.tre[o]=this.harvest; - //if (bit instanceof BlockLog){ - // LoonTools.log("^ Found log @ "+x+xo+" "+y+yo+" "+z+zo+" "); - //} - for(int xb=-1;xb<2;xb++) { - for(int yb=-1;yb<2;yb++) { - for(int zb=-1;zb<2;zb++) { - if (!this.setcheck(x+xb,y+yb,z+zb)) { - return 3; - } - } - } - } - }else{ - if (!canIgnore(bit)) { - return 2; - } - } - } - return f; - } - - public int checkTree(final World par1World,final int xo,final int yo,final int zo){ - boolean f; - for (f=true;f==true;){ - f=false; - for (int y=0;y<80;y++) { - for(int z=0;z<20;z++) { - for(int x=0;x<20;x++){ - final int r=this.check(par1World,x,y,z,xo,yo,zo); - if (r==3) { - return 3; - } - if (r==2) { - return 2; - } - if (r==1) { - f=true; - } - } - } - } - - for (int y=79;y>=0;y--) { - for(int z=19;z>=0;z--) { - for(int x=19;x>=0;x--){ - final int r=this.check(par1World,x,y,z,xo,yo,zo); - if (r==2) { - return 3; - } - //if (r==2) return 2; - if (r==1) { - f=true; - } - } - } - } - } - return 1; - } - - private int check2(final World par1World, final int x, final int y, final int z, final int xo, final int yo,final int zo) { - int f=0; - final int o=x+(z*20)+(y*400); - if (this.tre[o]==this.needcheck){ - this.tre[o]=this.ignore; - final Block bit = par1World.getBlock(x+xo, y+yo, z+zo); - if (bit instanceof BlockLog){ - f=1; - this.tre[o]=this.harvest; - //if (bit instanceof BlockLog){ - // LoonTools.log("^ Found log @ "+x+xo+" "+y+yo+" "+z+zo+" "); - //} - for(int xb=-1;xb<2;xb++) { - for(int yb=-1;yb<2;yb++) { - for(int zb=-1;zb<2;zb++) { - if (!this.setcheck(x+xb,y+yb,z+zb)) { - return 3; - } - } - } - } - }else if (bit instanceof BlockLeavesBase){ - }else{ - if (!canIgnore(bit)) { - return 2; - } - } - } - return f; - } - - public int checkTree2(final World par1World,final int xo,final int yo,final int zo){ - boolean f; - for (f=true;f==true;){ - f=false; - for (int y=0;y<80;y++) { - for(int z=0;z<20;z++) { - for(int x=0;x<20;x++){ - final int r=this.check2(par1World,x,y,z,xo,yo,zo); - if (r==3) { - return 3; - } - if (r==2) { - return 2; - } - if (r==1) { - f=true; - } - } - } - } - - for (int y=79;y>=0;y--) { - for(int z=19;z>=0;z--) { - for(int x=19;x>=0;x--){ - final int r=this.check2(par1World,x,y,z,xo,yo,zo); - if (r==2) { - return 3; - } - //if (r==2) return 2; - if (r==1) { - f=true; - } - } - } - } - } - return 1; - } - - public void exploadTree(final World par1World,final int xo,final int yo,final int zo, final EntityPlayer plr){ - for (int y=0;y<80;y++) { - for(int z=0;z<20;z++) { - for(int x=0;x<20;x++){ - final int o=x+(z*20)+(y*400); - if (this.tre[o]==this.harvest){ - final Block bit = par1World.getBlock(x+xo, y+yo, z+zo); - final int met = par1World.getBlockMetadata(x+xo, y+yo, z+zo); - - if ((bit instanceof BlockLog)||(bit instanceof BlockLeavesBase) || (bit.getUnlocalizedName().toLowerCase().contains("log")) || (bit.getUnlocalizedName().toLowerCase().contains("wood"))){ - bit.harvestBlock(par1World, plr, x+xo, y+yo, z+zo,met); - par1World.setBlockToAir(x+xo, y+yo, z+zo); - } - } - } - } - } - } - - private static void breakMushroom(final World wld, final Block bit, final EntityPlayer plr, final boolean silk, final int x, final int y, final int z, final int met) { - if (silk){ - final ItemStack stk = null; //TODO - /*if (bit==Blocks.brown_mushroom_block) stk = new ItemStack(LoonToolItems.brown_mushroom_block,1,met); - else if (bit==Blocks.red_mushroom_block) stk = new ItemStack(LoonToolItems.red_mushroom_block,1,met); - else stk = new ItemStack(bit,1,met);*/ - final EntityItem entityitem = new EntityItem(wld, x+0.5, y+0.5, z+0.5, stk); - entityitem.delayBeforeCanPickup = 10; - wld.spawnEntityInWorld(entityitem); - }else{ - bit.harvestBlock(wld, plr, x, y, z, met); - } - wld.setBlockToAir(x, y, z); - } - - public void exploadMushroom(final World par1World,final int xo,final int yo,final int zo, final EntityPlayer plr, final boolean silk){ - for (int y=0;y<80;y++) { - for(int z=0;z<20;z++) { - for(int x=0;x<20;x++){ - final int o=x+(z*20)+(y*400); - if (this.tre[o]==this.harvest){ - final Block bit = par1World.getBlock(x+xo, y+yo, z+zo); - final int met = par1World.getBlockMetadata(x+xo, y+yo, z+zo); - if (bit instanceof BlockHugeMushroom){ - breakMushroom(par1World, bit, plr, silk, x+xo, y+yo, z+zo,met); - }else{ - bit.harvestBlock(par1World, plr, x+xo, y+yo, z+zo,met); - par1World.setBlockToAir(x+xo, y+yo, z+zo); - } - } - } - } - } - } - - - @Override - public boolean onBlockDestroyed(final ItemStack itm, final World wld,final Block blk, final int x, final int y,final int z, final EntityLivingBase plr) { - if (!wld.isRemote){ - final Block bit = wld.getBlock(x, y, z); - final boolean silk=EnchantmentHelper.getSilkTouchModifier(plr); - if ((bit instanceof BlockHugeMushroom)){ - for (int n=0;n<32000;n++) { - this.tre[n]=this.unchecked; - } - final int met = wld.getBlockMetadata(x, y, z); - breakMushroom(wld, bit, (EntityPlayer) plr, silk, x, y, z,met); - wld.setBlockToAir(x,y,z); - this.tre[2210]=this.needcheck; - if (this.checkTree(wld,x-10,y-4,z-10)==1){ - this.exploadMushroom(wld,x-10,y-4,z-10,(EntityPlayer) plr,silk); - } - } - - if ((bit instanceof BlockLog) || (bit.getUnlocalizedName().toLowerCase().contains("log")) || (bit.getUnlocalizedName().toLowerCase().contains("wood"))){ - //LoonTools.log("cutting tree @ "+x+" "+y+" "+z+" "); - for (int n=0;n<32000;n++) { - this.tre[n]=this.unchecked; - } - final int met = wld.getBlockMetadata(x, y, z); - bit.harvestBlock(wld, (EntityPlayer) plr, x, y, z,met); - wld.setBlockToAir(x,y,z); - this.tre[2210]=this.needcheck; - if (this.checkTree(wld,x-10,y-4,z-10)==1){ - this.exploadTree(wld,x-10,y-4,z-10,(EntityPlayer) plr); - }else{ - for (int n=0;n<32000;n++) { - this.tre[n]=this.unchecked; - } - this.tre[2210]=this.needcheck; - if (this.checkTree2(wld,x-10,y-4,z-10)==1){ - this.exploadTree(wld,x-10,y-4,z-10,(EntityPlayer) plr); - } - } - } - } - return super.onBlockDestroyed(itm, wld, blk, x, y, z, plr); - } - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack){ - return EnumRarity.rare; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack){ - return true; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java deleted file mode 100644 index 830c4994ba..0000000000 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java +++ /dev/null @@ -1,462 +0,0 @@ -package gtPlusPlus.core.item.tool.staballoy; - -import java.util.List; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemPickaxe; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.MiningUtils; - -public class StaballoyPickaxe extends ItemPickaxe{ - - /* (non-Javadoc) - * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.ItemStack) - */ - @Override - public double getDurabilityForDisplay(final ItemStack stack) { - return (double)stack.getItemDamageForDisplay() / (double)stack.getMaxDamage(); - } - - /** - * Creates an NBT tag for this item if it doesn't have one. - * This also set some default values. - * @param rStack - * @return - */ - - private static boolean createNBT(ItemStack rStack){ - final NBTTagCompound tagMain = new NBTTagCompound(); - final NBTTagCompound tagNBT = new NBTTagCompound(); - - tagNBT.setBoolean("FACING_HORIZONTAL", true); - tagNBT.setString("FACING", "north"); - tagNBT.setString("lookingDirection", ""); - - tagMain.setTag("PickStats", tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - /* - * Is the player facing horizontally? - */ - - public static final boolean isFacingHorizontal(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("PickStats"); - if (aNBT != null) { - return aNBT.getBoolean("FACING_HORIZONTAL"); - } - } - else { - createNBT(aStack); - } - return true; - } - - public static final boolean setFacingHorizontal(final ItemStack aStack, final boolean aFacingHorizontal) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("PickStats"); - if (aNBT != null) { - aNBT.setBoolean("FACING_HORIZONTAL", aFacingHorizontal); - return true; - } - } - return false; - } - - /* - * Handles the Direction the player is facing - */ - - public static final String getFacingDirection(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("PickStats"); - if (aNBT != null) { - return aNBT.getString("FACING"); - } - } - else { - createNBT(aStack); - } - return "north"; - } - - public static final boolean setFacingDirection(final ItemStack aStack, final String aFacingHorizontal) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("PickStats"); - if (aNBT != null) { - aNBT.setString("FACING", aFacingHorizontal); - return true; - } - } - return false; - } - - /* - * The Looking Direction handlers - */ - - public static final String getLookingDirection(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("PickStats"); - if (aNBT != null) { - return aNBT.getString("lookingDirection"); - } - } - else { - createNBT(aStack); - } - return ""; - } - - public static final boolean setLookingDirection(final ItemStack aStack, final String aFacingHorizontal) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("PickStats"); - if (aNBT != null) { - aNBT.setString("lookingDirection", aFacingHorizontal); - return true; - } - } - return false; - } - - protected int miningLevel; - - /* - * - * - * - * Methods - * - * - * - */ - - @Override - public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer aPlayer) { - return super.onItemRightClick(stack, world, aPlayer); - } - - - - @Override - public boolean onBlockDestroyed(final ItemStack stack, final World world, final Block block, final int X, final int Y, final int Z, final EntityLivingBase entity) { - if (!world.isRemote){ - if (entity instanceof EntityPlayer) { - this.GetDestroyOrientation((EntityPlayer) entity, block, getLookingDirection(stack), world, X, Y, Z, stack); - } - } - return super.onBlockDestroyed(stack, world, block, X, Y, Z, entity); - } - - private float calculateDurabilityLoss(final World world, final int X, final int Y, final int Z){ - float bDurabilityLoss = 0; - Boolean correctTool = false; - float bHardness = 0; - if (!world.isRemote){ - try { - final Block removalist = world.getBlock(X, Y, Z); - //Utils.LOG_WARNING(removalist.toString()); - - bHardness = removalist.getBlockHardness(world, X, Y, Z); - Logger.WARNING("Hardness: "+bHardness); - - bDurabilityLoss = (bDurabilityLoss + bHardness); - //Utils.LOG_WARNING("Durability Loss: "+bDurabilityLoss); - - correctTool = this.canPickaxeBlock(removalist, world, new int[]{X,Y,Z}); - Logger.WARNING(""+correctTool); - - if (!correctTool){ - return 0; - } - - } catch (final NullPointerException e){ - - } - } - return 100; - } - - public Boolean canPickaxeBlock(final Block currentBlock, final World currentWorld, final int[] xyz){ - String correctTool = ""; - if (!currentWorld.isRemote){ - try { - correctTool = currentBlock.getHarvestTool(0); - if (MiningUtils.getBlockType(currentBlock, currentWorld, xyz, this.miningLevel) || correctTool.equals("pickaxe") || correctTool.equals("null")){ - //Utils.LOG_WARNING(correctTool); - return true;} - } catch (final NullPointerException e){ - return false;} - } - return false; - } - - private void GetDestroyOrientation(EntityPlayer entity, final Block block, final String FACING, final World world, final int X, final int Y, final int Z, final ItemStack heldItem){ - float DURABILITY_LOSS = 0; - if (!world.isRemote){ - - Logger.WARNING("hardness:"+block.getBlockHardness(world, X, Y, Z)); - if (FACING.equals("below") || FACING.equals("above")){ - DURABILITY_LOSS = 0; - for(int i = -1; i < 2; i++) { - for(int j = -1; j < 2; j++) { - final float dur = this.calculateDurabilityLoss(world, X + i, Y, Z + j); - DURABILITY_LOSS = (DURABILITY_LOSS + dur); - Logger.WARNING("Added Loss: "+dur); - this.removeBlockAndDropAsItem(world, X + i, Y, Z + j, heldItem); - } - } - } - - else if (FACING.equals("facingEast") || FACING.equals("facingWest")){ - DURABILITY_LOSS = 0; - for(int i = -1; i < 2; i++) { - for(int j = -1; j < 2; j++) { - final float dur = this.calculateDurabilityLoss(world, X, Y + i, Z + j); - DURABILITY_LOSS = (DURABILITY_LOSS + dur); - Logger.WARNING("Added Loss: "+dur); - this.removeBlockAndDropAsItem(world, X , Y + i, Z + j, heldItem); - } - } - } - - else if (FACING.equals("facingNorth") || FACING.equals("facingSouth")){ - DURABILITY_LOSS = 0; - for(int i = -1; i < 2; i++) { - for(int j = -1; j < 2; j++) { - final float dur = this.calculateDurabilityLoss(world, X + j, Y + i, Z); - DURABILITY_LOSS = (DURABILITY_LOSS + dur); - Logger.WARNING("Added Loss: "+dur); - this.removeBlockAndDropAsItem(world, X + j, Y + i, Z, heldItem); - } - } - } - - //int heldItemDurability = heldItem.getDamage(1); - Logger.WARNING("Total Loss: "+(int)DURABILITY_LOSS); - //heldItem.setDamage(heldStack, DURABILITY_LOSS); - //Utils.LOG_WARNING("|GID|Durability: "+heldItem.getItemDamage()); - //Utils.LOG_WARNING("Durability: "+heldStack.getDamage(heldStack)); - Logger.WARNING("1x: "+(heldItem.getItemDamage())); - final int itemdmg = heldItem.getItemDamage(); - final int maxdmg = heldItem.getMaxDamage(); - final int dodmg = (int)DURABILITY_LOSS; - final int durNow = maxdmg-itemdmg; - final int durLeft = (int) ((maxdmg-itemdmg)-DURABILITY_LOSS); - - Logger.WARNING( - "Current Damage: " + itemdmg - + " Max Damage: " + maxdmg - + " Durability to be lost: " + dodmg - + " Current Durability: " + durNow - + " Remaining Durability: " + durLeft - ); - - - //Break Tool - if (((durNow-dodmg) <= (99)) && (itemdmg != 0)){ - //TODO break tool - Logger.WARNING("Breaking Tool"); - heldItem.stackSize = 0; - } - //Do Damage - else { - //setItemDamage(heldItem, durLeft); - Logger.WARNING(""+(durNow-durLeft)); - this.damageItem(heldItem, (durNow-durLeft)-1, entity); - } - - - /*if (heldItem.getItemDamage() <= ((heldItem.getMaxDamage()-heldItem.getItemDamage())-DURABILITY_LOSS)){ - Utils.LOG_WARNING("2: "+DURABILITY_LOSS+" 3: "+((heldItem.getMaxDamage()-heldItem.getItemDamage())-DURABILITY_LOSS)); - setItemDamage(heldItem, (int) (heldItem.getMaxDamage()-(heldItem.getMaxDamage()-heldItem.getItemDamage())-DURABILITY_LOSS)); - } - else { - Utils.LOG_WARNING("3: "+( heldItem.getMaxDamage()-(heldItem.getMaxDamage()-heldItem.getItemDamage()))); - setItemDamage(heldItem, heldItem.getMaxDamage()-(heldItem.getMaxDamage()-heldItem.getItemDamage())); - }*/ - //Utils.LOG_WARNING("|GID|Durability: "+heldItem.getItemDamage()); - DURABILITY_LOSS = 0; - - } - } - - public void damageItem(final ItemStack item, final int damage, final EntityPlayer localPlayer){ - item.damageItem(damage, localPlayer); - } - - public void setItemDamage(final ItemStack item, final int damage){ - item.setItemDamage(damage-1); - } - - //Should clear up blocks quicker if I chain it. - public final void removeBlockAndDropAsItem(final World world, final int X, final int Y, final int Z, final ItemStack heldItem){ - try { - final Block block = world.getBlock(X, Y, Z); - final float dur = this.calculateDurabilityLoss(world, X, Y, Z); - Logger.WARNING(block.toString()); - String removalTool = ""; - removalTool = block.getHarvestTool(1); - - Logger.WARNING("Removing.1 "+removalTool); - /*if ((removalTool.equalsIgnoreCase("pickaxe") || removalTool.equalsIgnoreCase("null") || removalTool == null)){ - Utils.LOG_WARNING("Removing.2"); - if (UtilsMining.getBlockType(block, world, new int[]{X,Y,Z}, miningLevel)) { - Utils.LOG_WARNING("Removing.3"); */ - if (this.canPickaxeBlock(block, world, new int[]{X,Y,Z})){ - Logger.WARNING("Removing.4"); - - if (block == Blocks.air){ - return; - } - - if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) >= 0) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ - - Logger.WARNING("Removing.5"); - if (heldItem.getItemDamage() <= (heldItem.getMaxDamage()-dur)){ - - if (X == 0 && Y == 0 && Z == 0){ - - } - else { - block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0); - world.setBlockToAir(X, Y, Z); - } - - } - - } - /*} - - }*/ - } - else { - Logger.WARNING("Incorrect Tool for mining this block."); - } - } catch (final NullPointerException e){ - - } - } - - public boolean checkFacing(final ItemStack aStack, final EntityPlayer aPlayer, final World world){ - if (aPlayer != null){ - final int direction = MathHelper.floor_double((aPlayer.rotationYaw * 4F) / 360F + 0.5D) & 3; - //Utils.LOG_WARNING("Player - F: "+direction); - //Utils.LOG_WARNING("Player - getLookVec(): "+localPlayer.getLookVec().yCoord); - - /*if (localPlayer.getLookVec().yCoord > 0){ - localPlayer.getLookVec().yCoord; - }*/ - - final MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, aPlayer, false); - if (movingobjectposition != null){ - final int sideHit = movingobjectposition.sideHit; - String playerStandingPosition = ""; - if (movingobjectposition != null) { - //System.out.println("Side Hit: "+movingobjectposition.sideHit); - } - - if (sideHit == 0){ - playerStandingPosition = "above"; - setFacingHorizontal(aStack, false); - } - else if (sideHit == 1){ - playerStandingPosition = "below"; - setFacingHorizontal(aStack, false); - } - else if (sideHit == 2){ - playerStandingPosition = "facingSouth"; - setFacingHorizontal(aStack, true); - } - else if (sideHit == 3){ - playerStandingPosition = "facingNorth"; - setFacingHorizontal(aStack, true); - } - else if (sideHit == 4){ - playerStandingPosition = "facingEast"; - setFacingHorizontal(aStack, true); - } - else if (sideHit == 5){ - playerStandingPosition = "facingWest"; - setFacingHorizontal(aStack, true); - } - setLookingDirection(aStack, playerStandingPosition); - - if (direction == 0){ - setFacingDirection(aStack, "south"); - } - else if (direction == 1){ - setFacingDirection(aStack, "west"); - } - else if (direction == 2){ - setFacingDirection(aStack, "north"); - } - else if (direction == 3){ - setFacingDirection(aStack, "east"); - } - } - - - return true; - } - return false; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(EnumChatFormatting.GRAY+"Mines a 3x3 at 100 durability per block mined."); - list.add(EnumChatFormatting.GRAY+"Durability: "+(stack.getMaxDamage()-stack.getItemDamage())+"/"+stack.getMaxDamage()); - //super.addInformation(stack, aPlayer, list, bool); - } - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack){ - return EnumRarity.rare; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack){ - return true; - } - - - @Override - public boolean onBlockStartBreak(final ItemStack itemstack, final int X, final int Y, final int Z, final EntityPlayer aPlayer) { - this.checkFacing(itemstack, aPlayer, aPlayer.getEntityWorld()); - return super.onBlockStartBreak(itemstack, X, Y, Z, aPlayer); - } - - public StaballoyPickaxe(final String unlocalizedName, final ToolMaterial material) { - super(material); - this.setUnlocalizedName(unlocalizedName); - this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setMaxStackSize(1); - this.setMaxDamage(3200); - this.miningLevel = 5; - } -} diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java deleted file mode 100644 index 6265c9f0a3..0000000000 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java +++ /dev/null @@ -1,411 +0,0 @@ -package gtPlusPlus.core.item.tool.staballoy; - -import java.util.List; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemSpade; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.MiningUtils; - -public class StaballoySpade extends ItemSpade{ - - /* (non-Javadoc) - * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.ItemStack) - */ - @Override - public double getDurabilityForDisplay(final ItemStack stack) { - if (super.getDurabilityForDisplay(stack) > 0){ - return super.getDurabilityForDisplay(stack);} - return 0; - } - - - /** - * Creates an NBT tag for this item if it doesn't have one. - * This also set some default values. - * @param rStack - * @return - */ - - private static boolean createNBT(ItemStack rStack){ - final NBTTagCompound tagMain = new NBTTagCompound(); - final NBTTagCompound tagNBT = new NBTTagCompound(); - - tagNBT.setBoolean("FACING_HORIZONTAL", true); - tagNBT.setString("FACING", "north"); - tagNBT.setString("lookingDirection", ""); - - tagMain.setTag("PickStats", tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - /* - * Is the player facing horizontally? - */ - - public static final boolean isFacingHorizontal(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("PickStats"); - if (aNBT != null) { - return aNBT.getBoolean("FACING_HORIZONTAL"); - } - } - else { - createNBT(aStack); - } - return true; - } - - public static final boolean setFacingHorizontal(final ItemStack aStack, final boolean aFacingHorizontal) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("PickStats"); - if (aNBT != null) { - aNBT.setBoolean("FACING_HORIZONTAL", aFacingHorizontal); - return true; - } - } - return false; - } - - /* - * Handles the Direction the player is facing - */ - - public static final String getFacingDirection(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("PickStats"); - if (aNBT != null) { - return aNBT.getString("FACING"); - } - } - else { - createNBT(aStack); - } - return "north"; - } - - public static final boolean setFacingDirection(final ItemStack aStack, final String aFacingHorizontal) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("PickStats"); - if (aNBT != null) { - aNBT.setString("FACING", aFacingHorizontal); - return true; - } - } - return false; - } - - /* - * The Looking Direction handlers - */ - - public static final String getLookingDirection(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("PickStats"); - if (aNBT != null) { - return aNBT.getString("lookingDirection"); - } - } - else { - createNBT(aStack); - } - return ""; - } - - public static final boolean setLookingDirection(final ItemStack aStack, final String aFacingHorizontal) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("PickStats"); - if (aNBT != null) { - aNBT.setString("lookingDirection", aFacingHorizontal); - return true; - } - } - return false; - } - - private int miningLevel; - - /* - * - * - * - * Methods - * - * - * - */ - - @Override - public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer aPlayer) { - return super.onItemRightClick(stack, world, aPlayer); - } - - - - @Override - public boolean onBlockDestroyed(final ItemStack stack, final World world, final Block block, final int X, final int Y, final int Z, final EntityLivingBase entity) { - if (!world.isRemote){ - if (entity instanceof EntityPlayer) { - this.GetDestroyOrientation((EntityPlayer) entity, getLookingDirection(stack), world, X, Y, Z, stack); - } - } - return super.onBlockDestroyed(stack, world, block, X, Y, Z, entity); - } - - public Boolean canPickaxeBlock(final Block currentBlock, final World currentWorld, final int[] xyz){ - String correctTool = ""; - if (!currentWorld.isRemote){ - try { - correctTool = currentBlock.getHarvestTool(0); - //Utils.LOG_WARNING(correctTool); - - Logger.WARNING("Tool for Block: "+correctTool+" | Current block: "+currentBlock.getLocalizedName()); - if (MiningUtils.getBlockType(currentBlock, currentWorld, xyz, this.miningLevel) || correctTool.equals("shovel")){ - return true;} - } catch (final NullPointerException e){ - return false;} - } - return false; - } - - private void GetDestroyOrientation(EntityPlayer player, final String FACING, final World world, final int X, final int Y, final int Z, final ItemStack heldItem){ - float DURABILITY_LOSS = 0; - if (!world.isRemote){ - - if (FACING.equals("below") || FACING.equals("above")){ - DURABILITY_LOSS = 0; - for(int i = -1; i < 2; i++) { - for(int j = -1; j < 2; j++) { - DURABILITY_LOSS = (DURABILITY_LOSS + this.removeBlockAndDropAsItem(world, X + i, Y, Z + j, heldItem)); - } - } - } - - else if (FACING.equals("facingEast") || FACING.equals("facingWest")){ - DURABILITY_LOSS = 0; - for(int i = -1; i < 2; i++) { - for(int j = -1; j < 2; j++) { - DURABILITY_LOSS = (DURABILITY_LOSS + this.removeBlockAndDropAsItem(world, X , Y + i, Z + j, heldItem)); - } - } - } - - else if (FACING.equals("facingNorth") || FACING.equals("facingSouth")){ - DURABILITY_LOSS = 0; - for(int i = -1; i < 2; i++) { - for(int j = -1; j < 2; j++) { - DURABILITY_LOSS = (DURABILITY_LOSS + this.removeBlockAndDropAsItem(world, X + j, Y + i, Z, heldItem)); - } - } - } - - //int heldItemDurability = heldItem.getDamage(1); - Logger.WARNING("Total Loss: "+(int)DURABILITY_LOSS); - //heldItem.setDamage(heldStack, DURABILITY_LOSS); - //Utils.LOG_WARNING("|GID|Durability: "+heldItem.getItemDamage()); - //Utils.LOG_WARNING("Durability: "+heldStack.getDamage(heldStack)); - Logger.WARNING("1x: "+(heldItem.getItemDamage())); - final int itemdmg = heldItem.getItemDamage(); - final int maxdmg = heldItem.getMaxDamage(); - final int dodmg = (int)DURABILITY_LOSS; - final int durNow = maxdmg-itemdmg; - final int durLeft = (int) ((maxdmg-itemdmg)-DURABILITY_LOSS); - - Logger.WARNING( - "Current Damage: " + itemdmg - + " Max Damage: " + maxdmg - + " Durability to be lost: " + dodmg - + " Current Durability: " + durNow - + " Remaining Durability: " + durLeft - ); - - - //Break Tool - if (((durNow-dodmg) <= (900)) && (itemdmg != 0)){ - //TODO break tool - Logger.WARNING("Breaking Tool"); - heldItem.stackSize = 0; - } - //Do Damage - else { - //setItemDamage(heldItem, durLeft); - Logger.WARNING(""+(durNow-durLeft)); - this.damageItem(heldItem, (durNow-durLeft)-1, player); - } - DURABILITY_LOSS = 0; - - } - } - - public void damageItem(final ItemStack item, final int damage, final EntityPlayer localPlayer){ - item.damageItem(damage, localPlayer); - } - - public void setItemDamage(final ItemStack item, final int damage){ - item.setItemDamage(damage-1); - } - - //Should clear up blocks quicker if I chain it. - public int removeBlockAndDropAsItem(final World world, final int X, final int Y, final int Z, final ItemStack heldItem){ - Logger.WARNING("Trying to drop/remove a block."); - try { - final Block block = world.getBlock(X, Y, Z); - Logger.WARNING(block.toString()); - String removalTool = ""; - removalTool = block.getHarvestTool(0); - if (removalTool != null){ - if (removalTool.equals("shovel")){ - if (this.canPickaxeBlock(block, world, new int[]{X,Y,Z})){ - if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) != -1) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ - - final int itemdmg = heldItem.getItemDamage(); - final int maxdmg = heldItem.getMaxDamage(); - final int dodmg = 100; - final int durNow = maxdmg-itemdmg; - final int durLeft = (maxdmg-itemdmg)-100; - - if (((durNow-dodmg) <= (900)) && (itemdmg != 0)){ - //Do Nothing, Tool is useless. - return 0; - } - block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0); - world.setBlockToAir(X, Y, Z); - Logger.WARNING("Adding 100 damage to item."); - return 100; - } - Logger.WARNING("Incorrect Tool for mining this block. Wrong Block Water/lava/bedrock/blacklist"); - return 0; - } - Logger.WARNING("Incorrect Tool for mining this block. Cannot Shovel this block type."); - return 0; - } - Logger.WARNING("Incorrect Tool for mining this block. Blocks mining tool is now Shovel."); - return 0; - } - Logger.WARNING("Either the block was air or it declares an invalid mining tool."); - return 0; - } catch (final NullPointerException e){ - Logger.WARNING("Something Broke"); - e.printStackTrace(); - return 0; - } - } - - public boolean checkFacing(final ItemStack aStack, final EntityPlayer aPlayer, final World world){ - if (aPlayer != null){ - final int direction = MathHelper.floor_double((aPlayer.rotationYaw * 4F) / 360F + 0.5D) & 3; - //Utils.LOG_WARNING("Player - F: "+direction); - //Utils.LOG_WARNING("Player - getLookVec(): "+localPlayer.getLookVec().yCoord); - - /*if (localPlayer.getLookVec().yCoord > 0){ - localPlayer.getLookVec().yCoord; - }*/ - - final MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, aPlayer, false); - if (movingobjectposition != null){ - final int sideHit = movingobjectposition.sideHit; - String playerStandingPosition = ""; - if (movingobjectposition != null) { - //System.out.println("Side Hit: "+movingobjectposition.sideHit); - } - - if (sideHit == 0){ - playerStandingPosition = "above"; - setFacingHorizontal(aStack, false); - } - else if (sideHit == 1){ - playerStandingPosition = "below"; - setFacingHorizontal(aStack, false); - } - else if (sideHit == 2){ - playerStandingPosition = "facingSouth"; - setFacingHorizontal(aStack, true); - } - else if (sideHit == 3){ - playerStandingPosition = "facingNorth"; - setFacingHorizontal(aStack, true); - } - else if (sideHit == 4){ - playerStandingPosition = "facingEast"; - setFacingHorizontal(aStack, true); - } - else if (sideHit == 5){ - playerStandingPosition = "facingWest"; - setFacingHorizontal(aStack, true); - } - setLookingDirection(aStack, playerStandingPosition); - - if (direction == 0){ - setFacingDirection(aStack, "south"); - } - else if (direction == 1){ - setFacingDirection(aStack, "west"); - } - else if (direction == 2){ - setFacingDirection(aStack, "north"); - } - else if (direction == 3){ - setFacingDirection(aStack, "east"); - } - } - - - return true; - } - return false; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(EnumChatFormatting.GOLD+"Spades a 3x3 area in the direction you are facing."); - super.addInformation(stack, aPlayer, list, bool); - } - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack){ - return EnumRarity.rare; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack){ - return true; - } - - - @Override - public boolean onBlockStartBreak(final ItemStack itemstack, final int X, final int Y, final int Z, final EntityPlayer aPlayer) { - this.checkFacing(itemstack, aPlayer, aPlayer.worldObj); - return super.onBlockStartBreak(itemstack, X, Y, Z, aPlayer); - } - public StaballoySpade(final String unlocalizedName, final ToolMaterial material) { - super(material); - this.setUnlocalizedName(unlocalizedName); - this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setMaxStackSize(1); - this.setMaxDamage(3200); - } -} diff --git a/src/Java/gtPlusPlus/core/item/wearable/WearableLoader.java b/src/Java/gtPlusPlus/core/item/wearable/WearableLoader.java deleted file mode 100644 index 6912b4e771..0000000000 --- a/src/Java/gtPlusPlus/core/item/wearable/WearableLoader.java +++ /dev/null @@ -1,15 +0,0 @@ -package gtPlusPlus.core.item.wearable; - -import gtPlusPlus.core.item.wearable.armour.ArmourLoader; - -public class WearableLoader { - - public static void run() { - execute(); - } - - private static void execute() { - ArmourLoader.run(); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/wearable/armour/ArmourLoader.java b/src/Java/gtPlusPlus/core/item/wearable/armour/ArmourLoader.java deleted file mode 100644 index 6918f2b048..0000000000 --- a/src/Java/gtPlusPlus/core/item/wearable/armour/ArmourLoader.java +++ /dev/null @@ -1,41 +0,0 @@ -package gtPlusPlus.core.item.wearable.armour; - -import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.core.item.wearable.armour.tinfoil.ArmourTinFoilHat; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.item.Item; -import net.minecraft.item.ItemArmor.ArmorMaterial; - -import net.minecraftforge.common.util.EnumHelper; - -public class ArmourLoader { - - //Glass - public static Item ClearGlassChestplate; - public static Item ClearGlassBoots; - public static Item ClearGlassLeggings; - public static Item ClearGlassHelmet; - - //Tin Foil - public static Item TinFoilHat; - - public static ArmorMaterial ClearGlassArmour = EnumHelper.addArmorMaterial("ClearGlassArmor", 1, new int[] {1, 1, 1, 1}, 100); - public static ArmorMaterial TinFoilArmour = EnumHelper.addArmorMaterial("TINFOIL", 5, new int[]{1, 1, 1, 1}, 50); - - - public static void run() { - glassArmour(); - tinfoilArmour(); - } - - private static void glassArmour() { - //RenderingRegistry.addNewArmourRendererPrefix("ClearGlassArmor"); This needs to be client side only TODO - //ClearGlassHelmet = new ClearGlassArmor(2055, ClearGlassArmor, 5, 0).setUnlocalizedName("amethyst_helmet"); - } - - private static void tinfoilArmour() { - TinFoilHat = new ArmourTinFoilHat().setUnlocalizedName("itemHatTinFoil"); - GameRegistry.registerItem(TinFoilHat, "itemHatTinFoil", CORE.MODID); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/wearable/armour/base/BaseArmour.java b/src/Java/gtPlusPlus/core/item/wearable/armour/base/BaseArmour.java deleted file mode 100644 index 0c6a547d34..0000000000 --- a/src/Java/gtPlusPlus/core/item/wearable/armour/base/BaseArmour.java +++ /dev/null @@ -1,11 +0,0 @@ -package gtPlusPlus.core.item.wearable.armour.base; - -import gtPlusPlus.core.item.wearable.base.BaseItemWearable; - -public abstract class BaseArmour extends BaseItemWearable { - - public BaseArmour(ArmorMaterial material, int renderIndex, int armourType) { - super(material, renderIndex, armourType); - } - -} diff --git a/src/Java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourBoots.java b/src/Java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourBoots.java deleted file mode 100644 index 2ace8919d0..0000000000 --- a/src/Java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourBoots.java +++ /dev/null @@ -1,10 +0,0 @@ -package gtPlusPlus.core.item.wearable.armour.base; - -public abstract class BaseArmourBoots extends BaseArmour { - - public BaseArmourBoots(ArmorMaterial material, int renderIndex) { - super(material, renderIndex, 3); - // TODO Auto-generated constructor stub - } - -} diff --git a/src/Java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourChest.java b/src/Java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourChest.java deleted file mode 100644 index 16899c4229..0000000000 --- a/src/Java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourChest.java +++ /dev/null @@ -1,10 +0,0 @@ -package gtPlusPlus.core.item.wearable.armour.base; - -public abstract class BaseArmourChest extends BaseArmour { - - public BaseArmourChest(ArmorMaterial material, int renderIndex) { - super(material, renderIndex, 1); - // TODO Auto-generated constructor stub - } - -} diff --git a/src/Java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourHelm.java b/src/Java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourHelm.java deleted file mode 100644 index c3676277eb..0000000000 --- a/src/Java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourHelm.java +++ /dev/null @@ -1,10 +0,0 @@ -package gtPlusPlus.core.item.wearable.armour.base; - -public abstract class BaseArmourHelm extends BaseArmour { - - public BaseArmourHelm(ArmorMaterial material, int renderIndex) { - super(material, renderIndex, 0); - // TODO Auto-generated constructor stub - } - -} diff --git a/src/Java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourLegs.java b/src/Java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourLegs.java deleted file mode 100644 index 9794a713ac..0000000000 --- a/src/Java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourLegs.java +++ /dev/null @@ -1,10 +0,0 @@ -package gtPlusPlus.core.item.wearable.armour.base; - -public abstract class BaseArmourLegs extends BaseArmour { - - public BaseArmourLegs(ArmorMaterial material, int renderIndex) { - super(material, renderIndex, 2); - // TODO Auto-generated constructor stub - } - -} diff --git a/src/Java/gtPlusPlus/core/item/wearable/armour/hazmat/ArmourHazmat.java b/src/Java/gtPlusPlus/core/item/wearable/armour/hazmat/ArmourHazmat.java deleted file mode 100644 index 9fd7bf7020..0000000000 --- a/src/Java/gtPlusPlus/core/item/wearable/armour/hazmat/ArmourHazmat.java +++ /dev/null @@ -1,117 +0,0 @@ -package gtPlusPlus.core.item.wearable.armour.hazmat; - -import java.util.List; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.item.wearable.armour.ArmourLoader; -import gtPlusPlus.core.item.wearable.armour.base.BaseArmourHelm; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.client.renderer.texture.IIconRegister; -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.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.DamageSource; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -public class ArmourHazmat extends BaseArmourHelm { - - public IIcon iconHelm; - - public ArmourHazmat() { - super(ArmourLoader.TinFoilArmour, 0); - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister ir) { - this.iconHelm = ir.registerIcon(CORE.MODID + ":itemHatTinFoil"); - } - - @Override - public int getRenderIndex() { - return 0; - } - - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) { - return this.iconHelm; - } - - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { - return CORE.MODID + ":textures/models/TinFoil.png"; - } - - public EnumRarity getRarity(ItemStack itemstack) { - return EnumRarity.rare; - } - - public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { - return false; - } - - @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { - return super.getArmorDisplay(player, armor, slot); - } - - @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { - - } - - @SuppressWarnings({ "unchecked" }) - @Override - public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { - aList.add("DoomSquirter's protection against cosmic radiation!"); - aList.add("General paranoia makes the wearer unable to collect xp"); - aList.add("Movement speed is also reduced, to keep you safe"); - aList.add("This hat may also have other strange powers"); - } - - @Override - public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, - int slot) { - return new ArmorProperties(0, 0, 0); - } - - @Override - public boolean isDamageable() { - return false; - } - - @Override - public boolean itemInteractionForEntity(ItemStack p_111207_1_, EntityPlayer p_111207_2_, - EntityLivingBase p_111207_3_) { - return super.itemInteractionForEntity(p_111207_1_, p_111207_2_, p_111207_3_); - } - - @Override - public void onUpdate(ItemStack aStack, World aWorld, Entity aEntity, int p_77663_4_, boolean p_77663_5_) { - super.onUpdate(aStack, aWorld, aEntity, p_77663_4_, p_77663_5_); - } - - @Override - public boolean onEntityItemUpdate(EntityItem entityItem) { - return super.onEntityItemUpdate(entityItem); - } - - @Override - public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { - if (itemStack != null && player != null && world != null && !world.isRemote) { - if (player instanceof EntityPlayer) { - - } - } - super.onArmorTick(world, player, itemStack); - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return false; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/wearable/armour/tinfoil/ArmourTinFoilHat.java b/src/Java/gtPlusPlus/core/item/wearable/armour/tinfoil/ArmourTinFoilHat.java deleted file mode 100644 index c1fe96efb5..0000000000 --- a/src/Java/gtPlusPlus/core/item/wearable/armour/tinfoil/ArmourTinFoilHat.java +++ /dev/null @@ -1,183 +0,0 @@ -package gtPlusPlus.core.item.wearable.armour.tinfoil; - -import java.util.List; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.item.wearable.armour.ArmourLoader; -import gtPlusPlus.core.item.wearable.armour.base.BaseArmourHelm; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityBoat; -import net.minecraft.entity.item.EntityEnderEye; -import net.minecraft.entity.item.EntityEnderPearl; -import net.minecraft.entity.item.EntityExpBottle; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.item.EntityXPOrb; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.projectile.EntityEgg; -import net.minecraft.entity.projectile.EntityFireball; -import net.minecraft.entity.projectile.EntitySnowball; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.DamageSource; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -public class ArmourTinFoilHat extends BaseArmourHelm { - - public IIcon iconHelm; - - public ArmourTinFoilHat() { - super(ArmourLoader.TinFoilArmour, 0); - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister ir) { - this.iconHelm = ir.registerIcon(CORE.MODID + ":itemHatTinFoil"); - } - - @Override - public int getRenderIndex() { - return 0; - } - - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int par1) { - return this.iconHelm; - } - - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { - return CORE.MODID + ":textures/models/TinFoil.png"; - } - - public EnumRarity getRarity(ItemStack itemstack) { - return EnumRarity.uncommon; - } - - public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { - return false; - } - - @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { - return super.getArmorDisplay(player, armor, slot); - } - - @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { - - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { - aList.add("DoomSquirter's protection against cosmic radiation!"); - aList.add("General paranoia makes the wearer unable to collect xp"); - aList.add("Movement speed is also reduced, to keep you safe"); - aList.add("This hat may also have other strange powers"); - } - - @Override - public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, - int slot) { - return new ArmorProperties(0, 0, 0); - } - - @Override - public boolean isDamageable() { - return false; - } - - @Override - public boolean itemInteractionForEntity(ItemStack p_111207_1_, EntityPlayer p_111207_2_, - EntityLivingBase p_111207_3_) { - return super.itemInteractionForEntity(p_111207_1_, p_111207_2_, p_111207_3_); - } - - @Override - public void onUpdate(ItemStack aStack, World aWorld, Entity aEntity, int p_77663_4_, boolean p_77663_5_) { - super.onUpdate(aStack, aWorld, aEntity, p_77663_4_, p_77663_5_); - } - - @Override - public boolean onEntityItemUpdate(EntityItem entityItem) { - return super.onEntityItemUpdate(entityItem); - } - - @Override - public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { - if (itemStack != null && player != null && world != null && !world.isRemote) { - if (player instanceof EntityPlayer) { - - // Apply Slow - if (!GT_Utility.getPotion(player, Potion.moveSlowdown.id)) { - player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2, 1, true)); - } - - // Move Xp orbs away - try { - AxisAlignedBB box = player.boundingBox; - box.maxX = player.posX + 5; - box.maxY = player.posY + 5; - box.maxZ = player.posZ + 5; - box.minX = player.posX - 5; - box.minY = player.posY - 5; - box.minZ = player.posZ - 5; - @SuppressWarnings("unchecked") - List<Entity> g = world.getEntitiesWithinAABBExcludingEntity(player, box); - if (g.size() > 0) { - for (Entity e : g) { - if (e != null) { - if ( - !EntityXPOrb.class.isInstance(e) && - !EntityBoat.class.isInstance(e) && - !EntitySnowball.class.isInstance(e) && - !EntityFireball.class.isInstance(e) && - !EntityEgg.class.isInstance(e) && - !EntityExpBottle.class.isInstance(e) && - !EntityEnderEye.class.isInstance(e) && - !EntityEnderPearl.class.isInstance(e) - ) { - continue; - } - else { - //Logger.INFO("Found "+e.getClass().getName()); - double distX = player.posX - e.posX; - double distZ = player.posZ - e.posZ; - double distY = e.posY + 1.5D - player.posY; - double dir = Math.atan2(distZ, distX); - double speed = 1F / e.getDistanceToEntity(player) * 0.5; - speed = -speed; - if (distY < 0) { - e.motionY += speed; - } - e.motionX = Math.cos(dir) * speed; - e.motionZ = Math.sin(dir) * speed; - } - - - } - } - } - } catch (Throwable t) { - } - } - } - - super.onArmorTick(world, player, itemStack); - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return false; - } - -} diff --git a/src/Java/gtPlusPlus/core/item/wearable/base/BaseItemWearable.java b/src/Java/gtPlusPlus/core/item/wearable/base/BaseItemWearable.java deleted file mode 100644 index f23079bc8b..0000000000 --- a/src/Java/gtPlusPlus/core/item/wearable/base/BaseItemWearable.java +++ /dev/null @@ -1,65 +0,0 @@ -package gtPlusPlus.core.item.wearable.base; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemArmor; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.DamageSource; - -import net.minecraftforge.common.ISpecialArmor; - -public abstract class BaseItemWearable extends ItemArmor implements ISpecialArmor { - - public BaseItemWearable(ArmorMaterial material, int renderIndex, int armourType) { - super(material, renderIndex, armourType); - } - - public abstract int getRenderIndex(); - - - - @Override - public abstract ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, - int slot); - - @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public abstract void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot); - - public void dyeArmour(ItemStack aArmour, int aColour) { - func_82813_b(aArmour, aColour); - } - - @Override - public void func_82813_b(ItemStack p_82813_1_, int p_82813_2_) { - NBTTagCompound nbttagcompound = p_82813_1_.getTagCompound(); - if (nbttagcompound == null) { - nbttagcompound = new NBTTagCompound(); - p_82813_1_.setTagCompound(nbttagcompound); - } - NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display"); - if (!nbttagcompound.hasKey("display", 10)) { - nbttagcompound.setTag("display", nbttagcompound1); - } - nbttagcompound1.setInteger("color", p_82813_2_); - } - - @Override - public void removeColor(ItemStack p_82815_1_) { - NBTTagCompound nbttagcompound = p_82815_1_.getTagCompound(); - if (nbttagcompound != null) { - NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display"); - if (nbttagcompound1.hasKey("color")) { - nbttagcompound1.removeTag("color"); - } - } - } - - -} diff --git a/src/Java/gtPlusPlus/core/item/wearable/hazmat/ItemArmorHazmatEx.java b/src/Java/gtPlusPlus/core/item/wearable/hazmat/ItemArmorHazmatEx.java deleted file mode 100644 index 1f8009e54a..0000000000 --- a/src/Java/gtPlusPlus/core/item/wearable/hazmat/ItemArmorHazmatEx.java +++ /dev/null @@ -1,31 +0,0 @@ -package gtPlusPlus.core.item.wearable.hazmat; - -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.ic2.CustomInternalName; -import ic2.core.IC2; -import ic2.core.init.InternalName; -import ic2.core.item.armor.ItemArmorHazmat; -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; - -public class ItemArmorHazmatEx extends ItemArmorHazmat { - - public static void init() { - GregtechItemList.Armour_Hazmat_Advanced_Helmet.set(new ItemStack(new ItemArmorHazmatEx(CustomInternalName.aHazmatHelmetEx, 0))); - GregtechItemList.Armour_Hazmat_Advanced_Chest.set(new ItemStack(new ItemArmorHazmatEx(CustomInternalName.aHazmatChestEx, 1))); - GregtechItemList.Armour_Hazmat_Advanced_Legs.set(new ItemStack(new ItemArmorHazmatEx(CustomInternalName.aHazmatLegsEx, 2))); - GregtechItemList.Armour_Hazmat_Advanced_Boots.set(new ItemStack(new ItemArmorHazmatEx(CustomInternalName.aHazmatBootsEx, 3))); - } - - private ItemArmorHazmatEx(InternalName internalName, int type) { - super(internalName, type); - this.setMaxDamage(256); - } - - @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { - int suffix = this.armorType == 2 ? 2 : 1; - return IC2.textureDomain + ":textures/armor/" + "hazmatEx_" + suffix + ".png"; - } - -} diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java deleted file mode 100644 index dfd536d21c..0000000000 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ /dev/null @@ -1,363 +0,0 @@ -package gtPlusPlus.core.lib; - -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; - -import com.mojang.authlib.GameProfile; - -import cpw.mods.fml.common.FMLCommonHandler; -import gregtech.api.GregTech_API; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.api.objects.random.XSTR; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.preloader.CORE_Preloader; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; -import gtPlusPlus.xmod.gregtech.api.interfaces.internal.IGregtech_RecipeAdder; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; -import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractGenerator; -import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractTerminal; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraft.world.WorldServer; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.util.FakePlayerFactory; - -public class CORE { - - //import cpw.mods.fml.common.Optional; - - //Analytics handler - //public static SegmentAnalytics mHelper; - - public static Map PlayerCache; - - //Math Related - public static final float PI = (float) Math.PI; - public static volatile Random RANDOM = new XSTR(); - - //Env. Variables - public static Configuration Config; - - public static boolean DEVENV = false; - public static boolean NBT_PERSISTENCY_PATCH_APPLIED = false; - //Only can be set in Dev, no config or setting elsewhere. - public static final boolean LOAD_ALL_CONTENT = false;; - - //Mod Variables - - public static final String name = "GT++"; - public static final String MODID = "miscutils"; - public static final String VERSION = "1.7.15-GTNH"; - - //Tweakables - public static int EVERGLADES_ID = 227; - public static int EVERGLADESBIOME_ID = 238; - public static int AUSTRALIA_ID = 228; - public static int AUSTRALIA_BIOME_DESERT_1_ID = 239; - public static int AUSTRALIA_BIOME_DESERT_2_ID = 240; - public static int AUSTRALIA_BIOME_DESERT_3_ID = 241; - public static int AUSTRALIA_BIOME_PLAINS_ID = 242; - public static int AUSTRALIA_BIOME_OUTBACK_ID = 243; - public static int AUSTRALIA_BIOME_OCEAN_ID = 244; - public static int AUSTRALIA_BIOME_FOREST_ID = 245; - - //GT Vars; - public static final int GREG_FIRST_ID = 760; - public static final boolean MAIN_GREGTECH_5U_EXPERIMENTAL_FORK = Meta_GT_Proxy.areWeUsingGregtech5uExperimental(); - public static final int GREGTECH_API_VERSION = GregTech_API.VERSION; - public static int turbineCutoffBase = 75000; - - //GT++ Fake Player Profile - public static final GameProfile gameProfile = new GameProfile(UUID.nameUUIDFromBytes("gtplusplus.core".getBytes()), "[GT++]"); - public static final WeakHashMap<World, EntityPlayerMP> fakePlayerCache = new WeakHashMap<World, EntityPlayerMP>(); - //Tooltips; - public static final String GT_Tooltip = "Added by: " + EnumChatFormatting.DARK_GREEN+"Alkalus "+EnumChatFormatting.GRAY+"- "+EnumChatFormatting.RED+"[GT++]"; - public static final String GT_Tooltip_Builder = "" + EnumChatFormatting.DARK_GREEN+"Alkalus "+EnumChatFormatting.GRAY+"- "+EnumChatFormatting.RED+"[GT++]"; - public static final String GT_Tooltip_Radioactive = EnumChatFormatting.GRAY+"Warning: "+EnumChatFormatting.GREEN+"Radioactive! "+EnumChatFormatting.GOLD+" Avoid direct handling without hazmat protection."; - public static final String noItem = ""; - - //Because I want to be lazy Gregtech New Horizons Var. - public static boolean GTNH = false; - //Because I want to be lazy. Beyond Reality Classic Var. - public static boolean BRC = false; - - public static final String SEPERATOR = "/"; - - - /** - * Lists/Maps - */ - - //Burnables List - public static List<Pair<Integer, ItemStack>> burnables = new ArrayList<Pair<Integer, ItemStack>>(); - - - //TesseractMapss - public static final Map<UUID, Map<Integer, GT_MetaTileEntity_TesseractGenerator>> sTesseractGeneratorOwnershipMap = new HashMap<UUID, Map<Integer, GT_MetaTileEntity_TesseractGenerator>>(); - public static final Map<UUID, Map<Integer, GT_MetaTileEntity_TesseractTerminal>> sTesseractTerminalOwnershipMap = new HashMap<UUID, Map<Integer, GT_MetaTileEntity_TesseractTerminal>>(); - - //BookMap - public static final Map<String, ItemStack> sBookList = new ConcurrentHashMap<String, ItemStack>(); - - - - - /** - * Some Gregtech Material and Recipe Variables - */ - - @Deprecated - public static IGregtech_RecipeAdder sRecipeAdder; - public static IGregtech_RecipeAdder RA; - - public static final GT_Materials[] sMU_GeneratedMaterials = new GT_Materials[1000]; - - /** - * File Paths and Resource Paths - */ - - public static final String - TEX_DIR = "textures/", - TEX_DIR_GUI = TEX_DIR + "gui/", - TEX_DIR_ITEM = TEX_DIR + "items/", - 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_FLUIDS = MODID + ":" + TEX_DIR_FLUIDS; - - - - - /** Used to create a {@link EntityPlayer} instance from {@link FakePlayerFactory}. - * If this instance already exists in the cache, we will return that instead. - * These instances are held via weak reference, if the world object is unloaded, they too will be removed. - * This is the suggested way to handle them, as suggested by Forge. - * - * @param world - The {@link World} object for which you want to check for in the cache. - * This object is used as a weak reference in a {@link WeakHashMap}. - * @return - An {@link EntityPlayerMP} instance, returned either from cache or created and cached prior to return. - */ - public static EntityPlayerMP getFakePlayer(World world) { - if (fakePlayerCache.get(world) == null) { - fakePlayerCache.put(world, FakePlayerFactory.get((WorldServer) world, CORE.gameProfile)); - } - return fakePlayerCache.get(world); - } - - - - - - - - - - - - - - - - - - /* - * Config Switch Class - */ - - public static class ConfigSwitches { - //Debug - public static boolean disableEnderIOIntegration = false; - public static boolean disableEnderIOIngotTooltips = false; - public static boolean MACHINE_INFO = true; - public static boolean showHiddenNEIItems = false; - public static boolean dumpItemAndBlockData = false; - - //Tools - public static boolean enableSkookumChoochers = true; - public static boolean enableMultiSizeTools = true; - - //Block Drops - public static int chanceToDropDrainedShard = 196; - public static int chanceToDropFluoriteOre = 32; - - //Machine Related - public static boolean enableAlternativeBatteryAlloy = false; - public static boolean enableThaumcraftShardUnification = false; - public static boolean disableIC2Recipes = false; - public static boolean enableAlternativeDivisionSigilRecipe = false; - public static int boilerSteamPerSecond = 750; - public static final boolean requireControlCores = false; - - //Feature Related - public static boolean enableCustomCapes = false; - public static boolean enableCustomCircuits = true; - public static boolean enableOldGTcircuits = false; - public static boolean disableZombieReinforcement = false; - public static int enableWatchdogBGM = CORE_Preloader.enableWatchdogBGM; - - //GT Fixes - public static boolean enableNitroFix = false; - public static boolean enableSulfuricAcidFix = false; - public static boolean enableAnimatedTurbines = true; - public static boolean enableHarderRecipesForHighTierCasings = true; - - //Single Block Machines - public static boolean enableMachine_SolarGenerators = false; - public static boolean enableMachine_Safes = true; - public static boolean enableMachine_Dehydrators = true; - public static boolean enableMachine_SteamConverter = true; - public static boolean enableMachine_FluidTanks = true; - public static boolean enableMachine_RocketEngines = true; - public static boolean enableMachine_GeothermalEngines = true; - public static boolean enableMachine_WorldAccelerators = true; - public static boolean enableMachine_Tesseracts = true; - public static boolean enableMachine_SimpleWasher = true; - public static boolean enableMachine_Pollution = true; - public static boolean enableMachine_ComponentAssemblers = false; - public static boolean enableCustom_Pipes = true; - public static boolean enableCustom_Cables = true; - public static boolean enableMachine_RF_Convetor = false; - - //Multiblocks - public static boolean enableMultiblock_AlloyBlastSmelter = true; - public static boolean enableMultiblock_IndustrialCentrifuge = true; - public static boolean enableMultiblock_IndustrialCokeOven = true; - public static boolean enableMultiblock_IndustrialElectrolyzer = true; - public static boolean enableMultiblock_IndustrialMacerationStack = true; - public static boolean enableMultiblock_IndustrialPlatePress = true; - public static boolean enableMultiblock_IndustrialWireMill = true; - public static boolean enableMultiblock_IronBlastFurnace = true; - public static boolean enableMultiblock_MatterFabricator = true; - public static boolean enableMultiblock_MultiTank = true; - public static boolean enableMultiblock_PowerSubstation = true; - public static boolean enableMultiblock_LiquidFluorideThoriumReactor = true; - public static boolean enableMultiblock_NuclearFuelRefinery = true; - public static boolean enableMultiblock_TreeFarmer = true; - public static boolean enableMultiblock_IndustrialSifter = true; - public static boolean enableMultiblock_IndustrialThermalCentrifuge = true; - public static boolean enableMultiblock_IndustrialWashPlant = true; - public static boolean enableMultiblock_LargeAutoCrafter = true; - public static boolean enableMultiblock_ThermalBoiler = true; - public static boolean enableMultiblock_IndustrialCuttingMachine = true; - public static boolean enableMultiblock_IndustrialFishingPort = true; - public static boolean enableMultiblock_IndustrialExtrudingMachine = true; - public static boolean enableMultiblock_IndustrialMultiMachine = true; - public static boolean enableMultiblock_Cyclotron = true; - - //Visuals - public static boolean enableTreeFarmerParticles = true; - public static boolean useGregtechTextures = true; - - //Pollution - public static int pollutionPerSecondMultiPackager = 40; - public static int pollutionPerSecondMultiIndustrialAlloySmelter = 300; - public static int pollutionPerSecondMultiIndustrialArcFurnace = 2400; - public static int pollutionPerSecondMultiIndustrialCentrifuge = 300; - public static int pollutionPerSecondMultiIndustrialCokeOven = 80; - public static int pollutionPerSecondMultiIndustrialCuttingMachine = 160; - public static int pollutionPerSecondMultiIndustrialDehydrator = 500; - public static int pollutionPerSecondMultiIndustrialElectrolyzer = 300; - public static int pollutionPerSecondMultiIndustrialExtruder = 1000; - public static int pollutionPerSecondMultiIndustrialMacerator = 400; - public static int pollutionPerSecondMultiIndustrialMixer = 800; - public static int pollutionPerSecondMultiIndustrialMultiMachine_ModeMetal = 400; - public static int pollutionPerSecondMultiIndustrialMultiMachine_ModeFluid = 400; - public static int pollutionPerSecondMultiIndustrialMultiMachine_ModeMisc = 600; - public static int pollutionPerSecondMultiIndustrialPlatePress_ModeForming = 240; - public static int pollutionPerSecondMultiIndustrialPlatePress_ModeBending = 480; - public static int pollutionPerSecondMultiIndustrialSifter = 40; - public static int pollutionPerSecondMultiIndustrialThermalCentrifuge = 1000; - public static int pollutionPerSecondMultiIndustrialVacuumFreezer = 500; - public static int pollutionPerSecondMultiIndustrialWashPlant_ModeChemBath = 400; - public static int pollutionPerSecondMultiIndustrialWashPlant_ModeWasher = 100; - public static int pollutionPerSecondMultiIndustrialWireMill = 100; - public static int pollutionPerSecondMultiIsaMill = 1280; - public static int pollutionPerSecondMultiAdvDistillationTower_ModeDistillery = 240; - public static int pollutionPerSecondMultiAdvDistillationTower_ModeDT = 480; - public static int pollutionPerSecondMultiAdvEBF = 500; - public static int pollutionPerSecondMultiAdvImplosion = 5000; - public static int pollutionPerSecondMultiABS = 200; - public static int pollutionPerSecondMultiCyclotron = 200; - public static int pollutionPerSecondMultiIndustrialFishingPond = 20; - public static int pollutionPerSecondMultiLargeRocketEngine; - public static int pollutionPerSecondMultiLargeSemiFluidGenerator = 1280; - public static int pollutionPerSecondMultiMassFabricator = 40; - public static int pollutionPerSecondMultiRefinery = 4000; - public static int pollutionPerSecondMultiGeneratorArray; - public static int pollutionPerSecondMultiTreeFarm = 100; - public static int pollutionPerSecondMultiFrothFlotationCell = 0; - public static int pollutionPerSecondMultiAutoCrafter = 500; - public static int pollutionPerSecondMultiThermalBoiler = 700; - public static int pollutionPerSecondMultiAlgaePond = 0; - //pollution single blocks - public static int basePollutionPerSecondSemiFluidGenerator = 40; - public static double[] pollutionReleasedByTierSemiFluidGenerator = new double[]{0,2.0,4.0,8.0}; - public static int basePollutionPerSecondBoiler = 35; - public static double[] pollutionReleasedByTierBoiler = new double[]{0,1.0,1.43, 1.86}; - public static int baseMinPollutionPerSecondRocketFuelGenerator = 250; - public static int baseMaxPollutionPerSecondRocketFuelGenerator = 2000; - public static double[] pollutionReleasedByTierRocketFuelGenerator = new double[]{0,0,0,0,1,2,3}; - public static int basePollutionPerSecondGeothermalGenerator = 100; - public static double[] pollutionReleasedByTierGeothermalGenerator = new double[]{0,0,0,0,1,1,1}; - - } - - public static class Everglades{ - public static final String MODID = "ToxicEverglades"; - public static final String NAME = "GT++ Toxic Everglades"; - public static final String VERSION = "0.1"; - } - - public static class Australia{ - public static final String MODID = "Australia"; - public static final String NAME = "GT++ Australia"; - public static final String VERSION = "0.1"; - } - - - public static final void crash() { - crash("Generic Crash"); - } - - public static final void crash(String aReason) { - Logger.INFO("=========================================================="); - Logger.INFO("[GT++ CRASH]"); - Logger.INFO("=========================================================="); - Logger.INFO("Oooops..."); - Logger.INFO("This should only happy in a development environment or when something really bad happens."); - Logger.INFO("Reason: "+aReason); - Logger.INFO("=========================================================="); - Logger.INFO("Called from: "+ReflectionUtils.getMethodName(1)); - Logger.INFO(ReflectionUtils.getMethodName(2)); - Logger.INFO(ReflectionUtils.getMethodName(3)); - Logger.INFO(ReflectionUtils.getMethodName(4)); - Logger.INFO(ReflectionUtils.getMethodName(5)); - Logger.INFO(ReflectionUtils.getMethodName(6)); - Logger.INFO(ReflectionUtils.getMethodName(7)); - Logger.INFO(ReflectionUtils.getMethodName(8)); - Logger.INFO(ReflectionUtils.getMethodName(9)); - Logger.INFO(ReflectionUtils.getMethodName(10)); - Logger.INFO(ReflectionUtils.getMethodName(11)); - Logger.INFO(ReflectionUtils.getMethodName(12)); - Logger.INFO(ReflectionUtils.getMethodName(13)); - Logger.INFO(ReflectionUtils.getMethodName(14)); - Logger.INFO(ReflectionUtils.getMethodName(15)); - FMLCommonHandler.instance().exitJava(0, true); - } - - public static final void gc() { - System.gc(); - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/lib/LoadedMods.java b/src/Java/gtPlusPlus/core/lib/LoadedMods.java deleted file mode 100644 index 1eb8351d65..0000000000 --- a/src/Java/gtPlusPlus/core/lib/LoadedMods.java +++ /dev/null @@ -1,348 +0,0 @@ -package gtPlusPlus.core.lib; - -import static gtPlusPlus.core.lib.CORE.*; - -import java.util.HashMap; - -import cpw.mods.fml.common.Loader; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE.ConfigSwitches; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechTextures; -import gtPlusPlus.xmod.gregtech.recipes.GregtechRecipeAdder; - -public class LoadedMods { - - //Initialize Variables - public static boolean Gregtech = false; - public static boolean PlayerAPI = false; - public static boolean BuildCraft = false; - public static boolean EnderIO = false; - public static boolean Big_Reactors = false; - public static boolean IndustrialCraft2 = false; - public static boolean IndustrialCraft2Classic = false; - public static boolean Simply_Jetpacks = false; - public static boolean RFTools = false; - public static boolean Thaumcraft = false; - public static boolean Baubles = false; - public static boolean Extra_Utils = false; - public static boolean PneumaticCraft = false; - public static boolean MorePlanets = false; - public static boolean ForbiddenMagic = false; - public static boolean CompactWindmills = false; - public static boolean Railcraft = false; - public static boolean ImmersiveEngineering = false; - public static boolean Growthcraft = false; - public static boolean CoFHCore = false; - public static boolean Forestry = false; - public static boolean MagicBees = false; - public static boolean ExtraBees = false; - public static boolean Psychedelicraft = false; - public static boolean MiscUtils = true; //Dummy For MetaData Lookups in MT Wrapper - public static boolean ThermalFoundation = false; - public static boolean IHL = false; - public static boolean OpenComputers = false; //OpenComputers - public static boolean OpenBlocks = false; - public static boolean Computronics = false; //computronics - public static boolean DreamCraft = false; //GT: New Horizons - public static boolean BeyondRealityCore = false; //Beyond Reality - Probably Classic - public static boolean BiomesOPlenty = false; - public static boolean PamsHarvestcraft = false; - public static boolean GalacticraftCore = false; - public static boolean Mekanism = false; - public static boolean RedTech = false; //RedMage's Mod - public static boolean TecTech = false; //Technus' Mod - public static boolean KekzTech = false; //KekzDealers' Mod - public static boolean TiCon = false; - public static boolean StevesCarts = false; - public static boolean Witchery = false; - public static boolean Waila = false; - public static boolean CropsPlusPlus = false; //Barts Crop Mod - public static boolean Reliquary = false; - public static boolean SpiceOfLife = false; - - - - private static int totalMods; - @SuppressWarnings("deprecation") - public static void checkLoaded(){ - Logger.INFO("Looking for optional mod prereqs."); - if (isModLoaded("gregtech") ){ - Gregtech = true; - Logger.INFO("Components enabled for: Gregtech"); - if (Gregtech){ - try { - CORE.sRecipeAdder = CORE.RA = new GregtechRecipeAdder(); - Logger.INFO("Created Gregtech recipe handler."); - GregtechTextures.BlockIcons.VOID.name(); - GregtechTextures.ItemIcons.VOID.name(); - Logger.INFO("Created Gregtech texture handler."); - } catch (final NullPointerException e){ - Logger.INFO("Could NOT create a Gregtech recipe handler."); - } - } - - totalMods++; - } - if (isModLoaded("dreamcraft")){ - DreamCraft = true; - GTNH = true; - Logger.INFO("Components enabled for: DreamCraft"); - Logger.INFO("Components enabled for: GT: New Horizons"); - totalMods++; - } - if (isModLoaded("beyondrealitycore")){ - BeyondRealityCore = true; - BRC = true; - Logger.INFO("Components enabled for: Beyond Reality"); - totalMods++; - } - if (isModLoaded("PlayerAPI")){ - PlayerAPI = true; - Logger.INFO("Components enabled for: PlayerAPI"); - totalMods++; - } - if (isModLoaded("berriespp")) { - CropsPlusPlus = true; - Logger.INFO("Components enabled for: Crops++"); - totalMods++; - } - if (isModLoaded("xreliquary")) { - Reliquary = true; - Logger.INFO("Components enabled for: Reliquary"); - totalMods++; - } - if (isModLoaded("TConstruct")){ - TiCon = true; - Logger.INFO("Components enabled for: Tinkers Construct"); - totalMods++; - } - if (isModLoaded("BuildCraft")){ - BuildCraft = true; - Logger.INFO("Components enabled for: BuildCraft"); - totalMods++; - } - if ((isModLoaded("EnderIO")) && !ConfigSwitches.disableEnderIOIntegration){ - EnderIO = true; - Logger.INFO("Components enabled for: EnderIO"); - totalMods++; - } - if (isModLoaded("BigReactors")){ - Big_Reactors = true; - Logger.INFO("Components enabled for: Big Reactors"); - totalMods++; - } - if (isModLoaded("IC2")){ - IndustrialCraft2 = true; - Logger.INFO("Components enabled for: IndustrialCraft2"); - totalMods++; - } - if (isModLoaded("IC2-Classic-Spmod")){ - IndustrialCraft2Classic = true; - Logger.INFO("Components enabled for: IndustrialCraft2-Classic"); - totalMods++; - } - if (isModLoaded("simplyjetpacks")){ - Simply_Jetpacks = true; - Logger.INFO("Components enabled for: Simply Jetpacks"); - totalMods++; - } - if (isModLoaded("rftools")){ - RFTools = true; - Logger.INFO("Components enabled for: RFTools"); - totalMods++; - } - if (isModLoaded("StevesCarts")){ - StevesCarts = true; - Logger.INFO("Components enabled for: StevesCarts"); - totalMods++; - } - if (isModLoaded("OpenBlocks")){ - OpenBlocks = true; - Logger.INFO("Components enabled for: OpenBlocks"); - totalMods++; - } - if (isModLoaded("Thaumcraft")){ - Thaumcraft = true; - Logger.INFO("Components enabled for: Thaumcraft"); - totalMods++; - } - if (isModLoaded("BiomesOPlenty")){ - BiomesOPlenty = true; - Logger.INFO("Components enabled for: BiomesOPlenty"); - totalMods++; - } - if (isModLoaded("ExtraUtilities")){ - Extra_Utils = true; - Logger.INFO("Components enabled for: Extra_Utils"); - totalMods++; - } - if (isModLoaded("harvestcraft")){ - PamsHarvestcraft = true; - Logger.INFO("Components enabled for: PamsHarvestcraft"); - totalMods++; - } - if (isModLoaded("PneumaticCraft")){ - PneumaticCraft = true; - Logger.INFO("Components enabled for: PneumaticCraft"); - totalMods++; - } - if (isModLoaded("MorePlanet")){ - MorePlanets = true; - Logger.INFO("Components enabled for: MorePlanets"); - totalMods++; - } - if (isModLoaded("ForbiddenMagic")){ - ForbiddenMagic = true; - Logger.INFO("Components enabled for: ForbiddenMagic"); - totalMods++; - } - if (isModLoaded("CompactWindmills")){ - CompactWindmills = true; - Logger.INFO("Components enabled for: CompactWindmills"); - totalMods++; - } - if (isModLoaded("Railcraft")){ - Railcraft = true; - Logger.INFO("Components enabled for: Railcraft"); - totalMods++; - } - if (isModLoaded("Waila")){ - Waila = true; - Logger.INFO("Components enabled for: WAILA"); - totalMods++; - } - if (isModLoaded("SpiceOfLife")){ - SpiceOfLife = true; - Logger.INFO("Components enabled for: Spice Of Life"); - totalMods++; - } - if (isModLoaded("Mekanism")){ - Mekanism = true; - Logger.INFO("Components enabled for: Mekanism - This feature is not configurable and balances Mekanism to suit GT."); - totalMods++; - } - if (isModLoaded("Growthcraft")){ - Logger.INFO("Growthcraft Version: "+getModVersion("Growthcraft")); - if (getModVersion("Growthcraft").equals("1.7.10-2.3.1")){ - //Load Growthcraft Compat - Growthcraft = true; - Logger.INFO("Components enabled for: Growthcraft"); - totalMods++; - } - else { - Growthcraft = false; - Logger.INFO("Growthcraft found, but the version was too new. I will update GC support eventually."); - } - } - if (isModLoaded("CoFHCore")){ - CoFHCore = true; - Logger.INFO("Components enabled for: CoFHCore"); - totalMods++; - } - if (isModLoaded("Forestry")){ - Forestry = true; - Logger.INFO("Components enabled for: Forestry"); - totalMods++; - } - if (isModLoaded("MagicBees")){ - MagicBees = true; - Logger.INFO("Components enabled for: MagicBees"); - totalMods++; - } - if (isModLoaded("psychedelicraft")){ - Psychedelicraft = true; - Logger.INFO("Components enabled for: Psychedelicraft"); - totalMods++; - } - if (isModLoaded("ImmersiveEngineering")){ - ImmersiveEngineering = true; - Logger.INFO("Components enabled for: ImmersiveEngineering"); - totalMods++; - } - if (isModLoaded("ExtraBees")){ - ExtraBees = true; - Logger.INFO("Components enabled for: ExtraBees"); - totalMods++; - } - if (isModLoaded("ThermalFoundation") == false){ - ThermalFoundation = false; - Logger.INFO("Components enabled for: ThermalFoundation - This feature will disable itself if you add TF."); - totalMods++; - } - else if (isModLoaded("ThermalFoundation")){ - ThermalFoundation = true; - Logger.INFO("Components disabled for: ThermalFoundation - This feature will enable itself if you remove TF."); - //totalMods++; - } - if (isModLoaded("ihl")){ - IHL = true; - Logger.INFO("Components enabled for: IHL"); - totalMods++; - } - if (isModLoaded("Baubles")){ - Baubles = true; - Logger.INFO("Components enabled for: Baubles"); - totalMods++; - } - if (isModLoaded("GalacticraftCore")){ - GalacticraftCore = true; - Logger.INFO("Components enabled for: Galacticraft Core"); - totalMods++; - } - if (isModLoaded("OpenComputers")){ - OpenComputers = true; - Logger.INFO("Components enabled for: OpenComputers"); - totalMods++; - } - if (isModLoaded("computronics")){ - Computronics = true; - Logger.INFO("Components disabled for: Computronics - This feature will enable itself if you remove Computronics."); - totalMods++; - } - else { - Logger.INFO("Components enabled for: Computronics - This feature will disable itself if you add Computronics."); - } - if (isModLoaded("GTRedtech")){ - RedTech = true; - Logger.INFO("Components enabled for: GTRedtech"); - totalMods++; - } - if (isModLoaded("tectech")){ - TecTech = true; - Logger.INFO("Components enabled for: TecTech"); - totalMods++; - } - if (isModLoaded("kekztech")){ - KekzTech = true; - Logger.INFO("Components enabled for: KekzTech"); - totalMods++; - } - if (isModLoaded("witchery")){ - Witchery = true; - Logger.INFO("Components enabled for: Witchery"); - totalMods++; - } - - Logger.INFO("Content found for "+totalMods+" mods"); - - } - - public static String getModVersion(final String modName){ - final String ver = cpw.mods.fml.common.FMLCommonHandler.instance().findContainerFor(modName).getVersion(); - return ver; - } - - private static final HashMap<String, Boolean> mLoadedModCache = new HashMap<String, Boolean>(); - - public static boolean isModLoaded(String aModName) { - Boolean aResult = mLoadedModCache.get(aModName); - if (aResult == null) { - boolean aTemp = Loader.isModLoaded(aModName); - mLoadedModCache.put(aModName, aTemp); - aResult = aTemp; - } - return aResult; - } - -} diff --git a/src/Java/gtPlusPlus/core/lib/VanillaColours.java b/src/Java/gtPlusPlus/core/lib/VanillaColours.java deleted file mode 100644 index 9a7a82cb1f..0000000000 --- a/src/Java/gtPlusPlus/core/lib/VanillaColours.java +++ /dev/null @@ -1,28 +0,0 @@ -package gtPlusPlus.core.lib; - -import gtPlusPlus.core.util.Utils; - -public enum VanillaColours { - - BONE_MEAL(249, 255, 254), INK_BLACK(29, 29, 33), COCOA_BEANS(131, 84, 50), LAPIS_LAZULI(60, 68, 170), - DYE_WHITE(249, 255, 254), DYE_BLACK(29, 29, 33), DYE_RED(176, 46, 38), DYE_GREEN(94, 124, 22), - DYE_CYAN(22, 156, 156), DYE_PINK(243, 139, 170), DYE_LIME(128, 199, 31), DYE_YELLOW(254, 216, 61), - DYE_ORANGE(249, 128, 29), DYE_BROWN(131, 84, 50), DYE_LIGHT_BLUE(58, 179, 218), DYE_LIGHT_PURPLE(199, 78, 189), - DYE_LIGHT_GRAY(157, 157, 151), DYE_DARK_BLUE(60, 68, 170), DYE_DARK_PURPLE(137, 50, 184), DYE_DARK_GRAY(71, 79, 82); - - private final int r, g, b; - - private VanillaColours(int aR, int aG, int aB) { - r = aR; - g = aG; - b = aB; - } - - public short[] getAsShort() { - return new short[] { (short) r, (short) g, (short) b }; - } - - public int getAsInt() { - return Utils.rgbtoHexValue(r, g, b); - } -} diff --git a/src/Java/gtPlusPlus/core/material/ALLOY.java b/src/Java/gtPlusPlus/core/material/ALLOY.java deleted file mode 100644 index fd7547970c..0000000000 --- a/src/Java/gtPlusPlus/core/material/ALLOY.java +++ /dev/null @@ -1,1009 +0,0 @@ -package gtPlusPlus.core.material; - -import gregtech.api.enums.Materials; - -import gtPlusPlus.core.material.state.MaterialState; -import gtPlusPlus.core.util.minecraft.MaterialUtils; - -public final class ALLOY { - - //Just some GT Alloys that I need within mine. - public static final Material BRONZE = MaterialUtils.generateMaterialFromGtENUM(Materials.Bronze); - public static final Material STEEL = MaterialUtils.generateMaterialFromGtENUM(Materials.Steel); - public static final Material STEEL_BLACK = MaterialUtils.generateMaterialFromGtENUM(Materials.BlackSteel); - public static final Material INVAR = MaterialUtils.generateMaterialFromGtENUM(Materials.Invar); - public static final Material KANTHAL = MaterialUtils.generateMaterialFromGtENUM(Materials.Kanthal); - public static final Material NICHROME = MaterialUtils.generateMaterialFromGtENUM(Materials.Nichrome); - public static final Material TUNGSTENSTEEL = MaterialUtils.generateMaterialFromGtENUM(Materials.TungstenSteel); - public static final Material STAINLESS_STEEL = MaterialUtils.generateMaterialFromGtENUM(Materials.StainlessSteel); - public static final Material OSMIRIDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Osmiridium); - - public static final Material ENERGYCRYSTAL = new Material( - "Energy Crystal", //Material Name - MaterialState.SOLID, //State - new short[]{228, 255, 0, 0}, //Material Colour - 5660, //Melting Point in C - 7735, //Boiling Point in C - 150, //Protons - 80, //Neutrons - true, //Uses Blast furnace? - "⬟ ⯂ ⬢ ⬣ ⯃ ⯄", - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().AER, 5), - new MaterialStack(ELEMENT.getInstance().IGNIS, 5), - new MaterialStack(ELEMENT.getInstance().TERRA, 5), - new MaterialStack(ELEMENT.getInstance().AQUA, 5) - }); - - public static final Material BLOODSTEEL = new Material( - "Blood Steel", //Material Name - MaterialState.SOLID, //State - new short[]{142, 28, 0, 0}, //Material Colour - 2500, //Melting Point in C - 0, //Boiling Point in C - 100, //Protons - 100, //Neutrons - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ALLOY.STEEL, 5), - new MaterialStack(ELEMENT.getInstance().IGNIS, 5) - }); - - public static final Material STABALLOY = new Material( - "Staballoy", //Material Name - MaterialState.SOLID, //State - new short[]{68, 75, 66, 0}, //Material Colour - 3450, //Melting Point in C - -1, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().URANIUM238, 9), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 1) - }); - - public static final Material TANTALLOY_60 = new Material( - "Tantalloy-60", //Material Name - MaterialState.SOLID, //State - new short[]{213, 231, 237, 0}, //Material Colour - 3025, //Melting Point in C - -1, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().TUNGSTEN, 4), - new MaterialStack(ELEMENT.getInstance().TANTALUM, 46) - }); - - public static final Material TANTALLOY_61 = new Material( - "Tantalloy-61", //Material Name - MaterialState.SOLID, //State - new short[]{193, 211, 217, 0}, //Material Colour - 3030, //Melting Point in C - -1, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ALLOY.TANTALLOY_60, 2), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 12), - new MaterialStack(ELEMENT.getInstance().YTTRIUM, 8) - }); - - public static final Material TUMBAGA = new Material( - "Tumbaga", //Material Name - MaterialState.SOLID, //State - new short[]{255,178,15, 0}, //Material Colour - -1, - -1, - -1, - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().GOLD, 70), - new MaterialStack(ELEMENT.getInstance().COPPER, 30) - }); - - public static final Material POTIN = new Material( - "Potin", //Material Name - MaterialState.SOLID, //State - new short[]{201,151,129, 0}, //Material Colour - -1, - -1, - -1, - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().LEAD, 40), - new MaterialStack(ALLOY.BRONZE, 40), - new MaterialStack(ELEMENT.getInstance().TIN, 20) - }); - - /*public static final Material BEDROCKIUM = new Material( - "Bedrockium", //Material Name - new short[]{32, 32, 32, 0}, //Material Colour - 7735, //Melting Point in C - 0, //Boiling Point in C - 100, //Protons - 100, //Neutrons - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - null);*/ - - public static final Material INCONEL_625 = new Material( - "Inconel-625", //Material Name - MaterialState.SOLID, //State - new short[]{128, 200, 128, 0}, //Material Colour - 2425, //Melting Point in C - 3758, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().NICKEL, 3), - new MaterialStack(ELEMENT.getInstance().CHROMIUM, 7), - new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 10), - new MaterialStack(INVAR, 10), - new MaterialStack(NICHROME, 13) - }); - - public static final Material INCONEL_690 = new Material( - "Inconel-690", //Material Name - MaterialState.SOLID, //State - new short[]{118, 220, 138, 0}, //Material Colour - 3425, //Melting Point in C - 4895, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().CHROMIUM, 5), - new MaterialStack(ELEMENT.getInstance().NIOBIUM, 10), - new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 10), - new MaterialStack(NICHROME, 15) - }); - - public static final Material INCONEL_792 = new Material( - "Inconel-792", //Material Name - MaterialState.SOLID, //State - new short[]{108, 240, 118, 0}, //Material Colour - 3425, //Melting Point in C - 6200, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().NICKEL, 20), - new MaterialStack(ELEMENT.getInstance().NIOBIUM, 10), - new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 20), - new MaterialStack(NICHROME, 10) - }); - - public static final Material NITINOL_60 = new Material( - "Nitinol 60", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 5651, //Melting Point in C - 8975, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().NICKEL, 40), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 60) - }); - - - public static final Material ZERON_100 = new Material( - "Zeron-100", //Material Name - MaterialState.SOLID, //State - new short[]{180, 180, 20, 0}, //Material Colour - 6100, - 9785, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().CHROMIUM, 26), - new MaterialStack(ELEMENT.getInstance().NICKEL, 6), - new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 4), - new MaterialStack(ELEMENT.getInstance().COPPER, 20), - new MaterialStack(ELEMENT.getInstance().TUNGSTEN, 4), - new MaterialStack(ALLOY.STEEL, 40) - }); - - public static final Material MARAGING250 = new Material( - "Maraging Steel 250", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 2413, //Melting Point in C - 4555, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ALLOY.STEEL, 64), - new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 4), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 4), - new MaterialStack(ELEMENT.getInstance().NICKEL, 16), - new MaterialStack(ELEMENT.getInstance().COBALT, 8), - }); - - public static final Material MARAGING300 = new Material( - "Maraging Steel 300", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 2413, //Melting Point in C - 4555, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ALLOY.STEEL, 64), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 4), - new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 4), - new MaterialStack(ELEMENT.getInstance().NICKEL, 16), - new MaterialStack(ELEMENT.getInstance().COBALT, 8), - }); - - public static final Material MARAGING350 = new Material( - "Maraging Steel 350", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 2413, //Melting Point in C - 4555, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ALLOY.STEEL, 64), - new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 4), - new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 4), - new MaterialStack(ELEMENT.getInstance().NICKEL, 16), - new MaterialStack(ELEMENT.getInstance().COBALT, 8), - }); - - public static final Material AQUATIC_STEEL = new Material( - "Watertight Steel", //Material Name - MaterialState.SOLID, //State - new short[] {120, 120, 180}, //Material Colour - 2673, //Melting Point in C - 4835, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ALLOY.STEEL, 60), - new MaterialStack(ELEMENT.getInstance().CARBON, 10), - new MaterialStack(ELEMENT.getInstance().MANGANESE, 5), - new MaterialStack(ELEMENT.getInstance().SILICON, 10), - new MaterialStack(ELEMENT.getInstance().PHOSPHORUS, 5), - new MaterialStack(ELEMENT.getInstance().SULFUR, 5), - new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 5) - }); - - public static final Material STELLITE = new Material( - "Stellite", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 4310, //Melting Point in C - 6250, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().COBALT, 35), - new MaterialStack(ELEMENT.getInstance().CHROMIUM, 35), - new MaterialStack(ELEMENT.getInstance().MANGANESE, 20), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 10) - }); - - public static final Material TALONITE = new Material( - "Talonite", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 3454, //Melting Point in C - 5500, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().COBALT, 40), - new MaterialStack(ELEMENT.getInstance().CHROMIUM, 30), - new MaterialStack(ELEMENT.getInstance().PHOSPHORUS, 20), - new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 10) - }); - - public static final Material HASTELLOY_W = new Material( - "Hastelloy-W", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 3350, //Melting Point in C - 5755, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().IRON, 06), - new MaterialStack(ELEMENT.getInstance().COBALT, 2), - new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 24), - new MaterialStack(ELEMENT.getInstance().CHROMIUM, 6), - new MaterialStack(ELEMENT.getInstance().NICKEL, 62) - }); - - public static final Material HASTELLOY_X = new Material( - "Hastelloy-X", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 3350, //Melting Point in C - 5755, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().IRON, 18), - new MaterialStack(ELEMENT.getInstance().MANGANESE, 2), - new MaterialStack(ELEMENT.getInstance().SILICON, 2), - new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 8), - new MaterialStack(ELEMENT.getInstance().CHROMIUM, 22), - new MaterialStack(ELEMENT.getInstance().NICKEL, 48) - }); - - public static final Material HASTELLOY_N = new Material( - "Hastelloy-N", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 4350, //Melting Point in C - 6875, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().YTTRIUM, 8), - new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 16), - new MaterialStack(ELEMENT.getInstance().CHROMIUM, 8), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 8), - new MaterialStack(ELEMENT.getInstance().NICKEL, 60) - }); - - public static final Material HASTELLOY_C276 = new Material( - "Hastelloy-C276", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 4350, //Melting Point in C - 6520, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().COBALT, 2), - new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 16), - new MaterialStack(ELEMENT.getInstance().TUNGSTEN, 2), - new MaterialStack(ELEMENT.getInstance().COPPER, 2), - new MaterialStack(ELEMENT.getInstance().CHROMIUM, 14), - new MaterialStack(ELEMENT.getInstance().NICKEL, 64) - }); - - public static final Material INCOLOY_020 = new Material( - "Incoloy-020", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 3425, //Melting Point in C - 5420, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().IRON, 40), - new MaterialStack(ELEMENT.getInstance().COPPER, 4), - new MaterialStack(ELEMENT.getInstance().CHROMIUM, 20), - new MaterialStack(ELEMENT.getInstance().NICKEL, 36) - }); - - public static final Material INCOLOY_DS = new Material( - "Incoloy-DS", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 3425, //Melting Point in C - 5420, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().IRON, 46), - new MaterialStack(ELEMENT.getInstance().COBALT, 18), - new MaterialStack(ELEMENT.getInstance().CHROMIUM, 18), - new MaterialStack(ELEMENT.getInstance().NICKEL, 18) - }); - - public static final Material INCOLOY_MA956 = new Material( - "Incoloy-MA956", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 4425, //Melting Point in C - 6875, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().IRON, 64), - new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 12), - new MaterialStack(ELEMENT.getInstance().CHROMIUM, 20), - new MaterialStack(ELEMENT.getInstance().YTTRIUM, 4) - }); - - public static final Material TUNGSTEN_CARBIDE = new Material( - "Tungsten Carbide", //Material Name - MaterialState.SOLID, //State - new short[]{44, 44, 44, 0}, //Material Colour - 3422, //Melting Point in C - -1, - -1, - -1, - true, //Uses Blast furnace? - false, //Generate cells - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().CARBON, 50), - new MaterialStack(ELEMENT.getInstance().TUNGSTEN, 50) - }); - - public static final Material TUNGSTEN_TITANIUM_CARBIDE = new Material( - "Tungsten Titanium Carbide", //Material Name - MaterialState.SOLID, //State - null, - 4422, //Melting Point in C - -1, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(TUNGSTEN_CARBIDE, 70), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 30) - }); - - public static final Material SILICON_CARBIDE = new Material( - "Silicon Carbide", //Material Name - MaterialState.SOLID, //State - new short[]{40, 48, 36, 0}, //Material Colour - 1414, //Melting Point in C - -1, - -1, - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().SILICON, 50), - new MaterialStack(ELEMENT.getInstance().CARBON, 50) - }); - - public static final Material TANTALUM_CARBIDE = new Material( - "Tantalum Carbide", //Material Name - MaterialState.SOLID, //State - new short[]{139, 136, 120, 0}, //Material Colour - 2980, //Melting Point in C - -1, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().TANTALUM, 50), - new MaterialStack(ELEMENT.getInstance().CARBON, 50) - }); - - public static final Material ZIRCONIUM_CARBIDE = new Material( - "Zirconium Carbide", //Material Name - MaterialState.SOLID, //State - new short[]{222, 202, 180, 0}, //Material Colour - 1555, //Melting Point in C - -1, - -1, - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().ZIRCONIUM, 50), - new MaterialStack(ELEMENT.getInstance().CARBON, 50) - }); - - public static final Material NIOBIUM_CARBIDE = new Material( - "Niobium Carbide", //Material Name - MaterialState.SOLID, //State - new short[]{205, 197, 191, 0}, //Material Colour - 2477, //Melting Point in C - -1, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().NIOBIUM, 50), - new MaterialStack(ELEMENT.getInstance().CARBON, 50) - }); - - public static final Material ARCANITE = new Material( - "Arcanite", //Material Name - MaterialState.SOLID, //State - null, - 5666, //Melting Point in C - 9875, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().THORIUM232, 40), - new MaterialStack(ENERGYCRYSTAL, 40), - new MaterialStack(ELEMENT.getInstance().ORDO, 10), - new MaterialStack(ELEMENT.getInstance().PERDITIO, 10) - }); - - public static final Material LEAGRISIUM = new Material( - "Grisium", //Material Name - MaterialState.SOLID, //State - new short[]{53, 93, 106, 0}, //Material Colour - 3850, //Melting Point in C - 5550, //Boiling Point in C - 96, //Protons - 128, //Neutrons - true, //Uses Blast furnace? - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().TITANIUM, 18), - new MaterialStack(ELEMENT.getInstance().CARBON, 18), - new MaterialStack(ELEMENT.getInstance().POTASSIUM, 18), - new MaterialStack(ELEMENT.getInstance().LITHIUM, 18), - new MaterialStack(ELEMENT.getInstance().SULFUR, 18), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 10) - }); //Material Stacks with Percentage of required elements. - - public static final Material EGLIN_STEEL_BASE = new Material( - "Eglin Steel Base Compound", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - - new MaterialStack(ELEMENT.getInstance().IRON, 12), - new MaterialStack(KANTHAL, 3), - new MaterialStack(INVAR, 15) - }); - - public static final Material EGLIN_STEEL = new Material( - "Eglin Steel", //Material Name - MaterialState.SOLID, //State - new short[]{139,69,19, 0}, //Material Colour - 1048, //Melting Point in C - 1973, //Boiling Point in C - -1, - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ALLOY.EGLIN_STEEL_BASE, 10), - new MaterialStack(ELEMENT.getInstance().SULFUR, 1), - new MaterialStack(ELEMENT.getInstance().SILICON, 4), - new MaterialStack(ELEMENT.getInstance().CARBON, 1) - }); - - public static final Material HG1223 = new Material( - "HG-1223", //Material Name - MaterialState.LIQUID, //State - new short[]{39,85,159, 0}, //Material Colour - 6357, //Melting Point in C - 8563, //Boiling Point in C - -1, - -1, - false, //Uses Blast furnace? - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().MERCURY, 1), - new MaterialStack(ELEMENT.getInstance().BARIUM, 2), - new MaterialStack(ELEMENT.getInstance().CALCIUM, 2), - new MaterialStack(ELEMENT.getInstance().COPPER, 3), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 8) - }); - - - public static final Material HS188A = new Material( - "HS188-A", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 4870, //Melting Point in C - 7550, //Boiling Point in C - -1, //Protons - -1, //Neutrons - true, //Uses Blast furnace? - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().COBALT, 20), - new MaterialStack(ELEMENT.getInstance().HAFNIUM, 20), - new MaterialStack(TALONITE, 16), - new MaterialStack(ELEMENT.getInstance().RHENIUM, 10), - new MaterialStack(NIOBIUM_CARBIDE, 10), - new MaterialStack(HASTELLOY_X, 8), - new MaterialStack(TUNGSTENSTEEL, 8), - new MaterialStack(ZIRCONIUM_CARBIDE, 8), - }); //Material Stacks with Percentage of required elements. - - /** - * Stargate Materials - #D2FFA9 210, 255, 170 - */ - - public static final Material TRINIUM_TITANIUM = new Material( - "Trinium Titanium Alloy", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 3750, //Melting Point in C - 7210, //Boiling Point in C - -1, - -1, - true, //Uses Blast furnace? - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().TRINIUM_REFINED, 3), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 7) - }); - public static final Material TRINIUM_NAQUADAH = new Material( - "Trinium Naquadah Alloy", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 4200, //Melting Point in C - 7400, //Boiling Point in C - -1, - -1, - false, //Uses Blast furnace? - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().TRINIUM_REFINED, 5), - new MaterialStack(ELEMENT.getInstance().NAQUADAH, 9) - }); - public static final Material TRINIUM_NAQUADAH_CARBON = new Material( - "Trinium Naquadah Carbonite", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 6500, //Melting Point in C - 9000, //Boiling Point in C - -1, - -1, - true, //Uses Blast furnace? - new MaterialStack[]{ - new MaterialStack(TRINIUM_NAQUADAH, 9), - new MaterialStack(ELEMENT.getInstance().CARBON, 1) - }); - - public static final Material TRINIUM_REINFORCED_STEEL = new Material( - "Arceus Alloy 2B", //Material Name - MaterialState.SOLID, //State - new short[]{205, 197, 23, 0}, //Material Colour - 7555, //Melting Point in C - 12350, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().TRINIUM_REFINED, 30), - new MaterialStack(ALLOY.MARAGING350, 40), - new MaterialStack(ALLOY.TUNGSTENSTEEL, 20), - new MaterialStack(ALLOY.OSMIRIDIUM, 10), - new MaterialStack(ELEMENT.getInstance().STRONTIUM, 10) - }); - - - - /* - * Witchery Material - */ - - public static final Material KOBOLDITE = new Material( - "Koboldite", //Material Name - MaterialState.SOLID, //State - new short[]{80, 210, 255, 0}, //Material Colour - -1, //Melting Point in C - -1, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().NICKEL, 35), - new MaterialStack(ELEMENT.getInstance().THAUMIUM, 30), - new MaterialStack(ELEMENT.getInstance().IRON, 35) - }); - - - /* - * Top Tier Alloys - */ - - public static final Material HELICOPTER = new Material( - "HeLiCoPtEr", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 5763, - 8192, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().HELIUM, 20), - new MaterialStack(ELEMENT.getInstance().LITHIUM, 20), - new MaterialStack(ELEMENT.getInstance().COBALT, 20), - new MaterialStack(ELEMENT.getInstance().PLATINUM, 20), - new MaterialStack(ELEMENT.getInstance().ERBIUM, 20) - }); - - //0lafe Compound - public static final Material LAFIUM = new Material( - "Lafium Compound", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 6350, //Melting Point in C - 9865, //Boiling Point in C - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ALLOY.HASTELLOY_N, 8), - new MaterialStack(ELEMENT.getInstance().NAQUADAH, 4), - new MaterialStack(ELEMENT.getInstance().SAMARIUM, 2), - new MaterialStack(ELEMENT.getInstance().TUNGSTEN, 4), - new MaterialStack(ELEMENT.getInstance().ARGON, 2), - new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 6), - new MaterialStack(ELEMENT.getInstance().NICKEL, 8), - new MaterialStack(ELEMENT.getInstance().CARBON, 2) - }); - - //Cinobi Alloy - public static final Material CINOBITE = new Material( - "Cinobite A243", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 7350, //Melting Point in C - 12565, //Boiling Point in C - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ALLOY.ZERON_100, 16), - new MaterialStack(ELEMENT.getInstance().NAQUADRIA, 7), - new MaterialStack(ELEMENT.getInstance().GADOLINIUM, 5), - new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 3), - new MaterialStack(ELEMENT.getInstance().MERCURY, 2), - new MaterialStack(ELEMENT.getInstance().TIN, 2), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 12), - new MaterialStack(ALLOY.OSMIRIDIUM, 6) - }); - - //Piky Alloy - public static final Material PIKYONIUM = new Material( - "Pikyonium 64B", //Material Name - MaterialState.SOLID, //State - new short[]{52, 103, 186, 0}, //Material Colour - 6850, //Melting Point in C - 11765, //Boiling Point in C - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ALLOY.INCONEL_792, 16), - new MaterialStack(ALLOY.EGLIN_STEEL, 10), - new MaterialStack(ELEMENT.getInstance().NAQUADAH_ENRICHED, 8), - new MaterialStack(ELEMENT.getInstance().CERIUM, 6), - new MaterialStack(ELEMENT.getInstance().ANTIMONY, 4), - new MaterialStack(ELEMENT.getInstance().PLATINUM, 4), - new MaterialStack(ELEMENT.getInstance().YTTERBIUM, 2), - new MaterialStack(ALLOY.TUNGSTENSTEEL, 8) - }); - - //Piky Alloy - public static final Material ABYSSAL = new Material( - "Abyssal Alloy", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 9650, //Melting Point in C - 13765, //Boiling Point in C - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ALLOY.STAINLESS_STEEL, 10), - new MaterialStack(ALLOY.TUNGSTEN_CARBIDE, 10), - new MaterialStack(ALLOY.NICHROME, 10), - new MaterialStack(ALLOY.BRONZE, 10), - new MaterialStack(ALLOY.INCOLOY_MA956, 10), - new MaterialStack(ELEMENT.getInstance().IODINE, 2), - new MaterialStack(ELEMENT.getInstance().RADON, 2), - new MaterialStack(ELEMENT.getInstance().GERMANIUM, 2), - }); - - //Alkalus Alloy - public static final Material LAURENIUM = new Material( - "Laurenium", //Material Name - MaterialState.SOLID, //State - new short[] {244, 168, 255, 0}, //Material Colour - 6825, //Melting Point in C - 11355, //Boiling Point in C - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ALLOY.EGLIN_STEEL, 40), - new MaterialStack(ELEMENT.getInstance().INDIUM, 10), - new MaterialStack(ELEMENT.getInstance().CHROMIUM, 20), - new MaterialStack(ELEMENT.getInstance().DYSPROSIUM, 5), - new MaterialStack(ELEMENT.getInstance().RHENIUM, 5), - }); - - - //Bot Alloy - public static final Material BOTMIUM = new Material( - "Botmium", //Material Name - MaterialState.SOLID, //State - new short[] {80, 160, 80, 0}, //Material Colour - 8220, //Melting Point in C - 10540, //Boiling Point in C - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ALLOY.NITINOL_60, 2), - new MaterialStack(ELEMENT.getInstance().OSMIUM, 12), - new MaterialStack(ELEMENT.getInstance().RUTHENIUM, 12), - new MaterialStack(ELEMENT.getInstance().THALLIUM, 6), - }); - - //Titansteel - public static final Material TITANSTEEL = new Material( - "Titansteel", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 8250, //Melting Point in C - 11765, //Boiling Point in C - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ALLOY.TUNGSTEN_TITANIUM_CARBIDE, 3), - new MaterialStack(ELEMENT.getInstance().IGNIS, 1), - new MaterialStack(ELEMENT.getInstance().TERRA, 1), - new MaterialStack(ELEMENT.getInstance().PERDITIO, 1), - }); - - - public static final Material OCTIRON = new Material( - "Octiron", //Material Name - MaterialState.SOLID, //State - null, - 9120, //Melting Point in C - 14200, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ARCANITE, 30), - new MaterialStack(TITANSTEEL, 30), - new MaterialStack(ENERGYCRYSTAL, 5), - new MaterialStack(STEEL_BLACK, 10), - new MaterialStack(ELEMENT.getInstance().THAUMIUM, 25) - }); - - - - public static final Material BLACK_TITANIUM = new Material( - "Black Titanium", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - Materials.Titanium.mMeltingPoint*4, //Melting Point in C - Materials.Titanium.mMeltingPoint*16, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().TITANIUM, 55), - new MaterialStack(ELEMENT.getInstance().LANTHANUM, 12), - new MaterialStack(ELEMENT.getInstance().TUNGSTEN, 8), - new MaterialStack(ELEMENT.getInstance().COBALT, 6), - new MaterialStack(ELEMENT.getInstance().MANGANESE, 4), - new MaterialStack(ELEMENT.getInstance().PHOSPHORUS, 4), - new MaterialStack(ELEMENT.getInstance().PALLADIUM, 4), - new MaterialStack(ELEMENT.getInstance().NIOBIUM, 2), - new MaterialStack(ELEMENT.getInstance().ARGON, 5) - }); - - public static final Material BABBIT_ALLOY = new Material( - "Babbit Alloy", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 268, //Melting Point in C - 589, - -1, - -1, - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().TIN, 10), - new MaterialStack(ELEMENT.getInstance().LEAD, 72), - new MaterialStack(ELEMENT.getInstance().ANTIMONY, 16), - new MaterialStack(ELEMENT.getInstance().ARSENIC, 2) - }); - - - - - - - - - - - - - - - - //Quantum - public static final Material QUANTUM = new Material( - "Quantum", //Material Name - MaterialState.SOLID, //State - null, //Material Colour - 10500, //Melting Point in C - 25000, //Boiling Point in C - 150, //Protons - 200, //Neutrons - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ALLOY.STELLITE, 15), - new MaterialStack(ALLOY.ENERGYCRYSTAL, 5), - new MaterialStack(ALLOY.SILICON_CARBIDE, 5), - new MaterialStack(ELEMENT.getInstance().GALLIUM, 5), - new MaterialStack(ELEMENT.getInstance().AMERICIUM, 5), - new MaterialStack(ELEMENT.getInstance().PALLADIUM, 5), - new MaterialStack(ELEMENT.getInstance().BISMUTH, 5), - new MaterialStack(ELEMENT.getInstance().GERMANIUM, 5) - }); - - - -} diff --git a/src/Java/gtPlusPlus/core/material/ELEMENT.java b/src/Java/gtPlusPlus/core/material/ELEMENT.java deleted file mode 100644 index 54af01ef6e..0000000000 --- a/src/Java/gtPlusPlus/core/material/ELEMENT.java +++ /dev/null @@ -1,254 +0,0 @@ -package gtPlusPlus.core.material; - -import gregtech.api.enums.Materials; -import gregtech.api.enums.TextureSet; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.client.CustomTextureSet.TextureSets; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.state.MaterialState; -import gtPlusPlus.core.util.data.StringUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; - -public final class ELEMENT { - - public static final String[] NAMES = new String[]{"Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; - - //First 50 Elements - public final Material HYDROGEN = MaterialUtils.generateMaterialFromGtENUM(Materials.Hydrogen); - public final Material HELIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Helium); - public final Material LITHIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Lithium); - public final Material BERYLLIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Beryllium); - public final Material BORON = MaterialUtils.generateMaterialFromGtENUM(Materials.Boron); - public final Material CARBON = MaterialUtils.generateMaterialFromGtENUM(Materials.Carbon); - public final Material NITROGEN = MaterialUtils.generateMaterialFromGtENUM(Materials.Nitrogen); - public final Material OXYGEN = MaterialUtils.generateMaterialFromGtENUM(Materials.Oxygen); - public final Material FLUORINE = MaterialUtils.generateMaterialFromGtENUM(Materials.Fluorine); - public final Material NEON = new Material("Neon", MaterialState.PURE_GAS, new short[]{240, 180, 30}, -248, -246, 10, 10, false, "Ne", 0);//Not a GT Inherited Material - public final Material SODIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Sodium); - public final Material MAGNESIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Magnesium); - public final Material ALUMINIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Aluminium); - public final Material ALUMINIUMOXIDE = MaterialUtils.generateMaterialFromGtENUM(Materials.Aluminiumoxide); - public final Material SILICON = MaterialUtils.generateMaterialFromGtENUM(Materials.Silicon); - public final Material SILICONDIOXIDE = MaterialUtils.generateMaterialFromGtENUM(Materials.SiliconDioxide); - public final Material PHOSPHORUS = MaterialUtils.generateMaterialFromGtENUM(Materials.Phosphor); - public final Material SULFUR = MaterialUtils.generateMaterialFromGtENUM(Materials.Sulfur); - public final Material CHLORINE = MaterialUtils.generateMaterialFromGtENUM(Materials.Chlorine); - public final Material ARGON = MaterialUtils.generateMaterialFromGtENUM(Materials.Argon); - public final Material POTASSIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Potassium); - public final Material CALCIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Calcium); - public final Material SCANDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Scandium); - public final Material TITANIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Titanium); - public final Material VANADIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Vanadium); - public final Material CHROMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Chrome); - public final Material MANGANESE = MaterialUtils.generateMaterialFromGtENUM(Materials.Manganese); - public final Material IRON = MaterialUtils.generateMaterialFromGtENUM(Materials.Iron); - public final Material COBALT = MaterialUtils.generateMaterialFromGtENUM(Materials.Cobalt); - public final Material NICKEL = MaterialUtils.generateMaterialFromGtENUM(Materials.Nickel); - public final Material COPPER = MaterialUtils.generateMaterialFromGtENUM(Materials.Copper); - public final Material ZINC = MaterialUtils.generateMaterialFromGtENUM(Materials.Zinc); - public final Material GALLIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Gallium); - public final Material GERMANIUM = new Material("Germanium", MaterialState.SOLID, new short[]{200, 200, 200}, 937, 2830, 32, 41, false, "Ge", 0);//Not a GT Inherited Material - public final Material ARSENIC = MaterialUtils.generateMaterialFromGtENUM(Materials.Arsenic); - public final Material SELENIUM = new Material("Selenium", MaterialState.SOLID, new short[]{190, 190, 190}, 217, 685, 34, 45, false, "Se", 0);//Not a GT Inherited Material - public final Material BROMINE = new Material("Bromine", MaterialState.PURE_LIQUID, new short[]{200, 25, 25}, -7, 58, 35, 45, false, "Br", 0);//Not a GT Inherited Material - public final Material KRYPTON = new Material("Krypton", MaterialState.PURE_GAS, new short[]{5, 200, 220}, -157, -153, 36, 48, false, "Kr", 0);//Not a GT Inherited Material - public final Material RUBIDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Rubidium); - public final Material STRONTIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Strontium, new short[] {230, 210, 110}, TextureSet.SET_FLINT); - public final Material YTTRIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Yttrium); - public final Material ZIRCONIUM = new Material("Zirconium", MaterialState.SOLID, new short[]{255, 250, 205}, 1855, 4377, 40, 51, false, "Zr", 0);//Not a GT Inherited Material - public final Material NIOBIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Niobium); - public final Material MOLYBDENUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Molybdenum); - public final Material TECHNETIUM = new Material("Technetium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{220, 220, 220}, 2200, 4877, 43, 55, false, "Tc", 2);//Not a GT Inherited Material - public final Material RUTHENIUM = new Material("Ruthenium", MaterialState.SOLID, new short[]{220, 220, 220}, 2250, 3900, 44, 57, false, "Ru", 0);//Not a GT Inherited Material - public final Material RHODIUM = new Material("Rhodium", MaterialState.SOLID, new short[]{220, 220, 220}, 1966, 3727, 45, 58, false, "Rh", 0);//Not a GT Inherited Material - public final Material PALLADIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Palladium); - public final Material SILVER = MaterialUtils.generateMaterialFromGtENUM(Materials.Silver); - public final Material CADMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Cadmium); - public final Material INDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Indium); - public final Material TIN = MaterialUtils.generateMaterialFromGtENUM(Materials.Tin); - public final Material ANTIMONY = MaterialUtils.generateMaterialFromGtENUM(Materials.Antimony); - public final Material TELLURIUM = new Material("Tellurium", MaterialState.SOLID, new short[]{210, 210, 210}, 449, 989, 52, 76, false, "Te", 0);//Not a GT Inherited Material - public final Material IODINE = new Material("Iodine", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{96, 96, 96}, 114, 184, 53, 74, false, "I", 0);//Not a GT Inherited Material - public final Material XENON = new Material("Xenon", MaterialState.PURE_GAS, new short[]{5, 105, 210}, -111, -108, 54, 77, false, "Xe", 0);//Not a GT Inherited Material - public final Material CAESIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Caesium); - public final Material BARIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Barium); - public final Material LANTHANUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Lanthanum); - public final Material CERIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Cerium); - public final Material PRASEODYMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Praseodymium); - public final Material NEODYMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Neodymium); - public final Material PROMETHIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Promethium); - public final Material SAMARIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Samarium); - public final Material EUROPIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Europium); - public final Material GADOLINIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Gadolinium); - public final Material TERBIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Terbium); - public final Material DYSPROSIUM = new Material("Dysprosium", MaterialState.SOLID, new short[]{180, 180, 180}, 1412, 2562, 66, 97, false, "Dy", 0);//Not a GT Inherited Material - public final Material HOLMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Holmium); - public final Material ERBIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Erbium); - public final Material THULIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Thulium); - public final Material YTTERBIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Ytterbium); - public final Material LUTETIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Lutetium); - public final Material HAFNIUM = new Material("Hafnium", MaterialState.SOLID, new short[]{128, 128, 128}, 2150, 5400, 72, 106, false, "Hf", 0);//Not a GT Inherited Material - - //Second 50 elements - public final Material TANTALUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Tantalum); - public final Material TUNGSTEN = MaterialUtils.generateMaterialFromGtENUM(Materials.Tungsten); - public final Material RHENIUM = new Material("Rhenium", MaterialState.SOLID, new short[]{150, 150, 150}, 3180, 3627, 75, 111, false, "Re", 0);//Not a GT Inherited Material - public final Material OSMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Osmium); - public final Material IRIDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Iridium); - public final Material PLATINUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Platinum); - public final Material GOLD = MaterialUtils.generateMaterialFromGtENUM(Materials.Gold); - public final Material MERCURY = MaterialUtils.generateMaterialFromGtENUM(Materials.Mercury); //Mercury - public final Material THALLIUM = new Material("Thallium", MaterialState.SOLID, new short[]{175, 175, 175}, 304, 1457, 81, 123, false, "Tl", 0);//Not a GT Inherited Material - public final Material LEAD = MaterialUtils.generateMaterialFromGtENUM(Materials.Lead); - public final Material BISMUTH = MaterialUtils.generateMaterialFromGtENUM(Materials.Bismuth); - public final Material POLONIUM = new Material("Polonium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{180, 170, 180}, 254, 962, 84, 125, false, "Po", 1);//Not a GT Inherited Material - public final Material ASTATINE = new Material("Astatine", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{170, 180, 170}, 302, 337, 85, 125, false, "At", 1);//Not a GT Inherited Material - public final Material RADON = MaterialUtils.generateMaterialFromGtENUM(Materials.Radon); - public final Material FRANCIUM = new Material("Francium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{170, 160, 170}, 27, 677, 87, 136, false, "Fr", 1);//Not a GT Inherited Material - public final Material RADIUM = new Material("Radium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{165, 165, 165}, 700, 1737, 88, 138, false, "Ra", 1);//Not a GT Inherited Material - public final Material ACTINIUM = new Material("Actinium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{150, 165, 165}, 1050, 3200, 89, 138, false, "Ac", 1);//Not a GT Inherited Material - public final Material THORIUM = new Material("Thorium", MaterialState.SOLID, Materials.Thorium.mRGBa, Materials.Thorium.mMeltingPoint, Materials.Thorium.mBlastFurnaceTemp, 90, 142, false, StringUtils.superscript("Th"), 1); - public final Material PROTACTINIUM = new Material("Protactinium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{190, 150, 170}, 1568, 4027, 91, 140, false, "Pa", 1);//Not a GT Inherited Material - public final Material URANIUM238 = MaterialUtils.generateMaterialFromGtENUM(Materials.Uranium); - public final Material URANIUM235 = MaterialUtils.generateMaterialFromGtENUM(Materials.Uranium235); - public final Material NEPTUNIUM = new Material("Neptunium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{200, 220, 205}, 640, 3902, 93, 144, false, "Np", 2);//Not a GT Inherited Material - public final Material PLUTONIUM244 = MaterialUtils.generateMaterialFromGtENUM(Materials.Plutonium); - public final Material PLUTONIUM241 = MaterialUtils.generateMaterialFromGtENUM(Materials.Plutonium241); - public final Material AMERICIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Americium); //Americium - public final Material CURIUM = new Material("Curium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{175, 85, 110}, 1340, 3110, 96, 151, false, "Cm", 3);//Not a GT Inherited Material - public final Material BERKELIUM = new Material("Berkelium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{110, 250, 85}, 985, 710, 97, 150, false, "Bk", 4);//Not a GT Inherited Material - public final Material CALIFORNIUM = new Material("Californium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{85, 110, 205}, 899, 1472, 98, 153, false, "Cf", 4);//Not a GT Inherited Material - public final Material EINSTEINIUM = new Material("Einsteinium", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{255, 85, 110}, 860, 3500, 99, 153, false, "Es", 5);//Not a GT Inherited Material //Boiling Point is made up - public final Material FERMIUM = new Material("Fermium", MaterialState.LIQUID, TextureSets.NUCLEAR.get(), new short[]{75, 90, 25}, 1527, 3850, 100, 157, false, "Fm", 5);//Not a GT Inherited Material //Boiling Point is made up - - //Misc - public final Material AER = MaterialUtils.generateMaterialFromGtENUM(Materials.InfusedAir, TextureSets.GEM_A.get()); - public final Material IGNIS = MaterialUtils.generateMaterialFromGtENUM(Materials.InfusedFire, TextureSets.GEM_A.get()); - public final Material TERRA = MaterialUtils.generateMaterialFromGtENUM(Materials.InfusedEarth, TextureSets.GEM_A.get()); - public final Material AQUA = MaterialUtils.generateMaterialFromGtENUM(Materials.InfusedWater, TextureSets.GEM_A.get()); - public final Material PERDITIO = MaterialUtils.generateMaterialFromGtENUM(Materials.InfusedEntropy, TextureSets.GEM_A.get()); - public final Material ORDO = MaterialUtils.generateMaterialFromGtENUM(Materials.InfusedOrder, TextureSets.GEM_A.get()); - - //Fictional - public final Material YELLORIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Yellorium, new short[] {255, 242, 10}, TextureSets.NUCLEAR.get()); - public final Material NAQUADAH = MaterialUtils.generateMaterialFromGtENUM(Materials.Naquadah); - public final Material NAQUADAH_ENRICHED = MaterialUtils.generateMaterialFromGtENUM(Materials.NaquadahEnriched); - public final Material NAQUADRIA = MaterialUtils.generateMaterialFromGtENUM(Materials.Naquadria); - public final Material TRINIUM; - public final Material TRINIUM_REFINED; - //https://github.com/Blood-Asp/GT5-Unofficial/issues/609 - - - //Custom Isotopes - public final Material LITHIUM7 = new Material("Lithium 7", MaterialState.SOLID, TextureSet.SET_SHINY, Materials.Lithium.mRGBa, Materials.Lithium.mMeltingPoint, Materials.Lithium.mBlastFurnaceTemp, Materials.Lithium.getProtons(), Materials.Lithium.getNeutrons(), Materials.Lithium.mBlastFurnaceRequired, StringUtils.superscript("7Li"), 0, false);//Not a GT Inherited Material - public final Material URANIUM232 = new Material("Uranium 232", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{88, 220, 103, 0}, 1132, 4131, 92, 140, false, StringUtils.superscript("232U"), 4);//Not a GT Inherited Material - public final Material URANIUM233 = new Material("Uranium 233", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{73, 220, 83, 0}, 1132, 4131, 92, 141, false, StringUtils.superscript("233U"), 2);//Not a GT Inherited Material - public final Material THORIUM232 = new Material("Thorium 232", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{15, 60, 15, 0}, Materials.Thorium.mMeltingPoint, Materials.Thorium.mBlastFurnaceTemp, 90, 142, false, StringUtils.superscript("232Th"), 1, true);//Not a GT Inherited Material - public final Material PLUTONIUM239 = new Material("Plutonium-239", MaterialState.SOLID, TextureSets.NUCLEAR.get(), Materials.Plutonium.mDurability, Materials.Plutonium.mRGBa, Materials.Plutonium.mMeltingPoint, Materials.Plutonium.mBlastFurnaceTemp, 94, 145, false, StringUtils.superscript("239Pu"), 4, true);//Not a GT Inherited Material - //RTG Fuels - public final Material PLUTONIUM238 = new Material("Plutonium-238", MaterialState.SOLID, TextureSets.NUCLEAR.get(), Materials.Plutonium241.mDurability, Materials.Plutonium241.mRGBa, Materials.Plutonium241.mMeltingPoint, Materials.Plutonium241.mBlastFurnaceTemp, 94, 144, false, StringUtils.superscript("238Pu"), 2, false);//Not a GT Inherited Material - public final Material STRONTIUM90 = new Material("Strontium-90", MaterialState.SOLID, TextureSets.NUCLEAR.get(), Materials.Strontium.mDurability, Materials.Strontium.mRGBa, Materials.Strontium.mMeltingPoint, Materials.Strontium.mBlastFurnaceTemp, 38, 52, false, StringUtils.superscript("90Sr"), 2, false);//Not a GT Inherited Material - public final Material POLONIUM210 = new Material("Polonium-210", MaterialState.SOLID, TextureSets.NUCLEAR.get(), POLONIUM.vDurability, POLONIUM.getRGBA(), POLONIUM.getMeltingPointK(), POLONIUM.getBoilingPointK(), 84, 126, false, StringUtils.superscript("210Po"), 2, false);//Not a GT Inherited Material - public final Material AMERICIUM241 = new Material("Americium-241", MaterialState.SOLID, TextureSets.NUCLEAR.get(), Materials.Americium.mDurability, Materials.Americium.mRGBa, Materials.Americium.mMeltingPoint, Materials.Americium.mBlastFurnaceTemp, 95, 146, false, StringUtils.superscript("241Am"), 2, false);//Not a GT Inherited Material - - public final Material MAGIC = MaterialUtils.generateMaterialFromGtENUM(Materials.Magic, new short[] {10, 185, 140}); - public final Material THAUMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Thaumium); - - static { - Logger.MATERIALS("Initialising Base Elements."); - } - - private static final ELEMENT INSTANCE = new ELEMENT(); - - public ELEMENT(){ - //GTNH Trinium Handling - if (CORE.GTNH){ - //yay - Materials a1 = MaterialUtils.getMaterial("Trinium"); - Materials a2 = Materials.valueOf("Trinium"); - Materials a3 = Materials.get("Trinium"); - Materials a4; - if (a1 == null) { - Logger.INFO("[Material] First attempt to find Trinium failed, using backup method."); - if (a2 == null) { - Logger.INFO("[Material] Fallback attempt to find Trinium failed, using second fallback."); - if (a3 == null) { - Logger.INFO("[Material] Fallback attempt to find Trinium failed, dumping materials."); - for (Materials m : Materials.values()) { - Logger.INFO("[Material] Found "+MaterialUtils.getMaterialName(m)); - } - a4 = null; - } - else { - Logger.INFO("[Material] a3 Found "+MaterialUtils.getMaterialName(a3)); - a4 = a3; - } - } - else { - Logger.INFO("[Material] a2 Found "+MaterialUtils.getMaterialName(a2)); - a4 = a2; - } - TRINIUM = MaterialUtils.generateMaterialFromGtENUM(a4); - } - else { - Logger.INFO("[Material] a1 Found "+MaterialUtils.getMaterialName(a1)); - TRINIUM = MaterialUtils.generateMaterialFromGtENUM(a1); - } - - TRINIUM_REFINED = TRINIUM; - - } - else { - TRINIUM = new Material("Trinium", MaterialState.SOLID, TextureSet.SET_FINE, new short[]{70, 110, 30}, 604, 4057, 181, 133, false, "Ke", 0, false);//Not a GT Inherited Material - TRINIUM_REFINED = new Material("Refined Trinium", MaterialState.SOLID, TextureSets.REFINED.get(), new short[]{210, 255, 170}, 4304, 14057, 181, 133, false, "Ke", 0, new MaterialStack[]{new MaterialStack(TRINIUM, 1)});//Not a GT Inherited Material - } - } - - public static ELEMENT getInstance(){ - return INSTANCE; - } - - public static class STANDALONE { - - public static final Material CELESTIAL_TUNGSTEN = new Material("Celestial Tungsten", MaterialState.SOLID, TextureSets.REFINED.get(), new short[] {50, 50, 50, 2}, INSTANCE.TUNGSTEN.getMeltingPointC()+6500, INSTANCE.TUNGSTEN.getBoilingPointC()+7500, 160, 101, true, "✦◆✦", 0);//Not a GT Inherited Material - public static final Material ASTRAL_TITANIUM = new Material("Astral Titanium", MaterialState.SOLID, TextureSets.REFINED.get(), new short[] {220, 160, 240, 2}, INSTANCE.TITANIUM.getMeltingPointC()+7500, INSTANCE.TITANIUM.getBoilingPointC()+7500, 145, 133, true, "✧◇✧", 0);//Not a GT Inherited Material - public static final Material CHRONOMATIC_GLASS = new Material("Chromatic Glass", MaterialState.SOLID, new short[]{255, 255, 255, 3}, 9200, 17550, 40, 51, false, "⌘☯𓍰 𓍱 𓍲 𓍳 𓍴 𓍵 𓍶 𓍷 𓍸 ☯⌘ ", 0);//Not a GT Inherited Material - public static final Material ADVANCED_NITINOL = new Material("Advanced Nitinol", MaterialState.SOLID, TextureSets.ENRICHED.get(), ALLOY.NITINOL_60.getRGB(), 8400, 14377, 40, 51, true, "⚷⚙⚷ Ni4Ti6", 0);//Not a GT Inherited Material - public static final Material HYPOGEN = new Material("Hypogen", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{220, 120, 75, 2}, 12255, 19377, 240, 251, true, "Hy⚶", 0);//Not a GT Inherited Material - public static final Material RHUGNOR = new Material("Rhugnor", MaterialState.SOLID, TextureSets.ENRICHED.get(), new short[]{190, 0, 255, 0}, 8750, 14757, 184, 142, true, "Fs⚶", 0);//Not a GT Inherited Material //funeris - - - //Runescape materials - public static final Material BLACK_METAL = new Material("Black Metal", MaterialState.SOLID, TextureSet.SET_METALLIC, new short[] {5, 5, 5}, 2350, 4650, 24, 17, false, "҈", 0, new MaterialStack[]{new MaterialStack(getInstance().LEAD, 15), new MaterialStack(getInstance().MANGANESE, 25), new MaterialStack(getInstance().CARBON, 60)});//Not a GT Inherited Material - public static final Material WHITE_METAL = new Material("White Metal", MaterialState.SOLID, TextureSet.SET_METALLIC, new short[] {255, 255, 255}, 4560, 7580, 35, 41, false, "҉", 0, new MaterialStack[]{new MaterialStack(getInstance().COPPER, 5), new MaterialStack(getInstance().ANTIMONY, 10), new MaterialStack(getInstance().PLATINUM, 10), new MaterialStack(getInstance().TIN, 75)});//Not a GT Inherited Material - - public static final Material GRANITE = new Material( - "Ancient Granite", - MaterialState.SOLID, - TextureSet.SET_SAND, - new short[] {107, 107, 107}, - 500, - 2000, - 16, - 12, - false, - "«»", - 0, - false, - new MaterialStack[]{ - new MaterialStack(getInstance().OXYGEN, 30), - new MaterialStack(getInstance().IRON, 20), - new MaterialStack(getInstance().SILICONDIOXIDE, 20), - new MaterialStack(getInstance().ALUMINIUMOXIDE, 10), - new MaterialStack(getInstance().POTASSIUM, 10), - new MaterialStack(getInstance().CALCIUM, 5), - new MaterialStack(getInstance().SODIUM, 5) - });//Not a GT Inherited Material - - public static final Material RUNITE = new Material("Runite", MaterialState.SOLID, TextureSet.SET_FINE, new short[] {60, 200, 190}, 6750, 11550, 73, 87, true, "§", 0);//Not a GT Inherited Material - public static final Material DRAGON_METAL = new Material("Dragonblood", MaterialState.SOLID, TextureSet.SET_SHINY, new short[] {220, 40, 20, 2}, 10160, 17850, 96, 105, true, "۞", 0);//Not a GT Inherited Material - - } - - -} diff --git a/src/Java/gtPlusPlus/core/material/Ion.java b/src/Java/gtPlusPlus/core/material/Ion.java deleted file mode 100644 index 2b5b113b92..0000000000 --- a/src/Java/gtPlusPlus/core/material/Ion.java +++ /dev/null @@ -1,30 +0,0 @@ -package gtPlusPlus.core.material; - -public class Ion { - - private final Material mElement; - private final boolean mContainsPositiveCharge; - private final int mTotalIonization; - - public Ion(Material aMat, int chargeAmount) { - mElement = aMat; - mContainsPositiveCharge = (chargeAmount >= 0); - mTotalIonization = chargeAmount; - } - - public synchronized final Material getElement() { - return mElement; - } - - public synchronized final boolean containsPositiveCharge() { - return mContainsPositiveCharge; - } - - public synchronized final int getTotalIonization() { - return mTotalIonization; - } - - public final boolean isNeutral() { - return mTotalIonization == 0; - } -} diff --git a/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java b/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java deleted file mode 100644 index 19e8499f02..0000000000 --- a/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java +++ /dev/null @@ -1,308 +0,0 @@ -package gtPlusPlus.core.material; - -import gregtech.api.enums.Materials; -import gregtech.api.enums.TextureSet; -import gtPlusPlus.core.client.CustomTextureSet.TextureSets; -import gtPlusPlus.core.material.state.MaterialState; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; - -public final class MISC_MATERIALS { - - /* - * Some of these materials purely exist as data objects, items will most likely be assigned seperately. - * Most are just compositions which will have dusts assigned to them. - */ - - public static void run() { - MaterialUtils.generateSpecialDustAndAssignToAMaterial(STRONTIUM_OXIDE, false); - MaterialUtils.generateSpecialDustAndAssignToAMaterial(STRONTIUM_HYDROXIDE, false); - WATER.registerComponentForMaterial(FluidUtils.getWater(1000)); - } - - public static final Material STRONTIUM_OXIDE = new Material( - "Strontium Oxide", - MaterialState.SOLID, - TextureSet.SET_METALLIC, - null, - -1, - -1, - -1, - -1, - false, - "SrO", - 0, - false, - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().STRONTIUM, 1), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 1) - }); - - public static final Material SELENIUM_DIOXIDE = new Material( - "Selenium Dioxide", - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().SELENIUM, 1), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 2) - }); - - public static final Material SELENIOUS_ACID = new Material( - "Selenious Acid", - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(SELENIUM_DIOXIDE, 1), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 8), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 4) - }); - - public static final Material HYDROGEN_CYANIDE = new Material( - "Hydrogen Cyanide", - MaterialState.PURE_GAS, //State - null, //Material Colour - 4, //Melting Point in C - 26, //Boiling Point in C - -1, //Protons - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 1), - new MaterialStack(ELEMENT.getInstance().CARBON, 1), - new MaterialStack(ELEMENT.getInstance().NITROGEN, 1) - }); - - public static final Material CARBON_MONOXIDE = new Material( - "Carbon Monoxide", - MaterialState.PURE_GAS, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().CARBON, 1), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 1) - }); - - public static final Material CARBON_DIOXIDE = new Material( - "Carbon Dioxide", - MaterialState.PURE_GAS, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().CARBON, 1), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 2) - }); - - - /* - * Rare Earth Materials - */ - - public static final Material RARE_EARTH_LOW = new Material( - "Rare Earth (I)", //Material Name - MaterialState.ORE, //State - TextureSets.GEM_A.get(), //Texture Set - null, //Material Colour - 1200, - 2500, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ORES.GREENOCKITE, 1), - new MaterialStack(ORES.LANTHANITE_CE, 1), - new MaterialStack(ORES.AGARDITE_CD, 1), - new MaterialStack(ORES.YTTRIALITE, 1), - new MaterialStack(MaterialUtils.generateMaterialFromGtENUM(Materials.NetherQuartz), 1), - new MaterialStack(MaterialUtils.generateMaterialFromGtENUM(Materials.Galena), 1), - new MaterialStack(MaterialUtils.generateMaterialFromGtENUM(Materials.Chalcopyrite), 1), - new MaterialStack(ORES.CRYOLITE, 1), - new MaterialStack(ELEMENT.getInstance().YTTRIUM, 1) - }); - - public static final Material RARE_EARTH_MID = new Material( - "Rare Earth (II)", //Material Name - MaterialState.ORE, //State - TextureSets.ENRICHED.get(), //Texture Set - null, //Material Colour - 3500, - 5000, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ORES.LANTHANITE_ND, 1), - new MaterialStack(ORES.AGARDITE_ND, 1), - new MaterialStack(ORES.YTTRIAITE, 1), - new MaterialStack(ORES.CROCROITE, 1), - new MaterialStack(ORES.NICHROMITE, 1), - new MaterialStack(ORES.ZIRCON, 1), - new MaterialStack(ELEMENT.STANDALONE.GRANITE, 1), - new MaterialStack(ELEMENT.STANDALONE.BLACK_METAL, 1), - new MaterialStack(ELEMENT.STANDALONE.RUNITE, 1) - }); - - public static final Material RARE_EARTH_HIGH = new Material( - "Rare Earth (III)", //Material Name - MaterialState.ORE, //State - TextureSets.REFINED.get(), //Texture Set - null, //Material Colour - 5200, - 7500, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ORES.GADOLINITE_Y, 1), - new MaterialStack(ORES.LEPERSONNITE, 1), - new MaterialStack(ORES.FLORENCITE, 1), - new MaterialStack(ORES.FLUORCAPHITE, 1), - new MaterialStack(ORES.LAUTARITE, 1), - new MaterialStack(ORES.DEMICHELEITE_BR, 1), - new MaterialStack(ORES.ALBURNITE, 1), - new MaterialStack(ORES.SAMARSKITE_Y, 1), - new MaterialStack(ORES.AGARDITE_LA, 1), - }); - - public static final Material WATER = new Material( - "Water", - MaterialState.PURE_LIQUID, - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 2), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 1) - }); - - //OH - public static final Material HYDROXIDE = new Material( - "Hydroxide", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().OXYGEN, 1), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 1) - }); - - //NH3 - public static final Material AMMONIA = new Material( - "Ammonia", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -77, //Melting Point in C - -33, //Boiling Point in C - -1, //Protons - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().NITROGEN, 1), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 3) - }); - - //NH4 - public static final Material AMMONIUM = new Material( - "Ammonium", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().NITROGEN, 1), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 4) - }); - - - public static final Material HYDROGEN_CHLORIDE = new Material( - "Hydrogen Chloride", - MaterialState.PURE_GAS, - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 1), - new MaterialStack(ELEMENT.getInstance().CHLORINE, 1), - }); - - - public static final Material SODIUM_CHLORIDE = new Material( - "Sodium Chloride", - MaterialState.PURE_GAS, - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().SODIUM, 1), - new MaterialStack(ELEMENT.getInstance().CHLORINE, 1), - }); - - - public static final Material SODIUM_HYDROXIDE = new Material( - "Sodium Hydroxide", - MaterialState.PURE_GAS, - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().SODIUM, 1), - new MaterialStack(HYDROXIDE, 1), - }); - - public static final Material SALT_WATER = new Material( - "Salt Water", - MaterialState.PURE_LIQUID, - new MaterialStack[]{ - new MaterialStack(WATER, 3), - new MaterialStack(SODIUM_CHLORIDE, 1), - }); - - public static final Material BRINE = new Material( - "Brine", - MaterialState.PURE_LIQUID, - new MaterialStack[]{ - new MaterialStack(SALT_WATER, 1), - new MaterialStack(SODIUM_CHLORIDE, 2), - }); - - public static final Material STRONTIUM_HYDROXIDE = new Material( - "Strontium Hydroxide", - MaterialState.SOLID, - TextureSet.SET_METALLIC, - null, - -1, - -1, - -1, - -1, - false, - "Sr(OH)2", - 0, - false, - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().STRONTIUM, 1), - new MaterialStack(MISC_MATERIALS.HYDROXIDE, 2) - }); - - - -} diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java deleted file mode 100644 index 0e9eb9b376..0000000000 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ /dev/null @@ -1,1461 +0,0 @@ -package gtPlusPlus.core.material; - -import static gregtech.api.enums.GT_Values.M; -import static gtPlusPlus.core.util.math.MathUtils.safeCast_LongToInt; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.TextureSet; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.item.base.BaseItemComponent.ComponentTypes; -import gtPlusPlus.core.item.base.cell.BaseItemCell; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.state.MaterialState; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.data.StringUtils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.xmod.gregtech.api.enums.CustomOrePrefix; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.aspect.TC_Aspect_Wrapper; -import gtPlusPlus.xmod.tinkers.material.BaseTinkersMaterial; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -public class Material { - - public static final Set<Material> mMaterialMap = new HashSet<Material>(); - public static HashMap<String, Material> mMaterialCache = new HashMap<String, Material>(); - - public static final Map<String, Map<String, ItemStack>> mComponentMap = new HashMap<String, Map<String, ItemStack>>(); - - public static HashMap<String, String> sChemicalFormula = new HashMap<String, String>(); - - private String unlocalizedName; - private String localizedName; - - private MaterialState materialState; - private TextureSet textureSet; - - private Fluid mFluid; - private Fluid vPlasma; - - private boolean vGenerateCells; - - protected Object dataVar = MathUtils.generateSingularRandomHexValue(); - - private ArrayList<MaterialStack> vMaterialInput = new ArrayList<>(); - public long[] vSmallestRatio; - public short vComponentCount; - - private short[] RGBA; - - private boolean usesBlastFurnace; - public boolean isRadioactive; - public byte vRadiationLevel; - - private int meltingPointK; - private int boilingPointK; - private int meltingPointC; - private int boilingPointC; - private long vProtons; - private long vNeutrons; - private long vMass; - public int smallestStackSizeWhenProcessing; //Add a check for <=0 || > 64 - public int vTier; - public int vVoltageMultiplier; - public String vChemicalFormula; - public String vChemicalSymbol; - - public long vDurability; - public int vToolQuality; - public int vHarvestLevel; - - private TC_Aspect_Wrapper[] vAspects; - - public BaseTinkersMaterial vTiConHandler; - - - public static AutoMap<Materials> invalidMaterials = new AutoMap<Materials>(); - - - public Material(final String materialName, final MaterialState defaultState, final MaterialStack... inputs){ - this(materialName, defaultState, null, inputs); - } - - public Material(final String materialName, final MaterialState defaultState, final short[] rgba, final MaterialStack... inputs){ - this(materialName, defaultState, null, 0, rgba, -1, -1, -1, -1, false, "", 0, false, false, inputs); - } - - public Material(final String materialName, final MaterialState defaultState, final short[] rgba, int radiationLevel, MaterialStack... materialStacks) { - this(materialName, defaultState, null, 0, rgba, -1, -1, -1, -1, false, "", radiationLevel, false, materialStacks); - } - - public Material(String materialName, MaterialState defaultState, short[] rgba, int j, int k, int l, int m, int radiationLevel, MaterialStack[] materialStacks){ - this(materialName, defaultState, null, 0, rgba, j, k, l, m, false, "", radiationLevel, false, materialStacks); - } - - public Material(String materialName, MaterialState defaultState, final TextureSet set, short[] rgba, int meltingPoint, int boilingPoint, int protons, int neutrons, int radiationLevel, MaterialStack[] materialStacks){ - this(materialName, defaultState, set, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, false, "", radiationLevel, false, materialStacks); - } - - public Material(final String materialName, final MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final MaterialStack... inputs){ - this(materialName, defaultState, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, "", 0, inputs); - } - - public Material(final String materialName, final MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemSymbol, final MaterialStack... inputs){ - this(materialName, defaultState, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, chemSymbol, 0, inputs); - } - - public Material(final String materialName, final MaterialState defaultState, final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, boolean generateCells, final MaterialStack... inputs){ - this(materialName, defaultState, null, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, "", 0, generateCells, true, inputs); - } - - public Material(final String materialName, final MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final int radiationLevel, final MaterialStack... inputs){ - this(materialName, defaultState, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, "", radiationLevel, inputs); - } - - public Material(final String materialName, final MaterialState defaultState,final long durability, final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final int radiationLevel, final MaterialStack... inputs){ - this(materialName, defaultState, durability, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, "", radiationLevel, inputs); - } - - public Material(final String materialName, final MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, final MaterialStack... inputs){ - this(materialName, defaultState, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, chemicalSymbol, radiationLevel, inputs); - } - - public Material(final String materialName, final MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, boolean addCells,final MaterialStack... inputs) { - this (materialName, defaultState, null, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, chemicalSymbol, radiationLevel, addCells, true, inputs); - } - - public Material(final String materialName, final MaterialState defaultState, TextureSet textureSet,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, final MaterialStack... inputs){ - this (materialName, defaultState, textureSet, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, chemicalSymbol, radiationLevel, true, true, inputs); - } - - public Material(final String materialName, final MaterialState defaultState, TextureSet textureSet,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, boolean addCells,final MaterialStack... inputs) { - this (materialName, defaultState, textureSet, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, chemicalSymbol, radiationLevel, addCells, true, inputs); - } - - private Material(final String materialName, final MaterialState defaultState, final long durability, final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, final MaterialStack... inputs){ - this (materialName, defaultState, null, durability, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, chemicalSymbol, radiationLevel, true, true, inputs); - } - - public Material(final String materialName, final MaterialState defaultState, final TextureSet set, final long durability, final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, boolean generateCells, final MaterialStack... inputs){ - this (materialName, defaultState, set, durability, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, chemicalSymbol, radiationLevel, true, true, inputs); - } - - public Material(final String materialName, final MaterialState defaultState, final TextureSet set, final long durability, short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, String chemicalSymbol, final int radiationLevel, boolean generateCells, boolean generateFluid, final MaterialStack... inputs){ - - if (mMaterialMap.add(this)) { - - } - - if (defaultState == MaterialState.ORE) { - rgba = null; - } - - mComponentMap.put(unlocalizedName, new HashMap<String, ItemStack>()); - - try { - this.unlocalizedName = Utils.sanitizeString(materialName); - this.localizedName = materialName; - mMaterialCache.put(getLocalizedName().toLowerCase(), this); - Logger.INFO("Stored "+getLocalizedName()+" to cache with key: "+getLocalizedName().toLowerCase()); - - this.materialState = defaultState; - - Logger.MATERIALS(this.getLocalizedName()+" is "+defaultState.name()+"."); - - this.vGenerateCells = generateCells; - - //Add Components to an array. - if (inputs == null){ - this.vMaterialInput = null; - } - else { - if (inputs.length != 0){ - for (int i=0; i < inputs.length; i++){ - if (inputs[i] != null){ - this.vMaterialInput.add(i, inputs[i]); - } - } - } - } - - //set RGB - - if (rgba == null) { - if (vMaterialInput.size() > 0) { - - try { - Short[] mMixedRGB = new Short[3]; - AutoMap<Material> mMaterialSet = MaterialUtils.getCompoundMaterialsRecursively(this); - for (int mnh = 0; mnh < 3; mnh++) { - AutoMap<Short> aDataSet = new AutoMap<Short>(); - Set<Material> set4 = new HashSet<Material>(); - for (Material u : mMaterialSet) { - //if (u.getState() == MaterialState.ORE || u.getState() == MaterialState.SOLID) - set4.add(u); - } - for(Material e : set4){ - aDataSet.put(e.getRGB()[mnh]); - } - - Short aAverage = MathUtils.getShortAverage(aDataSet); - if (aAverage > Short.MAX_VALUE || aAverage < Short.MIN_VALUE || aAverage < 0 || aAverage > 255) { - if (aAverage > 255) { - while (aAverage > 255) { - aAverage = (short) (aAverage/2); - } - } - aAverage = (short) Math.max(Math.min(aAverage, 255), 0); - } - mMixedRGB[mnh] = aAverage; - } - - if (mMixedRGB != null && mMixedRGB[0] != null && mMixedRGB[1] != null && mMixedRGB[2] != null) { - this.RGBA = new short[] {mMixedRGB[0], mMixedRGB[1], mMixedRGB[2], 0}; - } - else { - this.RGBA = Materials.Steel.mRGBa; - } - } - catch (Throwable t) { - t.printStackTrace(); - this.RGBA = Materials.Steel.mRGBa; - } - } - else { - //Boring Grey Material - - int aValueForGen = this.getUnlocalizedName().hashCode(); - int hashSize = MathUtils.howManyPlaces(aValueForGen); - - String a = String.valueOf(aValueForGen); - String b = ""; - - if (hashSize < 9) { - int aSecondHash = this.materialState.hashCode(); - int hashSize2 = MathUtils.howManyPlaces(aSecondHash); - if (hashSize2 + hashSize >= 9) { - b = String.valueOf(aValueForGen); - } - else { - String c = b; - while (MathUtils.howManyPlaces(hashSize + c.length()) < 9) { - c = c + c.hashCode(); - } - b = c; - } - } - - String valueR; - if (b != null) { - valueR = a+b; - } - else { - valueR = a; - } - short fc[] = new short[3]; - int aIndex = 0; - for (char gg : valueR.toCharArray()) { - short ui = Short.parseShort(""+gg); - if (ui > 255 || ui < 0) { - if (ui > 255) { - while (ui > 255) { - ui = (short) (ui / 2); - } - } - else { - ui = 0; - } - } - fc[aIndex++] = ui; - - } - this.RGBA = fc; - } - } - else { - this.RGBA = rgba; - } - - //Set Melting/Boiling point, if value is -1 calculate it from compound inputs. - if (meltingPoint != -1){ - this.meltingPointC = meltingPoint; - } - else { - this.meltingPointC = this.calculateMeltingPoint(); - } - if (boilingPoint != -1){ - if (boilingPoint != 0){ - this.boilingPointC = boilingPoint; - } - else { - this.boilingPointC = meltingPoint*4; - } - } - else { - this.boilingPointC = this.calculateBoilingPoint(); - } - - this.meltingPointK = (int) MathUtils.celsiusToKelvin(this.meltingPointC); - this.boilingPointK = (int) MathUtils.celsiusToKelvin(this.boilingPointC); - - //Set Proton/Neutron count, if value is -1 calculate it from compound inputs. - if (protons != -1){ - this.vProtons = protons; - } - else { - this.vProtons = this.calculateProtons(); - } - if (boilingPoint != -1){ - this.vNeutrons = neutrons; - } - else { - this.vNeutrons = this.calculateNeutrons(); - } - - - this.vAspects = null; - - - this.vMass = this.getMass(); - - //Sets tool Durability - if (durability != 0){ - this.vDurability = durability; - } - else { - long aTempDura = 0; - for (MaterialStack g : this.getComposites()) { - if (g != null) { - aTempDura += safeCast_LongToInt(g.getStackMaterial().getMass() * 2000); - } - } - this.vDurability = aTempDura > 0 ? aTempDura : (this.getComposites().isEmpty() ? 51200 : 32000 * this.getComposites().size()); - } - - if ((this.vDurability >= 0) && (this.vDurability < 64000)){ - this.vToolQuality = 1; - this.vHarvestLevel = 2; - } - else if ((this.vDurability >= 64000) && (this.vDurability < 128000)){ - this.vToolQuality = 2; - this.vHarvestLevel = 2; - } - else if ((this.vDurability >= 128000) && (this.vDurability < 256000)){ - this.vToolQuality = 3; - this.vHarvestLevel = 2; - } - else if ((this.vDurability >= 256000) && (this.vDurability < 512000)){ - this.vToolQuality = 3; - this.vHarvestLevel = 3; - } - else if ((this.vDurability >= 512000) && (this.vDurability <= Integer.MAX_VALUE)){ - this.vToolQuality = 4; - this.vHarvestLevel = 4; - } - else { - this.vToolQuality = 1; - this.vHarvestLevel = 1; - } - - //Sets the Rad level - if (radiationLevel > 0){ - Logger.MATERIALS(this.getLocalizedName()+" is radioactive. Level: "+radiationLevel+"."); - this.isRadioactive = true; - this.vRadiationLevel = (byte) radiationLevel; - } - else { - if (vMaterialInput.size() > 0) { - AutoMap<Byte> aDataSet = new AutoMap<Byte>(); - for (MaterialStack m : this.vMaterialInput) { - aDataSet.put(m.getStackMaterial().vRadiationLevel); - } - byte aAverage = MathUtils.getByteAverage(aDataSet); - if (aAverage > 0) { - Logger.MATERIALS(this.getLocalizedName()+" is radioactive due to trace elements. Level: "+aAverage+"."); - this.isRadioactive = true; - this.vRadiationLevel = (byte) aAverage; - } - else { - Logger.MATERIALS(this.getLocalizedName()+" is not radioactive."); - this.isRadioactive = false; - this.vRadiationLevel = 0; - } - } - else { - Logger.MATERIALS(this.getLocalizedName()+" is not radioactive."); - this.isRadioactive = false; - this.vRadiationLevel = 0; - } - } - - /*if (vMaterialInput.size() > 0) { - AutoMap<Integer> aDataSet = new AutoMap<Integer>(); - - int bonus = 0; - bonus += this.vMaterialInput.size(); - bonus += MathUtils.roundToClosestInt(meltingPointC/1000); - - - - aDataSet.put(bonus); - - for (MaterialStack m : this.vMaterialInput) { - aDataSet.put(m.getStackMaterial().vTier); - } - int aAverage = MathUtils.getIntAverage(aDataSet); - if (aAverage > Integer.MAX_VALUE || aAverage < Integer.MIN_VALUE) { - aAverage = 0; - } - if (aAverage > 0) { - this.vTier = Math.min(aAverage, 10); - } - else { - this.vTier = MaterialUtils.getTierOfMaterial((int) MathUtils.celsiusToKelvin(meltingPoint)); - } - } - else { - this.vTier = MaterialUtils.getTierOfMaterial((int) MathUtils.celsiusToKelvin(meltingPoint)); - }*/ - this.vTier = MaterialUtils.getTierOfMaterial(meltingPoint); - - - //Sets the materials 'tier'. Will probably replace this logic. - - this.usesBlastFurnace = blastFurnace; - this.vVoltageMultiplier = MaterialUtils.getVoltageForTier(vTier); - - this.vComponentCount = this.getComponentCount(inputs); - this.vSmallestRatio = this.getSmallestRatio(this.vMaterialInput); - int tempSmallestSize = 0; - - if (this.vSmallestRatio != null){ - for (int v=0;v<this.vSmallestRatio.length;v++){ - tempSmallestSize=(int) (tempSmallestSize+this.vSmallestRatio[v]); - } - this.smallestStackSizeWhenProcessing = tempSmallestSize; //Valid stacksizes - } - else { - this.smallestStackSizeWhenProcessing = 1; //Valid stacksizes - } - - - //Makes a Fancy Chemical Tooltip - - if (chemicalSymbol == null) { - chemicalSymbol = ""; - } - - this.vChemicalSymbol = chemicalSymbol; - if (this.vMaterialInput != null){ - this.vChemicalFormula = this.getToolTip(chemicalSymbol, OrePrefixes.dust.mMaterialAmount / M, true); - } - else if (!this.vChemicalSymbol.equals("")){ - Logger.MATERIALS("materialInput is null, using a valid chemical symbol."); - this.vChemicalFormula = this.vChemicalSymbol; - } - else{ - Logger.MATERIALS("MaterialInput == null && chemicalSymbol probably equals nothing"); - this.vChemicalSymbol = "??"; - this.vChemicalFormula = "??"; - } - - if (generateFluid){ - final Materials aGregtechMaterial = tryFindGregtechMaterialEquivalent(); - FluidStack aTest = FluidUtils.getWildcardFluidStack(localizedName, 1); - if (aTest != null){ - this.mFluid = aTest.getFluid(); - checkForCellAndGenerate(this); - } - else { - if (aGregtechMaterial != null && !MaterialUtils.isNullGregtechMaterial(aGregtechMaterial)){ - aTest = FluidUtils.getWildcardFluidStack(aGregtechMaterial, 1); - } - if (aTest != null){ - this.mFluid = aTest.getFluid(); - checkForCellAndGenerate(this); - } - else { - mFluid = generateFluid(); - } - } - this.vPlasma = this.generatePlasma(); - } - else { - this.mFluid = null; - this.vPlasma = null; - } - String ratio = ""; - if (this.vSmallestRatio != null) { - for (int hu=0;hu<this.vSmallestRatio.length;hu++){ - if (ratio.equals("")){ - ratio = String.valueOf(this.vSmallestRatio[hu]); - } - else { - ratio = ratio + ":" +this.vSmallestRatio[hu]; - } - } - } - - this.textureSet = setTextureSet(set, vTier); - - if (LoadedMods.TiCon && this.materialState == MaterialState.SOLID) { - if (this.getProtons() >= 98 || this.getComposites().size() > 1 || this.getMeltingPointC() >= 3600) { - this.vTiConHandler = new BaseTinkersMaterial(this); - } - } - - sChemicalFormula.put(materialName.toLowerCase(), this.vChemicalFormula); - Logger.MATERIALS("Creating a Material instance for "+materialName); - Logger.MATERIALS("Formula: "+this.vChemicalFormula + " Smallest Stack: "+this.smallestStackSizeWhenProcessing+" Smallest Ratio:"+ratio); - Logger.MATERIALS("Protons: "+this.vProtons); - Logger.MATERIALS("Neutrons: "+this.vNeutrons); - Logger.MATERIALS("Mass: "+this.vMass+"/units"); - Logger.MATERIALS("Melting Point: "+this.meltingPointC+"C."); - Logger.MATERIALS("Boiling Point: "+this.boilingPointC+"C."); - } - catch (Throwable t){ - Logger.MATERIALS("Stack Trace for "+materialName); - t.printStackTrace(); - } - } - - private static void checkForCellAndGenerate(Material material) { - if (!material.vGenerateCells) { - return; - } - String aName = Utils.sanitizeString(material.unlocalizedName); - String aName2 = Utils.sanitizeString(material.unlocalizedName.toLowerCase()); - String aName3 = (material.localizedName == null) ? aName : material.localizedName; - ItemStack aTestCell1 = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+aName, 1); - ItemStack aTestCell2 = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+aName2, 1); - ItemStack aTestCell3 = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+aName3, 1); - if (aTestCell1 == null && aTestCell2 == null && aTestCell3 == null) { - Logger.INFO("Generating cell for "+ material.localizedName); - new BaseItemCell(material); - } - else { - if (aTestCell1 != null) { - Logger.INFO("Registering existing cell for "+ material.localizedName+", "+aName); - material.registerComponentForMaterial(OrePrefixes.cell, aTestCell1); - } - else if (aTestCell2 != null) { - Logger.INFO("Registering existing cell for "+ material.localizedName+", "+aName2); - material.registerComponentForMaterial(OrePrefixes.cell, aTestCell2); - } - else if (aTestCell3 != null) { - Logger.INFO("Registering existing cell for "+ material.localizedName+", "+aName3); - material.registerComponentForMaterial(OrePrefixes.cell, aTestCell3); - } - } - } - - public final TextureSet getTextureSet() { - synchronized(this) { - return textureSet; - } - } - - - public TextureSet setTextureSet(TextureSet set) { - return setTextureSet(set, vTier); - } - - public TextureSet setTextureSet(TextureSet set, int aTier) { - if (set != null) { - Logger.MATERIALS("Set textureset for "+this.localizedName+" to be "+set.mSetName+". This textureSet was supplied."); - return set; - } - - int aGem = 0; - int aShiny = 0; - TextureSet aSet = null; - - //Check Mixture Contents - for (MaterialStack m : this.getComposites()) { - - //Gems - if (m.getStackMaterial() == ELEMENT.getInstance().AER) { - aGem++; - } - else if (m.getStackMaterial() == ELEMENT.getInstance().AQUA) { - aGem++; - } - else if (m.getStackMaterial() == ELEMENT.getInstance().IGNIS) { - aGem++; - } - else if (m.getStackMaterial() == ELEMENT.getInstance().TERRA) { - aGem++; - } - else if (m.getStackMaterial() == ELEMENT.getInstance().MAGIC) { - aGem++; - } - //Shiny Materials - if (m.getStackMaterial() == ELEMENT.getInstance().GOLD) { - aShiny++; - } - else if (m.getStackMaterial() == ELEMENT.getInstance().SILVER) { - aShiny++; - } - else if (m.getStackMaterial() == ELEMENT.getInstance().PLATINUM) { - aShiny++; - } - else if (m.getStackMaterial() == ELEMENT.getInstance().AMERICIUM) { - aShiny++; - } - else if (m.getStackMaterial() == ELEMENT.getInstance().TITANIUM) { - aShiny++; - } - else if (m.getStackMaterial() == ELEMENT.getInstance().GERMANIUM) { - aShiny++; - } - else if (m.getStackMaterial() == ELEMENT.getInstance().GALLIUM) { - aShiny++; - } - else if (m.getStackMaterial() == ELEMENT.getInstance().MERCURY) { - aShiny++; - } - else if (m.getStackMaterial() == ELEMENT.getInstance().MAGIC) { - aShiny++; - } - else if (m.getStackMaterial() == ELEMENT.getInstance().SAMARIUM) { - aShiny++; - } - else if (m.getStackMaterial() == ELEMENT.getInstance().TANTALUM) { - aShiny++; - } - } - - if (aSet == null) { - if (aGem >= this.getComposites().size()/2) { - if (MathUtils.isNumberEven(aGem)) { - Logger.MATERIALS("Set textureset for "+this.localizedName+" to be "+TextureSet.SET_GEM_HORIZONTAL.mSetName+"."); - return TextureSet.SET_GEM_HORIZONTAL; - } - else { - Logger.MATERIALS("Set textureset for "+this.localizedName+" to be "+TextureSet.SET_GEM_VERTICAL.mSetName+"."); - return TextureSet.SET_GEM_VERTICAL; - } - } - } - - if (aSet == null) { - if (aShiny >= this.getComposites().size()/3) { - Logger.MATERIALS("Set textureset for "+this.localizedName+" to be "+TextureSet.SET_SHINY.mSetName+"."); - return TextureSet.SET_SHINY; - } - } - - // build hash table with count - AutoMap<Material> sets = new AutoMap<Material>(); - if (this.vMaterialInput != null) { - for (MaterialStack r : this.vMaterialInput) { - if (r.getStackMaterial().getTextureSet().mSetName.toLowerCase().contains("fluid")) { - sets.put(ELEMENT.getInstance().GOLD); - } - else { - sets.put(r.getStackMaterial()); - } - } - TextureSet mostUsedTypeTextureSet = MaterialUtils.getMostCommonTextureSet(new ArrayList<Material>(sets.values())); - if (mostUsedTypeTextureSet != null && mostUsedTypeTextureSet instanceof TextureSet) { - Logger.MATERIALS("Set textureset for "+this.localizedName+" to be "+mostUsedTypeTextureSet.mSetName+"."); - return mostUsedTypeTextureSet; - } - } - Logger.MATERIALS("Set textureset for "+this.localizedName+" to be "+Materials.Iron.mIconSet.mSetName+". [Fallback]"); - return Materials.Gold.mIconSet; - } - - public final String getLocalizedName(){ - if (this.localizedName != null) { - return this.localizedName; - } - return "ERROR BAD LOCALIZED NAME"; - } - - public final String getUnlocalizedName(){ - if (this.unlocalizedName != null) { - return this.unlocalizedName; - } - return "ERROR.BAD.UNLOCALIZED.NAME"; - } - - final public MaterialState getState(){ - return this.materialState; - } - - final public short[] getRGB(){ - if (this.RGBA != null) { - return this.RGBA; - } - return new short[] {255,0,0}; - } - - final public short[] getRGBA(){ - if (this.RGBA != null) { - if (this.RGBA.length == 4){ - return this.RGBA; - } - else { - return new short[]{this.RGBA[0], this.RGBA[1], this.RGBA[2], 0}; - } - } - return new short[] {255,0,0, 0}; - } - - final public int getRgbAsHex(){ - - final int returnValue = Utils.rgbtoHexValue(this.RGBA[0], this.RGBA[1], this.RGBA[2]); - if (returnValue == 0){ - return (int) this.dataVar; - } - return Utils.rgbtoHexValue(this.RGBA[0], this.RGBA[1], this.RGBA[2]); - } - - final public long getProtons() { - return this.vProtons; - } - - public final long getNeutrons() { - return this.vNeutrons; - } - - final public long getMass() { - return this.vProtons + this.vNeutrons; - } - - public final int getMeltingPointC() { - return this.meltingPointC; - } - - public final int getBoilingPointC() { - return this.boilingPointC; - } - - public final int getMeltingPointK() { - return this.meltingPointK; - } - - public final int getBoilingPointK() { - return this.boilingPointK; - } - - public final boolean requiresBlastFurnace(){ - return this.usesBlastFurnace; - } - - public final ItemStack getComponentByPrefix(OrePrefixes aPrefix, int stacksize) { - String aKey = aPrefix.name(); - Map<String, ItemStack> g = mComponentMap.get(this.unlocalizedName); - if (g == null) { - Map<String, ItemStack> aMap = new HashMap<String, ItemStack>(); - mComponentMap.put(unlocalizedName, aMap); - g = aMap; - } - ItemStack i = g.get(aKey); - if (i != null) { - return ItemUtils.getSimpleStack(i, stacksize); - } - else { - // Try get a GT Material - Materials Erf = MaterialUtils.getMaterial(this.unlocalizedName); - if (Erf != null && !MaterialUtils.isNullGregtechMaterial(Erf)) { - ItemStack Erg = ItemUtils.getOrePrefixStack(aPrefix, Erf, stacksize); - if (Erg != null && ItemUtils.checkForInvalidItems(Erg)) { - Logger.MATERIALS("Found \"" + aKey + this.unlocalizedName + "\" using backup GT Materials option."); - g.put(aKey, Erg); - mComponentMap.put(unlocalizedName, g); - return Erg; - } - else { - // Try get a molten cell - if (aPrefix == OrePrefixes.cell) { - Erg = ItemUtils.getOrePrefixStack(OrePrefixes.cellMolten, Erf, stacksize); - if (Erg != null && ItemUtils.checkForInvalidItems(Erg)) { - Logger.MATERIALS("Found \"" + OrePrefixes.cellMolten.name() + this.unlocalizedName + "\" using backup GT Materials option."); - g.put(aKey, Erg); - mComponentMap.put(unlocalizedName, g); - return Erg; - } - } - } - } else { - ItemStack u = ItemUtils.getItemStackOfAmountFromOreDictNoBroken(aKey + this.unlocalizedName, stacksize); - if (u != null) { - g.put(aKey, u); - mComponentMap.put(unlocalizedName, g); - return u; - } - } - //Logger.MATERIALS("Unabled to find \"" + aKey + this.unlocalizedName + "\""); - return ItemUtils.getErrorStack(stacksize, (aKey + this.unlocalizedName+" x"+stacksize)); - } - - } - - final public Block getBlock(){ - Block b = Block.getBlockFromItem(getBlock(1).getItem()); - if (b == null) { - Logger.INFO("[ERROR] Tried to get invalid block for "+this.getLocalizedName()+", returning debug block instead."); - } - return b != null ? b : Blocks.lit_furnace; - } - - public final ItemStack getBlock(final int stacksize){ - ItemStack i = getComponentByPrefix(OrePrefixes.block, stacksize); - return i != null ? i : ItemUtils.getItemStackOfAmountFromOreDictNoBroken("block"+this.unlocalizedName, stacksize); - } - - public final ItemStack getDust(final int stacksize){ - ItemStack i = getComponentByPrefix(OrePrefixes.dust, stacksize); - return i != null ? i : ItemUtils.getGregtechDust("dust"+this.unlocalizedName, stacksize); - } - - public final ItemStack getSmallDust(final int stacksize){ - return getComponentByPrefix(OrePrefixes.dustSmall, stacksize); - } - - public final ItemStack getTinyDust(final int stacksize){ - return getComponentByPrefix(OrePrefixes.dustTiny, stacksize); - } - - public final ItemStack getIngot(final int stacksize){ - return getComponentByPrefix(OrePrefixes.ingot, stacksize); - } - - public final ItemStack getHotIngot(final int stacksize){ - return getComponentByPrefix(OrePrefixes.ingotHot, stacksize); - } - - public final ItemStack getPlate(final int stacksize){ - return getComponentByPrefix(OrePrefixes.plate, stacksize); - } - - public final ItemStack getPlateDouble(final int stacksize){ - return getComponentByPrefix(OrePrefixes.plateDouble, stacksize); - } - - public final ItemStack getGear(final int stacksize){ - return getComponentByPrefix(OrePrefixes.gearGt, stacksize); - } - - public final ItemStack getRod(final int stacksize){ - return getComponentByPrefix(OrePrefixes.stick, stacksize); - } - - public final ItemStack getLongRod(final int stacksize){ - return getComponentByPrefix(OrePrefixes.stickLong, stacksize); - } - - public final ItemStack getBolt(final int stacksize){ - return getComponentByPrefix(OrePrefixes.bolt, stacksize); - } - - public final ItemStack getScrew(final int stacksize){ - return getComponentByPrefix(OrePrefixes.screw, stacksize); - } - - public final ItemStack getRing(final int stacksize){ - return getComponentByPrefix(OrePrefixes.ring, stacksize); - } - - public final ItemStack getRotor(final int stacksize){ - return getComponentByPrefix(OrePrefixes.rotor, stacksize); - } - - public final ItemStack getFrameBox(final int stacksize){ - return getComponentByPrefix(OrePrefixes.frameGt, stacksize); - } - - public final ItemStack getCell(final int stacksize){ - return getComponentByPrefix(OrePrefixes.cell, stacksize); - } - - public final ItemStack getPlasmaCell(final int stacksize){ - return getComponentByPrefix(OrePrefixes.cellPlasma, stacksize); - } - - public final ItemStack getNugget(final int stacksize){ - return getComponentByPrefix(OrePrefixes.nugget, stacksize); - } - - /** - * Ore Components - * @return - */ - - public final ItemStack getOre(final int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ore"+Utils.sanitizeString(this.getUnlocalizedName()), stacksize); - } - public final Block getOreBlock(final int stacksize){ - //Logger.DEBUG_MATERIALS("Trying to get ore block for "+this.getLocalizedName()+". Looking for '"+"ore"+Utils.sanitizeString(this.getUnlocalizedName())+"'."); - try{ - ItemStack a1 = getOre(1); - Item a2 = a1.getItem(); - Block a3 = Block.getBlockFromItem(a2); - if (a3 != null) { - return a3; - } - - Block x = Block.getBlockFromItem(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ore"+Utils.sanitizeString(this.unlocalizedName), stacksize).getItem()); - if (x != null){ - return x; - } - } - catch (Throwable t){ - //t.printStackTrace(); - } - //Logger.MATERIALS("Failed getting the Ore Block for "+this.getLocalizedName()+"."); - return Blocks.stone; - } - public final ItemStack getCrushed(final int stacksize){ - return getComponentByPrefix(OrePrefixes.crushed, stacksize); - } - public final ItemStack getCrushedPurified(final int stacksize){ - return getComponentByPrefix(OrePrefixes.crushedPurified, stacksize); - } - public final ItemStack getCrushedCentrifuged(final int stacksize){ - return getComponentByPrefix(OrePrefixes.crushedCentrifuged, stacksize); - } - public final ItemStack getDustPurified(final int stacksize){ - return getComponentByPrefix(OrePrefixes.dustPure, stacksize); - } - public final ItemStack getDustImpure(final int stacksize){ - return getComponentByPrefix(OrePrefixes.dustImpure, stacksize); - } - public final ItemStack getMilled(final int stacksize){ - return getComponentByPrefix(CustomOrePrefix.milled.get(), stacksize); - } - - public final boolean hasSolidForm() { - if (ItemUtils.checkForInvalidItems(new ItemStack[] {getDust(1), getBlock(1), getTinyDust(1), getSmallDust(1)})) { - return true; - } - return false; - } - - final public ItemStack[] getMaterialComposites(){ - if (this.vMaterialInput != null && !this.vMaterialInput.isEmpty()){ - final ItemStack[] temp = new ItemStack[this.vMaterialInput.size()]; - for (int i=0;i<this.vMaterialInput.size();i++){ - //Utils.LOG_MATERIALS("i:"+i); - ItemStack testNull = null; - try { - testNull = this.vMaterialInput.get(i).getValidStack(); - } catch (final Throwable r){ - Logger.MATERIALS("Failed gathering material stack for "+this.localizedName+"."); - Logger.MATERIALS("What Failed: Length:"+this.vMaterialInput.size()+" current:"+i); - } - try { - if (testNull != null){ - //Utils.LOG_MATERIALS("not null"); - temp[i] = this.vMaterialInput.get(i).getValidStack(); - } - } catch (final Throwable r){ - Logger.MATERIALS("Failed setting slot "+i+", using "+this.localizedName); - } - } - return temp; - } - return new ItemStack[]{}; - } - - public final ArrayList<MaterialStack> getComposites(){ - return this.vMaterialInput; - } - - final public int[] getMaterialCompositeStackSizes(){ - if (!this.vMaterialInput.isEmpty()){ - final int[] temp = new int[this.vMaterialInput.size()]; - for (int i=0;i<this.vMaterialInput.size();i++){ - if (this.vMaterialInput.get(i) != null) { - temp[i] = this.vMaterialInput.get(i).getDustStack().stackSize; - } else { - temp[i]=0; - } - } - return temp; - } - return new int[]{}; - } - - private final short getComponentCount(final MaterialStack[] inputs){ - - if (inputs == null || inputs.length < 1) { - return 1; - } - int counterTemp = 0; - for (final MaterialStack m : inputs){ - if (m.getStackMaterial() != null){ - counterTemp++; - } - } - if (counterTemp != 0){ - return (short) counterTemp; - } - else { - return 1; - } - } - - - public final long[] getSmallestRatio(final ArrayList<MaterialStack> tempInput){ - if (tempInput != null){ - if (!tempInput.isEmpty()){ - Logger.MATERIALS("length: "+tempInput.size()); - Logger.MATERIALS("(inputs != null): "+(tempInput != null)); - //Utils.LOG_MATERIALS("length: "+inputs.length); - final long[] tempRatio = new long[tempInput.size()]; - for (int x=0;x<tempInput.size();x++){ - //tempPercentage = tempPercentage+inputs[x].percentageToUse; - //this.mMaterialList.add(inputs[x]); - if (tempInput.get(x) != null){ - tempRatio[x] = tempInput.get(x).getPartsPerOneHundred(); - } - } - - final long[] smallestRatio = MathUtils.simplifyNumbersToSmallestForm(tempRatio); - - if (smallestRatio.length > 0){ - String tempRatioStringThing1 = ""; - for (int r=0;r<tempRatio.length;r++){ - tempRatioStringThing1 = tempRatioStringThing1 + tempRatio[r] +" : "; - } - Logger.MATERIALS("Default Ratio: "+tempRatioStringThing1); - - String tempRatioStringThing = ""; - int tempSmallestCraftingUseSize = 0; - for (int r=0;r<smallestRatio.length;r++){ - tempRatioStringThing = tempRatioStringThing + smallestRatio[r] +" : "; - tempSmallestCraftingUseSize = (int) (tempSmallestCraftingUseSize + smallestRatio[r]); - } - //this.smallestStackSizeWhenProcessing = tempSmallestCraftingUseSize; - Logger.MATERIALS("Smallest Ratio: "+tempRatioStringThing); - return smallestRatio; - } - } - } - return new long[] {}; - } - - public final String getToolTip(final String chemSymbol, final long aMultiplier, final boolean aShowQuestionMarks) { - if (!aShowQuestionMarks && (this.vChemicalFormula.equals("?")||this.vChemicalFormula.equals("??"))) { - return ""; - } - Logger.MATERIALS("===============| Calculating Atomic Formula for "+this.localizedName+" |==============="); - if (!chemSymbol.equals("")) { - return chemSymbol; - } - final ArrayList<MaterialStack> tempInput = this.vMaterialInput; - if (tempInput != null){ - if (!tempInput.isEmpty()){ - String dummyFormula = ""; - final long[] dummyFormulaArray = this.getSmallestRatio(tempInput); - if (dummyFormulaArray != null){ - if (dummyFormulaArray.length >= 1){ - for (int e=0;e<tempInput.size();e++){ - MaterialStack g = tempInput.get(e); - if (g != null){ - if (g.getStackMaterial() != null){ - - String aChemSymbol = g.getStackMaterial().vChemicalSymbol; - String aChemFormula = g.getStackMaterial().vChemicalFormula; - - if (aChemSymbol == null) { - aChemSymbol = "??"; - } - if (aChemFormula == null) { - aChemFormula = "??"; - } - - if (!aChemSymbol.equals("??")){ - if (dummyFormulaArray[e] > 1){ - - if (aChemFormula.length() > 3){ - dummyFormula = dummyFormula + "(" + aChemFormula + ")" + dummyFormulaArray[e]; - } - else { - dummyFormula = dummyFormula + aChemFormula + dummyFormulaArray[e]; - } - } - else if (dummyFormulaArray[e] == 1){ - if (aChemFormula.length() > 3){ - dummyFormula = dummyFormula + "(" +aChemFormula + ")"; - } - else { - dummyFormula = dummyFormula +aChemFormula; - } - } - else { - dummyFormula = dummyFormula + "??"; - } - } else { - dummyFormula = dummyFormula + "??"; - } - } else { - dummyFormula = dummyFormula + "??"; - } - } - } - return StringUtils.subscript(dummyFormula); - //return dummyFormula; - } - Logger.MATERIALS("dummyFormulaArray <= 0"); - } - Logger.MATERIALS("dummyFormulaArray == null"); - } - Logger.MATERIALS("tempInput.length <= 0"); - } - Logger.MATERIALS("tempInput == null"); - return "??"; - - } - - public final boolean queueFluidGeneration() { - return isFluidQueued = true; - } - - public final static void generateQueuedFluids() { - for (Material m : mMaterialMap) { - if (m.isFluidQueued) { - } - } - } - - //If we need a fluid, let's just queue it for later. - public boolean isFluidQueued = false; - - public final Fluid generateFluid(){ - if (this.materialState == MaterialState.ORE){ - return null; - } - - Fluid aGTBaseFluid = null; - - // Clean up Internal Fluid Generation - final Materials n1 = MaterialUtils.getMaterial(this.getLocalizedName(), Utils.sanitizeString(this.getLocalizedName())); - final Materials n2 = MaterialUtils.getMaterial(this.getUnlocalizedName(), Utils.sanitizeString(this.getUnlocalizedName())); - - FluidStack f1 = FluidUtils.getWildcardFluidStack(n1, 1); - FluidStack f2 = FluidUtils.getWildcardFluidStack(n2, 1); - FluidStack f3 = FluidUtils.getWildcardFluidStack(Utils.sanitizeString(this.getUnlocalizedName(), new char[] {'-', '_'}), 1); - FluidStack f4 = FluidUtils.getWildcardFluidStack(Utils.sanitizeString(this.getLocalizedName(), new char[] {'-', '_'}), 1); - - if (f1 != null) { - aGTBaseFluid = f1.getFluid(); - } - else if (f2 != null) { - aGTBaseFluid = f2.getFluid(); - } - else if (f3 != null) { - aGTBaseFluid = f3.getFluid(); - } - else if (f4 != null) { - aGTBaseFluid = f4.getFluid(); - } - - - ItemStack aFullCell = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1); - ItemStack aFullCell2 = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getLocalizedName(), 1); - ItemStack aFullCell3 = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+Utils.sanitizeString(this.getUnlocalizedName(), new char[] {'-', '_'}), 1); - ItemStack aFullCell4 = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+Utils.sanitizeString(this.getLocalizedName(), new char[] {'-', '_'}), 1); - - Logger.MATERIALS("Generating our own fluid."); - //Generate a Cell if we need to, but first validate all four searches are invalid - - if (!ItemUtils.checkForInvalidItems(new ItemStack[] {aFullCell, aFullCell2, aFullCell3, aFullCell4})){ - if (this.vGenerateCells){ - Item g = new BaseItemCell(this); - aFullCell = ItemUtils.getSimpleStack(g); - Logger.MATERIALS("Generated a cell for "+this.getUnlocalizedName()); - } - else { - Logger.MATERIALS("Did not generate a cell for "+this.getUnlocalizedName()); - } - } - else { - // One cell we searched for was valid, let's register it. - if (aFullCell != null) { - this.registerComponentForMaterial(ComponentTypes.CELL, aFullCell); - } - else if (aFullCell2 != null) { - this.registerComponentForMaterial(ComponentTypes.CELL, aFullCell2); - } - else if (aFullCell3 != null) { - this.registerComponentForMaterial(ComponentTypes.CELL, aFullCell3); - } - else if (aFullCell4 != null) { - this.registerComponentForMaterial(ComponentTypes.CELL, aFullCell4); - } - } - - // We found a GT fluid, let's use it. - // Good chance we registered the cell from this material too. - if (aGTBaseFluid != null) { - return aGTBaseFluid; - } - - // This fluid does not exist at all, time to generate it. - if (this.materialState == MaterialState.SOLID){ - return FluidUtils.addGTFluid( - this.getUnlocalizedName(), - "Molten "+this.getLocalizedName(), - this.RGBA, - 4, - this.getMeltingPointK(), - aFullCell, - ItemUtils.getEmptyCell(), - 1000, - this.vGenerateCells); - } - else if (this.materialState == MaterialState.LIQUID || this.materialState == MaterialState.PURE_LIQUID){ - return FluidUtils.addGTFluid( - this.getUnlocalizedName(), - this.getLocalizedName(), - this.RGBA, - 0, - this.getMeltingPointK(), - aFullCell, - ItemUtils.getEmptyCell(), - 1000, - this.vGenerateCells); - } - else if (this.materialState == MaterialState.GAS || this.materialState == MaterialState.PURE_GAS){ - return FluidUtils.generateGas(unlocalizedName, this.getLocalizedName(), getMeltingPointK(), getRGBA(), vGenerateCells); - /*return FluidUtils.addGTFluid( - this.getUnlocalizedName(), - this.getLocalizedName()+" Gas", - this.RGBA, - 2, - this.getMeltingPointK(), - aFullCell, - ItemUtils.getEmptyCell(), - 1000, - this.vGenerateCells);*/ - } - else { //Plasma - return this.generatePlasma(); - } - } - - public final Fluid generatePlasma(){ - if (this.materialState == MaterialState.ORE){ - return null; - } - final Materials isValid = tryFindGregtechMaterialEquivalent(); - - if (!this.vGenerateCells){ - return null; - } - if (isValid != null) { - for (Materials m : invalidMaterials.values()){ - if (isValid == m){ - return null; - } - } - if (isValid.mPlasma != null){ - Logger.MATERIALS("Using a pre-defined Plasma from GT."); - return isValid.mPlasma; - } - } - Logger.MATERIALS("Generating our own Plasma."); - return FluidUtils.addGTPlasma(this); - } - - - public Fluid getFluid() { - return mFluid; - } - - final public FluidStack getFluidStack(final int fluidAmount) { - if (this.mFluid == null){ - return null; - } - final FluidStack moltenFluid = new FluidStack(this.mFluid, fluidAmount); - return moltenFluid; - } - - final public boolean setFluid(Fluid aFluid) { - if (this.mFluid == null){ - this.mFluid = aFluid; - return true; - } - return false; - } - - - final public int calculateMeltingPoint(){ - try { - AutoMap<Integer> aDataSet = new AutoMap<Integer>(); - for (MaterialStack m : this.vMaterialInput) { - aDataSet.put(m.getStackMaterial().getMeltingPointC()); - } - long aAverage = MathUtils.getIntAverage(aDataSet); - return MathUtils.safeInt(aAverage); - } - catch (Throwable r){ - r.printStackTrace(); - return 500; - } - } - - final public int calculateBoilingPoint(){ - try { - - AutoMap<Integer> aDataSet = new AutoMap<Integer>(); - for (MaterialStack m : this.vMaterialInput) { - aDataSet.put(m.getStackMaterial().getBoilingPointC()); - } - long aAverage = MathUtils.getIntAverage(aDataSet); - return MathUtils.safeInt(aAverage); - } - catch (Throwable r){ - r.printStackTrace(); - return 2500; - } - } - - final public long calculateProtons(){ - try { - - AutoMap<Long> aDataSet = new AutoMap<Long>(); - for (MaterialStack m : this.vMaterialInput) { - aDataSet.put(m.getStackMaterial().getProtons()); - } - long aAverage = MathUtils.getLongAverage(aDataSet); - return MathUtils.safeInt(aAverage); - } - catch (Throwable r){ - r.printStackTrace(); - return 50; - } - } - - final public long calculateNeutrons(){ - try { - - AutoMap<Long> aDataSet = new AutoMap<Long>(); - for (MaterialStack m : this.vMaterialInput) { - aDataSet.put(m.getStackMaterial().getNeutrons()); - } - long aAverage = MathUtils.getLongAverage(aDataSet); - return MathUtils.safeInt(aAverage); - } - catch (Throwable r){ - r.printStackTrace(); - return 75; - } - } - - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (!Material.class.isInstance(obj)) { - return false; - } - Material aObj = (Material) obj; - if (aObj.unlocalizedName.equals(this.unlocalizedName)) { - if (aObj.localizedName.equals(this.localizedName)) { - return true; - } - } - return false; - } - - public boolean registerComponentForMaterial(FluidStack aStack) { - return registerComponentForMaterial(this, aStack); - } - - private static boolean registerComponentForMaterial(Material componentMaterial, FluidStack aStack) { - if (componentMaterial != null && aStack != null && componentMaterial.mFluid == null) { - componentMaterial.mFluid = aStack.getFluid(); - return true; - } - return false; - } - - public boolean registerComponentForMaterial(ComponentTypes aPrefix, ItemStack aStack) { - return registerComponentForMaterial(this, aPrefix.getGtOrePrefix(), aStack); - } - - public boolean registerComponentForMaterial(OrePrefixes aPrefix, ItemStack aStack) { - return registerComponentForMaterial(this, aPrefix, aStack); - } - - public static boolean registerComponentForMaterial(Material componentMaterial, ComponentTypes aPrefix, ItemStack aStack) { - return registerComponentForMaterial(componentMaterial, aPrefix.getGtOrePrefix(), aStack); - } - - public static boolean registerComponentForMaterial(Material componentMaterial, OrePrefixes aPrefix, ItemStack aStack) { - if (componentMaterial == null) { - return false; - } - //Register Component - Map<String, ItemStack> aMap = Material.mComponentMap.get(componentMaterial.getUnlocalizedName()); - if (aMap == null) { - aMap = new HashMap<String, ItemStack>(); - } - String aKey = aPrefix.name(); - ItemStack x = aMap.get(aKey); - if (x == null) { - aMap.put(aKey, aStack); - Logger.MATERIALS("Registering a material component. Item: ["+componentMaterial.getUnlocalizedName()+"] Map: ["+aKey+"]"); - Material.mComponentMap.put(componentMaterial.getUnlocalizedName(), aMap); - return true; - } - else { - //Bad - Logger.MATERIALS("Tried to double register a material component. "); - return false; - } - } - - public Materials tryFindGregtechMaterialEquivalent() { - return tryFindGregtechMaterialEquivalent(this); - } - - - public static Materials tryFindGregtechMaterialEquivalent(Material aMaterial) { - String aMaterialName = aMaterial.getLocalizedName(); - Materials aGregtechMaterial = Materials.get(aMaterialName); - if (aGregtechMaterial == null || MaterialUtils.isNullGregtechMaterial(aGregtechMaterial)) { - aMaterialName = aMaterialName.replace(" ", "_"); - aGregtechMaterial = Materials.get(aMaterialName); - if (aGregtechMaterial == null || MaterialUtils.isNullGregtechMaterial(aGregtechMaterial)) { - aMaterialName = aMaterialName.replace(" ", ""); - aGregtechMaterial = Materials.get(aMaterialName); - if (aGregtechMaterial == null || MaterialUtils.isNullGregtechMaterial(aGregtechMaterial)) { - return null; - } - else { - return aGregtechMaterial; - } - } - else { - return aGregtechMaterial; - } - } - else { - return aGregtechMaterial; - } - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java deleted file mode 100644 index d1ea784b81..0000000000 --- a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java +++ /dev/null @@ -1,464 +0,0 @@ -package gtPlusPlus.core.material; - -import java.util.Set; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.block.base.BasicBlock.BlockTypes; -import gtPlusPlus.core.block.base.BlockBaseModular; -import gtPlusPlus.core.block.base.BlockBaseOre; -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.item.base.BaseItemComponent.ComponentTypes; -import gtPlusPlus.core.item.base.bolts.BaseItemBolt; -import gtPlusPlus.core.item.base.dusts.BaseItemDust; -import gtPlusPlus.core.item.base.dusts.BaseItemDust.DustState; -import gtPlusPlus.core.item.base.gears.BaseItemGear; -import gtPlusPlus.core.item.base.ingots.BaseItemIngot; -import gtPlusPlus.core.item.base.ingots.BaseItemIngotHot; -import gtPlusPlus.core.item.base.nugget.BaseItemNugget; -import gtPlusPlus.core.item.base.ore.BaseItemCentrifugedCrushedOre; -import gtPlusPlus.core.item.base.ore.BaseItemCrushedOre; -import gtPlusPlus.core.item.base.ore.BaseItemImpureDust; -import gtPlusPlus.core.item.base.ore.BaseItemPurifiedCrushedOre; -import gtPlusPlus.core.item.base.ore.BaseItemPurifiedDust; -import gtPlusPlus.core.item.base.plates.BaseItemPlate; -import gtPlusPlus.core.item.base.plates.BaseItemPlateDouble; -import gtPlusPlus.core.item.base.rings.BaseItemRing; -import gtPlusPlus.core.item.base.rods.BaseItemRod; -import gtPlusPlus.core.item.base.rods.BaseItemRodLong; -import gtPlusPlus.core.item.base.rotors.BaseItemRotor; -import gtPlusPlus.core.item.base.screws.BaseItemScrew; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.nuclear.FLUORIDES; -import gtPlusPlus.core.material.state.MaterialState; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_AlloySmelter; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Assembler; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_BlastSmelter; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_DustGeneration; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Extruder; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_FluidCanning; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Fluids; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Fluorite; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_MaterialProcessing; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_MetalRecipe; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Ore; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Plasma; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Plates; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Recycling; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_ShapedCrafting; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -public class MaterialGenerator { - - public static final AutoMap<Set<RunnableWithInfo<Material>>> mRecipeMapsToGenerate = new AutoMap<Set<RunnableWithInfo<Material>>>(); - - @SuppressWarnings("unused") - private static volatile Item temp; - @SuppressWarnings("unused") - private static volatile Block tempBlock; - - - public static boolean addFluidExtractionRecipe(ItemStack aEmpty, ItemStack aRemains, FluidStack aFluid) { - return addFluidExtractionRecipe(aEmpty, aRemains, aFluid, null, null); - } - - /** - * Called Reflectively from CORE.RA.addFluidExtractionRecipe - * @param aSpecial - * @return - */ - public static boolean addFluidExtractionRecipe(ItemStack aEmpty, ItemStack aRemains, FluidStack aFluid, Integer aDuration, Integer aEU) { - RecipeGen_FluidCanning g = new RecipeGen_FluidCanning(true, aEmpty, aRemains, aFluid, aDuration, aEU); - if (g != null && g.valid()) { - //Logger.INFO("[FIND] Adding Extraction recipe for "+ItemUtils.getItemName(aEmpty)+", "+ItemUtils.getItemName(aRemains)+", "+ItemUtils.getFluidName(aFluid)); - return true; - } - Logger.INFO("[ERROR] FAILED adding Extraction recipe for "+ItemUtils.getItemName(aEmpty)+", "+ItemUtils.getItemName(aRemains)+", "+ItemUtils.getFluidName(aFluid)); - return false; - } - - - public static boolean addFluidCannerRecipe(ItemStack aEmpty, ItemStack aFullContainer, FluidStack aFluidIn, FluidStack rFluidOut) { - return addFluidCannerRecipe(aEmpty, aFullContainer, aFluidIn, rFluidOut, null, null); - } - /** - * Called Reflectively from CORE.RA.addFluidCannerRecipe - * @return - */ - public static boolean addFluidCannerRecipe(ItemStack aEmpty, ItemStack aFullContainer, FluidStack aFluidIn, FluidStack rFluidOut, Integer aTime, Integer aEu) { - /*GT_Recipe r = new Recipe_GT( - true, - new ItemStack[] {aEmpty}, - new ItemStack[] {aFullContainer}, - null, - new int[] {}, - new FluidStack[] {rFluidIn}, - new FluidStack[] {rFluidOut}, - 0, 0, 0);*/ - //new RecipeGen_FluidCanning(r, false); - RecipeGen_FluidCanning g = new RecipeGen_FluidCanning(false, aEmpty, aFullContainer, aFluidIn, null, null, 0); - if (g != null && g.valid()) { - return true; - } - return false; - } - - public static void generate(final Material matInfo){ - generate(matInfo, true); - } - - - public static void generate(final Material matInfo, final boolean generateEverything){ - generate(matInfo, generateEverything, true); - } - - public static boolean generate(final Material matInfo, final boolean generateEverything, final boolean generateBlastSmelterRecipes){ - try { - final String unlocalizedName = matInfo.getUnlocalizedName(); - final String materialName = matInfo.getLocalizedName(); - final short[] C = matInfo.getRGBA(); - final int Colour = Utils.rgbtoHexValue(C[0], C[1], C[2]); - final boolean hotIngot = matInfo.requiresBlastFurnace(); - int materialTier = matInfo.vTier; //TODO - - if ((materialTier > 10) || (materialTier <= 0)){ - materialTier = 2; - } - - int sRadiation = 0; - if (ItemUtils.isRadioactive(materialName) || (matInfo.vRadiationLevel != 0)){ - sRadiation = matInfo.vRadiationLevel; - } - - if (matInfo.getState() == MaterialState.SOLID){ - if (generateEverything == true){ - if (sRadiation >= 1){ - tempBlock = new BlockBaseModular(matInfo,BlockTypes.STANDARD); - temp = new BaseItemIngot(matInfo); - - temp = new BaseItemDust(matInfo); - temp = new BaseItemNugget(matInfo); - temp = new BaseItemPlate(matInfo); - temp = new BaseItemRod(matInfo); - temp = new BaseItemRodLong(matInfo); - } - - else { - tempBlock = new BlockBaseModular(matInfo,BlockTypes.STANDARD); - tempBlock = new BlockBaseModular(matInfo,BlockTypes.FRAME); - temp = new BaseItemIngot(matInfo); - if (hotIngot){ - temp = new BaseItemIngotHot(matInfo); - } - temp = new BaseItemDust(matInfo); - temp = new BaseItemNugget(matInfo); - temp = new BaseItemPlate(matInfo); - temp = new BaseItemPlateDouble(matInfo); - temp = new BaseItemBolt(matInfo); - temp = new BaseItemRod(matInfo); - temp = new BaseItemRodLong(matInfo); - temp = new BaseItemRing(matInfo); - temp = new BaseItemScrew(matInfo); - temp = new BaseItemRotor(matInfo); - temp = new BaseItemGear(matInfo); - } - } else { - tempBlock = new BlockBaseModular(matInfo,BlockTypes.STANDARD); - - temp = new BaseItemIngot(matInfo); - temp = new BaseItemDust(matInfo); - temp = new BaseItemNugget(matInfo); - temp = new BaseItemPlate(matInfo); - temp = new BaseItemPlateDouble(matInfo); - } - } - else if (matInfo.getState() == MaterialState.LIQUID){ - if (generateEverything == true){ - tempBlock = new BlockBaseModular(matInfo,BlockTypes.STANDARD); - } - temp = new BaseItemIngot(matInfo); - temp = new BaseItemDust(matInfo); - temp = new BaseItemNugget(matInfo); - temp = new BaseItemPlate(matInfo); - temp = new BaseItemPlateDouble(matInfo); - } - else if (matInfo.getState() == MaterialState.GAS){ - temp = new BaseItemDust(matInfo); - FluidUtils.generateGas(unlocalizedName, materialName, matInfo.getMeltingPointK(), C, true); - } - else if (matInfo.getState() == MaterialState.PURE_GAS){ - FluidUtils.generateGas(unlocalizedName, materialName, matInfo.getMeltingPointK(), C, true); - return true; - } - else if (matInfo.getState() == MaterialState.PURE_LIQUID){ - FluidUtils.generateFluidNoPrefix(unlocalizedName, materialName, matInfo.getMeltingPointK(), C); - return true; - } - else if (matInfo.getState() == MaterialState.ORE){ - - } - - //Add A jillion Recipes - old code - new RecipeGen_AlloySmelter(matInfo); - new RecipeGen_Assembler(matInfo); - if (generateBlastSmelterRecipes){ - new RecipeGen_BlastSmelter(matInfo); - } - new RecipeGen_MetalRecipe(matInfo); - new RecipeGen_Extruder(matInfo); - new RecipeGen_Fluids(matInfo); - new RecipeGen_Plates(matInfo); - new RecipeGen_ShapedCrafting(matInfo); - new RecipeGen_MaterialProcessing(matInfo); - - new RecipeGen_DustGeneration(matInfo); - new RecipeGen_Recycling(matInfo); - new RecipeGen_Plasma(matInfo); - - return true; - - } catch (final Throwable t) - - { - Logger.MATERIALS(""+matInfo.getLocalizedName()+" failed to generate."); - return false; - } - } - - public static void generateDusts(final Material matInfo){ - final String unlocalizedName = matInfo.getUnlocalizedName(); - final String materialName = matInfo.getLocalizedName(); - final short[] C = matInfo.getRGBA(); - final int Colour = Utils.rgbtoHexValue(C[0], C[1], C[2]); - int materialTier = matInfo.vTier; //TODO - - if ((materialTier > 10) || (materialTier <= 0)){ - materialTier = 2; - } - - int sRadiation = 0; - if (ItemUtils.isRadioactive(materialName) || (matInfo.vRadiationLevel != 0)){ - sRadiation = matInfo.vRadiationLevel; - } - - if (matInfo.getState() == MaterialState.SOLID){ - temp = new BaseItemDust(matInfo); - } - - //Add A jillion Recipes - old code - try { - RecipeGen_DustGeneration.addMixerRecipe_Standalone(matInfo); - new RecipeGen_Fluids(matInfo); - new RecipeGen_MaterialProcessing(matInfo); - } - catch (Throwable t) { - Logger.MATERIALS("Failed to generate some recipes for "+materialName); - Logger.ERROR("Failed to generate some recipes for "+materialName); - t.printStackTrace(); - } - //RecipeGen_Recycling.generateRecipes(matInfo); - } - - public static void generateNuclearMaterial(final Material matInfo){ - generateNuclearMaterial(matInfo, true); - } - - - public static void generateNuclearDusts(final Material matInfo){ - generateNuclearDusts(matInfo, true); - } - - public static void generateNuclearDusts(final Material matInfo, boolean generateDehydratorRecipe){ - generateNuclearMaterial(matInfo, false, true, false, false, true); - if (generateDehydratorRecipe && matInfo.getFluid() != null && matInfo.getDust(0) != null) { - CORE.RA.addDehydratorRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(20) - }, - matInfo.getFluidStack(144), - null, - new ItemStack[] { - matInfo.getDust(1), - }, - new int[] { 10000 }, - 10*(matInfo.vVoltageMultiplier/5), // Time in ticks - matInfo.vVoltageMultiplier); // EU - } - else { - Logger.INFO("Nuclear Dehydrator: Did not generate recipe for "+matInfo.getLocalizedName()+" | Null Fluid? "+(matInfo.getFluid() == null)+" | Null Dust? "+(matInfo.getDust(0) == null)); - } - } - - public static void generateNuclearMaterial(final Material matInfo, final boolean generatePlates){ - generateNuclearMaterial(matInfo, true, true, true, generatePlates, true); - } - - public static void generateNuclearMaterial(final Material matInfo, final boolean generateBlock, - final boolean generateDusts, final boolean generateIngot, final boolean generatePlates, final boolean disableOptionalRecipes){ - try { - - if (generateBlock) { - tempBlock = new BlockBaseModular(matInfo,BlockTypes.STANDARD); - } - if (generateDusts) { - temp = new BaseItemDust(matInfo); - } - if (generateIngot) { - temp = new BaseItemIngot(matInfo); - temp = new BaseItemNugget(matInfo); - } - - if (generatePlates) { - temp = new BaseItemPlate(matInfo); - temp = new BaseItemPlateDouble(matInfo); - new RecipeGen_Plates(matInfo); - new RecipeGen_Extruder(matInfo); - new RecipeGen_Assembler(matInfo); - } - - if (!disableOptionalRecipes) { - new RecipeGen_ShapedCrafting(matInfo); - new RecipeGen_Fluids(matInfo); - new RecipeGen_MaterialProcessing(matInfo); - new RecipeGen_Recycling(matInfo); - } - - new RecipeGen_MetalRecipe(matInfo); - new RecipeGen_DustGeneration(matInfo, disableOptionalRecipes); - new RecipeGen_Plasma(matInfo); - - } catch (final Throwable t){ - Logger.MATERIALS(""+matInfo.getLocalizedName()+" failed to generate."); - } - } - - - public static void generateOreMaterial(final Material matInfo){ - generateOreMaterial(matInfo, true, true, true, matInfo.getRGBA()); - } - - @SuppressWarnings("unused") - public static void generateOreMaterial(final Material matInfo, boolean generateOre, boolean generateDust, boolean generateSmallTinyDusts, short[] customRGB){ - try { - - if (matInfo == null){ - Logger.DEBUG_MATERIALS("Invalid Material while constructing null material."); - return; - } - - final String unlocalizedName = matInfo.getUnlocalizedName(); - final String materialName = matInfo.getLocalizedName(); - final short[] C = customRGB; - final Integer Colour = Utils.rgbtoHexValue(C[0], C[1], C[2]); - - - if (Colour == null){ - Logger.DEBUG_MATERIALS("Invalid Material while constructing "+materialName+"."); - return; - } - - int sRadiation = 0; - if (matInfo.vRadiationLevel > 0){ - sRadiation = matInfo.vRadiationLevel; - } - - if (generateOre) { - tempBlock = new BlockBaseOre(matInfo, BlockTypes.ORE, Colour.intValue()); - } - - DustState aState = new DustState(generateDust, generateSmallTinyDusts, generateSmallTinyDusts); - - if (!aState.generatesDust()) { - if (aState.generatesSmallDust()) { - temp = new BaseItemComponent(matInfo, ComponentTypes.DUSTSMALL); - } - if (aState.generatesTinyDust()) { - temp = new BaseItemComponent(matInfo, ComponentTypes.DUSTTINY); - } - } - else { - temp = new BaseItemDust(aState, matInfo); - } - - temp = new BaseItemCrushedOre(matInfo); - temp = new BaseItemCentrifugedCrushedOre(matInfo); - temp = new BaseItemPurifiedCrushedOre(matInfo); - temp = new BaseItemImpureDust(matInfo); - temp = new BaseItemPurifiedDust(matInfo); - - Logger.MATERIALS("Generated all ore components for "+matInfo.getLocalizedName()+", now generating processing recipes."); - - if (matInfo == FLUORIDES.FLUORITE){ - new RecipeGen_Fluorite(matInfo); - } - else { - new RecipeGen_Ore(matInfo); - } - - } catch (final Throwable t){ - Logger.MATERIALS("[Error] "+(matInfo != null ? matInfo.getLocalizedName() : "Null Material")+" failed to generate."); - t.printStackTrace(); - } - } - - public static boolean generateOreMaterialWithAllExcessComponents(final Material matInfo){ - try { - if (matInfo == null){ - Logger.DEBUG_MATERIALS("Invalid Material while constructing null material."); - return false; - } - final short[] C = matInfo.getRGBA(); - final Integer Colour = Utils.rgbtoHexValue(C[0], C[1], C[2]); - - tempBlock = new BlockBaseOre(matInfo, BlockTypes.ORE, Colour.intValue()); - tempBlock = new BlockBaseModular(matInfo,BlockTypes.STANDARD); - temp = new BaseItemIngot(matInfo); - temp = new BaseItemDust(matInfo); - temp = new BaseItemNugget(matInfo); - temp = new BaseItemPlate(matInfo); - temp = new BaseItemPlateDouble(matInfo); - - - temp = new BaseItemCrushedOre(matInfo); - temp = new BaseItemCentrifugedCrushedOre(matInfo); - temp = new BaseItemPurifiedCrushedOre(matInfo); - temp = new BaseItemImpureDust(matInfo); - temp = new BaseItemPurifiedDust(matInfo); - - Logger.MATERIALS("Generated all ore & base components for "+matInfo.getLocalizedName()+", now generating processing recipes."); - - new RecipeGen_Ore(matInfo, true); - new RecipeGen_AlloySmelter(matInfo); - new RecipeGen_Assembler(matInfo); - new RecipeGen_BlastSmelter(matInfo); - new RecipeGen_MetalRecipe(matInfo); - new RecipeGen_Extruder(matInfo); - new RecipeGen_Fluids(matInfo); - new RecipeGen_Plates(matInfo); - new RecipeGen_ShapedCrafting(matInfo); - new RecipeGen_MaterialProcessing(matInfo); - new RecipeGen_DustGeneration(matInfo); - new RecipeGen_Recycling(matInfo); - return true; - } - catch (final Throwable t){ - Logger.MATERIALS(""+matInfo.getLocalizedName()+" failed to generate."); - t.printStackTrace(); - return false; - } - - } - - -} diff --git a/src/Java/gtPlusPlus/core/material/MaterialStack.java b/src/Java/gtPlusPlus/core/material/MaterialStack.java deleted file mode 100644 index 63a9ccce9c..0000000000 --- a/src/Java/gtPlusPlus/core/material/MaterialStack.java +++ /dev/null @@ -1,109 +0,0 @@ -package gtPlusPlus.core.material; - -import java.math.BigDecimal; -import java.math.RoundingMode; - -import net.minecraft.item.ItemStack; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class MaterialStack { - - private final transient int[] vAmount; - private final Material stackMaterial; - private final double vPercentageToUse; - - public MaterialStack(final Material inputs, final double partOutOf100){ - this.stackMaterial = inputs; - //Logger.INFO("Tried getting MaterialStack for "+inputs.getLocalizedName()); - this.vPercentageToUse = partOutOf100; - this.vAmount = this.math(partOutOf100); - } - - private int[] math(final double val){ - double i; - //Cast to a BigDecimal to round it. - final BigDecimal bd = new BigDecimal(val).setScale(2, RoundingMode.HALF_EVEN); - i = bd.doubleValue(); - //Split the string into xx.xx - final String[] arr=String.valueOf(i).split("\\."); - final int[] intArr=new int[2]; - intArr[0]=Integer.parseInt(arr[0]); - intArr[1]=Integer.parseInt(arr[1]); - return intArr; - } - - public ItemStack getValidStack(){ - if (this.stackMaterial.getDust(1) == null){ - //if (this.stackMaterial.getCell(1) == null){ - return null; - //} - //return this.stackMaterial.getCell(this.vAmount[0]); - } - return this.stackMaterial.getDust(this.vAmount[0]); - } - - public ItemStack getDustStack(){ - return this.stackMaterial.getDust(this.vAmount[0]); - } - - public ItemStack getDustStack(final int amount){ - return this.stackMaterial.getDust(amount); - } - - public Material getStackMaterial(){ - if (this.stackMaterial == null){ - Logger.MATERIALS("Tried getStackMaterial, got an invalid material."); - Logger.MATERIALS(ReflectionUtils.getMethodName(0)); - Logger.MATERIALS(ReflectionUtils.getMethodName(1)); - Logger.MATERIALS(ReflectionUtils.getMethodName(2)); - Logger.MATERIALS(ReflectionUtils.getMethodName(3)); - return null; - } - return this.stackMaterial; - } - - public double getvPercentageToUse(){ - return this.vPercentageToUse; - } - - public long[] getSmallestStackSizes(){ - return this.stackMaterial.getSmallestRatio(this.stackMaterial.getComposites()); - } - - public int getPartsPerOneHundred(){ - if (this.vAmount != null){ - if ((this.vAmount[0] >= 1) && (this.vAmount[0] <= 100)){ - return this.vAmount[0]; - } - } - return 100; - } - public ItemStack getLeftOverStacksFromDecimalValue(){ - final int temp = this.vAmount[1]; - int getCount; - if ((temp >= 25) && (temp <=99)){ - getCount = temp/25; - return this.stackMaterial.getSmallDust(getCount); - } - else if ((temp >= 11) && (temp <= 24)){ - getCount = temp/11; - return this.stackMaterial.getTinyDust(getCount); - } - else { - return null; - } - } - - public ItemStack[] getValidItemStacks(){ - return ItemUtils.validItemsForOreDict(this.stackMaterial.getUnlocalizedName()); - } - - - - - - -} diff --git a/src/Java/gtPlusPlus/core/material/NONMATERIAL.java b/src/Java/gtPlusPlus/core/material/NONMATERIAL.java deleted file mode 100644 index 7ab72d50bc..0000000000 --- a/src/Java/gtPlusPlus/core/material/NONMATERIAL.java +++ /dev/null @@ -1,44 +0,0 @@ -package gtPlusPlus.core.material; - -import gregtech.api.enums.Materials; -import gregtech.api.enums.TextureSet; -import gtPlusPlus.core.util.minecraft.MaterialUtils; - -public class NONMATERIAL { - - //Soul Sand - public static final Material SOULSAND = MaterialUtils.generateMaterialFromGtENUM(Materials.SoulSand); - - //Redstone - public static final Material REDSTONE = MaterialUtils.generateMaterialFromGtENUM(Materials.Redstone); - - //Glowstone Dust - public static final Material GLOWSTONE = MaterialUtils.generateMaterialFromGtENUM(Materials.Glowstone); - - //Enderpearl - public static final Material ENDERPEARL = MaterialUtils.generateMaterialFromGtENUM(Materials.EnderPearl); - - //Raw Flesh - public static final Material MEAT = MaterialUtils.generateMaterialFromGtENUM(Materials.MeatRaw); - - //Clay - public static final Material CLAY = MaterialUtils.generateMaterialFromGtENUM(Materials.Clay); - - //Wrought Iron - public static final Material WROUGHT_IRON = MaterialUtils.generateMaterialFromGtENUM(Materials.WroughtIron); - - //PTFE - public static final Material PTFE = MaterialUtils.generateMaterialFromGtENUM(MaterialUtils.getMaterial("Polytetrafluoroethylene", "Plastic")); - - //Plastic - public static final Material PLASTIC = MaterialUtils.generateMaterialFromGtENUM(MaterialUtils.getMaterial("Plastic", "Rubber")); - - - static { - MEAT.setTextureSet(TextureSet.SET_ROUGH); - CLAY.setTextureSet(TextureSet.SET_ROUGH); - } - - - -} diff --git a/src/Java/gtPlusPlus/core/material/ORES.java b/src/Java/gtPlusPlus/core/material/ORES.java deleted file mode 100644 index 0186c23a07..0000000000 --- a/src/Java/gtPlusPlus/core/material/ORES.java +++ /dev/null @@ -1,849 +0,0 @@ -package gtPlusPlus.core.material; - -import gregtech.api.enums.TextureSet; -import gtPlusPlus.core.client.CustomTextureSet.TextureSets; -import gtPlusPlus.core.material.state.MaterialState; - -public final class ORES { - - public static final Material AGARDITE_CD = new Material( - "Agardite (Cd)", //Material Name - MaterialState.ORE, //State - TextureSet.SET_METALLIC, //Texture Set - new short[]{170, 188, 33, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{// (CdCa)Cu7(AsO2)4(O2H)5·3H2O - new MaterialStack(ELEMENT.getInstance().CADMIUM, 1), - new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), - new MaterialStack(ELEMENT.getInstance().COPPER, 7), - new MaterialStack(ELEMENT.getInstance().ARSENIC, 4), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 21), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 11) - }); - - public static final Material AGARDITE_LA = new Material( - "Agardite (La)", //Material Name - MaterialState.ORE, //State - TextureSet.SET_FINE, //Texture Set - new short[]{206, 232, 9, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{// (LaCa)Cu5(AsO6)2(OH)4·3H2O - new MaterialStack(ELEMENT.getInstance().LANTHANUM, 1), - new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), - new MaterialStack(ELEMENT.getInstance().COPPER, 5), - new MaterialStack(ELEMENT.getInstance().ARSENIC, 2), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 19), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 10) - }); - - public static final Material AGARDITE_ND = new Material( - "Agardite (Nd)", //Material Name - MaterialState.ORE, //State - TextureSet.SET_METALLIC, //Texture Set - new short[]{225, 244, 78, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{// (NdCa)Cu6(As3O3)2(O2H)6·3H2O - new MaterialStack(ELEMENT.getInstance().NEODYMIUM, 1), - new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), - new MaterialStack(ELEMENT.getInstance().COPPER, 6), - new MaterialStack(ELEMENT.getInstance().ARSENIC, 6), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 21), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 12) - }); - - public static final Material AGARDITE_Y = new Material( - "Agardite (Y)", //Material Name - MaterialState.ORE, //State - TextureSet.SET_METALLIC, //Texture Set - new short[]{210, 232, 44, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{// (YCa)Cu5(As2O4)3(OH)6·3H2O - new MaterialStack(ELEMENT.getInstance().YTTRIUM, 1), - new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), - new MaterialStack(ELEMENT.getInstance().COPPER, 5), - new MaterialStack(ELEMENT.getInstance().ARSENIC, 6), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 21), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 12) - }); - - //Alburnite - //Ag8GeTe2S4 - public static final Material ALBURNITE = new Material( - "Alburnite", //Material Name - MaterialState.ORE, //State - TextureSet.SET_METALLIC, //Texture Set - new short[]{16, 5, 105, 0}, //Material Colour - -1, - -1, - -1, - -1, - 0, //Radiation - new MaterialStack[]{// Na3AlF6 - new MaterialStack(ELEMENT.getInstance().GOLD, 8), - new MaterialStack(ELEMENT.getInstance().GERMANIUM, 1), - new MaterialStack(ELEMENT.getInstance().TELLURIUM, 2), - new MaterialStack(ELEMENT.getInstance().SULFUR, 4) - }); - - public static final Material CERITE = new Material( - "Cerite", //Material Name - MaterialState.ORE, //State - TextureSets.REFINED.get(), //Texture Set - new short[]{68, 13, 0, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{// (Ce,La,Ca)9(Mg,Fe+3)(SiO4)6(SiO3OH)(OH)3 - new MaterialStack(ELEMENT.getInstance().CERIUM, 9), - new MaterialStack(ELEMENT.getInstance().LANTHANUM, 9), - new MaterialStack(ELEMENT.getInstance().CALCIUM, 9), - new MaterialStack(ELEMENT.getInstance().MAGNESIUM, 3), - new MaterialStack(ELEMENT.getInstance().IRON, 3), - new MaterialStack(ELEMENT.getInstance().SILICON, 7), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 20), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 4) - }); - - //Comancheite - //Hg55N24(NH2,OH)4(Cl,Br)34 - public static final Material COMANCHEITE = new Material( - "Comancheite", //Material Name - MaterialState.ORE, //State - TextureSets.REFINED.get(), //Texture Set - new short[]{65, 205, 105, 0}, //Material Colour - -1, - -1, - -1, - -1, - 0, //Radiation - new MaterialStack[]{// Na3AlF6 - new MaterialStack(ELEMENT.getInstance().MERCURY, 54/4), - new MaterialStack(ELEMENT.getInstance().NITROGEN, 28/4), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 12/4), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 8/4), - new MaterialStack(ELEMENT.getInstance().CHLORINE, 34/4), - new MaterialStack(ELEMENT.getInstance().BROMINE, 34/4) - }); - - public static final Material CROCROITE = new Material( - "Crocoite", //Material Name - MaterialState.ORE, //State - TextureSet.SET_GEM_VERTICAL, //Texture Set - new short[]{255, 143, 84, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().LEAD, 2), - new MaterialStack(ELEMENT.getInstance().CHROMIUM, 2), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 3), - new MaterialStack(ELEMENT.getInstance().CAESIUM, 1), - }); - - public static final Material CRYOLITE = new Material( - "Cryolite (F)", //Material Name - MaterialState.ORE, //State - TextureSet.SET_SHINY, //Texture Set - new short[]{205, 205, 255, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{// Na3AlF6 - new MaterialStack(ELEMENT.getInstance().SODIUM, 3), - new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 6) - }); - - //Demicheleite-(Br) - // BiSBr - public static final Material DEMICHELEITE_BR = new Material( - "Demicheleite (Br)", //Material Name - MaterialState.ORE, //State - TextureSet.SET_SHINY, //Texture Set - new short[]{165, 75, 75, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{// Na3AlF6 - new MaterialStack(ELEMENT.getInstance().BISMUTH, 13), - new MaterialStack(ELEMENT.getInstance().SULFUR, 11), - new MaterialStack(ELEMENT.getInstance().BROMINE, 1) - }); - - public static final Material FLORENCITE = new Material( - "Florencite", //Material Name - MaterialState.ORE, //State - TextureSet.SET_METALLIC, //Texture Set - new short[]{249, 249, 124, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{// SmAl3(PO4)2(OH)6 - new MaterialStack(ELEMENT.getInstance().SAMARIUM, 1), - new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 3), - new MaterialStack(ELEMENT.getInstance().PHOSPHORUS, 1), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 10), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 6) - }); - - public static final Material FLUORCAPHITE = new Material( - "Fluorcaphite", //Material Name - MaterialState.ORE, //State - TextureSet.SET_FINE, //Texture Set - new short[]{255, 255, 30, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{// (Ca,Sr,Ce,Na)5(PO4)3F - new MaterialStack(ELEMENT.getInstance().CALCIUM, 5), - new MaterialStack(MISC_MATERIALS.STRONTIUM_OXIDE, 5), - new MaterialStack(ELEMENT.getInstance().CERIUM, 5), - new MaterialStack(ELEMENT.getInstance().SODIUM, 5), - new MaterialStack(ELEMENT.getInstance().PHOSPHORUS, 3), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 12), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 6), - }); - - //Gadolinite_Ce - public static final Material GADOLINITE_CE = new Material( - "Gadolinite (Ce)", //Material Name - MaterialState.ORE, //State - TextureSets.REFINED.get(), //Texture Set - new short[]{15, 159, 59, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().CERIUM, 4), - new MaterialStack(ELEMENT.getInstance().ERBIUM, 2), - new MaterialStack(ELEMENT.getInstance().LANTHANUM, 2), - new MaterialStack(ELEMENT.getInstance().NEODYMIUM, 2), - new MaterialStack(ELEMENT.getInstance().YTTRIUM, 2), - new MaterialStack(ELEMENT.getInstance().GADOLINIUM, 1), - new MaterialStack(ELEMENT.getInstance().BERYLLIUM, 2), - new MaterialStack(ELEMENT.getInstance().SILICON, 7), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 14), - }); - - //Gadolinite_Y - public static final Material GADOLINITE_Y = new Material( - "Gadolinite (Y)", //Material Name - MaterialState.ORE, //State - TextureSets.REFINED.get(), //Texture Set - new short[]{35, 189, 99, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().CERIUM, 2), - new MaterialStack(ELEMENT.getInstance().ERBIUM, 2), - new MaterialStack(ELEMENT.getInstance().LANTHANUM, 2), - new MaterialStack(ELEMENT.getInstance().NEODYMIUM, 2), - new MaterialStack(ELEMENT.getInstance().YTTRIUM, 4), - new MaterialStack(ELEMENT.getInstance().GADOLINIUM, 2), - new MaterialStack(ELEMENT.getInstance().BERYLLIUM, 3), - new MaterialStack(ELEMENT.getInstance().SILICON, 4), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 9), - }); - - public static final Material GEIKIELITE = new Material( - "Geikielite", //Material Name - MaterialState.ORE, //State - TextureSets.GEM_A.get(), //Texture Set - new short[]{187, 193, 204, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().MAGNESIUM, 1), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 1), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 3) - }); - - public static final Material GREENOCKITE = new Material( - "Greenockite", //Material Name - MaterialState.ORE, //State - TextureSets.GEM_A.get(), //Texture Set - new short[]{110, 193, 25, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().CADMIUM, 2), - new MaterialStack(ELEMENT.getInstance().SULFUR, 2), - }); - - public static final Material HIBONITE = new Material( - "Hibonite", //Material Name - MaterialState.ORE, //State - TextureSet.SET_METALLIC, //Texture Set - new short[]{58, 31, 0, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{// ((Ca,Ce)(Al,Ti,Mg)12O19) - new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), - new MaterialStack(ELEMENT.getInstance().CERIUM, 1), - new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 12), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 12), - new MaterialStack(ELEMENT.getInstance().MAGNESIUM, 12), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 19), - }); - - //Honeaite - //Au3TlTe2 - public static final Material HONEAITE = new Material( - "Honeaite", //Material Name - MaterialState.ORE, //State - TextureSet.SET_FINE, //Texture Set - new short[]{165, 165, 5, 0}, //Material Colour - -1, - -1, - -1, - -1, - 0, //Radiation - new MaterialStack[]{// Na3AlF6 - new MaterialStack(ELEMENT.getInstance().GOLD, 3), - new MaterialStack(ELEMENT.getInstance().THALLIUM, 1), - new MaterialStack(ELEMENT.getInstance().TELLURIUM, 2) - }); - - //Irarsite - //(Ir,Ru,Rh,Pt)AsS - public static final Material IRARSITE = new Material( - "Irarsite", //Material Name - MaterialState.ORE, //State - TextureSets.ENRICHED.get(), //Texture Set - new short[]{125, 105, 105, 0}, //Material Colour - -1, - -1, - -1, - -1, - 0, //Radiation - new MaterialStack[]{// Na3AlF6 - new MaterialStack(ELEMENT.getInstance().IRIDIUM, 1), - new MaterialStack(ELEMENT.getInstance().RUTHENIUM, 1), - new MaterialStack(ELEMENT.getInstance().RHODIUM, 1), - new MaterialStack(ELEMENT.getInstance().PLATINUM, 1), - new MaterialStack(ELEMENT.getInstance().ARSENIC, 1), - new MaterialStack(ELEMENT.getInstance().SULFUR, 1), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 1) - }); - - //Kashinite - //(Ir,Rh)2S3 - public static final Material KASHINITE = new Material( - "Kashinite", //Material Name - MaterialState.ORE, //State - TextureSet.SET_SHINY, //Texture Set - new short[]{75, 105, 75, 0}, //Material Colour - -1, - -1, - -1, - -1, - 0, //Radiation - new MaterialStack[]{// Na3AlF6 - new MaterialStack(ELEMENT.getInstance().IRIDIUM, 2), - new MaterialStack(ELEMENT.getInstance().RHODIUM, 2), - new MaterialStack(ELEMENT.getInstance().SULFUR, 3) - }); - - // Tl(Cl,Br) - public static final Material LAFOSSAITE = new Material( - "Lafossaite", //Material Name - MaterialState.ORE, //State - TextureSets.REFINED.get(), //Texture Set - new short[]{165, 105, 205, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{// Na3AlF6 - new MaterialStack(ELEMENT.getInstance().CHLORINE, 1), - new MaterialStack(ELEMENT.getInstance().BROMINE, 1), - new MaterialStack(ELEMENT.getInstance().THALLIUM, 1) - }); - - public static final Material LANTHANITE_CE = new Material( - "Lanthanite (Ce)", //Material Name - MaterialState.ORE, //State - TextureSet.SET_METALLIC, //Texture Set - new short[]{186, 113, 179, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{// (Ce)2(CO3)3·8(H2O) - new MaterialStack(ELEMENT.getInstance().CERIUM, 2), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 3), - new MaterialStack(ELEMENT.getInstance().CALCIUM, 3), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 2), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 1), - }); - - public static final Material LANTHANITE_LA = new Material( - "Lanthanite (La)", //Material Name - MaterialState.ORE, //State - TextureSets.REFINED.get(), //Texture Set - new short[]{219, 160, 214, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{// (La)2(CO3)3·8(H2O) - new MaterialStack(ELEMENT.getInstance().LANTHANUM, 2), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 3), - new MaterialStack(ELEMENT.getInstance().CALCIUM, 3), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 2), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 1), - }); - - public static final Material LANTHANITE_ND = new Material( - "Lanthanite (Nd)", //Material Name - MaterialState.ORE, //State - TextureSet.SET_METALLIC, //Texture Set - new short[]{153, 76, 145, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{// (Nd)2(CO3)3·8(H2O) - new MaterialStack(ELEMENT.getInstance().NEODYMIUM, 2), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 3), - new MaterialStack(ELEMENT.getInstance().CALCIUM, 3), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 2), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 1), - }); - - //Iodine Source - public static final Material LAUTARITE = new Material( - "Lautarite", //Material Name - MaterialState.ORE, //State - TextureSet.SET_FINE, //Texture Set - new short[]{165, 105, 205, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{// Na3AlF6 - new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), - new MaterialStack(ELEMENT.getInstance().IODINE, 2), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 6) - }); - - public static final Material LEPERSONNITE = new Material( - "Lepersonnite", //Material Name - MaterialState.ORE, //State - TextureSet.SET_EMERALD, //Texture Set - new short[]{175, 175, 20, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), - new MaterialStack(ELEMENT.getInstance().GADOLINIUM, 2), - new MaterialStack(ELEMENT.getInstance().DYSPROSIUM, 2), - new MaterialStack(ELEMENT.getInstance().URANIUM235, 2), - new MaterialStack(ELEMENT.getInstance().OXYGEN,32), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 24) - }); - - //Miessiite - //Pd11Te2Se2 - public static final Material MIESSIITE = new Material( - "Miessiite", //Material Name - MaterialState.ORE, //State - TextureSet.SET_FINE, //Texture Set - new short[]{75, 75, 75, 0}, //Material Colour - -1, - -1, - -1, - -1, - 0, //Radiation - new MaterialStack[]{// Na3AlF6 - new MaterialStack(ELEMENT.getInstance().PALLADIUM, 11), - new MaterialStack(ELEMENT.getInstance().TELLURIUM, 2), - new MaterialStack(ELEMENT.getInstance().SELENIUM, 2) - }); - - public static final Material NICHROMITE = new Material( - "Nichromite", //Material Name - MaterialState.ORE, //State - TextureSet.SET_METALLIC, //Texture Set - new short[]{22, 19, 19, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().NICKEL, 1), - new MaterialStack(ELEMENT.getInstance().COBALT, 1), - new MaterialStack(ELEMENT.getInstance().IRON, 3), - new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 2), - new MaterialStack(ELEMENT.getInstance().CHROMIUM, 2), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 8) - }); - - //Perroudite - //Hg5Ag4S5(I,Br)2Cl2 - public static final Material PERROUDITE = new Material( - "Perroudite", //Material Name - MaterialState.ORE, //State - TextureSet.SET_METALLIC, //Texture Set - new short[]{77, 165, 174, 0}, //Material Colour - -1, - -1, - -1, - -1, - 0, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().SULFUR, 5), - new MaterialStack(ELEMENT.getInstance().SILVER, 4), - new MaterialStack(ELEMENT.getInstance().IODINE, 2), - new MaterialStack(ELEMENT.getInstance().MERCURY, 5), - new MaterialStack(ELEMENT.getInstance().BROMINE, 2), - new MaterialStack(ELEMENT.getInstance().CHLORINE, 2) - }); - - public static final Material POLYCRASE = new Material( - "Polycrase", //Material Name - MaterialState.ORE, //State - TextureSet.SET_ROUGH, //Texture Set - new short[]{51, 0, 11, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().YTTRIUM, 1), - new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), - new MaterialStack(ELEMENT.getInstance().CERIUM, 1), - new MaterialStack(ELEMENT.getInstance().URANIUM235, 1), - new MaterialStack(ELEMENT.getInstance().THORIUM, 1), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 2), - new MaterialStack(ELEMENT.getInstance().NIOBIUM, 2), - new MaterialStack(ELEMENT.getInstance().TANTALUM, 2), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 6) - }); - - //Radiobarite - //Radium, Barium, Barite? - public static final Material RADIOBARITE = new Material( - "Barite (Rd)", //Material Name - MaterialState.ORE, //State - TextureSet.SET_FLINT, //Texture Set - new short[]{205, 205, 205, 0}, //Material Colour - -1, - -1, - -1, - -1, - 0, //Radiation - new MaterialStack[]{// Na3AlF6 - new MaterialStack(ELEMENT.getInstance().BARIUM, 32), - new MaterialStack(ELEMENT.getInstance().RADIUM, 1), - new MaterialStack(ELEMENT.getInstance().SULFUR, 16), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 15) - }); - - //Samarskite_Y - public static final Material SAMARSKITE_Y = new Material( - "Samarskite (Y)", //Material Name - MaterialState.ORE, //State - TextureSets.ENRICHED.get(), //Texture Set - new short[]{65, 163, 164, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().YTTRIUM, 2), //Y not YT/YB - new MaterialStack(ELEMENT.getInstance().IRON, 10), - new MaterialStack(ELEMENT.getInstance().URANIUM235, 2), - new MaterialStack(ELEMENT.getInstance().THORIUM, 3), - new MaterialStack(ELEMENT.getInstance().NIOBIUM, 2), - new MaterialStack(ELEMENT.getInstance().TANTALUM, 3) - }); - - //Samarskite_YB - public static final Material SAMARSKITE_YB = new Material( - "Samarskite (Yb)", //Material Name - MaterialState.ORE, //State - TextureSets.ENRICHED.get(), //Texture Set - new short[]{95, 193, 194, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().YTTERBIUM, 2), //Y not YT/YB - new MaterialStack(ELEMENT.getInstance().IRON, 9), - new MaterialStack(ELEMENT.getInstance().URANIUM235, 3), - new MaterialStack(ELEMENT.getInstance().THORIUM, 2), - new MaterialStack(ELEMENT.getInstance().NIOBIUM, 3), - new MaterialStack(ELEMENT.getInstance().TANTALUM, 2) - }); - - public static final Material TITANITE = new Material( - "Titanite", //Material Name - MaterialState.ORE, //State - TextureSet.SET_METALLIC, //Texture Set - new short[]{184, 198, 105, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().CALCIUM, 2), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 2), - new MaterialStack(ELEMENT.getInstance().SILICON, 2), - new MaterialStack(ELEMENT.getInstance().THORIUM, 1), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 10) - }); - - public static final Material XENOTIME = new Material( - "Xenotime", //Material Name - MaterialState.ORE, //State - TextureSet.SET_OPAL, //Texture Set - new short[]{235, 89, 199, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().YTTRIUM, 2), - new MaterialStack(ELEMENT.getInstance().YTTERBIUM, 2), - new MaterialStack(ELEMENT.getInstance().ERBIUM, 2), - new MaterialStack(ELEMENT.getInstance().EUROPIUM, 1), - new MaterialStack(ELEMENT.getInstance().PHOSPHORUS, 2), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 8) - }); - - public static final Material YTTRIAITE = new Material( //TODO - "Yttriaite", //Material Name - MaterialState.ORE, //State - TextureSet.SET_METALLIC, //Texture Set - new short[]{255, 143, 84, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().YTTRIUM, 1), //Y not YT/YB - new MaterialStack(ELEMENT.getInstance().OXYGEN, 3), - new MaterialStack(ELEMENT.getInstance().IRON, 4), - new MaterialStack(ELEMENT.getInstance().TIN, 1), - new MaterialStack(ELEMENT.getInstance().NITROGEN, 2) - }); - - public static final Material YTTRIALITE = new Material( - "Yttrialite", //Material Name - MaterialState.ORE, //State - TextureSet.SET_RUBY, //Texture Set - new short[]{35, 189, 99, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().YTTRIUM, 2), - new MaterialStack(ELEMENT.getInstance().THORIUM, 2), - new MaterialStack(ELEMENT.getInstance().SILICON, 2), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 7), - }); - - public static final Material YTTROCERITE = new Material( - "Yttrocerite", //Material Name - MaterialState.ORE, //State - TextureSet.SET_DIAMOND, //Texture Set - new short[]{35, 19, 199, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().CERIUM, 1), - new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 5), - new MaterialStack(ELEMENT.getInstance().YTTRIUM, 1), - }); - - public static final Material ZIMBABWEITE = new Material( - "Zimbabweite", //Material Name - MaterialState.ORE, //State - TextureSet.SET_FINE, //Texture Set - new short[]{193, 187, 131, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().CALCIUM, 2), - new MaterialStack(ELEMENT.getInstance().POTASSIUM, 2), - new MaterialStack(ELEMENT.getInstance().LEAD, 1), - new MaterialStack(ELEMENT.getInstance().ARSENIC, 4), - new MaterialStack(ELEMENT.getInstance().NIOBIUM, 4), - new MaterialStack(ELEMENT.getInstance().TANTALUM, 4), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 4), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 18) - }); - - public static final Material ZIRCON = new Material( - "Zircon", //Material Name - MaterialState.ORE, //State - TextureSets.GEM_A.get(), //Texture Set - new short[]{195, 19, 19, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().ZIRCONIUM, 1), - new MaterialStack(ELEMENT.getInstance().SILICON, 1), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 4), - }); - - public static final Material ZIRCONILITE = new Material( - "Zirconolite", //Material Name - MaterialState.ORE, //State - TextureSet.SET_FINE, //Texture Set - new short[]{45, 26, 0, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().CALCIUM, 2), - new MaterialStack(ELEMENT.getInstance().ZIRCONIUM, 2), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 4), - new MaterialStack(ELEMENT.getInstance().CERIUM, 1), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 14) - }); - - public static final Material ZIRCOPHYLLITE = new Material( - "Zircophyllite", //Material Name - MaterialState.ORE, //State - TextureSets.REFINED.get(), //Texture Set - new short[]{30, 0, 6, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().POTASSIUM, 3), - new MaterialStack(ELEMENT.getInstance().SODIUM, 3), - new MaterialStack(ELEMENT.getInstance().MANGANESE, 7), - new MaterialStack(ELEMENT.getInstance().IRON, 7), - new MaterialStack(ELEMENT.getInstance().ZIRCONIUM, 2), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 2), - new MaterialStack(ELEMENT.getInstance().NIOBIUM, 2), - new MaterialStack(ELEMENT.getInstance().SILICON, 8), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 13), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 7), - }); - - - public static final Material ZIRKELITE = new Material( - "Zirkelite", //Material Name - MaterialState.ORE, //State - TextureSets.GEM_A.get(), //Texture Set - new short[]{229, 208, 48, 0}, //Material Colour - -1, - -1, - -1, - -1, - -1, //Radiation - new MaterialStack[]{// (Ca,Th,Ce)Zr(Ti,Nb)2O7 - new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), - new MaterialStack(ELEMENT.getInstance().THORIUM, 1), - new MaterialStack(ELEMENT.getInstance().CERIUM, 1), - new MaterialStack(ELEMENT.getInstance().ZIRCONIUM, 1), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 2), - new MaterialStack(ELEMENT.getInstance().NIOBIUM, 2), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 7) - }); - - public static final Material DEEP_EARTH_REACTOR_FUEL_DEPOSIT = new Material( - "Radioactive Mineral Mix", //Material Name - MaterialState.ORE, //State - TextureSets.NUCLEAR.get(), //Texture Set - null, //Material Colour - -1, - -1, - -1, - -1, - 4, //Radiation - new MaterialStack[]{// Na3AlF6 - new MaterialStack(ELEMENT.getInstance().RADON, 2), - new MaterialStack(ELEMENT.getInstance().RADIUM, 1), - new MaterialStack(ELEMENT.getInstance().URANIUM235, 1), - new MaterialStack(ELEMENT.getInstance().URANIUM238, 10), - new MaterialStack(ELEMENT.getInstance().THORIUM, 25), - new MaterialStack(ELEMENT.getInstance().THORIUM232, 4), - new MaterialStack(FLUORCAPHITE, 6), - new MaterialStack(SAMARSKITE_Y, 8), - new MaterialStack(TITANITE, 4) - }); - - - - - -} diff --git a/src/Java/gtPlusPlus/core/material/Particle.java b/src/Java/gtPlusPlus/core/material/Particle.java deleted file mode 100644 index e93129ec58..0000000000 --- a/src/Java/gtPlusPlus/core/material/Particle.java +++ /dev/null @@ -1,153 +0,0 @@ -package gtPlusPlus.core.material; - -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.item.chemistry.IonParticles; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.item.ItemStack; - -public class Particle { - - public static final Particle GRAVITON; - - public static final Particle UP; - public static final Particle DOWN; - public static final Particle CHARM; - public static final Particle STRANGE; - public static final Particle TOP; - public static final Particle BOTTOM; - - public static final Particle ELECTRON; - public static final Particle ELECTRON_NEUTRINO; - public static final Particle MUON; - public static final Particle MUON_NEUTRINO; - public static final Particle TAU; - public static final Particle TAU_NEUTRINO; - - public static final Particle GLUON; - public static final Particle PHOTON; - public static final Particle Z_BOSON; - public static final Particle W_BOSON; - public static final Particle HIGGS_BOSON; - - public static final Particle PROTON; - public static final Particle NEUTRON; - public static final Particle LAMBDA; - public static final Particle OMEGA; - - public static final Particle PION; - public static final Particle ETA_MESON; - - public static final Particle UNKNOWN; - - public static final AutoMap<Particle> aMap = new AutoMap<Particle>(); - - static { - - /* - * Standard Model of Physics - */ - - //I exist, because I must. - GRAVITON = new Particle(ElementaryGroup.BOSON, "Graviton"); - - //Quarks - UP = new Particle(ElementaryGroup.QUARK, "Up"); - DOWN = new Particle(ElementaryGroup.QUARK, "Down"); - CHARM = new Particle(ElementaryGroup.QUARK, "Charm"); - STRANGE = new Particle(ElementaryGroup.QUARK, "Strange"); - TOP = new Particle(ElementaryGroup.QUARK, "Top"); - BOTTOM = new Particle(ElementaryGroup.QUARK, "Bottom"); - - //Leptons - ELECTRON = new Particle(ElementaryGroup.LEPTON, "Electron"); - MUON = new Particle(ElementaryGroup.LEPTON, "Muon"); - TAU = new Particle(ElementaryGroup.LEPTON, "Tau"); - ELECTRON_NEUTRINO = new Particle(ElementaryGroup.LEPTON, "Electron Neutrino"); - MUON_NEUTRINO = new Particle(ElementaryGroup.LEPTON, "Muon Neutrino"); - TAU_NEUTRINO = new Particle(ElementaryGroup.LEPTON, "Tau Neutrino"); - - //Bosons - GLUON = new Particle(ElementaryGroup.BOSON, "Gluon"); - PHOTON = new Particle(ElementaryGroup.BOSON, "Photon"); - Z_BOSON = new Particle(ElementaryGroup.BOSON, "Z Boson"); - W_BOSON = new Particle(ElementaryGroup.BOSON, "W Boson"); - HIGGS_BOSON = new Particle(ElementaryGroup.BOSON, "Higgs Boson"); - - /* - * Composite Particles - */ - - //Baryons - PROTON = new Particle(ElementaryGroup.BARYON, "Proton", new Particle[] {UP, UP, DOWN}); - NEUTRON = new Particle(ElementaryGroup.BARYON, "Neutron", new Particle[] {UP, DOWN, DOWN}); - LAMBDA = new Particle(ElementaryGroup.BARYON, "Lambda", new Particle[] {UP, DOWN, STRANGE}); - OMEGA = new Particle(ElementaryGroup.BARYON, "Omega", new Particle[] {STRANGE, STRANGE, STRANGE}); - - //Mesons - PION = new Particle(ElementaryGroup.MESON, "Pion", new Particle[] {MUON, MUON_NEUTRINO}); - ETA_MESON = new Particle(ElementaryGroup.MESON, "ETA Meson", new Particle[] {PION, PION, PION}); - - - //Wildcard - UNKNOWN = new Particle(ElementaryGroup.UNKNOWN, "Unknown"); - - } - - public static enum ElementaryGroup { - QUARK, - LEPTON, - BOSON, - BARYON, - MESON, - UNKNOWN; - } - - public final ElementaryGroup mParticleType; - public final String mParticleName; - public final Particle[] mComposition; - - public Particle(ElementaryGroup aParticleType, String aParticleName) { - this(aParticleType, aParticleName, null); - } - - public Particle(ElementaryGroup aParticleType, String aParticleName, Particle[] aComposition) { - mParticleType = aParticleType; - mParticleName = aParticleName; - mComposition = aComposition == null ? new Particle[] {this} : aComposition; - aMap.put(this); - } - - - public static ItemStack getIon(String aElementName, int aCharge) { - for (String g : gtPlusPlus.core.item.chemistry.IonParticles.NameToMetaMap.keySet()) { - if (g.toLowerCase().equals(Utils.sanitizeString(aElementName.toLowerCase()))){ - Integer meta = gtPlusPlus.core.item.chemistry.IonParticles.NameToMetaMap.get(Utils.sanitizeString(aElementName.toLowerCase())); - if (meta == null) { - meta = 0; - } - ItemStack aIon = ItemUtils.simpleMetaStack(ModItems.itemIonParticleBase, meta, 1); - if (aCharge != 0) { - IonParticles.setChargeState(aIon, aCharge); - } - return aIon; - } - } - return null; - } - - public static ItemStack getBaseParticle(Particle aParticle) { - String aPartName = Utils.sanitizeString(aParticle.mParticleName.toLowerCase()); - for (String g : gtPlusPlus.core.item.chemistry.StandardBaseParticles.NameToMetaMap.keySet()) { - if (g.toLowerCase().equals(aPartName)){ - Integer meta = gtPlusPlus.core.item.chemistry.StandardBaseParticles.NameToMetaMap.get(aPartName); - if (meta == null) { - meta = 0; - } - return ItemUtils.simpleMetaStack(ModItems.itemStandarParticleBase, meta, 1); - } - } - return null; - } -} diff --git a/src/Java/gtPlusPlus/core/material/gregtech/CustomGTMaterials.java b/src/Java/gtPlusPlus/core/material/gregtech/CustomGTMaterials.java deleted file mode 100644 index 20aebb80ed..0000000000 --- a/src/Java/gtPlusPlus/core/material/gregtech/CustomGTMaterials.java +++ /dev/null @@ -1,79 +0,0 @@ -package gtPlusPlus.core.material.gregtech; - -public class CustomGTMaterials { - - //public static Materials Fireclay = new MaterialBuilder(626, TextureSet.SET_ROUGH, "Fireclay").addDustItems().setRGB(173, 160, 155).setColor(Dyes.dyeBrown).setMaterialList(new MaterialStack(Brick, 1)).constructMaterial(); - - /**int aMetaItemSubID, - * TextureSet aIconSet, - * float aToolSpeed, - * int aDurability, - * int aToolQuality, - * boolean aUnificatable, - * String aName, String aDefaultLocalName, - * String aConfigSection, - * boolean aCustomOre, - * String aCustomID) { - - **/ - - /*public static List<Materials> Custom_GT_Materials = new ArrayList<Materials>(); - - public static Materials Zirconium = materialBuilder_Element(1232, TextureSet.SET_METALLIC, 6.0F, 256, 2, 1|2|8|32|64|128, 200, 200, 200, 0, "Zirconium", "Zirconium", 0, 0, 1811, 0, false, false, 3, 1, 1, Dyes.dyeLightGray, Element.Zr, Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.METALLUM, 3))); - public static Materials Geikielite = materialBuilder(1234, TextureSet.SET_SHINY, new int[]{1,2,3}, "Geikielite", Dyes.dyeBlack, Arrays.asList(new MaterialStack(Titanium, 1), new MaterialStack(Magnesium, 1), new MaterialStack(Oxygen, 3))); - public static Materials Zirconolite = materialBuilder(1235, TextureSet.SET_METALLIC, new int[]{1,2,3}, "Zirconolite", Dyes.dyeBlack, Arrays.asList(new MaterialStack(Calcium, 1), new MaterialStack(Zirconium, 1), new MaterialStack(Titanium, 2), new MaterialStack(Oxygen, 7))); - - public static final void run(){ - Utils.LOG_INFO("[Custom] Trying to initialise custom materials."); - } - - private final static boolean registerMaterial(Materials r){ - Custom_GT_Materials.add(r); - Utils.LOG_INFO("[Custom] Registered new Gregtech material - "+r.mName); - return true; - } - - public final static Materials materialBuilder(int ID, TextureSet texture, int[] rgb, String materialName, Dyes dyeColour, List<MaterialStack> composition){ - Materials newMat = new Materials( - ID, - texture, - 1.0F, - 0, - 2, - 1 |8 , - rgb[0], rgb[1], rgb[2], 0, - materialName, materialName, - 0, 0, -1, 0, false, false, 3, 1, 1, - dyeColour, - 1, - composition - ); - registerMaterial(newMat); - return newMat; - } - - public final static Materials materialBuilder_Element( - int ID, TextureSet texture, - float a, int b, int c, - int d, int r2, int g2, int b2, int a2, - String materialName, String e, - int f, int g, int h, int i, - boolean j, boolean k, - int l, int m, int n, - Dyes dyeColour, Element o, - List<TC_AspectStack> aspects){ - Materials newMat = new Materials( - ID, texture, - a, b, c, - d, r2, g2, b2, a2, - materialName, e, - f, g, h, i, j, k, l, m, n, - dyeColour, o, - aspects - ); - registerMaterial(newMat); - return newMat; - } -*/ - -} diff --git a/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java b/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java deleted file mode 100644 index d5c6e4a6bf..0000000000 --- a/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java +++ /dev/null @@ -1,284 +0,0 @@ -package gtPlusPlus.core.material.nuclear; - -import gregtech.api.enums.Materials; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.MISC_MATERIALS; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialStack; -import gtPlusPlus.core.material.state.MaterialState; - -public class FLUORIDES { - - public static final Material FLUORITE = new Material( - "Fluorite (F)", //Material Name - MaterialState.ORE, //State - null, //Material Colour - Materials.Fluorine.mMeltingPoint, //Melting Point in C - Materials.Fluorine.mBlastFurnaceTemp, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - false, //Generate cells - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().CALCIUM, 16), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 32), - new MaterialStack(ELEMENT.getInstance().IRON, 4), - new MaterialStack(ELEMENT.getInstance().CARBON, 2) - }); - - //ThF4 - public static final Material THORIUM_TETRAFLUORIDE = new Material( - "Thorium Tetrafluoride", //Material Name - MaterialState.LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().THORIUM232, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 4) - }); - - //ThF6 - public static final Material THORIUM_HEXAFLUORIDE = new Material( - "Thorium Hexafluoride", //Material Name - MaterialState.LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().THORIUM232, 1), - new MaterialStack(ELEMENT.getInstance().THORIUM, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 12) - }); - - //UF4 - public static final Material URANIUM_TETRAFLUORIDE = new Material( - "Uranium Tetrafluoride", //Material Name - MaterialState.LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().URANIUM233, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 4) - }); - - //UF6 - public static final Material URANIUM_HEXAFLUORIDE = new Material( - "Uranium Hexafluoride", //Material Name - MaterialState.LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(FLUORIDES.URANIUM_TETRAFLUORIDE, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 2) - }); - - //ZrF4 - - public static final Material ZIRCONIUM_TETRAFLUORIDE = new Material( - "Zirconium Tetrafluoride", //Material Name - MaterialState.LIQUID, //State - null, //Texture Set (Autogenerated) - 0, - null, //Material Colour - -1, - -1, - -1, - -1, - false, - "ZrF4", - -1, - true, - false, - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().ZIRCONIUM, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 4) - }); - - - -/* public static final Material ZIRCONIUM_TETRAFLUORIDE = new Material( - "Zirconium Tetrafluoride", //Material Name - MaterialState.LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().ZIRCONIUM, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 4) - });*/ - - //BeF2 - public static final Material BERYLLIUM_FLUORIDE = new Material( - "Beryllium Fluoride", //Material Name - MaterialState.LIQUID, //State - null, //Material Colour - -1, - -1, - -1, - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().BERYLLIUM, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 2) - }); - - //LiF - public static final Material LITHIUM_FLUORIDE = new Material( - "Lithium Fluoride", //Material Name - MaterialState.LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().LITHIUM7, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 1) - }); - - - //LFTR sub components - - //(NH4)HF2 - public static final Material AMMONIUM_BIFLUORIDE = new Material( - "Ammonium Bifluoride", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - 126, //Melting Point in C - 240, //Boiling Point in C - -1, //Protons - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(MISC_MATERIALS.AMMONIUM, 1), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 2) - }); - - //Be(OH)2 - public static final Material BERYLLIUM_HYDROXIDE = new Material( - "Beryllium Hydroxide", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().BERYLLIUM, 1), - new MaterialStack(MISC_MATERIALS.HYDROXIDE, 2) - }); - - // (NH4)2Be(OH)2 / (NH4)2BeF4 - public static final Material AMMONIUM_TETRAFLUOROBERYLLATE = new Material( - "Ammonium Tetrafluoroberyllate", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - 280, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(MISC_MATERIALS.AMMONIUM, 2), - new MaterialStack(FLUORIDES.BERYLLIUM_HYDROXIDE, 1) - }); - - - - //LFTR Output - public static final Material NEPTUNIUM_HEXAFLUORIDE = new Material( - "Neptunium Hexafluoride", //Material Name - MaterialState.GAS, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().NEPTUNIUM, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 6) - }); - - public static final Material TECHNETIUM_HEXAFLUORIDE = new Material( - "Technetium Hexafluoride", //Material Name - MaterialState.GAS, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().TECHNETIUM, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 6) - }); - - public static final Material SELENIUM_HEXAFLUORIDE = new Material( - "Selenium Hexafluoride", //Material Name - MaterialState.GAS, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().SELENIUM, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 6) - }); - - public static final Material SODIUM_FLUORIDE = new Material( - "Sodium Fluoride", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().SODIUM, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 1) - }); - - private static final FLUORIDES INSTANCE = new FLUORIDES(); - public static FLUORIDES getInstance(){return INSTANCE;} - -} diff --git a/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java b/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java deleted file mode 100644 index 9bc7459f0e..0000000000 --- a/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java +++ /dev/null @@ -1,376 +0,0 @@ -package gtPlusPlus.core.material.nuclear; - -import gtPlusPlus.core.client.CustomTextureSet.TextureSets; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialStack; -import gtPlusPlus.core.material.state.MaterialState; -import gtPlusPlus.core.util.data.StringUtils; - - -public final class NUCLIDE { - - public static final Material Li2BeF4 = new Material( - "Lithium Tetrafluoroberyllate", //Material Name - MaterialState.LIQUID, //State - TextureSets.NUCLEAR.get(), - null, //Material Colour - 566, //Melting Point in C - 870, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - StringUtils.subscript(StringUtils.superscript("7")+"Li2BeF4"), //Chemical Formula - 4, //Radioactivity Level - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(FLUORIDES.LITHIUM_FLUORIDE, 2), - new MaterialStack(FLUORIDES.BERYLLIUM_FLUORIDE, 1) - }); - - public static final Material LiFBeF2ThF4UF4 = new Material( - "LiFBeF2ThF4UF4", //Material Name - MaterialState.LIQUID, //State - TextureSets.NUCLEAR.get(), - null, //Material Colour - 566, //Melting Point in C - 870, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - StringUtils.subscript(StringUtils.superscript("7")+"LiFBeF2ThF4UF4"), //Chemical Formula - 5, //Radioactivity Level - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(FLUORIDES.LITHIUM_FLUORIDE, 65), - new MaterialStack(FLUORIDES.BERYLLIUM_FLUORIDE, 28), - new MaterialStack(FLUORIDES.THORIUM_TETRAFLUORIDE, 1), - new MaterialStack(FLUORIDES.URANIUM_TETRAFLUORIDE, 1) - }); - - public static final Material LiFBeF2ZrF4UF4 = new Material( - "LiFBeF2ZrF4UF4", //Material Name - MaterialState.LIQUID, //State - TextureSets.NUCLEAR.get(), - null, //Material Colour - 650, //Melting Point in C - 940, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - StringUtils.subscript(StringUtils.superscript("7")+"LiFBeF2ZrF4UF4"), //Chemical Formula - 5, //Radioactivity Level - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(FLUORIDES.LITHIUM_FLUORIDE, 65), - new MaterialStack(FLUORIDES.BERYLLIUM_FLUORIDE, 28), - new MaterialStack(FLUORIDES.ZIRCONIUM_TETRAFLUORIDE, 5), - new MaterialStack(FLUORIDES.URANIUM_TETRAFLUORIDE, 2) - }); - - public static final Material LiFBeF2ZrF4U235 = new Material( - "LiFBeF2ZrF4U235", //Material Name - MaterialState.LIQUID, //State - TextureSets.NUCLEAR.get(), - null, //Material Colour - 590, //Melting Point in C - 890, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - StringUtils.subscript(StringUtils.superscript("7")+"LiFBeF2ZrF4")+StringUtils.superscript("235U"), //Chemical Formula - 5, //Radioactivity Level - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(FLUORIDES.LITHIUM_FLUORIDE, 55), - new MaterialStack(FLUORIDES.BERYLLIUM_FLUORIDE, 25), - new MaterialStack(FLUORIDES.ZIRCONIUM_TETRAFLUORIDE, 6), - new MaterialStack(ELEMENT.getInstance().URANIUM235, 14) - }); - - // Misc - public static final Material BurntLftrFuel_MK1 = new Material( - "Burnt Reactor Fuel I", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - StringUtils.subscript(StringUtils.superscript("7")+"LiBeF2UF4FP"), //Chemical Formula - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().LITHIUM, 1), - new MaterialStack(FLUORIDES.BERYLLIUM_FLUORIDE, 1), - new MaterialStack(FLUORIDES.URANIUM_TETRAFLUORIDE, 1), - new MaterialStack(ELEMENT.getInstance().PROTACTINIUM, 1) - }); - - public static final Material BurntLftrFuel_MK2 = new Material( - "Burnt Reactor Fuel II", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - StringUtils.subscript(StringUtils.superscript("7")+"LiBeF2UF4FP"), //Chemical Formula - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().LITHIUM, 1), - new MaterialStack(FLUORIDES.BERYLLIUM_FLUORIDE, 1), - new MaterialStack(FLUORIDES.URANIUM_TETRAFLUORIDE, 1), - new MaterialStack(ELEMENT.getInstance().PROTACTINIUM, 1) - }); - - - - // LFTR Core Fluids - public static final Material LiFBeF2UF4FP = new Material( - "LiFBeF2UF4FP", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - StringUtils.subscript(StringUtils.superscript("7")+"LiFBeF2UF4FP"), //Chemical Formula - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(FLUORIDES.LITHIUM_FLUORIDE, 1), - new MaterialStack(FLUORIDES.BERYLLIUM_FLUORIDE, 1), - new MaterialStack(FLUORIDES.URANIUM_TETRAFLUORIDE, 1), - new MaterialStack(ELEMENT.getInstance().PROTACTINIUM, 1) - }); - - public static final Material Sparged_LiFBeF2UF4FP = new Material( - "Helium Sparged LiFBeF2UF4FP", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - StringUtils.subscript(StringUtils.superscript("7")+"LiFBeF2UF4FP"), //Chemical Formula - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(FLUORIDES.LITHIUM_FLUORIDE, 1), - new MaterialStack(FLUORIDES.BERYLLIUM_FLUORIDE, 1), - new MaterialStack(FLUORIDES.URANIUM_TETRAFLUORIDE, 1), - new MaterialStack(ELEMENT.getInstance().PROTACTINIUM, 1) - }); - - public static final Material UF6F2FP = new Material( - "UF6F2FP", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - StringUtils.subscript("UF6F2FP"), //Chemical Formula - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(FLUORIDES.URANIUM_HEXAFLUORIDE, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 3), - new MaterialStack(ELEMENT.getInstance().PHOSPHORUS, 1) - }); - - public static final Material LiFBeF2 = new Material( - "LiFBeF2", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - StringUtils.subscript(StringUtils.superscript("7")+"LiFBeF2"), //Chemical Formula - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(FLUORIDES.LITHIUM_FLUORIDE, 1), - new MaterialStack(FLUORIDES.BERYLLIUM_FLUORIDE, 1) - }); - - public static final Material LiFBeF2UF4 = new Material( - "LiFBeF2UF4", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - StringUtils.subscript(StringUtils.superscript("7")+"LiFBeF2UF4"), //Chemical Formula - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(LiFBeF2, 1), - new MaterialStack(FLUORIDES.URANIUM_TETRAFLUORIDE, 1) - }); - - - - - - - // LFTR Blanket Fluids - - // Tier 1 Fuel blanket output - public static final Material LiFThF4 = new Material( - "LiFThF4", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - StringUtils.subscript(StringUtils.superscript("7")+"LiFThF4"), //Chemical Formula - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(FLUORIDES.LITHIUM_FLUORIDE, 1), - new MaterialStack(FLUORIDES.THORIUM_TETRAFLUORIDE, 1) - }); - - // Tier 2 Fuel blanket output - public static final Material LiFBeF2ThF4 = new Material( - "LiFBeF2ThF4", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - StringUtils.subscript(StringUtils.superscript("7")+"LiFBeF2ThF4"), //Chemical Formula - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(FLUORIDES.LITHIUM_FLUORIDE, 1), - new MaterialStack(FLUORIDES.BERYLLIUM_FLUORIDE, 1), - new MaterialStack(FLUORIDES.THORIUM_TETRAFLUORIDE, 1) - }); - - // Tier 1 Fuel blanket output - public static final Material Sparged_LiFThF4 = new Material( - "Fluorine Sparged LiFThF4", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - StringUtils.subscript(StringUtils.superscript("7")+"LiFThF4"), //Chemical Formula - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(FLUORIDES.LITHIUM_FLUORIDE, 1), - new MaterialStack(FLUORIDES.THORIUM_TETRAFLUORIDE, 1) - }); - - // Tier 2 Fuel blanket output - public static final Material Sparged_LiFBeF2ThF4 = new Material( - "Fluorine Sparged LiFBeF2ThF4", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - StringUtils.subscript(StringUtils.superscript("7")+"LiFBeF2ThF4"), //Chemical Formula - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(FLUORIDES.LITHIUM_FLUORIDE, 1), - new MaterialStack(FLUORIDES.BERYLLIUM_FLUORIDE, 1), - new MaterialStack(FLUORIDES.THORIUM_TETRAFLUORIDE, 1) - }); - - public static final Material UF6F2 = new Material( - "UF6F2", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, //Neutrons - false, //Uses Blast furnace? - StringUtils.subscript("UF6F2"), //Chemical Formula - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(FLUORIDES.URANIUM_HEXAFLUORIDE, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 2) - }); - - - - - - - - - - - - - // Secondary material is molten metal - public static final Material NAQ_FUEL_T1 = new Material( - "Naquadah Fuel", - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().NAQUADAH, 2), - new MaterialStack(ELEMENT.getInstance().TANTALUM, 3) - }); - - // Secondary material is a plasma - public static final Material NAQ_FUEL_T2 = new Material( - "Enriched Naquadah Fuel", - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().NAQUADAH_ENRICHED, 2), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 3) - }); - - // Secondary material is a plasma - public static final Material NAQ_FUEL_T3 = new Material( - "Naquadria Fuel", - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().NAQUADRIA, 2), - new MaterialStack(ELEMENT.getInstance().AMERICIUM, 3) - }); - - - - private static final NUCLIDE INSTANCE = new NUCLIDE(); - - public static NUCLIDE getInstance(){ - return INSTANCE; - } - -} diff --git a/src/Java/gtPlusPlus/core/material/state/MaterialState.java b/src/Java/gtPlusPlus/core/material/state/MaterialState.java deleted file mode 100644 index 460fe019dc..0000000000 --- a/src/Java/gtPlusPlus/core/material/state/MaterialState.java +++ /dev/null @@ -1,18 +0,0 @@ -package gtPlusPlus.core.material.state; - -public enum MaterialState { - SOLID(0), - LIQUID(1), - GAS(2), - PLASMA(3), - PURE_LIQUID(4), - ORE(5), - PURE_GAS(6); - private int STATE; - private MaterialState (final int State){ - this.STATE = State; - } - public int ID() { - return this.STATE; - } -} diff --git a/src/Java/gtPlusPlus/core/network/handler/AbstractClientMessageHandler.java b/src/Java/gtPlusPlus/core/network/handler/AbstractClientMessageHandler.java deleted file mode 100644 index b7ced2f7e9..0000000000 --- a/src/Java/gtPlusPlus/core/network/handler/AbstractClientMessageHandler.java +++ /dev/null @@ -1,13 +0,0 @@ -package gtPlusPlus.core.network.handler; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import net.minecraft.entity.player.EntityPlayer; - -public abstract class AbstractClientMessageHandler<T extends IMessage> extends AbstractMessageHandler<T> { - - public final IMessage handleServerMessage(EntityPlayer player, T message, MessageContext ctx) { - return null; - } - -} diff --git a/src/Java/gtPlusPlus/core/network/handler/AbstractMessageHandler.java b/src/Java/gtPlusPlus/core/network/handler/AbstractMessageHandler.java deleted file mode 100644 index ca350f220f..0000000000 --- a/src/Java/gtPlusPlus/core/network/handler/AbstractMessageHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -package gtPlusPlus.core.network.handler; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.GTplusplus; -import net.minecraft.entity.player.EntityPlayer; - -public abstract class AbstractMessageHandler <T extends IMessage> implements IMessageHandler <T, IMessage> -{ - /** - * Handle a message received on the client side - * @return a message to send back to the Server, or null if no reply is necessary - */ - @SideOnly(Side.CLIENT) - public abstract IMessage handleClientMessage(EntityPlayer player, T message, MessageContext ctx); - - /** - * Handle a message received on the server side - * @return a message to send back to the Client, or null if no reply is necessary - */ - public abstract IMessage handleServerMessage(EntityPlayer player, T message, MessageContext ctx); - - @Override - public IMessage onMessage(T message, MessageContext ctx) { - if (ctx.side.isClient()) { - return handleClientMessage(GTplusplus.proxy.getPlayerEntity(ctx), message, ctx); - } else { - // server side proxy will return the server side EntityPlayer - return handleServerMessage(GTplusplus.proxy.getPlayerEntity(ctx), message, ctx); - } - } - - -} diff --git a/src/Java/gtPlusPlus/core/network/handler/AbstractServerMessageHandler.java b/src/Java/gtPlusPlus/core/network/handler/AbstractServerMessageHandler.java deleted file mode 100644 index d49e6cf350..0000000000 --- a/src/Java/gtPlusPlus/core/network/handler/AbstractServerMessageHandler.java +++ /dev/null @@ -1,13 +0,0 @@ -package gtPlusPlus.core.network.handler; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import net.minecraft.entity.player.EntityPlayer; - -public abstract class AbstractServerMessageHandler<T extends IMessage> extends AbstractMessageHandler<T> { - - public final IMessage handleClientMessage(EntityPlayer player, T message, MessageContext ctx) { - return null; - } - -} diff --git a/src/Java/gtPlusPlus/core/network/packet/AbstractPacket.java b/src/Java/gtPlusPlus/core/network/packet/AbstractPacket.java deleted file mode 100644 index d6368e3d9e..0000000000 --- a/src/Java/gtPlusPlus/core/network/packet/AbstractPacket.java +++ /dev/null @@ -1,9 +0,0 @@ -package gtPlusPlus.core.network.packet; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; - -public interface AbstractPacket extends IMessage { - - public abstract String getPacketName(); - -} diff --git a/src/Java/gtPlusPlus/core/network/packet/Packet_VolumetricFlaskGui.java b/src/Java/gtPlusPlus/core/network/packet/Packet_VolumetricFlaskGui.java deleted file mode 100644 index 609ea729b7..0000000000 --- a/src/Java/gtPlusPlus/core/network/packet/Packet_VolumetricFlaskGui.java +++ /dev/null @@ -1,128 +0,0 @@ -package gtPlusPlus.core.network.packet; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import cpw.mods.fml.relauncher.Side; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.network.handler.AbstractServerMessageHandler; -import gtPlusPlus.core.tileentities.general.TileEntityVolumetricFlaskSetter; -import io.netty.buffer.ByteBuf; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class Packet_VolumetricFlaskGui extends AbstractServerMessageHandler<Packet_VolumetricFlaskGui> implements AbstractPacket { - - private int x; - private int y; - private int z; - private int flaskValue; - - public Packet_VolumetricFlaskGui() { - - } - - public Packet_VolumetricFlaskGui(TileEntityVolumetricFlaskSetter tile, int aCustomValue) { - x = tile.xCoord; - y = tile.yCoord; - z = tile.zCoord; - flaskValue = aCustomValue; - Logger.INFO("Created Packet with values ("+x+", "+y+", "+z+" | "+flaskValue+")"); - } - - @Override - public void toBytes(ByteBuf buf) { - buf.writeInt(x); - buf.writeInt(y); - buf.writeInt(z); - buf.writeInt(flaskValue); - Logger.INFO("Writing to byte buffer."); - } - - @Override - public void fromBytes(ByteBuf buf) { - x = buf.readInt(); - y = buf.readInt(); - z = buf.readInt(); - flaskValue = buf.readInt(); - Logger.INFO("Reading from byte buffer."); - } - - public int getX() { - return x; - } - - public void setX(int x) { - this.x = x; - } - - public int getY() { - return y; - } - - public void setY(int y) { - this.y = y; - } - - public int getZ() { - return z; - } - - public void setZ(int z) { - this.z = z; - } - - public int getCustomValue() { - return flaskValue; - } - - public void setCustomValue(int aVal) { - this.flaskValue = aVal; - } - - protected TileEntityVolumetricFlaskSetter getTileEntity(Packet_VolumetricFlaskGui message, MessageContext ctx) { - Logger.INFO("Trying to get tile."); - World worldObj = getWorld(ctx); - if(worldObj == null) { - Logger.INFO("Bad world object."); - return null; - } - TileEntity te = worldObj.getTileEntity(message.getX(), message.getY(), message.getZ()); - if(te == null) { - Logger.INFO("Bad Tile."); - return null; - } - if(te instanceof TileEntityVolumetricFlaskSetter) { - Logger.INFO("Found Tile."); - return (TileEntityVolumetricFlaskSetter) te; - } - Logger.INFO("Error."); - return null; - } - - protected World getWorld(MessageContext ctx) { - if(ctx.side == Side.SERVER) { - return ctx.getServerHandler().playerEntity.worldObj; - } else { - return GTplusplus.proxy.getClientWorld(); - } - } - - @Override - public IMessage handleServerMessage(EntityPlayer player, Packet_VolumetricFlaskGui message, MessageContext ctx) { - TileEntityVolumetricFlaskSetter te = getTileEntity(message, ctx); - if(te != null) { - Logger.INFO("Setting value on tile. "+message.getCustomValue()); - te.setCustomValue(message.getCustomValue()); - //return new Packet_VolumetricFlaskGui2(te, message.getCustomValue()); - } - return null; - } - - @Override - public String getPacketName() { - return "Packet_VoluemtricFlaskSetter_ToServer"; - } - -} diff --git a/src/Java/gtPlusPlus/core/network/packet/Packet_VolumetricFlaskGui2.java b/src/Java/gtPlusPlus/core/network/packet/Packet_VolumetricFlaskGui2.java deleted file mode 100644 index bc6e6149d8..0000000000 --- a/src/Java/gtPlusPlus/core/network/packet/Packet_VolumetricFlaskGui2.java +++ /dev/null @@ -1,127 +0,0 @@ -package gtPlusPlus.core.network.packet; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import cpw.mods.fml.relauncher.Side; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.network.handler.AbstractClientMessageHandler; -import gtPlusPlus.core.tileentities.general.TileEntityVolumetricFlaskSetter; -import io.netty.buffer.ByteBuf; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class Packet_VolumetricFlaskGui2 extends AbstractClientMessageHandler<Packet_VolumetricFlaskGui2> implements AbstractPacket { - - private int x; - private int y; - private int z; - private int flaskValue; - - public Packet_VolumetricFlaskGui2() { - - } - - public Packet_VolumetricFlaskGui2(TileEntityVolumetricFlaskSetter tile, int aCustomValue) { - x = tile.xCoord; - y = tile.yCoord; - z = tile.zCoord; - flaskValue = aCustomValue; - Logger.INFO("Created Packet with values ("+x+", "+y+", "+z+" | "+flaskValue+")"); - } - - @Override - public void toBytes(ByteBuf buf) { - buf.writeInt(x); - buf.writeInt(y); - buf.writeInt(z); - buf.writeInt(flaskValue); - Logger.INFO("Writing to byte buffer."); - } - - @Override - public void fromBytes(ByteBuf buf) { - x = buf.readInt(); - y = buf.readInt(); - z = buf.readInt(); - flaskValue = buf.readInt(); - Logger.INFO("Reading from byte buffer."); - } - - public int getX() { - return x; - } - - public void setX(int x) { - this.x = x; - } - - public int getY() { - return y; - } - - public void setY(int y) { - this.y = y; - } - - public int getZ() { - return z; - } - - public void setZ(int z) { - this.z = z; - } - - public int getCustomValue() { - return flaskValue; - } - - public void setCustomValue(int aVal) { - this.flaskValue = aVal; - } - - protected TileEntityVolumetricFlaskSetter getTileEntity(Packet_VolumetricFlaskGui2 message, MessageContext ctx) { - Logger.INFO("Trying to get tile."); - World worldObj = getWorld(ctx); - if(worldObj == null) { - Logger.INFO("Bad world object."); - return null; - } - TileEntity te = worldObj.getTileEntity(message.getX(), message.getY(), message.getZ()); - if(te == null) { - Logger.INFO("Bad Tile."); - return null; - } - if(te instanceof TileEntityVolumetricFlaskSetter) { - Logger.INFO("Found Tile."); - return (TileEntityVolumetricFlaskSetter) te; - } - Logger.INFO("Error."); - return null; - } - - protected World getWorld(MessageContext ctx) { - if(ctx.side == Side.SERVER) { - return ctx.getServerHandler().playerEntity.worldObj; - } else { - return GTplusplus.proxy.getClientWorld(); - } - } - - @Override - public String getPacketName() { - return "Packet_VoluemtricFlaskSetter_ToClient"; - } - - @Override - public IMessage handleClientMessage(EntityPlayer player, Packet_VolumetricFlaskGui2 message, MessageContext ctx) { - TileEntityVolumetricFlaskSetter te = getTileEntity(message, ctx); - if(te != null) { - Logger.INFO("Setting value on tile. "+message.getCustomValue()); - te.setCustomValue(message.getCustomValue()); - } - return null; - } - -} diff --git a/src/Java/gtPlusPlus/core/players/FakeFarmer.java b/src/Java/gtPlusPlus/core/players/FakeFarmer.java deleted file mode 100644 index ef9ee3c3e7..0000000000 --- a/src/Java/gtPlusPlus/core/players/FakeFarmer.java +++ /dev/null @@ -1,86 +0,0 @@ -package gtPlusPlus.core.players; - -import java.util.UUID; - -import com.mojang.authlib.GameProfile; - -import cpw.mods.fml.common.FMLCommonHandler; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.network.play.client.C15PacketClientSettings; -import net.minecraft.server.management.ItemInWorldManager; -import net.minecraft.stats.StatBase; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.DamageSource; -import net.minecraft.util.IChatComponent; -import net.minecraft.world.World; -import net.minecraft.world.WorldServer; - -public class FakeFarmer extends EntityPlayerMP { - private static final UUID uuid = UUID.fromString("c1ddfd7f-120a-4437-8b64-38660d3ec62d"); - - private static GameProfile FAKE_PROFILE = new GameProfile(uuid, "[GT_Farm_Manager]"); - - public FakeFarmer(final WorldServer world) { - super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, FAKE_PROFILE, new ItemInWorldManager(world)); - } - - @Override - public boolean canCommandSenderUseCommand(final int i, final String s) { - return false; - } - - @Override - public ChunkCoordinates getPlayerCoordinates() { - return new ChunkCoordinates(0, 0, 0); - } - - @Override - public void addChatComponentMessage(final IChatComponent chatmessagecomponent) { - } - - @Override - public void addChatMessage(final IChatComponent p_145747_1_) { - } - - @Override - public void addStat(final StatBase par1StatBase, final int par2) { - } - - @Override - public void openGui(final Object mod, final int modGuiId, final World world, final int x, final int y, final int z) { - } - - @Override - public boolean isEntityInvulnerable() { - return true; - } - - @Override - public boolean canAttackPlayer(final EntityPlayer player) { - return false; - } - - @Override - public void onDeath(final DamageSource source) { - } - - @Override - public void onUpdate() { - } - - @Override - public void travelToDimension(final int dim) { - } - - @Override - public void func_147100_a(final C15PacketClientSettings pkt) { - } - - @Override - public boolean canPlayerEdit(final int par1, final int par2, final int par3, final int par4, final ItemStack par5ItemStack) { - return true; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java deleted file mode 100644 index 5a0c0f4ea3..0000000000 --- a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java +++ /dev/null @@ -1,271 +0,0 @@ -package gtPlusPlus.core.proxy; - -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.client.registry.ClientRegistry; -import cpw.mods.fml.client.registry.RenderingRegistry; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.event.*; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.australia.entity.model.ModelBoar; -import gtPlusPlus.australia.entity.model.ModelDingo; -import gtPlusPlus.australia.entity.model.ModelOctopus; -import gtPlusPlus.australia.entity.render.*; -import gtPlusPlus.australia.entity.type.*; -import gtPlusPlus.core.client.model.ModelGiantChicken; -import gtPlusPlus.core.client.renderer.*; -import gtPlusPlus.core.common.CommonProxy; -import gtPlusPlus.core.common.compat.COMPAT_PlayerAPI; -import gtPlusPlus.core.entity.EntityPrimedMiningExplosive; -import gtPlusPlus.core.entity.EntityTeslaTowerLightning; -import gtPlusPlus.core.entity.monster.*; -import gtPlusPlus.core.entity.projectile.*; -import gtPlusPlus.core.handler.render.FirepitRender; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.CORE.ConfigSwitches; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; -import gtPlusPlus.core.tileentities.general.TileEntityFirepit; -import gtPlusPlus.core.util.minecraft.particles.EntityParticleFXMysterious; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; -import gtPlusPlus.xmod.gregtech.common.render.GTPP_CapeRenderer; -import gtPlusPlus.xmod.gregtech.common.render.GTPP_FlaskRenderer; -import gtPlusPlus.xmod.gregtech.common.render.GTPP_Render_MachineBlock; -import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.EntityFX; -import net.minecraft.client.renderer.entity.RenderFireball; -import net.minecraft.client.renderer.entity.RenderSnowball; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.world.World; -import net.minecraftforge.client.IItemRenderer; -import net.minecraftforge.client.MinecraftForgeClient; - -public class ClientProxy extends CommonProxy implements Runnable{ - - private final GTPP_CapeRenderer mCapeRenderer; - @SideOnly(Side.CLIENT) - public static boolean mFancyGraphics = false; - - public ClientProxy(){ - mCapeRenderer = new GTPP_CapeRenderer(); - //Get Graphics Mode. - mFancyGraphics = Minecraft.isFancyGraphicsEnabled(); - } - - @SubscribeEvent - public void receiveRenderSpecialsEvent(net.minecraftforge.client.event.RenderPlayerEvent.Specials.Pre aEvent) { - if (ConfigSwitches.enableCustomCapes){ - mCapeRenderer.receiveRenderSpecialsEvent(aEvent); - } - } - - @SideOnly(Side.CLIENT) - public static String playerName = ""; - - @Override - public void preInit(final FMLPreInitializationEvent e) { - super.preInit(e); - if (ConfigSwitches.enableCustomCapes){ - onPreLoad(); - } - //Do this weird things for textures. - GTplusplus.loadTextures(); - //We boot up the sneak manager. - if (LoadedMods.PlayerAPI){ - this.init_PlayerAPI_PRE(); - } - } - - @Override - public void init(final FMLInitializationEvent e) { - if (LoadedMods.PlayerAPI){ - this.init_PlayerAPI_INIT(); - } - - /** - * Custom Block Renderers - */ - new CustomOreBlockRenderer(); - new CustomItemBlockRenderer(); - new GTPP_Render_MachineBlock(); - - if (Meta_GT_Proxy.sDoesVolumetricFlaskExist) { - new GTPP_FlaskRenderer(); - } - - super.init(e); - } - - @Override - public void postInit(final FMLPostInitializationEvent e) { - super.postInit(e); - } - - @Override - public void registerRenderThings(){ - - // Standard GT++ - - /** - * Entities - */ - - RenderingRegistry.registerEntityRenderingHandler(EntityPrimedMiningExplosive.class, new RenderMiningExplosivesPrimed()); - RenderingRegistry.registerEntityRenderingHandler(EntitySickBlaze.class, new RenderSickBlaze()); - RenderingRegistry.registerEntityRenderingHandler(EntityStaballoyConstruct.class, new RenderStaballoyConstruct()); - RenderingRegistry.registerEntityRenderingHandler(EntityToxinballSmall.class, new RenderToxinball(1F)); - RenderingRegistry.registerEntityRenderingHandler(EntitySulfuricAcidPotion.class, new RenderSnowball(ModItems.itemSulfuricPotion)); - RenderingRegistry.registerEntityRenderingHandler(EntityHydrofluoricAcidPotion.class, new RenderSnowball(ModItems.itemHydrofluoricPotion)); - RenderingRegistry.registerEntityRenderingHandler(EntityTeslaTowerLightning.class, new RenderPlasmaBolt()); - RenderingRegistry.registerEntityRenderingHandler(EntityGiantChickenBase.class, new RenderGiantChicken(new ModelGiantChicken(), 1f)); - RenderingRegistry.registerEntityRenderingHandler(EntityBatKing.class, new RenderBatKing()); - RenderingRegistry.registerEntityRenderingHandler(EntityThrowableBomb.class, new RenderSnowball(ModItems.itemBomb, 1)); - RenderingRegistry.registerEntityRenderingHandler(EntityLightningAttack.class, new RenderFireball(1F)); - - /** - * Tiles - */ - - Logger.INFO("Registering Custom Renderer for the Fire Pit."); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFirepit.class, new FirepitRender()); - Logger.INFO("Registering Custom Renderer for the Lead Lined Chest."); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDecayablesChest.class, new RenderDecayChest()); - Logger.INFO("Registering Custom Renderer for the Egg Box."); - //ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEggBox.class, ModelEggBox.getRenderer()); - - - //GT++ Australia - - /** - * Entities - */ - - RenderingRegistry.registerEntityRenderingHandler(EntityAustralianSpiderBase.class, new RenderAustralianSpider()); - RenderingRegistry.registerEntityRenderingHandler(EntityBoar.class, new RenderBoar(new ModelBoar(), new ModelBoar(0.5F), 0.7F)); - RenderingRegistry.registerEntityRenderingHandler(EntityDingo.class, new RenderDingo(new ModelDingo(), new ModelDingo(), 0.5F)); - RenderingRegistry.registerEntityRenderingHandler(EntityOctopus.class, new RenderOctopus(new ModelOctopus(), 0.7F)); - - - - - - - - /** - * Items - */ - for (Pair<Item, IItemRenderer> sItemRenderMappings : mItemRenderMappings) { - MinecraftForgeClient.registerItemRenderer(sItemRenderMappings.getKey(), sItemRenderMappings.getValue()); - } - - } - - @Override - public int addArmor(final String armor){ - return RenderingRegistry.addNewArmourRendererPrefix(armor); - } - - @Override - public void generateMysteriousParticles(final Entity theEntity) - { - final double motionX = theEntity.worldObj.rand.nextGaussian() * 0.02D; - final double motionY = theEntity.worldObj.rand.nextGaussian() * 0.02D; - final double motionZ = theEntity.worldObj.rand.nextGaussian() * 0.02D; - final EntityFX particleMysterious = new EntityParticleFXMysterious( - - theEntity.worldObj, - (theEntity.posX + (theEntity.worldObj.rand.nextFloat() * theEntity.width - - * 2.0F)) - theEntity.width, - theEntity.posY + 0.5D + (theEntity.worldObj.rand.nextFloat() - - * theEntity.height), - (theEntity.posZ + (theEntity.worldObj.rand.nextFloat() * theEntity.width - - * 2.0F)) - theEntity.width, - - motionX, - - motionY, - - motionZ); - Minecraft.getMinecraft().effectRenderer.addEffect(particleMysterious); - } - - @Override - public void serverStarting(final FMLServerStartingEvent e) - { - - } - - @Optional.Method(modid = "PlayerAPI") - private void init_PlayerAPI_PRE(){ - //Register player instance - COMPAT_PlayerAPI.clientProxy.initPre(); - } - - @Optional.Method(modid = "PlayerAPI") - private void init_PlayerAPI_INIT(){ - //Register player instance - COMPAT_PlayerAPI.clientProxy.Init(); - } - - - - public void onPreLoad() { - /*if (ConfigSwitches.enableCustomCapes){ - String arr$[] = { - "draknyte1", "fobius" - }; - int len$ = arr$.length; - for (int i$ = 0; i$ < len$; i$++) { - String tName = arr$[i$]; - mCapeList.add(tName.toLowerCase()); - } - (new Thread(this)).start(); - }*/ - } - - @Override - public void run() { - /*try { - if (ConfigSwitches.enableCustomCapes){ - Logger.INFO("GT++ Mod: Downloading Cape List."); - @SuppressWarnings("resource") - Scanner tScanner = new Scanner(new URL("https://github.com/draknyte1/GTplusplus/blob/master/SupporterList.txt").openStream()); - while (tScanner.hasNextLine()) { - String tName = tScanner.nextLine(); - if (!this.mCapeList.contains(tName.toLowerCase())) { - this.mCapeList.add(tName.toLowerCase()); - } - } - } - } catch (Throwable e) { - Logger.INFO("Failed to download GT++ cape list."); - }*/ - } - - @Override - public void onLoadComplete(FMLLoadCompleteEvent event) { - GTplusplus.tryPatchTurbineTextures(); - super.onLoadComplete(event); - } - - @Override - public World getClientWorld() { - return FMLClientHandler.instance().getClient().theWorld; - } - - @Override - public EntityPlayer getPlayerEntity(MessageContext ctx) { - return (ctx.side.isClient() ? Minecraft.getMinecraft().thePlayer : super.getPlayerEntity(ctx)); - } - -} diff --git a/src/Java/gtPlusPlus/core/proxy/ServerProxy.java b/src/Java/gtPlusPlus/core/proxy/ServerProxy.java deleted file mode 100644 index 8aeeb70191..0000000000 --- a/src/Java/gtPlusPlus/core/proxy/ServerProxy.java +++ /dev/null @@ -1,29 +0,0 @@ -package gtPlusPlus.core.proxy; - -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; - -import gtPlusPlus.core.common.CommonProxy; - -public class ServerProxy extends CommonProxy{ - - @Override - public void preInit(final FMLPreInitializationEvent e) { - // TODO Auto-generated method stub - super.preInit(e); - } - - @Override - public void init(final FMLInitializationEvent e) { - // TODO Auto-generated method stub - super.init(e); - } - - @Override - public void postInit(final FMLPostInitializationEvent e) { - // TODO Auto-generated method stub - super.postInit(e); - } - -} diff --git a/src/Java/gtPlusPlus/core/recipe/Gregtech_Recipe_Adder.java b/src/Java/gtPlusPlus/core/recipe/Gregtech_Recipe_Adder.java deleted file mode 100644 index b5fc9c3995..0000000000 --- a/src/Java/gtPlusPlus/core/recipe/Gregtech_Recipe_Adder.java +++ /dev/null @@ -1,100 +0,0 @@ -package gtPlusPlus.core.recipe; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_ModHandler; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class Gregtech_Recipe_Adder { - - private static int euT; - private static int ticks; - private static ItemStack inputStack1; - private static ItemStack inputStack2; - private static ItemStack outputStack1; - private static ItemStack outputStack2; - - public static void addRecipe( - final Item maceratorInput, final int maceratorInputAmount1, - final Item maceratorOutput, final int maceratorOutputAmount1, - final Item compressorInput, final int compressorInputAmount1, - final Item compressorOutput, final int compressorOutputAmount1, - final Item blastFurnaceInput, final int blastFurnaceInputAmount1, - final Item blastFurnaceOutput, final int blastFurnaceOutputAmount1, - final Item blastFurnaceInput2, final int blastFurnaceInputAmount2, - final Item blastFurnaceOutput2, final int blastFurnaceOutputAmount2, - final Item smeltingInput, final int smeltingInputAmount1, - final Item smeltingOutput, final int smeltingOutputAmount1, - - final int euPerTick, final int timeInTicks, - final boolean addMaceratorRecipe, final boolean addCompressorRecipe, final boolean addBlastFurnaceRecipe, final int blastFurnaceTemp, final boolean addSmeltingRecipe, final boolean addMixerRecipe){ - euT = euPerTick; - ticks = timeInTicks; - - resetVars(); - if (addMaceratorRecipe){ - inputStack1 = ItemUtils.getSimpleStack(maceratorInput, maceratorInputAmount1); - outputStack1 = ItemUtils.getSimpleStack(maceratorOutput, maceratorOutputAmount1); - addMaceratorRecipe(inputStack1, outputStack1); - } - resetVars(); - if (addCompressorRecipe){ - inputStack1 = ItemUtils.getSimpleStack(compressorInput, compressorInputAmount1); - outputStack1 = ItemUtils.getSimpleStack(compressorOutput, compressorOutputAmount1); - addCompressorRecipe(inputStack1, outputStack1); - } - resetVars(); - if (addBlastFurnaceRecipe){ - inputStack1 = ItemUtils.getSimpleStack(blastFurnaceInput, blastFurnaceInputAmount1); - inputStack2 = ItemUtils.getSimpleStack(blastFurnaceInput2, blastFurnaceInputAmount2); - outputStack1 = ItemUtils.getSimpleStack(blastFurnaceOutput, blastFurnaceOutputAmount1); - outputStack2 = ItemUtils.getSimpleStack(blastFurnaceOutput2, blastFurnaceOutputAmount2); - addBlastFurnaceRecipe(inputStack1, inputStack2, outputStack1, outputStack2, blastFurnaceTemp); - } - resetVars(); - if (addSmeltingRecipe){ - inputStack1 = ItemUtils.getSimpleStack(smeltingInput, smeltingInputAmount1); - outputStack1 = ItemUtils.getSimpleStack(smeltingOutput, smeltingOutputAmount1); - addSmeltingRecipe(inputStack1, outputStack1); - } - resetVars(); - - } - - private static void resetVars(){ - inputStack1 = null; - inputStack2 = null; - outputStack1 = null; - outputStack2 = null; - } - - private static void addMaceratorRecipe(final ItemStack input1, final ItemStack output1){ - GT_ModHandler.addPulverisationRecipe(input1, output1); - } - - private static void addCompressorRecipe(final ItemStack input1, final ItemStack output1){ - GT_ModHandler.addCompressionRecipe(input1, output1); - } - - private static void addBlastFurnaceRecipe(final ItemStack input1, final ItemStack input2, final ItemStack output1, final ItemStack output2, final int tempRequired){ - Logger.INFO("Registering Blast Furnace Recipes."); - GT_Values.RA.addBlastRecipe( - input1, - input2, - GT_Values.NF, GT_Values.NF, - output1, - output2, - ticks, - euT, - tempRequired); - } - - private static void addSmeltingRecipe(final ItemStack input1, final ItemStack output1){ - GT_ModHandler.addSmeltingRecipe(input1, output1); - } - -} diff --git a/src/Java/gtPlusPlus/core/recipe/LOADER_Machine_Components.java b/src/Java/gtPlusPlus/core/recipe/LOADER_Machine_Components.java deleted file mode 100644 index 460b29e802..0000000000 --- a/src/Java/gtPlusPlus/core/recipe/LOADER_Machine_Components.java +++ /dev/null @@ -1,216 +0,0 @@ -package gtPlusPlus.core.recipe; - -import gregtech.api.enums.ItemList; - -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; - -public class LOADER_Machine_Components { - - public static void initialise(){ - - registerDefaultComponents(); - - if (!CORE.GTNH){ - if(CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - registerGTExperimentalComponents(); - } - else { - registerGTStandardComponents(); - } - } - else { - registerGTNHComponents(); - } - } - - private static void registerDefaultComponents(){ - //Machine Components - CI.electricMotor_LV = ItemList.Electric_Motor_LV.get(1); - CI.electricMotor_MV = ItemList.Electric_Motor_MV.get(1); - CI.electricMotor_HV = ItemList.Electric_Motor_HV.get(1); - CI.electricMotor_EV = ItemList.Electric_Motor_EV.get(1); - CI.electricMotor_IV = ItemList.Electric_Motor_IV.get(1); - CI.electricPump_LV = ItemList.Electric_Pump_LV.get(1); - CI.electricPump_MV = ItemList.Electric_Pump_MV.get(1); - CI.electricPump_HV = ItemList.Electric_Pump_HV.get(1); - CI.electricPump_EV = ItemList.Electric_Pump_EV.get(1); - CI.electricPump_IV = ItemList.Electric_Pump_IV.get(1); - CI.electricPiston_LV = ItemList.Electric_Piston_LV.get(1); - CI.electricPiston_MV = ItemList.Electric_Piston_MV.get(1); - CI.electricPiston_HV = ItemList.Electric_Piston_HV.get(1); - CI.electricPiston_EV = ItemList.Electric_Piston_EV.get(1); - CI.electricPiston_IV = ItemList.Electric_Piston_IV.get(1); - CI.robotArm_LV = ItemList.Robot_Arm_LV.get(1); - CI.robotArm_MV = ItemList.Robot_Arm_MV.get(1); - CI.robotArm_HV = ItemList.Robot_Arm_HV.get(1); - CI.robotArm_EV = ItemList.Robot_Arm_EV.get(1); - CI.robotArm_IV = ItemList.Robot_Arm_IV.get(1); - CI.conveyorModule_LV = ItemList.Conveyor_Module_LV.get(1); - CI.conveyorModule_MV = ItemList.Conveyor_Module_MV.get(1); - CI.conveyorModule_HV = ItemList.Conveyor_Module_HV.get(1); - CI.conveyorModule_EV = ItemList.Conveyor_Module_EV.get(1); - CI.conveyorModule_IV = ItemList.Conveyor_Module_IV.get(1); - CI.emitter_LV = ItemList.Emitter_LV.get(1); - CI.emitter_MV = ItemList.Emitter_MV.get(1); - CI.emitter_HV = ItemList.Emitter_HV.get(1); - CI.emitter_EV = ItemList.Emitter_EV.get(1); - CI.emitter_IV = ItemList.Emitter_IV.get(1); - CI.fieldGenerator_LV = ItemList.Field_Generator_LV.get(1); - CI.fieldGenerator_MV = ItemList.Field_Generator_MV.get(1); - CI.fieldGenerator_HV = ItemList.Field_Generator_HV.get(1); - CI.fieldGenerator_EV = ItemList.Field_Generator_EV.get(1); - CI.fieldGenerator_IV = ItemList.Field_Generator_IV.get(1); - CI.sensor_LV = ItemList.Sensor_LV.get(1); - CI.sensor_MV = ItemList.Sensor_MV.get(1); - CI.sensor_HV = ItemList.Sensor_HV.get(1); - CI.sensor_EV = ItemList.Sensor_EV.get(1); - CI.sensor_IV = ItemList.Sensor_IV.get(1); - } - - private static void registerGTExperimentalComponents(){ - //GT++ Machine Components - CI.electricMotor_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32606, 1); - CI.electricMotor_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32607, 1); - CI.electricMotor_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32608, 1); - CI.electricPump_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32620, 1); - CI.electricPump_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32621, 1); - CI.electricPump_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32622, 1); - CI.electricPiston_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32645, 1); - CI.electricPiston_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32646, 1); - CI.electricPiston_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32647, 1); - CI.robotArm_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32655, 1); - CI.robotArm_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32656, 1); - CI.robotArm_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32657, 1); - CI.conveyorModule_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32636, 1); - CI.conveyorModule_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32637, 1); - CI.conveyorModule_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32638, 1); - CI.emitter_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32685, 1); - CI.emitter_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32686, 1); - CI.emitter_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32687, 1); - CI.fieldGenerator_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32675, 1); - CI.fieldGenerator_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32676, 1); - CI.fieldGenerator_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32677, 1); - CI.sensor_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32695, 1); - CI.sensor_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32696, 1); - CI.sensor_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32697, 1); - - registerComponentsULV(); - registerComponentsMAX(); - } - - private static void registerGTStandardComponents(){ - CI.electricMotor_LuV = GregtechItemList.Electric_Motor_LuV.get(1); - CI.electricMotor_ZPM = GregtechItemList.Electric_Motor_ZPM.get(1); - CI.electricMotor_UV = GregtechItemList.Electric_Motor_UV.get(1); - CI.electricMotor_MAX = GregtechItemList.Electric_Motor_MAX.get(1); - CI.electricPump_LuV = GregtechItemList.Electric_Pump_LuV.get(1); - CI.electricPump_ZPM = GregtechItemList.Electric_Pump_ZPM.get(1); - CI.electricPump_UV = GregtechItemList.Electric_Pump_UV.get(1); - CI.electricPump_MAX = GregtechItemList.Electric_Pump_MAX.get(1); - CI.electricPiston_LuV = GregtechItemList.Electric_Piston_LuV.get(1); - CI.electricPiston_ZPM = GregtechItemList.Electric_Piston_ZPM.get(1); - CI.electricPiston_UV = GregtechItemList.Electric_Piston_UV.get(1); - CI.electricPiston_MAX = GregtechItemList.Electric_Piston_MAX.get(1); - CI.robotArm_LuV = GregtechItemList.Robot_Arm_LuV.get(1); - CI.robotArm_ZPM = GregtechItemList.Robot_Arm_ZPM.get(1); - CI.robotArm_UV = GregtechItemList.Robot_Arm_UV.get(1); - CI.robotArm_MAX = GregtechItemList.Robot_Arm_MAX.get(1); - CI.conveyorModule_LuV = GregtechItemList.Conveyor_Module_LuV.get(1); - CI.conveyorModule_ZPM = GregtechItemList.Conveyor_Module_ZPM.get(1); - CI.conveyorModule_UV = GregtechItemList.Conveyor_Module_UV.get(1); - CI.conveyorModule_MAX = GregtechItemList.Conveyor_Module_MAX.get(1); - CI.emitter_LuV = GregtechItemList.Emitter_LuV.get(1); - CI.emitter_ZPM = GregtechItemList.Emitter_ZPM.get(1); - CI.emitter_UV = GregtechItemList.Emitter_UV.get(1); - CI.emitter_MAX = GregtechItemList.Emitter_MAX.get(1); - CI.fieldGenerator_LuV = GregtechItemList.Field_Generator_LuV.get(1); - CI.fieldGenerator_ZPM = GregtechItemList.Field_Generator_ZPM.get(1); - CI.fieldGenerator_UV = GregtechItemList.Field_Generator_UV.get(1); - CI.fieldGenerator_MAX = GregtechItemList.Field_Generator_MAX.get(1); - CI.sensor_LuV = GregtechItemList.Sensor_LuV.get(1); - CI.sensor_ZPM = GregtechItemList.Sensor_ZPM.get(1); - CI.sensor_UV = GregtechItemList.Sensor_UV.get(1); - CI.sensor_MAX = GregtechItemList.Sensor_MAX.get(1); - - registerComponentsULV(); - } - - private static void registerGTNHComponents(){ - //Machine Components - CI.electricMotor_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32606, 1); - CI.electricMotor_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32607, 1); - CI.electricMotor_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32608, 1); - - CI.electricPump_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32615, 1); - CI.electricPump_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32616, 1); - CI.electricPump_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32617, 1); - - CI.electricPiston_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32645, 1); - CI.electricPiston_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32646, 1); - CI.electricPiston_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32647, 1); - - CI.robotArm_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32655, 1); - CI.robotArm_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32656, 1); - CI.robotArm_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32657, 1); - - CI.conveyorModule_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32635, 1); - CI.conveyorModule_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32636, 1); - CI.conveyorModule_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32637, 1); - - CI.emitter_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32685, 1); - CI.emitter_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32686, 1); - CI.emitter_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32687, 1); - - CI.fieldGenerator_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32675, 1); - CI.fieldGenerator_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32676, 1); - CI.fieldGenerator_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32677, 1); - - CI.sensor_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32695, 1); - CI.sensor_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32696, 1); - CI.sensor_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32697, 1); - - // Thanks 0lafe - CI.electricMotor_MAX = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32596, 1); - CI.electricPump_MAX = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32618, 1); - CI.electricPiston_MAX = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32648, 1); - CI.robotArm_MAX = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32658, 1); - CI.conveyorModule_MAX = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32638, 1); - CI.emitter_MAX = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32688, 1); - CI.fieldGenerator_MAX = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32678, 1); - CI.sensor_MAX = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32698, 1); - - registerComponentsULV(); - } - - private static boolean registerComponentsULV(){ - - CI.electricMotor_ULV = GregtechItemList.Electric_Motor_ULV.get(1); - CI.electricPump_ULV = GregtechItemList.Electric_Pump_ULV.get(1); - CI.electricPiston_ULV = GregtechItemList.Electric_Piston_ULV.get(1); - CI.robotArm_ULV = GregtechItemList.Robot_Arm_ULV.get(1); - CI.conveyorModule_ULV = GregtechItemList.Conveyor_Module_ULV.get(1); - CI.emitter_ULV = GregtechItemList.Emitter_ULV.get(1); - CI.fieldGenerator_ULV = GregtechItemList.Field_Generator_ULV.get(1); - CI.sensor_ULV = GregtechItemList.Sensor_ULV.get(1); - return true; - } - - private static boolean registerComponentsMAX() { - - // Max Tier Components Blood Never added... Useless, lol. - CI.electricMotor_MAX = GregtechItemList.Electric_Motor_MAX.get(1); - CI.electricPump_MAX = GregtechItemList.Electric_Pump_MAX.get(1); - CI.electricPiston_MAX = GregtechItemList.Electric_Piston_MAX.get(1); - CI.robotArm_MAX = GregtechItemList.Robot_Arm_MAX.get(1); - CI.conveyorModule_MAX = GregtechItemList.Conveyor_Module_MAX.get(1); - CI.emitter_MAX = GregtechItemList.Emitter_MAX.get(1); - CI.fieldGenerator_MAX = GregtechItemList.Field_Generator_MAX.get(1); - CI.sensor_MAX = GregtechItemList.Sensor_MAX.get(1); - - return true; - } - -} diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Extruder.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Extruder.java deleted file mode 100644 index 455beb2fd0..0000000000 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Extruder.java +++ /dev/null @@ -1,47 +0,0 @@ -package gtPlusPlus.core.recipe; - -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.*; -import gregtech.api.interfaces.IOreRecipeRegistrator; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; - -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; - -public class RECIPES_Extruder implements IOreRecipeRegistrator { - - public RECIPES_Extruder() { - OrePrefixes.ingot.add((IOreRecipeRegistrator) this); - OrePrefixes.dust.add((IOreRecipeRegistrator) this); - } - - public void registerOre(final OrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, - final String aModName, final ItemStack aStack) { - if (!CORE.GTNH && ((aMaterial == Materials.Glass || aMaterial == Materials.WroughtIron - || GT_OreDictUnificator.get(OrePrefixes.ingot, (Object) aMaterial, 1L) != null) - && !aMaterial.contains(SubTag.NO_SMELTING))) { - final long aMaterialMass = aMaterial.getMass(); - final int tAmount = (int) (aPrefix.mMaterialAmount / 3628800L); - if (tAmount > 0 && tAmount <= 64 && aPrefix.mMaterialAmount % 3628800L == 0L) { - int tVoltageMultiplier = (aMaterial.mBlastFurnaceTemp >= 2800) ? 64 : 16; - if (aMaterial.contains(SubTag.NO_SMASHING)) { - tVoltageMultiplier /= 4; - } else if (aPrefix.name().startsWith(OrePrefixes.dust.name())) { - return; - } - - GT_Values.RA.addExtruderRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), - GregtechItemList.Shape_Extruder_SmallGear.get(0L, new Object[0]), - GT_OreDictUnificator.get(OrePrefixes.gearGtSmall, (Object) aMaterial.mSmeltInto, (long) tAmount), - ((int) Math.max(aMaterialMass * 5L * tAmount, tAmount)/4), 8 * tVoltageMultiplier); - GT_Values.RA.addAlloySmelterRecipe(GT_Utility.copyAmount(2L, new Object[]{aStack}), - ItemList.Shape_Mold_Gear_Small.get(0L, new Object[0]), - GT_OreDictUnificator.get(OrePrefixes.gearGtSmall, (Object) aMaterial.mSmeltInto, (long) tAmount), - ((int) Math.max(aMaterialMass * 10L * tAmount, tAmount)/4), 2 * tVoltageMultiplier); - - } - } - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java deleted file mode 100644 index 3d0e6aebfd..0000000000 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ /dev/null @@ -1,2262 +0,0 @@ -package gtPlusPlus.core.recipe; - -import static gtPlusPlus.core.lib.CORE.GTNH; - -import java.util.ArrayList; - -import cpw.mods.fml.common.Loader; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.HotFuel; -import gregtech.api.util.ThermalFuel; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.item.chemistry.AgriculturalChem; -import gtPlusPlus.core.item.chemistry.GenericChem; -import gtPlusPlus.core.item.chemistry.IonParticles; -import gtPlusPlus.core.item.chemistry.RocketFuels; -import gtPlusPlus.core.item.crafting.ItemDummyResearch; -import gtPlusPlus.core.item.crafting.ItemDummyResearch.ASSEMBLY_LINE_RESEARCH; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.MISC_MATERIALS; -import gtPlusPlus.core.material.ORES; -import gtPlusPlus.core.material.Particle; -import gtPlusPlus.core.material.nuclear.FLUORIDES; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.EnchantingUtils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.core.util.reflect.AddGregtechRecipe; -import gtPlusPlus.everglades.dimension.Dimension_Everglades; -import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; - -public class RECIPES_GREGTECH { - - public static void run() { - Logger.INFO("Loading Recipes through GregAPI for Industrial Multiblocks."); - execute(); - } - - private static void execute() { - cokeOvenRecipes(); - electrolyzerRecipes(); - assemblerRecipes(); - fluidcannerRecipes(); - distilleryRecipes(); - extractorRecipes(); - fluidExtractorRecipes(); - chemicalBathRecipes(); - chemicalReactorRecipes(); - dehydratorRecipes(); - blastFurnaceRecipes(); - - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { - largeChemReactorRecipes(); - fusionRecipes(); - } - - fissionFuelRecipes(); - autoclaveRecipes(); - compressorRecipes(); - mixerRecipes(); - macerationRecipes(); - centrifugeRecipes(); - benderRecipes(); - cyclotronRecipes(); - blastSmelterRecipes(); - //advancedMixerRecipes(); - sifterRecipes(); - electroMagneticSeperatorRecipes(); - extruderRecipes(); - cuttingSawRecipes(); - breweryRecipes(); - laserEngraverRecipes(); - assemblyLineRecipes(); - latheRecipes(); - vacuumFreezerRecipes(); - fluidheaterRecipes(); - chemplantRecipes(); - packagerRecipes(); - - - /** - * Special Recipe handlers - */ - RECIPES_SeleniumProcessing.init(); - RECIPES_RareEarthProcessing.init(); - - - - - - - addFuels(); - } - - - - private static void packagerRecipes() { - - - } - - private static void chemplantRecipes() { - - //This is subsequently absorbed in water to form nitric acid and nitric oxide. - //3 NO2 (g) + H2O (l) → 2 HNO3 (aq) + NO (g) (ΔH = −117 kJ/mol) - //The nitric oxide is cycled back for reoxidation. Alternatively, if the last step is carried out in air: - //4 NO2 (g) + O2 (g) + 2 H2O (l) → 4 HNO3 (aq) - - // Advanced method for Nitric Acid Production - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(17), - CI.getPinkCatalyst(0), - }, - new FluidStack[] { - FluidUtils.getFluidStack(GenericChem.Nitrogen_Dioxide, 4000), - FluidUtils.getAir(4000), - FluidUtils.getWater(2000), - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack("nitricacid", 4000), - }, - 10 * 20, - 480, - 3); - - // Advanced recipe for Fluorine Production - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(17), - CI.getPurpleCatalyst(0), - ItemUtils.getSimpleStack(Blocks.sandstone, 64), - ItemUtils.getSimpleStack(Blocks.sandstone, 64) - }, - new FluidStack[] { - FluidUtils.getFluidStack("nitricacid", 4000), - FluidUtils.getAir(8000) - }, - new ItemStack[] { - FLUORIDES.FLUORITE.getOre(8), - FLUORIDES.FLUORITE.getOre(4), - FLUORIDES.FLUORITE.getOre(4), - FLUORIDES.FLUORITE.getOre(4), - }, - new FluidStack[] { - - }, - new int[] { - 0, 2500, 2000, 1500 - }, - 10 * 20, - 1024, - 5); - - // Advanced recipe for Fluorine Production - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(17), - CI.getPurpleCatalyst(0), - ItemUtils.getSimpleStack(Blocks.sand, 64), - ItemUtils.getSimpleStack(Blocks.sand, 64) - }, - new FluidStack[] { - FluidUtils.getFluidStack("nitricacid", 5000), - FluidUtils.getAir(12000) - }, - new ItemStack[] { - FLUORIDES.FLUORITE.getOre(4), - FLUORIDES.FLUORITE.getOre(2), - FLUORIDES.FLUORITE.getOre(2), - FLUORIDES.FLUORITE.getOre(2), - }, - new FluidStack[] { - - }, - new int[] { - 7500, 1500, 1000, 500 - }, - 10 * 20, - 1024, - 5); - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(16), - CI.getPinkCatalyst(0), - }, - new FluidStack[] { - FluidUtils.getFluidStack(GenericChem.Nitrogen_Dioxide, 3000), - FluidUtils.getDistilledWater(5000) - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getFluidStack("nitricacid", 2000), - FluidUtils.getFluidStack(GenericChem.Nitric_Oxide, 1500), - }, - 10 * 20, - 480, - 2); - - // Produce Boric Acid - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(21), - ItemUtils.getItemStackOfAmountFromOreDict("dustBorax", 4), - }, - new FluidStack[] { - FluidUtils.getFluidStack(GenericChem.HydrochloricAcid, 2000) - }, - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("dustSalt", 5), - }, - new FluidStack[] { - FluidUtils.getFluidStack("boricacid", 2000), - FluidUtils.getWater(5000) - - }, - 20 * 30, - MaterialUtils.getVoltageForTier(3), - 3); - - // Produce Th232 - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(22), - ELEMENT.getInstance().THORIUM.getDust(16) - }, - new FluidStack[] { - FluidUtils.getDistilledWater(2000), - FluidUtils.getFluidStack("boricacid", 1500) - }, - new ItemStack[] { - ELEMENT.getInstance().THORIUM.getSmallDust(32), - ELEMENT.getInstance().THORIUM232.getDust(2), - ELEMENT.getInstance().THORIUM232.getSmallDust(2), - ELEMENT.getInstance().URANIUM232.getDust(1), - }, - new FluidStack[] { - - }, - new int[] { - 0, 0, 1000, 250 - }, - 20 * 300, - MaterialUtils.getVoltageForTier(4), - 4); - - // Modify Sapling into Pine Sapling - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedBioCircuit(6), - ItemUtils.getSimpleStack(Blocks.sapling, 32) - }, - new FluidStack[] { - FluidUtils.getFluidStack("fluid.geneticmutagen", 2000), - FluidUtils.getDistilledWater(8000) - }, - new ItemStack[] { - ItemUtils.getSimpleStack(BOP_Block_Registrator.sapling_Pine, 16) - }, - new FluidStack[] { - - }, - 120 * 20, - 64, - 2); - - - // Convert GT++ Plutonium239 into normal Plutonium - if (Materials.Plutonium.mDefaultLocalName.equals("Plutonium 239")) { - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(16), - ELEMENT.getInstance().PLUTONIUM239.getDust(1) - }, - new FluidStack[] { - - }, - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("dustPlutonium", 1) - }, - new FluidStack[] { - - }, - 5 * 20, - 1, - 2); - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(16), - ELEMENT.getInstance().PLUTONIUM239.getSmallDust(1) - }, - new FluidStack[] { - - }, - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallPlutonium", 1) - }, - new FluidStack[] { - - }, - 5 * 20, - 1, - 2); - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(16), - ELEMENT.getInstance().PLUTONIUM239.getTinyDust(1) - }, - new FluidStack[] { - - }, - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyPlutonium", 1) - }, - new FluidStack[] { - - }, - 5 * 20, - 1, - 2); - } - - int aLaureniumTier = ALLOY.LAURENIUM.vTier; - // Adding Recipes for Casings - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(12), - CI.getTieredMachineCasing(aLaureniumTier-1), - ALLOY.LAURENIUM.getPlate(8), - CI.getGear(aLaureniumTier, 2) - }, - new FluidStack[] { - CI.getTieredFluid(aLaureniumTier, 2 * 144), - CI.getAlternativeTieredFluid(aLaureniumTier-1, 4 * 144), - CI.getTertiaryTieredFluid(aLaureniumTier-2, 6 * 144) - }, - new ItemStack[] { - GregtechItemList.Casing_Machine_Custom_3.get(1) - }, - new FluidStack[] { - - }, - 20 * 20, - MaterialUtils.getVoltageForTier(aLaureniumTier-2), - 5); - - int aBotmiumTier = ALLOY.BOTMIUM.vTier; - // Adding Recipes for Casings - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(12), - CI.getTieredMachineCasing(aBotmiumTier-1), - ALLOY.BOTMIUM.getPlate(8), - CI.getGear(aBotmiumTier, 2) - }, - new FluidStack[] { - CI.getTieredFluid(aBotmiumTier, 2 * 144), - CI.getAlternativeTieredFluid(aBotmiumTier-1, 4 * 144), - CI.getTertiaryTieredFluid(aBotmiumTier-2, 6 * 144) - }, - new ItemStack[] { - GregtechItemList.Casing_Machine_Custom_4.get(1) - }, - new FluidStack[] { - - }, - 20 * 20, - MaterialUtils.getVoltageForTier(aBotmiumTier-2), - 6); - - - //Refine GT HF into GT++ HF - if (FluidUtils.doesHydrofluoricAcidGtExist()) { - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(22), - }, - new FluidStack[] { - FluidUtils.getHydrofluoricAcid(2000), - FluidUtils.getHydrofluoricAcidGT(5000) - }, - new ItemStack[] { - - }, - new FluidStack[] { - FluidUtils.getHydrofluoricAcid(6000) - }, - 30 * 20, - 480, - 3); - } - - } - - private static void fluidheaterRecipes() { - GT_Values.RA.addFluidHeaterRecipe(CI.getNumberedCircuit(20), FluidUtils.getWater(1000), FluidUtils.getHotWater(1000), 30, 30); - - } - - private static void vacuumFreezerRecipes() { - GT_Values.RA.addVacuumFreezerRecipe(GregtechItemList.Bomb_Cast_Molten.get(1), GregtechItemList.Bomb_Cast_Set.get(1), 20 * 30); - } - - private static void latheRecipes() { - - GT_Values.RA.addLatheRecipe( - ALLOY.EGLIN_STEEL.getBlock(1), - GregtechItemList.Bomb_Cast_Mold.get(1), - null, - 20 * 60 * 15, - 120); - - GT_Values.RA.addLatheRecipe( - GregtechItemList.Bomb_Cast_Set.get(1), - GregtechItemList.Bomb_Cast_Broken.get(2), - ItemUtils.getSimpleStack(ModItems.itemBombCasing, 2), - 20 * 60 * 5, - 30); - - } - - private static void fusionRecipes() { - - /** - * Adds a Fusion reactor Recipe - * - * @param aInput1 = first Input (not null, and respects StackSize) - * @param aInput2 = second Input (not null, and respects StackSize) - * @param aOutput = Output of the Fusion (can be null, and respects StackSize) - * @param aFusionDurationInTicks = How many ticks the Fusion lasts (must be > 0) - * @param aFusionEnergyPerTick = The EU generated per Tick (can even be negative!) - * @param aEnergyNeededForStartingFusion = EU needed for heating the Reactor up (must be >= 0) - */ - - //Hydrogen Plasma - /*CORE.RA.addFusionReactorRecipe( - Particle.getIon("Hydrogen", 0), - Particle.getIon("Hydrogen", 0), - Materials.Hydrogen.getPlasma(1), - 5000, - 16, - 4096, - 40000000);*/ - - - //Hypogen Creation - GT_Values.RA.addFusionReactorRecipe( - Materials.Neutronium.getMolten(128), - ALLOY.QUANTUM.getFluidStack(256), - ELEMENT.STANDALONE.HYPOGEN.getFluidStack(4), - 2048 * 4, - (int) MaterialUtils.getVoltageForTier(9), - 600000000 * 2); - - //Rhugnor - GT_Values.RA.addFusionReactorRecipe( - GenericChem.TEFLON.getFluidStack(64), - ALLOY.PIKYONIUM.getFluidStack(128), - ELEMENT.STANDALONE.RHUGNOR.getFluidStack(8), - 2048 * 4, - (int) MaterialUtils.getVoltageForTier(7), - 150000000 * 2); - - } - - private static void assemblyLineRecipes() { - - - - ItemStack[] aCoilWire = new ItemStack[] { - ItemUtils.simpleMetaStack("miscutils:itemDehydratorCoilWire", 0, GTNH ? 64 : 32), - ItemUtils.simpleMetaStack("miscutils:itemDehydratorCoilWire", 1, GTNH ? 64 : 32), - ItemUtils.simpleMetaStack("miscutils:itemDehydratorCoilWire", 2, GTNH ? 64 : 32), - ItemUtils.simpleMetaStack("miscutils:itemDehydratorCoilWire", 3, GTNH ? 64 : 32), - }; - - - - - //Containment Casings - CORE.RA.addAssemblylineRecipe( - ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_1_CONTAINMENT, 1), - 20 * 60 * 30, - new Object[] { - ItemList.Field_Generator_IV.get(GTNH ? 32 : 16), - ItemList.Electric_Motor_EV.get(GTNH ? 64 : 32), - ItemList.Energy_LapotronicOrb.get(GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.cableGt12, 7, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.wireGt16, 6, GTNH ? 64 : 32), - ItemUtils.getOrePrefixStack(OrePrefixes.plate, Materials.Naquadria, GTNH ? 64 : 16), - ELEMENT.getInstance().GADOLINIUM.getDust(GTNH ? 32 : 8), - ELEMENT.getInstance().SAMARIUM.getDust(GTNH ? 16 : 4), - ALLOY.ARCANITE.getGear(GTNH ? 8 : 2), - new Object[] {CI.getTieredCircuitOreDictName(5), 64}, - new Object[] {CI.getTieredCircuitOreDictName(6), 32}, - new Object[] {CI.getTieredCircuitOreDictName(7), 16}, - GregtechItemList.Laser_Lens_Special.get(1), - aCoilWire[3] - }, - new FluidStack[] { - ALLOY.NITINOL_60.getFluidStack(144 * 9 * (GTNH ? 4 : 2)), - ALLOY.ENERGYCRYSTAL.getFluidStack(144 * 9 * (GTNH ? 8 : 4)), - ALLOY.TUMBAGA.getFluidStack(144 * 9 * (GTNH ? 32 : 8)), - ALLOY.NICHROME.getFluidStack(144 * 1 * (GTNH ? 16 : 4)), - }, - ItemUtils.getSimpleStack(ModBlocks.blockCasings3Misc, 15, 32), - 20 * 60 * 10 * (GTNH ? 2 : 1), - (int) MaterialUtils.getVoltageForTier(6)); - - //Slow Fusion Controller - /*CORE.RA.addAssemblylineRecipe( - GregtechItemList.COMET_Cyclotron.get(1), - 20 * 60 * 30, - new ItemStack[] { - CI.getFieldGenerator(6, GTNH ? 32 : 8), - ItemList.Electric_Motor_EV.get(GTNH ? 32 : 8), - ItemList.Tool_Scanner.get(GTNH ? 4 : 2), - CI.getTieredComponent(OrePrefixes.cableGt12, 6, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.wireGt16, 5, GTNH ? 64 : 32), - CI.getTieredComponent(OrePrefixes.plate, 6, GTNH ? 64 : 32), - ELEMENT.getInstance().GADOLINIUM.getDust(GTNH ? 32 : 8), - ELEMENT.getInstance().SAMARIUM.getDust(GTNH ? 16 : 4), - ALLOY.INCOLOY_MA956.getGear(GTNH ? 8 : 2), - CI.getTieredComponent(OrePrefixes.circuit, 5, GTNH ? 64 : 32), - CI.getTieredComponent(OrePrefixes.circuit, 6, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 16 : 8) - }, - new FluidStack[] { - CI.getTieredFluid(6, 144 * 9 * (GTNH ? 8 : 4)), - CI.getTertiaryTieredFluid(6, 144 * 9 * (GTNH ? 8 : 4)), - CI.getAlternativeTieredFluid(6, 144 * 9 * (GTNH ? 8 : 4)), - CI.getTieredFluid(5, 144 * 9 * (GTNH ? 16 : 8)), - }, - GregtechItemList.Miniature_Fusion.get(1), - 20 * 60 * 5 * (GTNH ? 2 : 1), - (int) MaterialUtils.getVoltageForTier(7));*/ - - - //Plasma Tank - /*CORE.RA.addAssemblylineRecipe( - ItemUtils.getOrePrefixStack(OrePrefixes.pipeMedium, Materials.Superconductor, 1), - 20 * 60 * 5, - new ItemStack[] { - CI.getTieredComponent(OrePrefixes.plate, 5, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.circuit, 5, GTNH ? 16 : 4), - CI.getTieredComponent(OrePrefixes.pipeHuge, 5, GTNH ? 16 : 4), - CI.getTieredComponent(OrePrefixes.cableGt08, 7, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.gearGt, 6, GTNH ? 8 : 4), - aCoilWire[2] - }, - new FluidStack[] { - CI.getTieredFluid(4, 144 * 9 * (GTNH ? 16 : 8)), - CI.getTertiaryTieredFluid(4, 144 * 9 * (GTNH ? 16 : 8)), - CI.getAlternativeTieredFluid(4, 144 * 9 * (GTNH ? 16 : 8)), - - }, - GregtechItemList.Plasma_Tank.get(1), - 20 * 60 * 1 * (GTNH ? 2 : 1), - (int) MaterialUtils.getVoltageForTier(5));*/ - - // Turbine Automation Port - CORE.RA.addAssemblylineRecipe( - ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_8_TURBINE_AUTOMATION, 1), - 20 * 60 * 60 * 24, - new Object[] { - CI.getTieredMachineHull(8, 4), - CI.getConveyor(8, GTNH ? 24 : 12), - CI.getElectricMotor(7, GTNH ? 32 : 16), - CI.getElectricPiston(7, GTNH ? 16 : 4), - CI.getEnergyCore(6, GTNH ? 8 : 2), - CI.getPlate(8, GTNH ? 24 : 12), - CI.getTieredComponent(OrePrefixes.screw, 8, GTNH ? 48 : 24), - CI.getTieredComponent(OrePrefixes.bolt, 7, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.rod, 6, GTNH ? 12 : 6), - new Object[] {CI.getTieredCircuitOreDictName(7), 20}, - CI.getTieredComponent(OrePrefixes.rotor, 6, GTNH ? 16 : 8), - }, - new FluidStack[] { - CI.getTieredFluid(8, 144 * 32), - CI.getAlternativeTieredFluid(7, 144 * 16), - CI.getTertiaryTieredFluid(7, 144 * 16), - ALLOY.BABBIT_ALLOY.getFluidStack(128 * 144), - ALLOY.ZERON_100.getFluidStack(144 * 64) - - }, - GregtechItemList.Hatch_Input_TurbineHousing.get(4), - 20 * 60 * 60 * (GTNH ? 2 : 1), - (int) MaterialUtils.getVoltageForTier(8)); - - - /* - * Contianment casings - */ - - ItemStack[] aGemCasings = new ItemStack[] { - GregtechItemList.Battery_Casing_Gem_1.get(1), - GregtechItemList.Battery_Casing_Gem_2.get(1), - GregtechItemList.Battery_Casing_Gem_3.get(1), - GregtechItemList.Battery_Casing_Gem_4.get(1), - }; - ItemStack[] aResearch = new ItemStack[] { - Particle.getBaseParticle(Particle.UNKNOWN), - GregtechItemList.Battery_Casing_Gem_1.get(1), - GregtechItemList.Battery_Casing_Gem_2.get(1), - GregtechItemList.Battery_Casing_Gem_3.get(1), - }; - - int aCasingSlot = 0; - for (int j = 6; j < 10; j++) { - CORE.RA.addAssemblylineRecipe( - aResearch[aCasingSlot], - 20 * 60 * 60, - new ItemStack[] { - CI.getTieredComponent(OrePrefixes.plate, j-1,16), - CI.getTieredComponent(OrePrefixes.cableGt08, j+1,(GTNH ? 32 : 16)), - CI.getTieredComponent(OrePrefixes.gearGt, j-1, 4), - aCoilWire[aCasingSlot] - }, - new FluidStack[] { - CI.getTieredFluid(j, 144 *(GTNH ? 8 : 4)), - CI.getTertiaryTieredFluid(j-2, 144 * (GTNH ? 16 : 8)), - CI.getAlternativeTieredFluid(j, 144 * (GTNH ? 16 : 12)), - - }, - aGemCasings[aCasingSlot++], - 20 * 60 * 1 * (GTNH ? 2 : 1), - (int) MaterialUtils.getVoltageForTier(j)); - } - - /* - * Gem Battery Recipes - */ - - ItemStack[] aGemBatteries = new ItemStack[] { - GregtechItemList.Battery_Gem_1.get(1), - GregtechItemList.Battery_Gem_2.get(1), - GregtechItemList.Battery_Gem_3.get(1), - GregtechItemList.Battery_Gem_4.get(1), - }; - - ItemStack[] aExoticInputs = new ItemStack[] { - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.ELECTRON), - Particle.getBaseParticle(Particle.CHARM), - Particle.getBaseParticle(Particle.GRAVITON) - }; - aCasingSlot = 0; - for (int j = 6; j < 10; j++) { - CORE.RA.addAssemblylineRecipe( - aExoticInputs[aCasingSlot], - 20 * 60 * 60 * 5, - new Object[] { - aGemCasings[aCasingSlot], - ItemUtils.getSimpleStack(aExoticInputs[aCasingSlot], 16), - CI.getTieredComponent(OrePrefixes.plate, j, 16), - new Object[] {CI.getTieredCircuitOreDictName(j), 8}, - CI.getTieredComponent(OrePrefixes.wireGt16, j+1, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.bolt, j, GTNH ? 8 : 4), - CI.getTieredComponent(OrePrefixes.screw, j-1, GTNH ? 8 : 4), - }, - new FluidStack[] { - CI.getTieredFluid(j, 144 * 1 * (GTNH ? 16 : 8)), - CI.getTertiaryTieredFluid(j-2, 144 * 2 * (GTNH ? 16 : 8)), - CI.getAlternativeTieredFluid(j, 144 * (GTNH ? 16 : 8)), - CI.getTertiaryTieredFluid(j-1, 144 * (GTNH ? 16 : 8)), - }, - aGemBatteries[aCasingSlot++], - 20 * 60 * 1 * (GTNH ? 2 : 1), - (int) MaterialUtils.getVoltageForTier(j)); - } - - - if (LoadedMods.Baubles) { - //Nano Healer - CORE.RA.addAssemblylineRecipe( - ItemUtils.simpleMetaStack(Items.golden_apple, 1, 1), - 20 * 60 * 10, - new Object[] { - ItemUtils.getSimpleStack(aGemCasings[2], GTNH ? 4 : 2), - CI.getTieredComponent(OrePrefixes.plate, 8, GTNH ? 32 : 16), - new Object[] {CI.getTieredCircuitOreDictName(7), 16}, - CI.getTieredComponent(OrePrefixes.cableGt02, 7, GTNH ? 16 : 8), - CI.getTieredComponent(OrePrefixes.gearGt, 6, GTNH ? 6 : 3), - CI.getTieredComponent(OrePrefixes.screw, 7, GTNH ? 16 : 8), - CI.getTieredComponent(OrePrefixes.bolt, 5, GTNH ? 24 : 12), - CI.getTieredComponent(OrePrefixes.frameGt, 4, GTNH ? 12 : 6), - aCoilWire[3] - }, - new FluidStack[] { - CI.getTieredFluid(7, 144 * 18 * (GTNH ? 16 : 8)), - CI.getTertiaryTieredFluid(7, 144 * 18 * (GTNH ? 16 : 8)), - CI.getAlternativeTieredFluid(6, 144 * 18 * (GTNH ? 16 : 8)), - CI.getAlternativeTieredFluid(7, 144 * 18 * (GTNH ? 16 : 8)), - - }, - ItemUtils.getItemStackFromFQRN("miscutils:personalHealingDevice", 1), - 20 * 60 * 30 * (GTNH ? 2 : 1), - (int) MaterialUtils.getVoltageForTier(7)); - - - - //Charge Pack LuV-UV - - ItemStack[] aChargeResearch = new ItemStack[] { - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore7", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore8", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore9", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore10", 1), - }; - - ItemStack[] aChargeOutputs = new ItemStack[] { - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_1, 1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_2, 1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_3, 1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_4, 1), - }; - - int aCurrSlot = 0; - for (int h = 6; h < 10; h++) { - CORE.RA.addAssemblylineRecipe( - aChargeResearch[aCurrSlot], - 20 * 60 * 10 * (aCurrSlot + 1), - new Object[] { - ItemUtils.getSimpleStack(aGemBatteries[aCurrSlot],2), - aCoilWire[aCurrSlot], - CI.getTieredComponent(OrePrefixes.plate, h, 8), - new Object[] {CI.getTieredCircuitOreDictName(h), 4}, - new Object[] {CI.getTieredCircuitOreDictName(h-1), 8}, - CI.getTieredComponent(OrePrefixes.cableGt12, h-1, 16), - CI.getTieredComponent(OrePrefixes.screw, h, GTNH ? 16 : 8), - CI.getTieredComponent(OrePrefixes.bolt, h-2, GTNH ? 32 : 16), - CI.getFieldGenerator(h, 1), - }, - new FluidStack[] { - CI.getTieredFluid(h, 144 * 4 * (GTNH ? 8 : 4)), - CI.getTertiaryTieredFluid(h-1, 144 * 4 * (GTNH ? 8 : 4)), - CI.getAlternativeTieredFluid(h-1, 144 * 4 * (GTNH ? 8 : 4)), - CI.getAlternativeTieredFluid(h-2, 144 * 4 * (GTNH ? 8 : 4)), - }, - aChargeOutputs[aCurrSlot], - 20 * 60 * 30 * (GTNH ? 2 : 1) * (aCurrSlot+1), - (int) MaterialUtils.getVoltageForTier(h)); - aCurrSlot++; - } - - //Cloaking device - CORE.RA.addAssemblylineRecipe( - ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_9_CLOAKING, 1), - 20 * 60 * 10, - new Object[] { - ItemUtils.getSimpleStack(aGemCasings[3], GTNH ? 4 : 2), - CI.getTieredComponent(OrePrefixes.plate, 8, GTNH ? 32 : 16), - new Object[] {CI.getTieredCircuitOreDictName(7), 16}, - CI.getTieredComponent(OrePrefixes.cableGt04, 8, GTNH ? 16 : 8), - CI.getTieredComponent(OrePrefixes.gearGt, 7, GTNH ? 6 : 3), - CI.getTieredComponent(OrePrefixes.screw, 8, GTNH ? 16 : 8), - CI.getTieredComponent(OrePrefixes.bolt, 7, GTNH ? 24 : 12), - CI.getTieredComponent(OrePrefixes.frameGt, 5, GTNH ? 12 : 6), - aCoilWire[3] - }, - new FluidStack[] { - CI.getTieredFluid(8, 144 * 18 * (GTNH ? 16 : 8)), - CI.getTertiaryTieredFluid(8, 144 * 18 * (GTNH ? 16 : 8)), - CI.getAlternativeTieredFluid(7, 144 * 18 * (GTNH ? 16 : 8)), - CI.getAlternativeTieredFluid(8, 144 * 18 * (GTNH ? 16 : 8)), - - }, - ItemUtils.getItemStackFromFQRN("miscutils:personalCloakingDevice", 1), - 20 * 60 * 30 * (GTNH ? 2 : 1), - (int) MaterialUtils.getVoltageForTier(8)); - } - - - - - - - - - - } - - private static void laserEngraverRecipes() { - - // Laser Sensors and Emitters together - GregtechItemList[] aTransParts = new GregtechItemList[] { - GregtechItemList.TransmissionComponent_ULV, - GregtechItemList.TransmissionComponent_LV, - GregtechItemList.TransmissionComponent_MV, - GregtechItemList.TransmissionComponent_HV, - GregtechItemList.TransmissionComponent_EV, - GregtechItemList.TransmissionComponent_IV, - GregtechItemList.TransmissionComponent_LuV, - GregtechItemList.TransmissionComponent_ZPM, - GregtechItemList.TransmissionComponent_UV, - GregtechItemList.TransmissionComponent_MAX, - }; - for (int i=0;i<10;i++) { - GT_Values.RA.addLaserEngraverRecipe( - CI.getEmitter(i, 2), - CI.getSensor(i, 2), - aTransParts[i].get(1), - 20 * 5, - MaterialUtils.getVoltageForTier(i)); - } - - - - GT_Values.RA.addLaserEngraverRecipe( - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Tungsten, 6L), - GregtechItemList.Laser_Lens_Special.get(0), - ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN.getDust(1), - 20 * 60 * 3, - MaterialUtils.getVoltageForTier(ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN.vTier)); - - GT_Values.RA.addLaserEngraverRecipe( - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Titanium, 8L), - GregtechItemList.Laser_Lens_Special.get(0), - ELEMENT.STANDALONE.ASTRAL_TITANIUM.getDust(1), - 20 * 60 * 2, - MaterialUtils.getVoltageForTier(ELEMENT.STANDALONE.ASTRAL_TITANIUM.vTier)); - - GT_Values.RA.addLaserEngraverRecipe( - ALLOY.NITINOL_60.getBlock(2), - GregtechItemList.Laser_Lens_Special.get(0), - ELEMENT.STANDALONE.ADVANCED_NITINOL.getBlock(1), - 20 * 60 * 1, - MaterialUtils.getVoltageForTier(ELEMENT.STANDALONE.ADVANCED_NITINOL.vTier)); - - GT_Values.RA.addLaserEngraverRecipe( - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Glass, 64L), - GregtechItemList.Laser_Lens_Special.get(0), - ELEMENT.STANDALONE.CHRONOMATIC_GLASS.getDust(1), - 20 * 60 * 5, - MaterialUtils.getVoltageForTier(ELEMENT.STANDALONE.CHRONOMATIC_GLASS.vTier)); - - - GT_Values.RA.addLaserEngraverRecipe( - CI.getFieldGenerator(6, 1), - CI.getEmitter(7, 2), - ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_1_CONTAINMENT, 1), - 20 * 60 * 5, - MaterialUtils.getVoltageForTier(5)); - - // Distillus Upgrade Chip - GT_Values.RA.addLaserEngraverRecipe( - GregtechItemList.Laser_Lens_WoodsGlass.get(0), - ItemUtils.simpleMetaStack(AgriculturalChem.mBioCircuit, 20, 1), - GregtechItemList.Distillus_Upgrade_Chip.get(1), - 20 * 60 * 5, - MaterialUtils.getVoltageForTier(5)); - - - - - } - - private static void breweryRecipes() { - CORE.RA.addBrewingRecipe(14, EnchantingUtils.getMobEssence(100), EnchantingUtils.getLiquidXP(1332), 100, 120, false); - CORE.RA.addBrewingRecipe(14, EnchantingUtils.getLiquidXP(1332), EnchantingUtils.getMobEssence(100), 100, 120, false); - CORE.RA.addBrewingRecipe(ItemUtils.getSimpleStack(BOP_Block_Registrator.sapling_Rainforest), FluidUtils.getFluidStack("water", 100), FluidUtils.getFluidStack("biomass", 100), 1200, 3, false); - CORE.RA.addBrewingRecipe(ItemUtils.getSimpleStack(BOP_Block_Registrator.sapling_Rainforest), FluidUtils.getFluidStack("honey", 100), FluidUtils.getFluidStack("biomass", 150), 1200, 3, false); - CORE.RA.addBrewingRecipe(ItemUtils.getSimpleStack(BOP_Block_Registrator.sapling_Rainforest), FluidUtils.getFluidStack("juice", 100), FluidUtils.getFluidStack("biomass", 150), 1200, 3, false); - } - - private static void cuttingSawRecipes() { - GT_Values.RA.addCutterRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("blockMeatRaw", 1), //Input - ItemUtils.getItemStackOfAmountFromOreDict("plateMeatRaw", 9), //Output - null, - 16, //Time - 8); //EU - } - - private static void electrolyzerRecipes() { - GT_Values.RA.addElectrolyzerRecipe( - ItemUtils.getSimpleStack(ModItems.dustDecayedRadium226, 1), - null, - null, - FluidUtils.getFluidStack("radon", !GTNH ? 500 : 144), - null, - null, - null, - null, - null, - null, - new int[]{}, - 20*90, - 240); - } - - private static void extruderRecipes() { - // Osmium Credits - if (GT_Values.RA.addExtruderRecipe(ItemUtils.getItemStackOfAmountFromOreDict("blockOsmium", 1), - ItemList.Shape_Mold_Credit.get(0), ItemList.Credit_Greg_Osmium.get(1), - (int) Math.max(Materials.Osmium.getMass() * 2L * 20, 1), 1024)) { - Logger.WARNING("Extruder Recipe: Osmium Credit - Success"); - } - else { - Logger.WARNING("Extruder Recipe: Osmium Credit - Failed"); - } - } - - private static void blastSmelterRecipes() { - - if (!GTNH) { - // Trinium - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(8), - ELEMENT.getInstance().BISMUTH.getDust(8), - ELEMENT.getInstance().IRON.getDust(64), - ELEMENT.getInstance().CARBON.getDust(16), - ELEMENT.getInstance().GOLD.getDust(16), - ELEMENT.getInstance().SILVER.getDust(16), - ELEMENT.getInstance().OSMIUM.getDust(4), - ELEMENT.getInstance().IRIDIUM.getDust(4), - ELEMENT.getInstance().CERIUM.getDust(8) - }, - FluidUtils.getFluidStack("molten.trinium", 136 * 144), 0, 20 * 3000, - 2040*4); - } - - //Eglin Steel - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(6), - ELEMENT.getInstance().IRON.getDust(4), - ALLOY.KANTHAL.getDust(1), - ALLOY.INVAR.getDust(5), - ELEMENT.getInstance().SULFUR.getDust(1), - ELEMENT.getInstance().CARBON.getDust(1), - ELEMENT.getInstance().SILICON.getDust(4) - }, - ALLOY.EGLIN_STEEL.getFluidStack(16 * 144), - 0, - 20 * 45, - 120); - - //HG1223 - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(5), - ELEMENT.getInstance().MERCURY.getCell(1), - ELEMENT.getInstance().BARIUM.getDust(2), - ELEMENT.getInstance().CALCIUM.getDust(2), - ELEMENT.getInstance().COPPER.getDust(3), - }, - ELEMENT.getInstance().OXYGEN.getFluidStack(8000), - ALLOY.HG1223.getFluidStack(16 * 144), - new ItemStack[] { - CI.emptyCells(1) - }, - new int[] {10000}, //Output Chance - 20 * 120, - 30720); - - //NITINOL_60 - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(2), - ELEMENT.getInstance().TITANIUM.getDust(3), - ELEMENT.getInstance().NICKEL.getDust(2) - }, - ALLOY.NITINOL_60.getFluidStack(5 * 144), - 0, - 20 * 75, - 7680); - - - - - - // Germanium Roasting - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(15), - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedSphalerite", 8), - ELEMENT.getInstance().CARBON.getDust(32), - }, - Materials.SulfuricAcid.getFluid(2000), - ELEMENT.getInstance().GERMANIUM.getFluidStack(288), - 0, - 20 * 300, - 4000); - - - // Ruthenium Roasting - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(19), - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedIridium", 8), - ELEMENT.getInstance().CARBON.getDust(32), - }, - Materials.SulfuricAcid.getFluid(2000), - ELEMENT.getInstance().RUTHENIUM.getFluidStack(288), - 0, - 20 * 300, - 8000); - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(19), - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedOsmium", 8), - ELEMENT.getInstance().CARBON.getDust(32), - }, - Materials.SulfuricAcid.getFluid(2000), - ELEMENT.getInstance().RUTHENIUM.getFluidStack(288), - 0, - 20 * 300, - 8000); - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(19), - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedPlatinum", 8), - ELEMENT.getInstance().CARBON.getDust(32), - }, - Materials.SulfuricAcid.getFluid(2000), - ELEMENT.getInstance().RUTHENIUM.getFluidStack(288), - 0, - 20 * 300, - 8000); - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(19), - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedCooperite", 8), - ELEMENT.getInstance().CARBON.getDust(32), - }, - Materials.SulfuricAcid.getFluid(8000), - ELEMENT.getInstance().RUTHENIUM.getFluidStack(144), - 0, - 20 * 300, - 8000); - - // Rhenium Roasting - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(20), - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedScheelite", 8), - ELEMENT.getInstance().CARBON.getDust(32), - }, - Materials.SulfuricAcid.getFluid(10000), - ELEMENT.getInstance().RHENIUM.getFluidStack(144), - 0, - 20 * 300, - 4000); - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(20), - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedMolybdenite", 8), - ELEMENT.getInstance().CARBON.getDust(32), - }, - Materials.SulfuricAcid.getFluid(7500), - ELEMENT.getInstance().RHENIUM.getFluidStack(144), - 0, - 20 * 300, - 4000); - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(20), - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedMolybdenum", 8), - ELEMENT.getInstance().CARBON.getDust(32), - }, - Materials.SulfuricAcid.getFluid(5000), - ELEMENT.getInstance().RHENIUM.getFluidStack(288), - 0, - 20 * 300, - 4000); - - //Thallium Roasting - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(21), - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedIron", 12), - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedPyrite", 16), - ELEMENT.getInstance().CARBON.getDust(64), - }, - Materials.SulfuricAcid.getFluid(5000), - ELEMENT.getInstance().THALLIUM.getFluidStack(288+144), - 0, - 20 * 300, - 8000); - - - - //Strontium processing - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(21), - MISC_MATERIALS.STRONTIUM_OXIDE.getDust(8), - ELEMENT.getInstance().ALUMINIUM.getDust(8), - }, - null, - ELEMENT.getInstance().OXYGEN.getFluidStack(8000), - new ItemStack[] { - ELEMENT.getInstance().ALUMINIUM.getIngot(8), - ELEMENT.getInstance().STRONTIUM.getIngot(8) - }, - new int[] {10000, 10000}, //Output Chance - 20 * 120, - 480*4); - - - //Wood's Glass Laser Lens - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(5), - ItemList.Shape_Mold_Ball.get(0), - ELEMENT.getInstance().BARIUM.getDust(1), - ELEMENT.getInstance().SODIUM.getDust(1), - ELEMENT.getInstance().SILICON.getDust(2), - ELEMENT.getInstance().NICKEL.getDust(1), - ItemUtils.getItemStackOfAmountFromOreDict("dustGlass", 5) - }, - FluidUtils.getUUM(1000), - null, - new ItemStack[] { - GregtechItemList.Laser_Lens_WoodsGlass.get(1) - }, - new int[] {10000}, - 20 * 300, - (int) GT_Values.V[3]); - - - - } - - private static void fluidcannerRecipes() { - // Sulfuric Acid - CORE.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(Items.glass_bottle), - ItemUtils.getSimpleStack(ModItems.itemSulfuricPotion), FluidUtils.getFluidStack("sulfuricacid", 250), - null); - CORE.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(ModItems.itemSulfuricPotion), - ItemUtils.getSimpleStack(Items.glass_bottle), null, FluidUtils.getFluidStack("sulfuricacid", 250)); - - - - // Hydrofluoric Acid - boolean addedGtExtraction = false; - // Try use Internal GT Fluid first - if (Utils.getGregtechVersionAsInt() >= 50929) { - // Hydrofluoric Acid - CORE.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(Items.glass_bottle), - ItemUtils.getSimpleStack(ModItems.itemHydrofluoricPotion), - FluidUtils.getFluidStack("hydrofluoricacid_gt5u", 250), null); - addedGtExtraction = CORE.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(ModItems.itemHydrofluoricPotion), - ItemUtils.getSimpleStack(Items.glass_bottle), null, FluidUtils.getFluidStack("hydrofluoricacid_gt5u", 250)); - } - //Add a Fill recipe for GT++ Acid - CORE.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(Items.glass_bottle), - ItemUtils.getSimpleStack(ModItems.itemHydrofluoricPotion), - FluidUtils.getFluidStack("hydrofluoricacid", 125), null); - //Add an empty recipe, but only if we didn't for the standard GT HF. Prevents Fluid transformation exploits. - if (!addedGtExtraction) { - CORE.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(ModItems.itemHydrofluoricPotion), ItemUtils.getSimpleStack(Items.glass_bottle), null, FluidUtils.getFluidStack("hydrofluoricacid", 125)); - } - - //Gelid Cryotheum - CORE.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustCryotheum", 1), FluidUtils.getFluidStack("cryotheum", 250), 200, 240); - - //Ender Fluid - CORE.RA.addFluidExtractionRecipe(ItemUtils.getSimpleStack(Items.ender_pearl), FluidUtils.getFluidStack("ender", 250), 100, 30); - - //Blazing Pyrotheum - CORE.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustPyrotheum", 1), FluidUtils.getFluidStack("pyrotheum", 250), 200, 240); - - - } - - private static void cokeOvenRecipes() { - Logger.INFO("Loading Recipes for Industrial Coking Oven."); - // Wood to Charcoal - //Try use all woods found - ArrayList<ItemStack> aLogData = OreDictionary.getOres("logWood"); - if (aLogData.isEmpty()) { - AddGregtechRecipe.addCokeAndPyrolyseRecipes(GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 20L), 20, - GT_ModHandler.getSteam(1000), GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Charcoal, 24L), - FluidUtils.getFluidStack("fluid.coalgas", 1440), 60, 30); } - else { - for (ItemStack stack : aLogData) { - AddGregtechRecipe.addCokeAndPyrolyseRecipes(ItemUtils.getSimpleStack(stack, 20), 20, - GT_ModHandler.getSteam(1000), GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Charcoal, 24L), - FluidUtils.getFluidStack("fluid.coalgas", 1440), 60, 30); - } - } - - // Coal to Coke - AddGregtechRecipe.addCokeAndPyrolyseRecipes(GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 16L), 22, - GT_ModHandler.getSteam(1000), ItemUtils.getItemStackOfAmountFromOreDict("fuelCoke", 10), - FluidUtils.getFluidStack("fluid.coalgas", 2880), 30, 120); - - // Coke & Coal - CORE.RA.addCokeOvenRecipe(GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 12L), - ItemUtils.getItemStackOfAmountFromOreDict("fuelCoke", 6), GT_ModHandler.getSteam(2000), - FluidUtils.getFluidStack("fluid.coalgas", 5040), - ItemUtils.getItemStackOfAmountFromOreDict("fuelCoke", 14), 60 * 20, 240); - - } - - private static void matterFabRecipes() { - Logger.INFO("Loading Recipes for Matter Fabricator."); - - try { - - CORE.RA.addMatterFabricatorRecipe(Materials.UUAmplifier.getFluid(1L), // Fluid - // Input - Materials.UUMatter.getFluid(1L), // Fluid Output - 800, // Time in ticks - 32); // EU - } - catch (final NullPointerException e) { - Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE"); - } - try { - - CORE.RA.addMatterFabricatorRecipe(null, // Fluid Input - Materials.UUMatter.getFluid(1L), // Fluid Output - 3200, // Time in ticks - 32); // EU - } - catch (final NullPointerException e) { - Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE"); - } - - } - - private static void dehydratorRecipes() { - Logger.INFO("Loading Recipes for Chemical Dehydrator."); - - - ItemStack cropGrape = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cropGrape", 1); - ItemStack foodRaisins = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foodRaisins", 1); - - if (cropGrape != null && foodRaisins != null) - CORE.RA.addDehydratorRecipe(new ItemStack[] { - CI.getNumberedBioCircuit(20), - cropGrape - }, // Item - null, // Fluid input (slot 1) - null, // Fluid output (slot 2) - new ItemStack[] { - foodRaisins - }, // Output - new int[] { 10000 }, - 10, // Time in ticks - 2); // EU - - - - // Process Waste Water - CORE.RA.addDehydratorRecipe( - new ItemStack[] { - CI.getNumberedBioCircuit(21) - }, - FluidUtils.getFluidStack("fluid.sludge", 1000), - FluidUtils.getFluidStack("nitricacid", 10), - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyIron", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyCopper", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyTin", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyNickel", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyCobalt", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAluminium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinySilver", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyGold", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustTinyIridium", 1) }, - new int[] { 10, 5, 5, 4, 4, 3, 2, 2, 1 }, - 2 * 20, - 500); // EU - - - CORE.RA.addDehydratorRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(18), - CI.emptyCells(3) - }, - FluidUtils.getFluidStack("fluid.ethylbenzene", 1000), - null, - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("cellStyrene", 1), - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogen", 2) - }, - new int[] {10000, 10000}, - 3 * 20, - 30); - - /* - * Try Add custom Recipe for drying leather - */ - if (LoadedMods.PamsHarvestcraft && Loader.isModLoaded("Backpack")) { - ItemStack aLeather1, aLeather2; - aLeather1 = ItemUtils.getCorrectStacktype("harvestcraft:hardenedleatherItem", 1); - aLeather2 = ItemUtils.getCorrectStacktype("Backpack:tannedLeather", 1); - CORE.RA.addDehydratorRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(18), - aLeather1 - }, - FluidUtils.getFluidStack("fluid.ethylbenzene", 1000), - null, - new ItemStack[] { - aLeather2 - }, - new int[] {10000}, - 5 * 20, - 180); - } - - } - - private static void largeChemReactorRecipes() { - //Styrene - CORE.RA.addMultiblockChemicalRecipe( - new ItemStack[]{CI.getNumberedCircuit(24)}, - new FluidStack[]{ - FluidUtils.getFluidStack("fluid.ethylbenzene", 1000) - }, - new FluidStack[]{ - MaterialUtils.getMaterial("Styrene").getFluid(1000), - Materials.Hydrogen.getGas(2000) - }, - null, - 30, - 30); - //Short-cut Styrene - CORE.RA.addMultiblockChemicalRecipe( - new ItemStack[]{CI.getNumberedCircuit(24)}, - new FluidStack[]{ - MaterialUtils.getMaterial("Ethylene").getGas(500), - MaterialUtils.getMaterial("Benzene").getFluid(500) - }, - new FluidStack[]{ - MaterialUtils.getMaterial("Styrene").getFluid(500), - Materials.Hydrogen.getGas(1000) - }, - null, - 240, - 120); - } - - private static void fissionFuelRecipes() { - try { - - } - catch (final NullPointerException e) { - Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE"); - } - } - - private static void assemblerRecipes() { - // ItemUtils.getSimpleStack(GregtechItemList.Casing_Vanadium_Redox.get(1) - addAR(ItemUtils.getItemStackOfAmountFromOreDict("plateVanadium", 32), - ItemUtils.getItemStackOfAmountFromOreDict("frameGtVanadiumSteel", 8), - FluidUtils.getFluidStack("oxygen", 8000), - ItemUtils.simpleMetaStack(ModItems.itemHalfCompleteCasings, 0, 4), 16, 60); - addAR(ItemUtils.simpleMetaStack(ModItems.itemHalfCompleteCasings, 0, 2), - ItemUtils.getItemStackOfAmountFromOreDict("plateVanadiumGallium", 8), - FluidUtils.getFluidStack("molten.tantalum", 144 * 4), - ItemUtils.simpleMetaStack(ModItems.itemHalfCompleteCasings, 1, 8), 32, 120); - addAR(ItemUtils.simpleMetaStack(ModItems.itemHalfCompleteCasings, 1, 1), - ItemUtils.getItemStackOfAmountFromOreDict("plateDenseLead", 4), FluidUtils.getFluidStack("oxygen", 16000), - ItemUtils.getSimpleStack(GregtechItemList.Casing_Vanadium_Redox.get(1), 1), 64, 240); - - //Tier 2-6 - ItemStack T1 = GregtechItemList.Casing_Vanadium_Redox.get(1); - ItemStack T2 = GregtechItemList.Casing_Vanadium_Redox_IV.get(1); - ItemStack T3 = GregtechItemList.Casing_Vanadium_Redox_LuV.get(1); - ItemStack T4 = GregtechItemList.Casing_Vanadium_Redox_ZPM.get(1); - ItemStack T5 = GregtechItemList.Casing_Vanadium_Redox_UV.get(1); - ItemStack T6 = GregtechItemList.Casing_Vanadium_Redox_MAX.get(1); - - addAR(T1, - ItemUtils.getItemStackOfAmountFromOreDict("plateDenseTitanium", 4), - FluidUtils.getFluidStack("nitrogen", 16000), - T2, 120, 2000); - addAR(T2, - ItemUtils.getItemStackOfAmountFromOreDict("plateDenseTungstenSteel", 4), - FluidUtils.getFluidStack("helium", 8000), - T3, 250, 8000); - addAR(T3, - ItemUtils.getItemStackOfAmountFromOreDict("plateAlloyIridium", 16), - FluidUtils.getFluidStack("argon", 4000), - T4, 500, 32000); - addAR(T4, - ItemUtils.getItemStackOfAmountFromOreDict("plateDenseNaquadah", 4), - FluidUtils.getFluidStack("radon", 4000), - T5, 1000, 128000); - addAR(T5, - ItemUtils.getItemStackOfAmountFromOreDict("plateDenseAmericium", 4), - FluidUtils.getFluidStack("krypton", 500), - T6, 2000, 512000); - - addAR(ItemUtils.getItemStackOfAmountFromOreDict( - "dustClay", 32), - GregtechItemList.Bomb_Cast_Mold.get(0), - FluidUtils.getWater(4000), - GregtechItemList.Bomb_Cast.get(4), - 30, 120); - addAR(ItemUtils.getSimpleStack(Items.redstone, 32), - ItemUtils.getSimpleStack(ModItems.itemRope, 16), - Materials.Glue.getFluid(500), - ItemUtils.getSimpleStack(ModItems.itemDetCable, 24), - 30, - 120); - - - - /*addAR(ItemUtils.getItemStackOfAmountFromOreDict("plateIncoloy020", 16), - ItemUtils.getItemStackOfAmountFromOreDict("frameGtIncoloyMA956", 4), null, - GregtechItemList.Casing_Power_SubStation.get(4), 80, 120);*/ - - - - - - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - GregtechItemList.Casing_Multi_Use.get(1), - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(6), 1), - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(4), 8), - CI.sensor_HV, - CI.emitter_HV, - CI.fieldGenerator_HV, - }, - null, - ItemUtils.getSimpleStack(Dimension_Everglades.blockPortalFrame), - 20*20, - 2048); - - - - - - - - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {ItemUtils.getSimpleStack(ModItems.itemRope, 6)}, null, ItemUtils.getSimpleStack(ModBlocks.blockNet, 2), 1*20, 8); - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {ItemUtils.getSimpleStack(CI.explosiveITNT, 2), ItemUtils.getSimpleStack(CI.explosiveTNT, 4), ELEMENT.getInstance().SULFUR.getDust(2), ELEMENT.getInstance().IRON.getFrameBox(1)}, null, ItemUtils.getSimpleStack(ModBlocks.blockMiningExplosive, 3), 5*20, 60); - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {ItemUtils.getSimpleStack(Items.nether_star), ItemUtils.getItemStackOfAmountFromOreDict("plateTungstenSteel", 8), ItemUtils.getItemStackOfAmountFromOreDict("stickBlackSteel", 8)}, null, ItemUtils.getSimpleStack(ModBlocks.blockWitherGuard, 32), 30*20, 500); - - - ItemStack aFluidReg1 = ItemUtils.getValueOfItemList("FluidRegulator_LV", ItemList.Pump_LV).get(1); - ItemStack aFluidReg2 = ItemUtils.getValueOfItemList("FluidRegulator_MV", ItemList.Pump_MV).get(1); - ItemStack aFluidReg3 = ItemUtils.getValueOfItemList("FluidRegulator_HV", ItemList.Pump_HV).get(1); - ItemStack aFluidReg4 = ItemUtils.getValueOfItemList("FluidRegulator_EV", ItemList.Pump_EV).get(1); - - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - aFluidReg1, - CI.electricMotor_LV, - CI.getTieredComponent(OrePrefixes.bolt, 1, GTNH ? 8 : 4), - ItemUtils.getItemStackOfAmountFromOreDict("ringBrass", 1), - ItemUtils.getItemStackOfAmountFromOreDict("stickBrass", 1), - ItemUtils.getItemStackOfAmountFromOreDict("plateSteel", 2) - }, null, ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 1, 1), 10*20, 30); - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - aFluidReg2, - CI.electricMotor_MV, - CI.getTieredComponent(OrePrefixes.bolt, 2, GTNH ? 8 : 4), - ItemUtils.getItemStackOfAmountFromOreDict("ringInvar", 1), - ItemUtils.getItemStackOfAmountFromOreDict("stickInvar", 1), - ItemUtils.getItemStackOfAmountFromOreDict("plateAluminium", 2) - }, null, ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 2, 1), 10*20*2, 120); - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - aFluidReg3, - CI.electricMotor_HV, - CI.getTieredComponent(OrePrefixes.bolt, 3, GTNH ? 8 : 4), - ItemUtils.getItemStackOfAmountFromOreDict("ringChrome", 1), - ItemUtils.getItemStackOfAmountFromOreDict("stickChrome", 1), - ItemUtils.getItemStackOfAmountFromOreDict("plateStainlessSteel", 2) - }, null, ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 3, 1), 10*20*3, 480); - - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - aFluidReg4, - CI.electricMotor_EV, - CI.getTieredComponent(OrePrefixes.bolt, 4, GTNH ? 8 : 4), - ItemUtils.getItemStackOfAmountFromOreDict("ringTitanium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("stickTitanium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("plateTungstenSteel", 2) - }, null, ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 4, 1), 10*20*4, 1960); - - GT_Values.RA.addAssemblerRecipe(ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 1, 1), CI.getNumberedCircuit(20), ItemUtils.simpleMetaStack(ModItems.toolGregtechPump, 1000, 1), 30, 30); - GT_Values.RA.addAssemblerRecipe(ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 2, 1), CI.getNumberedCircuit(20), ItemUtils.simpleMetaStack(ModItems.toolGregtechPump, 1001, 1), 120, 120); - GT_Values.RA.addAssemblerRecipe(ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 3, 1), CI.getNumberedCircuit(20), ItemUtils.simpleMetaStack(ModItems.toolGregtechPump, 1002, 1), 480, 480); - GT_Values.RA.addAssemblerRecipe(ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 4, 1), CI.getNumberedCircuit(20), ItemUtils.simpleMetaStack(ModItems.toolGregtechPump, 1003, 1), 1820, 1820); - - - - - - //Low tier Charge Packs - - final ItemStack[] aPackBatteries = new ItemStack[] { - ItemList.Battery_RE_LV_Lithium.get(4), - ItemList.Battery_RE_MV_Lithium.get(4), - ItemList.Battery_RE_HV_Lithium.get(4), - GregtechItemList.Battery_RE_EV_Lithium.get(4), - ItemList.Energy_LapotronicOrb.get(4), - }; - final ItemStack[] aPackPlates = new ItemStack[] { - CI.getPlate(1,8), - CI.getPlate(2,8), - CI.getPlate(3,8), - CI.getPlate(4,8), - CI.getPlate(5,8), - }; - final ItemStack[] aPackWire = new ItemStack[] { - CI.getTieredComponent(OrePrefixes.wireGt02, 1,6), - CI.getTieredComponent(OrePrefixes.wireGt04, 2,6), - CI.getTieredComponent(OrePrefixes.wireGt08, 3,6), - CI.getTieredComponent(OrePrefixes.wireGt12, 4,6), - CI.getTieredComponent(OrePrefixes.wireGt16, 5,6), - }; - final ItemStack[] aPackCircuit = new ItemStack[] { - CI.getTieredComponent(OrePrefixes.circuit, 1,4), - CI.getTieredComponent(OrePrefixes.circuit, 2,4), - CI.getTieredComponent(OrePrefixes.circuit, 3,4), - CI.getTieredComponent(OrePrefixes.circuit, 4,4), - CI.getTieredComponent(OrePrefixes.circuit, 5,4), - }; - final ItemStack[] aPackRing = new ItemStack[] { - CI.getTieredComponent(OrePrefixes.ring, 1,12), - CI.getTieredComponent(OrePrefixes.ring, 2,12), - CI.getTieredComponent(OrePrefixes.ring, 3,12), - CI.getTieredComponent(OrePrefixes.ring, 4,12), - CI.getTieredComponent(OrePrefixes.ring, 5,12), - }; - final ItemStack[] aPackOutput = new ItemStack[] { - ItemUtils.getSimpleStack(ModItems.itemChargePack_Low_1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_Low_2), - ItemUtils.getSimpleStack(ModItems.itemChargePack_Low_3), - ItemUtils.getSimpleStack(ModItems.itemChargePack_Low_4), - ItemUtils.getSimpleStack(ModItems.itemChargePack_Low_5) - }; - - for (int i = 1; i < 6; i++) { - - int aAS = i-1; - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - aPackPlates[aAS], - aPackRing[aAS], - aPackWire[aAS], - aPackCircuit[aAS], - aPackBatteries[aAS], - CI.getSensor(i, GTNH ? 4 : 2), - }, - CI.getTieredFluid(i, (144 * (GTNH ? 4 : 2))), - aPackOutput[aAS], - 30 * 20 * i, - (int) GT_Values.V[i]); - } - - - if (!GTNH) { - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.WroughtIron, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.WroughtIron, 2L), GregtechItemList.Fluid_Cell_1L.get(1L, new Object[0]), 50, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Bronze, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Bronze, 2L), GregtechItemList.Fluid_Cell_16L.get(1L, new Object[0]), 50, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Brass, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Brass, 2L), GregtechItemList.Fluid_Cell_36L.get(1L, new Object[0]), 75, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Invar, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Invar, 2L), GregtechItemList.Fluid_Cell_144L.get(1L, new Object[0]), 75, 32); - - } else { - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.WroughtIron, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.WroughtIron, 4L), GregtechItemList.Fluid_Cell_1L.get(1L, new Object[0]), 50, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Bronze, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Bronze, 4L), GregtechItemList.Fluid_Cell_16L.get(1L, new Object[0]), 50, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Brass, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Brass, 4L), GregtechItemList.Fluid_Cell_36L.get(1L, new Object[0]), 75, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Invar, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Invar, 4L), GregtechItemList.Fluid_Cell_144L.get(1L, new Object[0]), 75, 32); - } - } - - - if (LoadedMods.Baubles) { - - - - // Turbine Housing Research Page - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - ItemUtils.getGregtechCircuit(17), - ItemUtils.getItemStackOfAmountFromOreDict("plateRefinedTrinium", GTNH ? 64 : 32), - CI.getSensor(6, GTNH ? 6 : 3), - CI.getBolt(7, GTNH ? 64 : 32), - ItemUtils.getItemStackOfAmountFromOreDict("wireFinePlatinum", GTNH ? 64 : 32), - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(7), GTNH ? 12 : 6) - }, - CI.getAlternativeTieredFluid(7, 144 * 32), - ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_8_TURBINE_AUTOMATION, 1), - 20 * 60 * 5, - (int) GT_Values.V[6]); - - // Cloaking Device Research Page - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - ItemUtils.getGregtechCircuit(17), - ItemUtils.getSimpleStack(ModItems.itemCircuitLFTR, 4), - CI.getFieldGenerator(6, GTNH ? 16 : 8), - ItemUtils.getItemStackOfAmountFromOreDict("wireFinePalladium", GTNH ? 32 : 16), - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(6), GTNH ? 12 : 6) - }, - CI.getAlternativeTieredFluid(7, 144 * 32), - ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_9_CLOAKING, 1), - 20 * 60 * 10, - (int) GT_Values.V[7]); - - - // Supreme Pizza Gloves - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - ItemUtils.getGregtechCircuit(19), - ItemUtils.getSimpleStack(ModItems.itemRope, GTNH ? 32 : 16), - ItemUtils.getItemStackOfAmountFromOreDict("gearGtSmallWroughtIron", GTNH ? 8 : 4), - ItemUtils.getItemStackOfAmountFromOreDict("wireFineCopper", GTNH ? 32 : 16), - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(1), GTNH ? 2 : 1) - }, - FluidUtils.getFluidStack("molten.rubber", 2000), - ItemUtils.getSimpleStack(ModItems.itemPersonalFireProofDevice), - 20 * 60 * 5, - 30); - } - - - - - - } - - private static boolean addAR(final ItemStack inputA, final ItemStack inputB, final FluidStack inputFluidA, - final ItemStack outputA, final int seconds, final int voltage) { - // return GT_Values.RA.addAssemblerRecipe(inputA, inputB, outputA, - // seconds*20, voltage); - return GT_Values.RA.addAssemblerRecipe(inputA, inputB, inputFluidA, outputA, seconds * 20, voltage); - } - - private static void distilleryRecipes() { - Logger.INFO("Registering Distillery/Distillation Tower Recipes."); - GT_Values.RA.addDistilleryRecipe(ItemList.Circuit_Integrated.getWithDamage(0L, 4L, new Object[0]), - FluidUtils.getFluidStack("air", 1000), FluidUtils.getFluidStack("helium", 1), 400, 30, false); - GT_Values.RA.addDistillationTowerRecipe(FluidUtils.getFluidStack("air", 20000), - FluidUtils.getFluidStackArray("helium", 25), ItemUtils.getSimpleStack(ModItems.itemHydrogenBlob, 1), - 200, 60); - - // Apatite Distillation - /* - * so if you dissolve aparite in sulphuric acid you'll get a mixture of - * SO2, H2O, HF and HCl - */ - final FluidStack[] apatiteOutput = { - FluidUtils.getFluidStack("sulfurousacid", 3800), - FluidUtils.getFluidStack("hydrogenchloride", 1000), - FluidUtils.getFluidStack("hydrofluoricacid", 400) }; - GT_Values.RA.addDistillationTowerRecipe( - FluidUtils.getFluidStack("sulfuricapatite", 5200), - apatiteOutput, null, - 45 * 20, - 120); - - final FluidStack[] sulfurousacidOutput = { - FluidUtils.getFluidStack("sulfurdioxide", 500), - FluidUtils.getFluidStack("water", 500) }; - GT_Values.RA.addDistillationTowerRecipe( - FluidUtils.getFluidStack("sulfurousacid", 1000), - sulfurousacidOutput, - null, - 10 * 20, - 60); - - final FluidStack[] sulfurdioxideOutput = { - FluidUtils.getFluidStack("oxygen", 2000) - }; - GT_Values.RA.addDistillationTowerRecipe( - FluidUtils.getFluidStack("sulfurdioxide", 144 * 3), - sulfurdioxideOutput, - ItemUtils.getItemStackOfAmountFromOreDict("dustSulfur", 1), - 5 * 20, - 30); - } - - private static void addFuels() { - Logger.INFO("Registering New Fuels."); - - if (!GTNH) { - GT_Values.RA.addFuel(ItemUtils.simpleMetaStack("EnderIO:bucketFire_water", 0, 1), null, 120, 0); - GT_Values.RA.addFuel(ItemUtils.simpleMetaStack("EnderIO:bucketRocket_fuel", 0, 1), null, 112, 0); - GT_Values.RA.addFuel(ItemUtils.simpleMetaStack("EnderIO:bucketHootch", 0, 1), null, 36, 0); - } - - HotFuel.addNewHotFuel(GT_ModHandler.getLava(83), GT_Values.NF, - new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("nuggetCopper", 1), - ItemUtils.getItemStackOfAmountFromOreDict("nuggetTin", 1), - ItemUtils.getItemStackOfAmountFromOreDict("nuggetGold", 1), - ItemUtils.getItemStackOfAmountFromOreDict("nuggetSilver", 1), - ItemUtils.getItemStackOfAmountFromOreDict("nuggetTantalum", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallTungstate", 1), - ItemUtils.getSimpleStack(Blocks.obsidian) }, - new int[] { 2000, 1000, 250, 250, 250, 250, 500 }, 0); - - HotFuel.addNewHotFuel(FluidUtils.getFluidStack("ic2pahoehoelava", 83), GT_Values.NF, - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("nuggetBronze", 1), - ItemUtils.getItemStackOfAmountFromOreDict("nuggetElectrum", 1), - ItemUtils.getItemStackOfAmountFromOreDict("nuggetTantalum", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallTungstate", 1), - ItemUtils.getSimpleStack(Blocks.obsidian) }, - new int[] { 750, 250, 250, 250, 1850 }, 0); - - /* - * HotFuel.addNewHotFuel( FluidUtils.getFluidStack("ic2hotcoolant", - * 100), GT_Values.NF, new ItemStack[]{}, new int[]{}, 0); - */ - - ThermalFuel.addSteamTurbineFuel(FluidUtils.getFluidStack("steam", 1024)); - - // CORE.RA.addFuel(UtilsItems.simpleMetaStack("EnderIO:bucketRocket_fuel", - // 0, 1), null, 112, 0); - GT_Values.RA.addFuel(ItemUtils.getSimpleStack(Items.lava_bucket), null, 32, 2); - GT_Values.RA.addFuel(ItemUtils.getIC2Cell(2), null, 32, 2); - GT_Values.RA.addFuel(ItemUtils.getIC2Cell(11), null, 24, 2); - // System.exit(1); - } - - private static void extractorRecipes() { - Logger.INFO("Registering Extractor Recipes."); - GT_ModHandler.addExtractionRecipe(GregtechItemList.Battery_RE_EV_Sodium.get(1L, new Object[0]), - ItemList.Battery_Hull_HV.get(4L, new Object[0])); - GT_ModHandler.addExtractionRecipe(GregtechItemList.Battery_RE_EV_Cadmium.get(1L, new Object[0]), - ItemList.Battery_Hull_HV.get(4L, new Object[0])); - GT_ModHandler.addExtractionRecipe(GregtechItemList.Battery_RE_EV_Lithium.get(1L, new Object[0]), - ItemList.Battery_Hull_HV.get(4L, new Object[0])); - } - - private static void fluidExtractorRecipes() { - - } - - private static void chemicalBathRecipes() { - - } - - private static void centrifugeRecipes() { - - } - - private static void mixerRecipes() { - - GT_Values.RA.addMixerRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("dustSulfur", 1), - null, - null, - null, - FluidUtils.getFluidStack("oxygen", 2000), - FluidUtils.getFluidStack("sulfurdioxide", 3000), - null, - 600, - 60); - - } - - private static void chemicalReactorRecipes() { - - //Bombs - GT_Values.RA.addChemicalRecipe( - ItemUtils.getSimpleStack(ModItems.itemBombCasing, 4), - ItemUtils.getSimpleStack(RocketFuels.Ammonium_Nitrate_Dust, 8), - Materials.Fuel.getFluid(1000), - null, - ItemUtils.getSimpleStack(ModItems.itemBombUnf, 4), - 300 * 20); - - GT_Values.RA.addChemicalRecipe( - ItemUtils.getSimpleStack(ModItems.itemBombUnf, 4), - ItemUtils.getSimpleStack(ModItems.itemDetCable, 4), - FluidUtils.getFluidStack(RocketFuels.Kerosene, 100), - null, - ItemUtils.getSimpleStack(ModItems.itemBomb, 4), - 10 * 20); - - GT_Values.RA.addChemicalRecipe( - CI.getNumberedAdvancedCircuit(21), - ItemUtils.getItemStackOfAmountFromOreDict("dustApatite", 32), - FluidUtils.getFluidStack("sulfuricacid", 4000), - FluidUtils.getFluidStack("sulfuricapatite", 8000), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallSulfur", 8), - 20 * 20); - - } - - private static void blastFurnaceRecipes() { - - //public boolean addBlastRecipe( - //ItemStack aInput1, ItemStack aInput2, - //FluidStack aFluidInput, FluidStack aFluidOutput, - //ItemStack aOutput1, ItemStack aOutput2, - //int aDuration, int aEUt, int aLevel) - - - //Synthetic Graphite - GT_Values.RA.addBlastRecipe( - CI.getNumberedCircuit(22), - ALLOY.SILICON_CARBIDE.getDust(16), - ELEMENT.getInstance().NITROGEN.getFluidStack(4000), - GT_Values.NF, - ItemUtils.getItemStackOfAmountFromOreDict("dustGraphite", 8), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallSilicon", 8), - 60 * 20, - MaterialUtils.getVoltageForTier(GTNH ? 5 : 4), - 4500); - - //Bomb Casings - GT_Values.RA.addBlastRecipe( - GregtechItemList.Bomb_Cast.get(4), - ALLOY.STEEL.getDust(16), - ELEMENT.getInstance().OXYGEN.getFluidStack(2000), - GT_Values.NF, - GregtechItemList.Bomb_Cast_Molten.get(4), - null, - 4 * 60 * 20, - MaterialUtils.getVoltageForTier(GTNH ? 3 : 2), - 2800); - - //Krypton Processing - if (ModItems.itemHotTitaniumIngot != null) { - GT_Values.RA.addBlastRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("ingotTitanium", 1), - CI.getNumberedCircuit(16), - GT_Values.NF, - GT_Values.NF, - ItemUtils.getItemStackOfAmountFromOreDict("ingotHotTitanium", 1), - null, - 10 * 20, - 500, - Materials.Titanium.mBlastFurnaceTemp); - } - - } - - private static void autoclaveRecipes() { - - } - - private static void benderRecipes() { - - if (CORE.ConfigSwitches.enableMultiblock_PowerSubstation) { - GT_Values.RA.addBenderRecipe(ItemUtils.getItemStackOfAmountFromOreDict("ingotVanadium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("plateVanadium", 1), 8, 16); - } - } - - private static void compressorRecipes() { - GT_ModHandler.addCompressionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustSmallClay", 4), - ItemUtils.getItemStackOfAmountFromOreDict("plateClay", 1)); - GT_ModHandler.addCompressionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustSmallMeatRaw", 4), - ItemUtils.getItemStackOfAmountFromOreDict("plateMeatRaw", 1)); - GT_ModHandler.addCompressionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustMeatRaw", 9), - ItemUtils.getItemStackOfAmountFromOreDict("blockMeatRaw", 1)); - - CORE.RA.addCompressorRecipe(ItemList.FusionComputer_UV.get(9), GregtechItemList.Compressed_Fusion_Reactor.get(1), (int) GT_Values.V[7], (int) GT_Values.V[8]); - } - - private static void macerationRecipes() { - - GT_ModHandler.addPulverisationRecipe(ItemUtils.getItemStackOfAmountFromOreDict("blockMeatRaw", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustMeatRaw", 9)); - - GT_ModHandler.addPulverisationRecipe(GregtechItemList.Bomb_Cast_Broken.get(1), - ItemUtils.getItemStackOfAmountFromOreDict("dustClay", 3)); - - if (ItemUtils.simpleMetaStack("chisel:limestone", 0, 1) != null) { - GT_ModHandler.addPulverisationRecipe(ItemUtils.getItemStackOfAmountFromOreDict("limestone", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustCalcite", 4)); - } - - } - - private static void cyclotronRecipes() { - - // Polonium - CORE.RA.addCyclotronRecipe(CI.getNumberedCircuit(0), FluidUtils.getFluidStack("molten.bismuth", 1), - new ItemStack[] { GregtechItemList.Pellet_RTG_PO210.get(1) }, null, new int[] { 100 }, 20 * 300 * 100, 2040 * 4, - 500 * 20); - - // Americium - CORE.RA.addCyclotronRecipe(CI.getNumberedCircuit(0), FluidUtils.getFluidStack("molten.americium", 1), - new ItemStack[] { GregtechItemList.Pellet_RTG_AM241.get(4) }, null, new int[] { 2500 }, 20 * 300 * 100, 1020 * 4, - 500 * 20); //PO Special Value - - // Strontium u235 - CORE.RA.addCyclotronRecipe(CI.getNumberedCircuit(0), FluidUtils.getFluidStack("molten.uranium235", 10), - new ItemStack[] { GregtechItemList.Pellet_RTG_SR90.get(1) }, null, new int[] { 570 }, 20 * 300 * 100, 1020 * 4, - 500 * 20); //PO Special Value - - // Strontium u233 - CORE.RA.addCyclotronRecipe(CI.getNumberedCircuit(0), FluidUtils.getFluidStack("molten.uranium233", 10), - new ItemStack[] { GregtechItemList.Pellet_RTG_SR90.get(1) }, null, new int[] { 660 }, 20 * 300 * 100, 1020 * 4, - 500 * 20); //PO Special Value - - // Strontium pu239 - CORE.RA.addCyclotronRecipe(CI.getNumberedCircuit(0), FluidUtils.getFluidStack("molten.plutonium239", 10), - new ItemStack[] { GregtechItemList.Pellet_RTG_SR90.get(1) }, null, new int[] { 220 }, 20 * 300 * 100, 1020 * 4, - 500 * 20); //PO Special Value - - // Plutonium - CORE.RA.addCyclotronRecipe(CI.getNumberedCircuit(0), FluidUtils.getFluidStack("molten.plutonium238", 1), - new ItemStack[] { GregtechItemList.Pellet_RTG_PU238.get(2) }, null, new int[] { 780 }, 20 * 300 * 100, 1020 * 4, - 500 * 20); //PO Special Value - - // Neptunium - CORE.RA.addCyclotronRecipe(new ItemStack[] {ELEMENT.getInstance().URANIUM238.getDust(1) }, FluidUtils.getFluidStack("deuterium", 400), - new ItemStack[] {ItemUtils.getSimpleStack(ModItems.dustNeptunium238)}, null, new int[] { 500 }, 20 * 5, 500 * 4, - 500 * 20); //PO Special Value - - - /** - * Particle Science - */ - - - // Quark Smash - CORE.RA.addCyclotronRecipe( - CI.getNumberedCircuit(3), - FluidUtils.getFluidStack("plasma.hydrogen", 100), - new ItemStack[] { - Particle.getBaseParticle(Particle.UP), - Particle.getBaseParticle(Particle.DOWN), - Particle.getBaseParticle(Particle.CHARM), - Particle.getBaseParticle(Particle.STRANGE), - Particle.getBaseParticle(Particle.TOP), - Particle.getBaseParticle(Particle.BOTTOM), - }, - null, - new int[] { 50, 50, 50, 50, 50, 50 }, - 20 * 300 * 9, - (int) MaterialUtils.getVoltageForTier(7), - 750 * 20); - - // Lepton Smash - CORE.RA.addCyclotronRecipe( - CI.getNumberedCircuit(6), - FluidUtils.getFluidStack("plasma.helium", 1500), - new ItemStack[] { - Particle.getBaseParticle(Particle.ELECTRON), - Particle.getBaseParticle(Particle.MUON), - Particle.getBaseParticle(Particle.TAU), - Particle.getBaseParticle(Particle.ELECTRON_NEUTRINO), - Particle.getBaseParticle(Particle.MUON_NEUTRINO), - Particle.getBaseParticle(Particle.TAU_NEUTRINO), - }, - null, - new int[] { 600, 40, 20, 15, 10, 5 }, - 20 * 300 * 8, - (int) MaterialUtils.getVoltageForTier(7), - 750 * 20); - - // Boson Smash - CORE.RA.addCyclotronRecipe( - CI.getNumberedCircuit(9), - FluidUtils.getFluidStack("plasma.helium", 1500), - new ItemStack[] { - Particle.getBaseParticle(Particle.GLUON), - Particle.getBaseParticle(Particle.PHOTON), - Particle.getBaseParticle(Particle.Z_BOSON), - Particle.getBaseParticle(Particle.W_BOSON), - Particle.getBaseParticle(Particle.HIGGS_BOSON), - }, - null, - new int[] { 160, 260, 150, 150, 1 }, - 20 * 300 * 6, - (int) MaterialUtils.getVoltageForTier(7), - 750 * 20); - - - // Mixed Smash 1 - CORE.RA.addCyclotronRecipe( - CI.getNumberedCircuit(12), - FluidUtils.getFluidStack("plasma.beryllium", 2500), - new ItemStack[] { - Particle.getBaseParticle(Particle.GRAVITON), - Particle.getBaseParticle(Particle.ETA_MESON), - Particle.getBaseParticle(Particle.PION), - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.NEUTRON), - Particle.getBaseParticle(Particle.LAMBDA), - Particle.getBaseParticle(Particle.OMEGA), - Particle.getBaseParticle(Particle.HIGGS_BOSON), - }, - null, - new int[] { 10, 20, 20, 10, 10, 5, 5, 2 }, - 17 * 247 * 32, - (int) MaterialUtils.getVoltageForTier(8), - 750 * 20); - - // Graviton Smash - CORE.RA.addCyclotronRecipe( - CI.getNumberedCircuit(15), - FluidUtils.getFluidStack("plasma.hydrogen", GTNH ? 50 : 10), - new ItemStack[] { - Particle.getBaseParticle(Particle.GRAVITON), - Particle.getBaseParticle(Particle.UNKNOWN) - }, - null, - new int[] {15, 100}, - 20 * (GTNH ? 90 : 30), - (int) MaterialUtils.getVoltageForTier(6), - 1000 * 20); - - FluidStack aPlasma = Materials.Duranium.getMolten(GTNH ? 40 : 10); - FluidStack aPlasma_NULL = Materials._NULL.getPlasma(1); - - if (aPlasma == null || aPlasma.isFluidEqual(aPlasma_NULL)) { - aPlasma = Materials.Americium.getMolten(GTNH ? 20 : 5); - } - - // Quantum Anomaly - CORE.RA.addCyclotronRecipe( - new ItemStack[] { - CI.getNumberedCircuit(24), - Particle.getBaseParticle(Particle.UNKNOWN), - }, - aPlasma, - new ItemStack[] { - GregtechItemList.Laser_Lens_Special.get(1) - }, - null, - new int[] {100}, - 20 * (GTNH ? 300 : 60), - (int) MaterialUtils.getVoltageForTier(6), - 1000 * 20); - - /* - * Ions - */ - - int IonCount = 2; - int tenCountA = (GTNH ? 2 : 1); - int tenCountB = 0; - for (String y : IonParticles.MetaToNameMap.values()) { - if (y.toLowerCase().contains("hydrogen")) { - continue; - } - FluidStack aPlasma2 = FluidUtils.getFluidStack("plasma."+y.toLowerCase(), 2); - Materials aTestMat = MaterialUtils.getMaterial(y); - FluidStack aPlasma3 = aTestMat != null ? aTestMat.getPlasma(2) : aPlasma2; - - // Ionize Plasma - if ((aPlasma2 != null && !aPlasma2.isFluidEqual(aPlasma_NULL)) || (aPlasma3 != null && !aPlasma3.isFluidEqual(aPlasma_NULL))) { - CORE.RA.addCyclotronRecipe( - CI.getNumberedCircuit(1+(tenCountA-1)), - aPlasma2 != null ? aPlasma2 : aPlasma3, - new ItemStack[] { - Particle.getIon(y, 1), - Particle.getIon(y, 2), - Particle.getIon(y, 3), - Particle.getIon(y, -1), - Particle.getIon(y, -2), - Particle.getIon(y, -3), - Particle.getIon(y, 1), - Particle.getIon(y, 2), - Particle.getIon(y, -1), - }, - null, - new int[] { 275, 250, 225, 275, 250, 225, 275, 250, 275}, - 20 * 20 * (IonCount++) * tenCountA, - (int) MaterialUtils.getVoltageForTier(7), - 1500 * 20 * tenCountA); - } - else { - Logger.INFO("Plasma for "+y+" does not exist, please report this to Alkalus."); - } - - if (tenCountB == 12) { - tenCountB = 0; - tenCountA++; - } - else { - tenCountB++; - } - } - - // Generate Hydrogen Ion Recipe - CORE.RA.addCyclotronRecipe( - CI.getNumberedCircuit(24), - FluidUtils.getWildcardFluidStack("hydrogen", 1000), - new ItemStack[] { - Particle.getIon("Hydrogen", 1), - Particle.getIon("Hydrogen", 2), - Particle.getIon("Hydrogen", 3), - Particle.getIon("Hydrogen", 1), - Particle.getIon("Hydrogen", 2), - Particle.getIon("Hydrogen", 3), - Particle.getIon("Hydrogen", -1), - Particle.getIon("Hydrogen", -2), - Particle.getIon("Hydrogen", -3) - }, - null, - new int[] { 125, 125, 125, 125, 125, 125, 125, 125, 125 }, - 20 * 20, - (int) MaterialUtils.getVoltageForTier(6), - 15000); - - // Generate Hydrogen Plasma Recipe - CORE.RA.addCyclotronRecipe( - new ItemStack[] { - Particle.getIon("Hydrogen", 0), - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogen", 1) - }, - null, - new ItemStack[] { - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.NEUTRON), - Particle.getBaseParticle(Particle.ELECTRON), - Particle.getBaseParticle(Particle.UNKNOWN), - Particle.getBaseParticle(Particle.UNKNOWN), - Particle.getBaseParticle(Particle.UNKNOWN), - CI.emptyCells(1) - }, - FluidUtils.getFluidStack("plasma.hydrogen", 1), - new int[] { 250, 250, 250, 500, 500, 500, 10000 }, - 20 * 60 * 2, - (int) MaterialUtils.getVoltageForTier(6), - 750 * 20); - - - // Generate Protons Easily - CORE.RA.addCyclotronRecipe( - new ItemStack[] { - CI.getNumberedCircuit(20), - Particle.getIon("Hydrogen", 0) - }, - FluidUtils.getWildcardFluidStack("hydrogen", 100), - new ItemStack[] { - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.PROTON), - }, - null, - new int[] { 750, 750, 750, 750, 750, 750, 750, 750, 750 }, - 20 * 20, - (int) MaterialUtils.getVoltageForTier(6), - 15000); - - CORE.RA.addCyclotronRecipe( - new ItemStack[] { - CI.getNumberedCircuit(22), - Particle.getBaseParticle(Particle.UNKNOWN), - }, - FluidUtils.getWildcardFluidStack("hydrogen", 100), - new ItemStack[] { - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.PROTON), - Particle.getBaseParticle(Particle.PROTON), - }, - null, - new int[] { 375, 375, 375, 375, 375, 375, 375, 375, 375 }, - 20 * 20, - (int) MaterialUtils.getVoltageForTier(6), - 15000); - - - //Create Strange Dust - CORE.RA.addCyclotronRecipe( - new ItemStack[] { - ELEMENT.getInstance().PLUTONIUM238.getDust(1), - Particle.getBaseParticle(Particle.UNKNOWN), - Particle.getBaseParticle(Particle.UNKNOWN), - Particle.getBaseParticle(Particle.UNKNOWN), - Particle.getBaseParticle(Particle.UNKNOWN), - Particle.getBaseParticle(Particle.UNKNOWN), - Particle.getBaseParticle(Particle.UNKNOWN), - Particle.getBaseParticle(Particle.UNKNOWN), - Particle.getBaseParticle(Particle.UNKNOWN), - }, - FluidUtils.getFluidStack(FluidUtils.getWildcardFluidStack("ender", 1000), 1000), - new ItemStack[] { - ORES.DEEP_EARTH_REACTOR_FUEL_DEPOSIT.getDust(1) - }, - null, - new int[] { 2500 }, - 20 * 60 * 15, - (int) MaterialUtils.getVoltageForTier(7), - 15000); - - - - - - } - - private static void sifterRecipes() { - - } - - private static void electroMagneticSeperatorRecipes() { - - if (!GTNH) { - // Trinium - GT_Values.RA.addElectromagneticSeparatorRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedNaquadah", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustNaquadah", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallNaquadahEnriched", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallTrinium", 1), new int[] { 10000, 2500, 5000 }, - 20 * 20, 24); - - // Trinium - GT_Values.RA.addElectromagneticSeparatorRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedIridium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustIridium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallOsmium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallTrinium", 1), new int[] { 10000, 2500, 5000 }, - 20 * 20, 24); - - // Trinium - GT_Values.RA.addElectromagneticSeparatorRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedWulfenite", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustWulfenite", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallTrinium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallTrinium", 1), new int[] { 10000, 3000, 3000 }, - 20 * 20, 24); - } - - } - - private static void advancedMixerRecipes() { - // HgBa2Ca2Cu3O8 - /*CORE.RA.addMixerRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("cellMercury", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustBarium", 2), - ItemUtils.getItemStackOfAmountFromOreDict("dustCalcium", 2), - ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 3), - FluidUtils.getFluidStack("oxygen", 8000), - null, CI.emptyCells(1), ALLOY.HG1223.getDust(16), null, null, - 30 * 20, 500); */ - - } - -} diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java deleted file mode 100644 index 1c95467770..0000000000 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java +++ /dev/null @@ -1,515 +0,0 @@ -package gtPlusPlus.core.recipe; - -import static gtPlusPlus.core.lib.CORE.GTNH; -import static gtPlusPlus.core.recipe.common.CI.bitsd; -import static gtPlusPlus.core.util.minecraft.ItemUtils.getSimpleStack; -import static gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits.generatePipeRecipes; -import static gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits.generateWireRecipes; - -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.*; -import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; -import gtPlusPlus.xmod.gregtech.common.helpers.VolumetricFlaskHelper; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; - -public class RECIPES_General { - - static final ItemStack NULL = null; - static ItemStack RECIPE_Paper; - static ItemStack RECIPE_Dirt; - static ItemStack RECIPE_Snow; - static ItemStack RECIPE_Obsidian; - static String RECIPE_LapisDust = "dustLazurite"; - static ItemStack OUTPUT_Blueprint; - static ItemStack RECIPE_CraftingTable; - static String RECIPE_BronzePlate = "plateBronze"; - static ItemStack RECIPE_BasicCasingIC2; - static ItemStack OUTPUT_Workbench_Bronze; - static ItemStack RECIPE_HydrogenDust; - - public static void loadRecipes(){ - if (LoadedMods.Gregtech){ - RECIPE_Paper = ItemUtils.getSimpleStack(Items.paper); - RECIPE_Dirt = ItemUtils.getSimpleStack(Blocks.dirt); - RECIPE_Snow = ItemUtils.getSimpleStack(Blocks.snow); - RECIPE_Obsidian = ItemUtils.getSimpleStack(Blocks.obsidian); - RECIPE_CraftingTable = ItemUtils.getSimpleStack(Blocks.crafting_table); - RECIPE_HydrogenDust = ItemUtils.getSimpleStack(ModItems.itemHydrogenBlob); - RECIPE_BasicCasingIC2 = ItemUtils.getItemStackFromFQRN("IC2:blockMachine", 1); - OUTPUT_Workbench_Bronze = ItemUtils.getSimpleStack(ModBlocks.blockWorkbench); - OUTPUT_Blueprint = ItemUtils.getSimpleStack(ModItems.itemBlueprintBase); - run(); - addCompressedObsidian(); - migratedRecipes(); - } - } - - private static void run() { - //Workbench Blueprint - /*RecipeUtils.addShapedRecipe( - RECIPE_Paper, RECIPE_LapisDust, NULL, - RECIPE_Paper, RECIPE_LapisDust, NULL, - RECIPE_LapisDust, RECIPE_LapisDust, NULL, - OUTPUT_Blueprint);*/ - - //Bronze Workbench - /*RecipeUtils.addShapedRecipe( - RECIPE_BronzePlate, RECIPE_CraftingTable, RECIPE_BronzePlate, - RECIPE_BronzePlate, RECIPE_BasicCasingIC2, RECIPE_BronzePlate, - RECIPE_BronzePlate, RECIPE_BronzePlate, RECIPE_BronzePlate, - OUTPUT_Workbench_Bronze);*/ - - //Generates recipes for the Dull shard when TC is not installed. - if (!LoadedMods.Thaumcraft) { - //Dull Shard to Aer - RecipeUtils.addShapedRecipe( - RECIPE_HydrogenDust, RECIPE_HydrogenDust, RECIPE_HydrogenDust, - RECIPE_HydrogenDust, ItemUtils.getSimpleStack(ModItems.shardDull), RECIPE_HydrogenDust, - RECIPE_HydrogenDust, RECIPE_HydrogenDust, RECIPE_HydrogenDust, - ItemUtils.getSimpleStack(ModItems.shardAer)); - //Dull Shard to Ignis - RecipeUtils.addShapedRecipe( - RECIPE_Obsidian, RECIPE_Obsidian, RECIPE_Obsidian, - RECIPE_Obsidian, ItemUtils.getSimpleStack(ModItems.shardDull), RECIPE_Obsidian, - RECIPE_Obsidian, RECIPE_Obsidian, RECIPE_Obsidian, - ItemUtils.getSimpleStack(ModItems.shardIgnis)); - //Dull Shard to Terra - RecipeUtils.addShapedRecipe( - RECIPE_Dirt, RECIPE_Dirt, RECIPE_Dirt, - RECIPE_Dirt, ItemUtils.getSimpleStack(ModItems.shardDull), RECIPE_Dirt, - RECIPE_Dirt, RECIPE_Dirt, RECIPE_Dirt, - ItemUtils.getSimpleStack(ModItems.shardTerra)); - //Dull Shard to Aqua - RecipeUtils.addShapedRecipe( - RECIPE_LapisDust, RECIPE_LapisDust, RECIPE_LapisDust, - RECIPE_LapisDust, ItemUtils.getSimpleStack(ModItems.shardDull), RECIPE_LapisDust, - RECIPE_LapisDust, RECIPE_LapisDust, RECIPE_LapisDust, - ItemUtils.getSimpleStack(ModItems.shardAqua)); - - GT_ModHandler.addPulverisationRecipe(ItemUtils.getSimpleStack(ModItems.shardAer), ItemUtils.getSimpleStack(ModItems.dustAer, 2)); - GT_ModHandler.addPulverisationRecipe(ItemUtils.getSimpleStack(ModItems.shardIgnis), ItemUtils.getSimpleStack(ModItems.dustIgnis, 2)); - GT_ModHandler.addPulverisationRecipe(ItemUtils.getSimpleStack(ModItems.shardTerra), ItemUtils.getSimpleStack(ModItems.dustTerra, 2)); - GT_ModHandler.addPulverisationRecipe(ItemUtils.getSimpleStack(ModItems.shardAqua), ItemUtils.getSimpleStack(ModItems.dustAqua, 2)); - - } - - //Rainforest oak Sapling - if (RecipeUtils.addShapedRecipe( - "stickWood", "stickWood", "stickWood", - "stickWood", "treeSapling", "stickWood", - "stickWood", "dustBone", "stickWood", - ItemUtils.getSimpleStack(BOP_Block_Registrator.sapling_Rainforest))){ - Logger.INFO("Added a recipe for Rainforest oak Saplings."); - } - - //Iron bars - final ItemStack ironBars; - if (CORE.GTNH) { - ironBars = ItemUtils.getItemStackFromFQRN("dreamcraft:item.SteelBars", 1); - } else { - ironBars = ItemUtils.getItemStackFromFQRN("minecraft:iron_bars", 1); - } - - //Fish Trap - if (RecipeUtils.addShapedRecipe( - ironBars, ironBars, ironBars, - ironBars, "frameGtWroughtIron", ironBars, - ironBars, ironBars, ironBars, - ItemUtils.getSimpleStack(ModBlocks.blockFishTrap))){ - Logger.INFO("Added a recipe for the Fish Trap."); - } - - //Small Gear Extruder Shape - if (!CORE.GTNH) { - GT_ModHandler.addCraftingRecipe(GregtechItemList.Shape_Extruder_SmallGear.get(1L, new Object[0]), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"hXS", "XPX", "fXd", Character.valueOf('P'), ItemList.Shape_Extruder_Gear, Character.valueOf('X'), OrePrefixes.plate.get(Materials.Steel), Character.valueOf('S'), OrePrefixes.screw.get(Materials.Steel)}); - - - String[] ironTypes = {"", "Wrought", "Pig", "Any"}; - for (int y=0;y<ironTypes.length;y++) { - //Iron bars - String ironRecipe = "stick"+ironTypes[y]+"Iron"; - if (RecipeUtils.addShapedRecipe( - null, CI.craftingToolWrench, null, - ironRecipe, ironRecipe, ironRecipe, - ironRecipe, ironRecipe, ironRecipe, - ItemUtils.getItemStackFromFQRN("minecraft:iron_bars", 8))) { - Logger.INFO("Re-added old GT recipe for Iron Bars."); - } - } - } - - - //Shaped Crafting for ULV Material Dusts - - //Potin - if (RecipeUtils.addShapelessGregtechRecipe(new Object[] {"dustLead", "dustBronze", "dustTin", - "dustLead", "dustBronze"}, ALLOY.POTIN.getDust(5))){ - Logger.INFO("Added shapeless recipe for Potin Dust."); - } - - //Tumbaga - if (RecipeUtils.addShapelessGregtechRecipe(new Object[] { - "dustGold", "dustGold", "dustCopper"}, ItemUtils.getSimpleStack(ModItems.dustTumbagaMix))){ - Logger.INFO("Added shapeless recipe for Tumbaga Mix."); - } - if (RecipeUtils.addShapelessGregtechRecipe(new Object[] { - ItemUtils.getSimpleStack(ModItems.dustTumbagaMix), - ItemUtils.getSimpleStack(ModItems.dustTumbagaMix), - ItemUtils.getSimpleStack(ModItems.dustTumbagaMix), - "dustGold" - }, - ALLOY.TUMBAGA.getDust(10))){ - Logger.INFO("Added shapeless recipe for Tumbaga Dust."); - } - - - - if (CORE.ConfigSwitches.enableMachine_Pollution) { - RecipeUtils.addShapedRecipe( - CI.craftingToolFile, "plateIron", "stickIron", - "plateIron", "ringIron", "plateIron", - "stickIron", "plateIron", CI.craftingToolHammer_Hard, - ItemUtils.simpleMetaStack(ModItems.itemBasicTurbine, 0, 1) - ); - RecipeUtils.addShapedRecipe( - CI.craftingToolFile, "plateBronze", "stickBronze", - "plateBronze", "ringBronze", "plateBronze", - "stickBronze", "plateBronze", CI.craftingToolHammer_Hard, - ItemUtils.simpleMetaStack(ModItems.itemBasicTurbine, 1, 1) - ); - RecipeUtils.addShapedRecipe( - CI.craftingToolFile, "plateSteel", "stickSteel", - "plateSteel", "ringSteel", "plateSteel", - "stickSteel", "plateSteel", CI.craftingToolHammer_Hard, - ItemUtils.simpleMetaStack(ModItems.itemBasicTurbine, 2, 1) - ); - } - - if (Meta_GT_Proxy.sDoesVolumetricFlaskExist) { - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(4), - ItemUtils.getSimpleStack(Blocks.glass, 16), - ItemUtils.getSimpleStack(Blocks.glowstone, 16), - ItemList.Large_Fluid_Cell_Steel.get(1) - }, - FluidUtils.getFluidStack("molten.borosilicateglass", 2000), - VolumetricFlaskHelper.getLargeVolumetricFlask(2), - 20 * 15, - MaterialUtils.getVoltageForTier(3)); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(5), - ItemUtils.getSimpleStack(Blocks.glass, 64), - ItemUtils.getSimpleStack(Blocks.glowstone, 64), - ItemList.Large_Fluid_Cell_TungstenSteel.get(1) - }, - FluidUtils.getFluidStack("molten.borosilicateglass", 8000), - VolumetricFlaskHelper.getGiganticVolumetricFlask(2), - 20 * 15, - MaterialUtils.getVoltageForTier(5)); - - } - - - - //Mining Explosive - Logger.RECIPE("[Inspection] Explosives"); - if (RecipeUtils.addShapedRecipe( - CI.explosiveITNT, CI.explosiveTNT, CI.explosiveITNT, - CI.explosiveTNT, "frameGtIron", CI.explosiveTNT, - "dustSulfur", CI.explosiveTNT, "dustSulfur", - ItemUtils.getSimpleStack(ModBlocks.blockMiningExplosive, 3))){ - Logger.INFO("Added a recipe for Mining Explosives."); - } - - //Alkalus Coin - if (RecipeUtils.addShapedRecipe( - "gemExquisiteRuby", "gemFlawlessDiamond", "gemExquisiteDiamond", - "gemFlawlessRuby", ItemList.Credit_Greg_Osmium.get(1), "gemFlawlessSapphire", - "gemExquisiteEmerald", "gemFlawlessEmerald", "gemExquisiteSapphire", - ItemUtils.getSimpleStack(ModItems.itemAlkalusDisk))){ - Logger.INFO("Added a recipe for The Alkalus Disk."); - } - - /*final String fancyGems[] = new String[]{"gemExquisiteDiamond", "gemExquisiteEmerald", "gemExquisiteRuby", "gemExquisiteSapphire"}; - final ItemStack gemShards[] = new ItemStack[]{ItemUtils.simpleMetaStack(ModItems.itemGemShards, 0, 1), - ItemUtils.simpleMetaStack(ModItems.itemGemShards, 1, 1), - ItemUtils.simpleMetaStack(ModItems.itemGemShards, 2, 1), - ItemUtils.simpleMetaStack(ModItems.itemGemShards, 3, 1)}; - - int l=0; - for (final String gem : fancyGems){ - GameRegistry.addShapelessRecipe( - gemShards[l], - ItemUtils.getItemStackOfAmountFromOreDict(gem, 1), - new ItemStack(ModItems.itemAlkalusDisk, 1, OreDictionary.WILDCARD_VALUE)); - l++; - }*/ - - Logger.RECIPE("[Inspection] Wither Cage"); - if (RecipeUtils.addShapedRecipe( - "stickBlackSteel", "plateTungstenSteel", "stickBlackSteel", - "plateTungstenSteel", getSimpleStack(Items.nether_star), "plateTungstenSteel", - "stickBlackSteel", "plateTungstenSteel", "stickBlackSteel", - ItemUtils.getSimpleStack(ModBlocks.blockWitherGuard, 32))){ - Logger.INFO("Added a recipe for Wither Cages."); - } - - /*Logger.RECIPE("[Inspection] Xp Converter"); - if (RecipeUtils.addShapedRecipe( - getSimpleStack(Items.experience_bottle), ItemUtils.simpleMetaStack(ModBlocks.blockCompressedObsidian, 2, 1), getSimpleStack(Items.experience_bottle), - ItemUtils.simpleMetaStack(ModBlocks.blockCompressedObsidian, 5, 1), getSimpleStack(Items.nether_star), ItemUtils.simpleMetaStack(ModBlocks.blockCompressedObsidian, 5, 1), - getSimpleStack(Items.experience_bottle), ItemUtils.simpleMetaStack(ModBlocks.blockCompressedObsidian, 2, 1), getSimpleStack(Items.experience_bottle), - ItemUtils.getSimpleStack(ModBlocks.blockXpConverter, 1))){ - Logger.INFO("Added a recipe for XP Converter."); - }*/ - - - - - // Rope/Fiber/Net - if (RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDictNoBroken(CI.craftingToolKnife, 1), ItemUtils.getSimpleStack(Items.reeds)}, - ItemUtils.getSimpleStack(ModItems.itemFiber, 16) - )){ - Logger.INFO("Added a recipe for Fiber."); - } - - if (RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDictNoBroken(CI.craftingToolKnife, 1), ItemUtils.getSimpleStack(Blocks.sapling)}, - ItemUtils.getSimpleStack(ModItems.itemFiber, 32) - )){ - Logger.INFO("Added a recipe for Fiber."); - } - - if (RecipeUtils.addShapedRecipe( - null, ItemUtils.getSimpleStack(ModItems.itemFiber, 1), null, - ItemUtils.getSimpleStack(ModItems.itemFiber, 1), CI.craftingToolKnife, ItemUtils.getSimpleStack(ModItems.itemFiber, 1), - null, ItemUtils.getSimpleStack(ModItems.itemFiber, 1), null, - ItemUtils.getSimpleStack(ModItems.itemRope, 3))){ - Logger.INFO("Added a recipe for Rope."); - } - - Logger.RECIPE("[Inspection] Net"); - if (RecipeUtils.addShapedRecipe( - ItemUtils.getSimpleStack(ModItems.itemRope, 1), ItemUtils.getSimpleStack(ModItems.itemRope, 1), ItemUtils.getSimpleStack(ModItems.itemRope, 1), - ItemUtils.getSimpleStack(ModItems.itemRope, 1), ItemUtils.getSimpleStack(ModItems.itemRope, 1), ItemUtils.getSimpleStack(ModItems.itemRope, 1), - null, null, null, - ItemUtils.getSimpleStack(ModBlocks.blockNet, 2))){ - Logger.INFO("Added a recipe for Nets."); - } - - // Slow Builders Ring - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { ItemUtils.getSimpleStack(Blocks.ice, 8), - ItemUtils.getSimpleStack(ModBlocks.blockNet, 8), ItemUtils.getSimpleStack(Blocks.vine, 8), - ALLOY.TUMBAGA.getRing(1), }, - FluidUtils.getWater(1000), // Fluid - ItemUtils.getItemStackFromFQRN("miscutils:SlowBuildingRing", 1), // Output - 20 * 30, // Dur - 16); // Eu - - // Pest Killer - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedCircuit(16), - CI.getTieredMachineCasing(1), - CI.getElectricPump(2, 1), - CI.getPlate(2, GTNH ? 4 : 2), - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(0), GTNH ? 2 : 1), - }, - FluidUtils.getHotWater(500), // Fluid - ItemUtils.getSimpleStack(ModBlocks.blockPestKiller), // Output - 20 * 60, // Dur - 16); // Eu - - - - - } - - private static boolean addCompressedObsidian(){ - //Invert Obsidian - if (RecipeUtils.addShapedRecipe( - getSimpleStack(Items.redstone), getSimpleStack(Items.glowstone_dust), getSimpleStack(Items.redstone), - getSimpleStack(Items.glowstone_dust), ItemUtils.simpleMetaStack(ModBlocks.blockCompressedObsidian, 1, 1), getSimpleStack(Items.glowstone_dust), - getSimpleStack(Items.redstone), getSimpleStack(Items.glowstone_dust), getSimpleStack(Items.redstone), - ItemUtils.simpleMetaStack(ModBlocks.blockCompressedObsidian, 5, 1))){ - Logger.INFO("Added a recipe for Inverted Obsidian."); - } - - final ItemStack[] mItems = new ItemStack[6]; - mItems[0] = ItemUtils.getSimpleStack(Blocks.obsidian); - for (int r=0;r<5;r++){ - mItems[r+1] = ItemUtils.simpleMetaStack(ModBlocks.blockCompressedObsidian, r, 1); - } - - //Compressed Obsidian 1-5 - for (int r=0;r<5;r++){ - - final ItemStack input = mItems[r]; - final ItemStack output = mItems[r+1]; - - if (RecipeUtils.addShapedRecipe( - input, input, input, - input, input, input, - input, input, input, - output)){ - Logger.INFO("Added a recipe for Compressed Obsidian ["+r+"]"); - } - - if (RecipeUtils.addShapelessGregtechRecipe(new ItemStack[]{output}, ItemUtils.getSimpleStack(input, 9))){ - Logger.INFO("Added a shapeless recipe for Compressed Obsidian ["+r+"]"); - } - - } - return true; - } - - private static void migratedRecipes() { - - RecipeUtils.generateMortarRecipe(ItemUtils.getSimpleStack(ModItems.itemPlateRawMeat), ItemUtils.getItemStackOfAmountFromOreDict("dustMeatRaw", 1)); - - generateWireRecipes(ELEMENT.getInstance().ZIRCONIUM); - generateWireRecipes(ALLOY.HG1223); - generateWireRecipes(ALLOY.LEAGRISIUM); - generateWireRecipes(ALLOY.TRINIUM_TITANIUM); - - GT_Materials[] g = new GT_Materials[] { - GT_Materials.Staballoy, - GT_Materials.Tantalloy60, - GT_Materials.Tantalloy61, - GT_Materials.Void, - GT_Materials.Potin, - GT_Materials.MaragingSteel300, - GT_Materials.MaragingSteel350, - GT_Materials.Inconel690, - GT_Materials.Inconel792, - GT_Materials.HastelloyX, - GT_Materials.TriniumNaquadahCarbonite, - - }; - for (GT_Materials e : g) { - if (e == GT_Materials.Void) { - if (!LoadedMods.Thaumcraft) { - continue; - } - } - int tVoltageMultiplier = (e.mBlastFurnaceTemp >= 2800) ? 64 : 16; - generatePipeRecipes(e.mDefaultLocalName, e.getMass(), tVoltageMultiplier); - } - - Materials[] h = new Materials[] { - Materials.Europium, - Materials.Tungsten, - Materials.DarkSteel, - Materials.Clay, - Materials.Lead, - - }; - - for (Materials e : h) { - if (e == Materials.DarkSteel) { - if (!LoadedMods.EnderIO) { - continue; - } - } - int tVoltageMultiplier = (e.mBlastFurnaceTemp >= 2800) ? 64 : 16; - generatePipeRecipes(e.mDefaultLocalName, e.getMass(), tVoltageMultiplier); - } - - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[4], "rotorGtStainlessSteel", CI.component_Plate[4], - CI.getTieredCircuitOreDictName(3), CI.machineHull_HV, CI.getTieredCircuitOreDictName(3), - CI.component_Plate[4], CI.electricPump_HV, CI.component_Plate[4], - GregtechItemList.Hatch_Air_Intake.get(1L, new Object[0])); - - RecipeUtils.addShapedGregtechRecipe(CI.component_Plate[6], ALLOY.MARAGING250.getGear(1), CI.component_Plate[6], - CI.getTieredCircuitOreDictName(4), GregtechItemList.Casing_AdvancedVacuum.get(1), - CI.getTieredCircuitOreDictName(4), CI.component_Plate[5], ItemList.Hatch_Input_IV.get(1), - CI.component_Plate[5], GregtechItemList.Hatch_Input_Cryotheum.get(1L, new Object[0])); - - RecipeUtils.addShapedGregtechRecipe(CI.component_Plate[5], ALLOY.MARAGING300.getGear(1), CI.component_Plate[5], - CI.getTieredCircuitOreDictName(4), GregtechItemList.Casing_Adv_BlastFurnace.get(1), - CI.getTieredCircuitOreDictName(4), CI.component_Plate[6], ItemList.Hatch_Input_IV.get(1), - CI.component_Plate[6], GregtechItemList.Hatch_Input_Pyrotheum.get(1L, new Object[0])); - - RecipeUtils.addShapedGregtechRecipe(CI.component_Plate[8], ALLOY.PIKYONIUM.getGear(1), CI.component_Plate[9], - CI.getTieredCircuitOreDictName(7), GregtechItemList.Casing_Naq_Reactor_A.get(1), - CI.getTieredCircuitOreDictName(7), CI.component_Plate[9], ItemList.Hatch_Input_ZPM.get(1), - CI.component_Plate[8], GregtechItemList.Hatch_Input_Naquadah.get(1L, new Object[0])); - - - if (PollutionUtils.isPollutionEnabled()) { - GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_LV.get(1L, new Object[0]), bitsd, - new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_LV.get(1), Character.valueOf('P'), - GregtechItemList.Pollution_Cleaner_LV.get(1) }); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_MV.get(1L, new Object[0]), bitsd, - new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_MV.get(1), Character.valueOf('P'), - GregtechItemList.Pollution_Cleaner_MV.get(1) }); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_HV.get(1L, new Object[0]), bitsd, - new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_HV.get(1), Character.valueOf('P'), - GregtechItemList.Pollution_Cleaner_HV.get(1) }); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_EV.get(1L, new Object[0]), bitsd, - new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_EV.get(1), Character.valueOf('P'), - GregtechItemList.Pollution_Cleaner_EV.get(1) }); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_IV.get(1L, new Object[0]), bitsd, - new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_IV.get(1), Character.valueOf('P'), - GregtechItemList.Pollution_Cleaner_IV.get(1) }); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_LuV.get(1L, new Object[0]), bitsd, - new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_LuV.get(1), Character.valueOf('P'), - GregtechItemList.Pollution_Cleaner_LuV.get(1) }); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_ZPM.get(1L, new Object[0]), bitsd, - new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_ZPM.get(1), Character.valueOf('P'), - GregtechItemList.Pollution_Cleaner_ZPM.get(1) }); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_UV.get(1L, new Object[0]), bitsd, - new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_UV.get(1), Character.valueOf('P'), - GregtechItemList.Pollution_Cleaner_UV.get(1) }); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_MAX.get(1L, new Object[0]), bitsd, - new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_MAX.get(1), Character.valueOf('P'), - GregtechItemList.Pollution_Cleaner_MAX.get(1) }); - } - - - - - - - - - - - } - - - - - - - - - -} - - diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_LaserEngraver.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_LaserEngraver.java deleted file mode 100644 index 76182e61d9..0000000000 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_LaserEngraver.java +++ /dev/null @@ -1,135 +0,0 @@ -package gtPlusPlus.core.recipe; - -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.*; -import gregtech.api.interfaces.IOreRecipeRegistrator; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.everglades.dimension.Dimension_Everglades; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; - -public class RECIPES_LaserEngraver implements IOreRecipeRegistrator { - public RECIPES_LaserEngraver() { - OrePrefixes.crafting.add(this); - } - - @Override - public void registerOre(final OrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, final String aModName, final ItemStack aStack) { - if (aOreDictName.equals(OreDictNames.craftingLensBlue.toString())) { - - if (CORE.ConfigSwitches.enableCustomCircuits && !CORE.GTNH){ - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foilYttriumBariumCuprate", 1) != null){ - GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.YttriumBariumCuprate, 2L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Circuit_Parts_Wiring_IV.get(1L, new Object[0]), 64, 480); - } - else { - Logger.INFO("foilYttriumBariumCuprate does not exist within Gregtech, please report this issue to Blood-asp on github."); - Logger.INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); - } - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foilVanadiumGallium", 1) != null){ - GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.VanadiumGallium, 2L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Circuit_Parts_Wiring_IV.get(1L, new Object[0]), 64, 480); - } - else { - Logger.INFO("foilVanadiumGallium does not exist within Gregtech, please report this issue to Blood-asp on github."); - Logger.INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); - } - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foilNiobiumTitanium", 1) != null){ - GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.NiobiumTitanium, 2L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Circuit_Parts_Wiring_IV.get(1L, new Object[0]), 64, 480); - } - else { - Logger.INFO("foilNiobiumTitanium does not exist within Gregtech, please report this issue to Blood-asp on github."); - Logger.INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); - } - } - - - } else if (aOreDictName.equals(OreDictNames.craftingLensYellow.toString())) { - if (CORE.ConfigSwitches.enableCustomCircuits && !CORE.GTNH){ - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foilOsmium", 1) != null){ - GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Osmium, 2L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Circuit_Parts_Wiring_LuV.get(1L, new Object[0]), 64, 1024); - } - else { - Logger.INFO("foilOsmium does not exist within Gregtech, please report this issue to Blood-asp on github."); - Logger.INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); - } - } - - } else if (aOreDictName.equals(OreDictNames.craftingLensCyan.toString())) { - } else if (aOreDictName.equals(OreDictNames.craftingLensRed.toString())) { - } else if (aOreDictName.equals(OreDictNames.craftingLensGreen.toString())) { - if (CORE.ConfigSwitches.enableCustomCircuits && !CORE.GTNH){ - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foilNaquadah", 1) != null){ - GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Naquadah, 2L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Circuit_Parts_Wiring_ZPM.get(1L, new Object[0]), 64, 2000); - } - else { - Logger.INFO("foilNaquadah does not exist within Gregtech, please report this issue to Blood-asp on github."); - Logger.INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); - } - } - } else if (aOreDictName.equals(OreDictNames.craftingLensWhite.toString())) { - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateLithium", 1) != null){ - GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Lithium, 2L), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemUtils.getItemStackOfAmountFromOreDict("plateDoubleLithium7", 1), 4*60*20, 2000); - } - else { - Logger.INFO("plateLithium does not exist within Gregtech, please report this issue to Blood-asp on github."); - Logger.INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); - } - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustLithium", 1) != null){ - GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Lithium, 3L), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemUtils.getItemStackOfAmountFromOreDict("dustLithium7", 1), 2*60*20, 2000); - } - else { - Logger.INFO("dustLithium does not exist within Gregtech, please report this issue to Blood-asp on github."); - Logger.INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); - } - - } - - else if (aOreDictName.equals(OreDictNames.craftingLensLime.toString())) { - //Coil Wires - ItemStack coilWire1 = ItemUtils.getItemStackWithMeta(true, "miscutils:itemDehydratorCoilWire", "coilWire1", 0, 1); - ItemStack coilWire2 = ItemUtils.getItemStackWithMeta(true, "miscutils:itemDehydratorCoilWire:1", "coilWire2", 1, 1); - ItemStack coilWire3 = ItemUtils.getItemStackWithMeta(true, "miscutils:itemDehydratorCoilWire:2", "coilWire3", 2, 1); - ItemStack coilWire4 = ItemUtils.getItemStackWithMeta(true, "miscutils:itemDehydratorCoilWire:3", "coilWire4", 3, 1); - - //Simple Life - String wire = "wireGt02"; - - //Wires to Laser - ItemStack wireT1a = ItemUtils.getItemStackOfAmountFromOreDict(wire+"Aluminium", 1); - ItemStack wireT1b = ItemUtils.getItemStackOfAmountFromOreDict(wire+"Nichrome", 1); - ItemStack wireT2a = ItemUtils.getItemStackOfAmountFromOreDict(wire+"Osmium", 1); - ItemStack wireT2b = ItemUtils.getItemStackOfAmountFromOreDict(wire+"Platinum", 1); - ItemStack wireT3a = ItemUtils.getItemStackOfAmountFromOreDict(wire+"VanadiumGallium", 1); - ItemStack wireT3b = ItemUtils.getItemStackOfAmountFromOreDict(wire+"YttriumBariumCuprate", 1); - ItemStack wireT3c = ItemUtils.getItemStackOfAmountFromOreDict(wire+"NiobiumTitanium", 1); - ItemStack wireT4a = ItemUtils.getItemStackOfAmountFromOreDict(wire+"Naquadah", 1); - - //T1 - GT_Values.RA.addLaserEngraverRecipe(wireT1a, GT_Utility.copyAmount(0L, new Object[]{aStack}), coilWire1, 10*20, 500); - GT_Values.RA.addLaserEngraverRecipe(wireT1b, GT_Utility.copyAmount(0L, new Object[]{aStack}), coilWire1, 10*20, 500); - //T2 - GT_Values.RA.addLaserEngraverRecipe(wireT2a, GT_Utility.copyAmount(0L, new Object[]{aStack}), coilWire2, 20*20, 2000); - GT_Values.RA.addLaserEngraverRecipe(wireT2b, GT_Utility.copyAmount(0L, new Object[]{aStack}), coilWire2, 20*20, 2000); - //T3 - GT_Values.RA.addLaserEngraverRecipe(wireT3a, GT_Utility.copyAmount(0L, new Object[]{aStack}), coilWire3, 30*20, 8000); - GT_Values.RA.addLaserEngraverRecipe(wireT3b, GT_Utility.copyAmount(0L, new Object[]{aStack}), coilWire3, 30*20, 8000); - GT_Values.RA.addLaserEngraverRecipe(wireT3c, GT_Utility.copyAmount(0L, new Object[]{aStack}), coilWire3, 30*20, 8000); - //T4 - GT_Values.RA.addLaserEngraverRecipe(wireT4a, GT_Utility.copyAmount(0L, new Object[]{aStack}), coilWire4, 40*20, 32000); - - - } - - else if (aOreDictName.equals(OreDictNames.craftingLensOrange.toString())) { - GT_Values.RA.addLaserEngraverRecipe(ItemUtils.getSimpleStack(ModItems.itemAlkalusDisk), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemUtils.getSimpleStack(Dimension_Everglades.portalItem), 360*60*20, 4096); - } - - - - } -} diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_MTWRAPPER.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_MTWRAPPER.java deleted file mode 100644 index 0d377f74de..0000000000 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_MTWRAPPER.java +++ /dev/null @@ -1,27 +0,0 @@ -package gtPlusPlus.core.recipe; - -public class RECIPES_MTWRAPPER { - - public static int MT_RECIPES_LOADED = 0; - public static int MT_RECIPES_FAILED = 0; - - public static void run(){ - - } - - public static void addShaped(final Object item_Output, - final Object item_1, final Object item_2, final Object item_3, - final Object item_4, final Object item_5, final Object item_6, - final Object item_7, final Object item_8, final Object item_9){ - - - } - - public static void addShapeless(){ - - } - - - -} - diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java deleted file mode 100644 index 71b4c4ef48..0000000000 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java +++ /dev/null @@ -1,410 +0,0 @@ -package gtPlusPlus.core.recipe; - -import gregtech.api.enums.*; -import gregtech.api.util.GT_OreDictUnificator; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.RecipeUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; - -public class RECIPES_MachineComponents { - - //Wire - public static String wireTier0 = "wireGt01Lead"; - public static String wireTier1 = "wireGt01RedAlloy"; - public static String wireTier6 = "wireGt08NiobiumTitanium"; - public static String wireTier7 = "wireGt08Osmium"; - public static String wireTier8 = "wireGt08Naquadah"; - public static String wireTier9 = "wireGt08Superconductor"; - public static String wireTier10 = "wireGt16Superconductor"; - - //Cable - public static String cableTier0 = "cableGt01Lead"; - public static String cableTier1 = "cableGt01RedAlloy"; - public static String cableTier6 = "cableGt04Tungsten"; - public static String cableTier7 = "cableGt04NiobiumTitanium"; - public static String cableTier8 = "cableGt04Osmium"; - public static String cableTier9 = "cableGt04Naquadah"; - public static String cableTier10 = "wireGt08Superconductor"; - - //Plates - public static String plateTier0 = "plateWroughtIron"; - public static String plateTier7 = "plateChrome"; - public static String plateTier8 = "plateIridium"; - public static String plateTier9 = "plateOsmium"; - public static String plateTier10 = "plateNeutronium"; - - //rods - public static String rodTier0 = "stickWroughtIron"; - public static String rodTier1 = "stickPotin"; - public static String rodTier2 = "stickIronMagnetic"; - public static String rodTier7a = "stickChrome"; - public static String rodTier8a = "stickIridium"; - public static String rodTier9a = "stickOsmium"; - public static String rodTier10a = "stickNeutronium"; - public static String rodTier7b = "stickPlatinum"; - public static String rodTier8b = "stickChrome"; - public static String rodTier9b = "stickIridium"; - public static String rodTier10b = "stickOsmium"; - public static String rodTier7c = "stickTitanium"; - public static String rodTier8c = "stickTungstenSteel"; - public static String rodTier9c = "stickNaquadah"; - public static String rodTier10c = "stickOsmium"; - - //Screws - public static String screwTier0 = "screwPotin"; - public static String screwTier7 = "screwChrome"; - public static String screwTier8 = "screwIridium"; - public static String screwTier9 = "screwOsmium"; - public static String screwTier10 = "screwNeutronium"; - - //Rotors - public static String rotorTier0 = "rotorPotin"; - public static String rotorTier7 = "rotorChrome"; - public static String rotorTier8 = "rotorIridium"; - public static String rotorTier9 = "rotorOsmium"; - public static String rotorTier10 = "rotorNeutronium"; - - //Fluid Pipe - public static String pipeTier0 = "pipeSmallLead"; - public static String pipeTier7 = "pipeHugeSteel"; - public static String pipeTier8 = "pipeHugeStainlessSteel"; - public static String pipeTier9 = "pipeHugeTitanium"; - public static String pipeTier10 = "pipeHugeTungstenSteel"; - - //Rubber Ring/Plate - public static String itemRubberRing = "ringRubber"; - public static String plateRubber = "plateRubber"; - - //Circuits - public static String circuitTier0 = "circuitPrimitive"; - public static String circuitTier1 = "circuitBasic"; - public static String circuitTier6 = "circuitMaster"; - public static String circuitTier7 = "circuitUltimate"; - public static String circuitTier8 = "circuitSuperconductor"; - public static String circuitTier9 = "circuitInfinite"; - public static String circuitTier10 = "circuitQuantum"; - - //small gears - public static String smallGearTier0 = "gearGtSmallWroughtIron"; - public static String smallGearTier7 = "gearGtSmallChrome"; - public static String smallGearTier8 = "gearGtSmallIridium"; - public static String smallGearTier9 = "gearGtSmallOsmium"; - public static String smallGearTier10 = "gearGtSmallNeutronium"; - - public static final void loadRecipes(){ - Logger.INFO("Loading Recipes for the Various Circuits and Machine components."); - if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - run(); - } - else { - onlyULVComponents(); - if (!CORE.GTNH) { - onlyMaxComponents(); - } - } - gregtechMachinePhase(); - } - - private static void run(){ - //Electric Motors - RecipeUtils.addShapedGregtechRecipe( - cableTier7, wireTier7, rodTier7a, - wireTier7, rodTier7b, wireTier7, - rodTier7a, wireTier7, cableTier7, - CI.electricMotor_LuV); - RecipeUtils.addShapedGregtechRecipe( - cableTier8, wireTier8, rodTier8a, - wireTier8, rodTier8b, wireTier8, - rodTier8a, wireTier8, cableTier8, - CI.electricMotor_ZPM); - RecipeUtils.addShapedGregtechRecipe( - cableTier9, wireTier9, rodTier9a, - wireTier9, rodTier9b, wireTier9, - rodTier9a, wireTier9, cableTier9, - CI.electricMotor_UV); - RecipeUtils.addShapedGregtechRecipe( - cableTier10, wireTier10, rodTier10a, - wireTier10, rodTier10b, wireTier10, - rodTier10a, wireTier10, cableTier10, - CI.electricMotor_MAX); - - //Electric Pump - RecipeUtils.addShapedGregtechRecipe( - cableTier7, rotorTier7, itemRubberRing, - CI.craftingToolScrewdriver, pipeTier7, CI.craftingToolWrench, - itemRubberRing, CI.electricMotor_LuV, cableTier7, - CI.electricPump_LuV); - RecipeUtils.addShapedGregtechRecipe( - cableTier8, rotorTier8, itemRubberRing, - CI.craftingToolScrewdriver, pipeTier8, CI.craftingToolWrench, - itemRubberRing, CI.electricMotor_ZPM, cableTier8, - CI.electricPump_ZPM); - RecipeUtils.addShapedGregtechRecipe( - cableTier9, rotorTier9, itemRubberRing, - CI.craftingToolScrewdriver, pipeTier9, CI.craftingToolWrench, - itemRubberRing, CI.electricMotor_UV, cableTier9, - CI.electricPump_UV); - RecipeUtils.addShapedGregtechRecipe( - cableTier10, rotorTier10, itemRubberRing, - CI.craftingToolScrewdriver, pipeTier10, CI.craftingToolWrench, - itemRubberRing, CI.electricMotor_MAX, cableTier10, - CI.electricPump_MAX); - - //Electric Pump - RecipeUtils.addShapedGregtechRecipe( - plateTier7, plateTier7, plateTier7, - cableTier7, rodTier7a, rodTier7a, - cableTier7, CI.electricMotor_LuV, smallGearTier7, - CI.electricPiston_LuV); - RecipeUtils.addShapedGregtechRecipe( - plateTier8, plateTier8, plateTier8, - cableTier8, rodTier8a, rodTier8a, - cableTier8, CI.electricMotor_ZPM, smallGearTier8, - CI.electricPiston_ZPM); - RecipeUtils.addShapedGregtechRecipe( - plateTier9, plateTier9, plateTier9, - cableTier9, rodTier9a, rodTier9a, - cableTier9, CI.electricMotor_UV, smallGearTier9, - CI.electricPiston_UV); - RecipeUtils.addShapedGregtechRecipe( - plateTier10, plateTier10, plateTier10, - cableTier10, rodTier10a, rodTier10a, - cableTier10, CI.electricMotor_MAX, smallGearTier10, - CI.electricPiston_MAX); - - //Robot Arms - RecipeUtils.addShapedGregtechRecipe( - cableTier7, cableTier7, cableTier7, - CI.electricMotor_LuV, rodTier7a, CI.electricMotor_LuV, - CI.electricPiston_LuV, circuitTier7, rodTier7a, - CI.robotArm_LuV); - RecipeUtils.addShapedGregtechRecipe( - cableTier8, cableTier8, cableTier8, - CI.electricMotor_ZPM, rodTier8a, CI.electricMotor_ZPM, - CI.electricPiston_ZPM, circuitTier8, rodTier8a, - CI.robotArm_ZPM); - RecipeUtils.addShapedGregtechRecipe( - cableTier9, cableTier9, cableTier9, - CI.electricMotor_UV, rodTier9a, CI.electricMotor_UV, - CI.electricPiston_UV, circuitTier9, rodTier9a, - CI.robotArm_UV); - RecipeUtils.addShapedGregtechRecipe( - cableTier10, cableTier10, cableTier10, - CI.electricMotor_MAX, rodTier10a, CI.electricMotor_MAX, - CI.electricPiston_MAX, circuitTier10, rodTier10a, - CI.robotArm_MAX); - - //Conveyor Modules - RecipeUtils.addShapedGregtechRecipe( - plateRubber, plateRubber, plateRubber, - CI.electricMotor_LuV, cableTier7, CI.electricMotor_LuV, - plateRubber, plateRubber, plateRubber, - CI.conveyorModule_LuV); - RecipeUtils.addShapedGregtechRecipe( - plateRubber, plateRubber, plateRubber, - CI.electricMotor_ZPM, cableTier8, CI.electricMotor_ZPM, - plateRubber, plateRubber, plateRubber, - CI.conveyorModule_ZPM); - RecipeUtils.addShapedGregtechRecipe( - plateRubber, plateRubber, plateRubber, - CI.electricMotor_UV, cableTier9, CI.electricMotor_UV, - plateRubber, plateRubber, plateRubber, - CI.conveyorModule_UV); - RecipeUtils.addShapedGregtechRecipe( - plateRubber, plateRubber, plateRubber, - CI.electricMotor_MAX, cableTier10, CI.electricMotor_MAX, - plateRubber, plateRubber, plateRubber, - CI.conveyorModule_MAX); - - //Emitter Modules - RecipeUtils.addShapedGregtechRecipe( - rodTier7c, rodTier7c, circuitTier7, - cableTier7, circuitTier6, rodTier7c, - circuitTier7, cableTier7, rodTier7c, - CI.emitter_LuV); - RecipeUtils.addShapedGregtechRecipe( - rodTier8c, rodTier8c, circuitTier8, - cableTier8, circuitTier7, rodTier8c, - circuitTier8, cableTier8, rodTier8c, - CI.emitter_ZPM); - RecipeUtils.addShapedGregtechRecipe( - rodTier9c, rodTier9c, circuitTier9, - cableTier9, circuitTier8, rodTier9c, - circuitTier9, cableTier9, rodTier9c, - CI.emitter_UV); - RecipeUtils.addShapedGregtechRecipe( - rodTier10c, rodTier10c, circuitTier10, - cableTier10, circuitTier9, rodTier10c, - circuitTier10, cableTier10, rodTier10c, - CI.emitter_MAX); - - //Field Generator Modules - RecipeUtils.addShapedGregtechRecipe( - wireTier7, circuitTier7, wireTier7, - circuitTier7, circuitTier6, circuitTier7, - wireTier7, circuitTier7, wireTier7, - CI.fieldGenerator_LuV); - RecipeUtils.addShapedGregtechRecipe( - wireTier8, circuitTier8, wireTier8, - circuitTier8, circuitTier7, circuitTier8, - wireTier8, circuitTier8, wireTier8, - CI.fieldGenerator_ZPM); - RecipeUtils.addShapedGregtechRecipe( - wireTier9, circuitTier9, wireTier9, - circuitTier9, circuitTier8, circuitTier9, - wireTier9, circuitTier9, wireTier9, - CI.fieldGenerator_UV); - RecipeUtils.addShapedGregtechRecipe( - wireTier10, circuitTier10, wireTier10, - circuitTier10, circuitTier9, circuitTier10, - wireTier10, circuitTier10, wireTier10, - CI.fieldGenerator_MAX); - - //Sensor Modules - RecipeUtils.addShapedRecipe( - plateTier7, null, circuitTier6, - plateTier7, rodTier7c, null, - circuitTier7, plateTier7, plateTier7, - CI.sensor_LuV); - RecipeUtils.addShapedRecipe( - plateTier8, null, circuitTier7, - plateTier8, rodTier8c, null, - circuitTier8, plateTier8, plateTier8, - CI.sensor_ZPM); - RecipeUtils.addShapedRecipe( - plateTier9, null, circuitTier8, - plateTier9, rodTier9c, null, - circuitTier9, plateTier9, plateTier9, - CI.sensor_UV); - RecipeUtils.addShapedRecipe( - plateTier10, null, circuitTier9, - plateTier10, rodTier10c, null, - circuitTier10, plateTier10, plateTier10, - CI.sensor_MAX); - - onlyULVComponents(); - - Logger.INFO("Done loading recipes for the Various machine components."); - - } - - private static void onlyULVComponents(){ - RecipeUtils.addShapedGregtechRecipe( - cableTier1, wireTier0, rodTier0, - wireTier0, rodTier2, wireTier0, - rodTier0, wireTier0, cableTier1, - CI.electricMotor_ULV); - - RecipeUtils.addShapedGregtechRecipe( - cableTier0, rotorTier0, itemRubberRing, - CI.craftingToolScrewdriver, pipeTier0, CI.craftingToolWrench, - itemRubberRing, CI.electricMotor_ULV, cableTier0, - CI.electricPump_ULV); - - RecipeUtils.addShapedGregtechRecipe( - plateTier0, plateTier0, plateTier0, - cableTier0, rodTier1, rodTier1, - cableTier0, CI.electricMotor_ULV, smallGearTier0, - CI.electricPiston_ULV); - - RecipeUtils.addShapedGregtechRecipe( - cableTier0, cableTier0, cableTier0, - CI.electricMotor_ULV, rodTier1, CI.electricMotor_ULV, - CI.electricPiston_ULV, circuitTier0, rodTier1, - CI.robotArm_ULV); - - RecipeUtils.addShapedGregtechRecipe( - plateRubber, plateRubber, plateRubber, - CI.electricMotor_ULV, cableTier0, CI.electricMotor_ULV, - plateRubber, plateRubber, plateRubber, - CI.conveyorModule_ULV); - - RecipeUtils.addShapedGregtechRecipe( - rodTier2, rodTier2, circuitTier0, - cableTier0, circuitTier1, rodTier2, - circuitTier0, cableTier0, rodTier2, - CI.emitter_ULV); - - RecipeUtils.addShapedGregtechRecipe( - wireTier0, circuitTier0, wireTier0, - circuitTier0, circuitTier1, circuitTier0, - wireTier0, circuitTier0, wireTier0, - CI.fieldGenerator_ULV); - - RecipeUtils.addShapedRecipe( - plateTier0, null, circuitTier1, - plateTier0, rodTier2, null, - circuitTier0, plateTier0, plateTier0, - CI.sensor_ULV); - } - - private static void onlyMaxComponents(){ - RecipeUtils.addShapedGregtechRecipe( - cableTier10, wireTier10, rodTier10a, - wireTier10, rodTier10b, wireTier10, - rodTier10a, wireTier10, cableTier10, - CI.electricMotor_MAX); - RecipeUtils.addShapedGregtechRecipe( - cableTier10, rotorTier10, itemRubberRing, - CI.craftingToolScrewdriver, pipeTier10, CI.craftingToolWrench, - itemRubberRing, CI.electricMotor_MAX, cableTier10, - CI.electricPump_MAX); - RecipeUtils.addShapedGregtechRecipe( - plateTier10, plateTier10, plateTier10, - cableTier10, rodTier10a, rodTier10a, - cableTier10, CI.electricMotor_MAX, smallGearTier10, - CI.electricPiston_MAX); - RecipeUtils.addShapedGregtechRecipe( - cableTier10, cableTier10, cableTier10, - CI.electricMotor_MAX, rodTier10a, CI.electricMotor_MAX, - CI.electricPiston_MAX, circuitTier10, rodTier10a, - CI.robotArm_MAX); - RecipeUtils.addShapedGregtechRecipe( - plateRubber, plateRubber, plateRubber, - CI.electricMotor_MAX, cableTier10, CI.electricMotor_MAX, - plateRubber, plateRubber, plateRubber, - CI.conveyorModule_MAX); - RecipeUtils.addShapedGregtechRecipe( - rodTier10c, rodTier10c, circuitTier10, - cableTier10, circuitTier9, rodTier10c, - circuitTier10, cableTier10, rodTier10c, - CI.emitter_MAX); - RecipeUtils.addShapedGregtechRecipe( - wireTier10, circuitTier10, wireTier10, - circuitTier10, circuitTier9, circuitTier10, - wireTier10, circuitTier10, wireTier10, - CI.fieldGenerator_MAX); - RecipeUtils.addShapedRecipe( - plateTier10, null, circuitTier9, - plateTier10, rodTier10c, null, - circuitTier10, plateTier10, plateTier10, - CI.sensor_MAX); - } - - private static void gregtechMachinePhase(){ - if (CORE.ConfigSwitches.enableCustomCircuits && !CORE.GTNH){ - Logger.INFO("Adding Gregtech machine recipes for the circuits."); - GT_Values.RA.addFormingPressRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Silicon, 1L), GregtechItemList.Circuit_Parts_Wiring_IV.get(4L, new Object[0]), GregtechItemList.Circuit_Board_IV.get(1L, new Object[0]), 30, 240); - GT_Values.RA.addFormingPressRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Silicon, 1L), GregtechItemList.Circuit_Parts_Wiring_LuV.get(4L, new Object[0]), GregtechItemList.Circuit_Board_LuV.get(1L, new Object[0]), 60, 480); - GT_Values.RA.addFormingPressRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Silicon, 2L), GregtechItemList.Circuit_Parts_Wiring_ZPM.get(4L, new Object[0]), GregtechItemList.Circuit_Board_ZPM.get(1L, new Object[0]), 90, 1000); - GT_Values.RA.addFormingPressRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Lazurite, 1L), GregtechItemList.Circuit_Parts_Crystal_Chip_IV.get(3L, new Object[0]), GregtechItemList.Circuit_Parts_IV.get(1L, new Object[0]), 30, 480); - GT_Values.RA.addFormingPressRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Lazurite, 1L), GregtechItemList.Circuit_Parts_Crystal_Chip_LuV.get(3L, new Object[0]), GregtechItemList.Circuit_Parts_LuV.get(1L, new Object[0]), 60, 1000); - GT_Values.RA.addFormingPressRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Lazurite, 1L), GregtechItemList.Circuit_Parts_Crystal_Chip_ZPM.get(3L, new Object[0]), GregtechItemList.Circuit_Parts_ZPM.get(1L, new Object[0]), 90, 2000); - GT_Values.RA.addForgeHammerRecipe(ItemList.Circuit_Master.get(1L, new Object[0]), GregtechItemList.Circuit_Parts_Crystal_Chip_IV.get(5L, new Object[0]), 30, 256); - GT_Values.RA.addForgeHammerRecipe(GregtechItemList.Circuit_IV.get(1L, new Object[0]), GregtechItemList.Circuit_Parts_Crystal_Chip_LuV.get(5L, new Object[0]), 60, 512); - GT_Values.RA.addForgeHammerRecipe(GregtechItemList.Circuit_LuV.get(1L, new Object[0]), GregtechItemList.Circuit_Parts_Crystal_Chip_ZPM.get(5L, new Object[0]), 120, 1024); - for (final Materials tMat : Materials.values()) { - if ((tMat.mStandardMoltenFluid != null) && (tMat.contains(SubTag.SOLDERING_MATERIAL))) { - final int tMultiplier = tMat.contains(SubTag.SOLDERING_MATERIAL_GOOD) ? 1 : tMat.contains(SubTag.SOLDERING_MATERIAL_BAD) ? 4 : 2; - GT_Values.RA.addAssemblerRecipe(GregtechItemList.Circuit_Board_IV.get(1L, new Object[0]), GregtechItemList.Circuit_Parts_IV.get(1L, new Object[0]), tMat.getMolten((144L * tMultiplier) / 4L), GregtechItemList.Circuit_IV.get(1L, new Object[0]), 30, 480); - GT_Values.RA.addAssemblerRecipe(GregtechItemList.Circuit_Board_LuV.get(1L, new Object[0]), GregtechItemList.Circuit_Parts_LuV.get(1L, new Object[0]), tMat.getMolten((144L * tMultiplier) / 4L), GregtechItemList.Circuit_LuV.get(1L, new Object[0]), 60, 1000); - GT_Values.RA.addAssemblerRecipe(GregtechItemList.Circuit_Board_ZPM.get(1L, new Object[0]), GregtechItemList.Circuit_Parts_ZPM.get(1L, new Object[0]), tMat.getMolten((144L * tMultiplier) / 4L), GregtechItemList.Circuit_ZPM.get(1L, new Object[0]), 90, 2000); - - } - } - } - } -} diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java deleted file mode 100644 index 14001d86bd..0000000000 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ /dev/null @@ -1,2926 +0,0 @@ -package gtPlusPlus.core.recipe; - -import static gtPlusPlus.core.lib.CORE.GTNH; - -import cpw.mods.fml.common.Loader; -import gregtech.api.GregTech_API; -import gregtech.api.enums.*; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.item.chemistry.AgriculturalChem; -import gtPlusPlus.core.item.crafting.ItemDummyResearch; -import gtPlusPlus.core.item.crafting.ItemDummyResearch.ASSEMBLY_LINE_RESEARCH; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.*; -import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.everglades.dimension.Dimension_Everglades; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; -import gtPlusPlus.xmod.gregtech.common.covers.CoverManager; -import gtPlusPlus.xmod.gregtech.common.helpers.VolumetricFlaskHelper; -import gtPlusPlus.xmod.gregtech.common.items.MetaCustomCoverItem; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -public class RECIPES_Machines { - - //Outputs - //static ItemStack RECIPE_BufferCore_ULV = new ItemStack(GregtechEnergyBuffer.itemBufferCore); - public static ItemStack RECIPE_SteamCondenser; - public static ItemStack RECIPE_IronBlastFurnace; - public static ItemStack RECIPE_IronPlatedBricks; - public static ItemStack RECIPE_Buffer_ULV = GregtechItemList.Energy_Buffer_1by1_ULV.get(1); - public static ItemStack RECIPE_Buffer_LV = GregtechItemList.Energy_Buffer_1by1_LV.get(1); - public static ItemStack RECIPE_Buffer_MV = GregtechItemList.Energy_Buffer_1by1_MV.get(1); - public static ItemStack RECIPE_Buffer_HV = GregtechItemList.Energy_Buffer_1by1_HV.get(1); - public static ItemStack RECIPE_Buffer_EV = GregtechItemList.Energy_Buffer_1by1_EV.get(1); - public static ItemStack RECIPE_Buffer_IV = GregtechItemList.Energy_Buffer_1by1_IV.get(1); - public static ItemStack RECIPE_Buffer_LuV = GregtechItemList.Energy_Buffer_1by1_LuV.get(1); - public static ItemStack RECIPE_Buffer_ZPM = GregtechItemList.Energy_Buffer_1by1_ZPM.get(1); - public static ItemStack RECIPE_Buffer_UV = GregtechItemList.Energy_Buffer_1by1_UV.get(1); - public static ItemStack RECIPE_Buffer_MAX = GregtechItemList.Energy_Buffer_1by1_MAX.get(1); - //Industrial Centrifuge - public static ItemStack RECIPE_IndustrialCentrifugeController; - public static ItemStack RECIPE_IndustrialCentrifugeCasing; - //Industrial Coke Oven - public static ItemStack RECIPE_IndustrialCokeOvenController; - public static ItemStack RECIPE_IndustrialCokeOvenFrame; - public static ItemStack RECIPE_IndustrialCokeOvenCasingA; - public static ItemStack RECIPE_IndustrialCokeOvenCasingB; - //Industrial Electrolyzer - public static ItemStack RECIPE_IndustrialElectrolyzerController; - public static ItemStack RECIPE_IndustrialElectrolyzerFrame; - //Industrial Material Press - public static ItemStack RECIPE_IndustrialMaterialPressController; - public static ItemStack RECIPE_IndustrialMaterialPressFrame; - //Industrial Maceration Stack - public static ItemStack RECIPE_IndustrialMacerationStackController; - public static ItemStack RECIPE_IndustrialMacerationStackFrame; - //Industrial Wire Factory - public static ItemStack RECIPE_IndustrialWireFactoryController; - public static ItemStack RECIPE_IndustrialWireFactoryFrame; - //Industrial Multi Tank - public static ItemStack RECIPE_IndustrialMultiTankController; - public static ItemStack RECIPE_IndustrialMultiTankFrame; - //Industrial Matter Fabricator - public static ItemStack RECIPE_IndustrialMatterFabController; - public static ItemStack RECIPE_IndustrialMatterFabFrame; - public static ItemStack RECIPE_IndustrialMatterFabCoil; - //Industrial Blast Smelter - public static ItemStack RECIPE_IndustrialBlastSmelterController; - public static ItemStack RECIPE_IndustrialBlastSmelterFrame; - public static ItemStack RECIPE_IndustrialBlastSmelterCoil; - //Industrial Sieve - public static ItemStack RECIPE_IndustrialSieveController; - public static ItemStack RECIPE_IndustrialSieveFrame; - public static ItemStack RECIPE_IndustrialSieveGrate; - //Industrial Tree Farmer - public static ItemStack RECIPE_TreeFarmController; - public static ItemStack RECIPE_TreeFarmFrame; - //Tesseracts - public static ItemStack RECIPE_TesseractGenerator; - public static ItemStack RECIPE_TesseractTerminal; - //Thermal Boiler - public static ItemStack RECIPE_ThermalBoilerController; - public static ItemStack RECIPE_ThermalBoilerCasing; - - //Thorium Reactor - public static ItemStack RECIPE_LFTRController; - public static ItemStack RECIPE_LFTROuterCasing; - public static ItemStack RECIPE_LFTRInnerCasing; - - //Milling - public static ItemStack RECIPE_ISAMill_Controller; - public static ItemStack RECIPE_ISAMill_Gearbox; - public static ItemStack RECIPE_ISAMill_Casing; - public static ItemStack RECIPE_ISAMill_Hatch; - public static ItemStack RECIPE_Flotation_Controller; - public static ItemStack RECIPE_Flotation_Casing; - - //Cyclotron - public static ItemStack RECIPE_CyclotronController; - public static ItemStack RECIPE_CyclotronOuterCasing; - public static ItemStack RECIPE_CyclotronInnerCoil; - - - //Buffer Cores - public static ItemStack RECIPE_BufferCore_ULV = ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore1", 1); - public static ItemStack RECIPE_BufferCore_LV = ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore2", 1); - public static ItemStack RECIPE_BufferCore_MV = ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore3", 1); - public static ItemStack RECIPE_BufferCore_HV = ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore4", 1); - public static ItemStack RECIPE_BufferCore_EV = ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore5", 1); - public static ItemStack RECIPE_BufferCore_IV = ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore6", 1); - public static ItemStack RECIPE_BufferCore_LuV = ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore7", 1); - public static ItemStack RECIPE_BufferCore_ZPM = ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore8", 1); - public static ItemStack RECIPE_BufferCore_UV = ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore9", 1); - public static ItemStack RECIPE_BufferCore_MAX = ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore10", 1); - - - //Wire - public static String wireTier1 = "wireGt08Lead"; - public static String wireTier2 = "wireGt08Tin"; - public static String wireTier3 = "wireGt08Copper"; - public static String wireTier4 = "wireGt08Gold"; - public static String wireTier5 = "wireGt08Aluminium"; - public static String wireTier6 = "wireGt08Tungsten"; - public static String wireTier7 = "wireGt08Naquadah"; - public static String wireTier8 = "wireGt08Osmium"; - public static String wireTier9 = "wireGt08Superconductor"; - public static String wireTier10 = "wireGt16Superconductor"; - - //Wire - public static String cableTier1 = "cableGt04Lead"; - public static String cableTier2 = "cableGt04Tin"; - public static String cableTier3 = "cableGt04Copper"; - public static String cableTier4 = "cableGt04Gold"; - public static String cableTier5 = "cableGt04Aluminium"; - public static String cableTier6 = "cableGt04Tungsten"; - public static String cableTier7 = "cableGt04Naquadah"; - public static String cableTier8 = "cableGt04Osmium"; - public static String cableTier9 = "cableGt04NiobiumTitanium"; - public static String cableTier10 = "cableGt08NiobiumTitanium"; - - public static String pipeTier1 = "pipeHuge"+"Clay"; - public static String pipeTier2 = "pipeHuge"+"Potin"; - public static String pipeTier3 = "pipeHuge"+"Steel"; - public static String pipeTier4 = "pipeHuge"+"StainlessSteel"; - public static String pipeTier5 = "pipeHuge"+"TungstenSteel"; - public static String pipeTier6 = "pipeHuge"+"MaragingSteel300"; - public static String pipeTier7 = "pipeHuge"+"Tantalloy60"; - public static String pipeTier8 = "pipeHuge"+"Tantalloy61"; - public static String pipeTier9 = "pipeHuge"+"Inconel792"; - public static String pipeTier10 = "pipeHuge"+"HastelloyX"; - public static String pipeTier11 = "pipeHuge"+"Europium"; - - // EV/IV MACHINES - public static ItemStack EV_MACHINE_Electrolyzer; - public static ItemStack EV_MACHINE_Centrifuge; - public static ItemStack EV_MACHINE_BendingMachine; - public static ItemStack EV_MACHINE_Wiremill; - public static ItemStack HV_MACHINE_Macerator; - public static ItemStack EV_MACHINE_Macerator; - public static ItemStack EV_MACHINE_Cutter; - public static ItemStack EV_MACHINE_MassFabricator; - public static ItemStack EV_MACHINE_Extruder; - public static ItemStack EV_MACHINE_Sifter; - public static ItemStack EV_MACHINE_ThermalCentrifuge; - public static ItemStack EV_MACHINE_OreWasher; - public static ItemStack EV_MACHINE_AlloySmelter; - public static ItemStack EV_MACHINE_Mixer; - - - //Cables - public static String cableGt02Electrum = "cableGt02Electrum"; - - - //Plates - public static String plateElectricalSteel= "plateElectricalSteel"; - public static String plateEnergeticAlloy= "plateEnergeticAlloy"; - public static String plateCobalt = "plateCobalt"; - public static String plateBronze = "plateBronze"; - public static String plateSteel = "plateSteel"; - - //Pipes - public static String pipeLargeCopper="pipeLargeCopper"; - public static String pipeHugeSteel="pipeHugeSteel"; - public static String pipeHugeStainlessSteel="pipeHugeStainlessSteel"; - public static String pipeHugeTitanium="pipeHugeTitanium"; - - //Lava Boiler - public static ItemStack boiler_Coal; - public static ItemStack blockBricks = ItemUtils.getItemStackFromFQRN("minecraft:brick_block", 1); - - //Batteries - public static String batteryBasic = "batteryBasic"; - public static String batteryAdvanced = "batteryAdvanced"; - public static String batteryElite = "batteryElite"; - public static String batteryMaster = "batteryMaster"; - public static String batteryUltimate = "batteryUltimate"; - public static ItemStack IC2MFE; - public static ItemStack IC2MFSU; - - //Misc - public static ItemStack INPUT_RCCokeOvenBlock; - public static ItemStack INPUT_IECokeOvenBlock; - - //Output Determiner - public static int Casing_Amount; - - - - public static final void loadRecipes(){ - run(); - Logger.INFO("Loading Recipes for the Various machine blocks."); - } - - private static void run(){ - - //Determines Casing Recipe Output - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && !GTNH){ - Casing_Amount=2; - } - else { - Casing_Amount=1; - } - - initModItems(); - tieredMachineHulls(); - controlCores(); - energyCores(); - wirelessChargers(); - largeArcFurnace(); - industrialVacuumFurnace(); - fakeMachineCasingCovers(); - ztonesCoverRecipes(); - overflowValveCovers(); - superBuses(); - roundRobinators(); - chunkloaders(); - distillus(); - algaeFarm(); - chemPlant(); - zyngen(); - milling(); - sparging(); - - } - - private static void zyngen() { - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(6), - CI.getTieredMachineHull(4), - ItemList.Machine_EV_AlloySmelter.get(1), - CI.getGear(3, 16), - CI.getBolt(3, 64), - CI.getPlate(4, 16) - }, - CI.getAlternativeTieredFluid(4, 144 * 8), - GregtechItemList.Industrial_AlloySmelter.get(1), - 20 * 30, - MaterialUtils.getVoltageForTier(4)); - - } - - private static void chemPlant() { - - - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Casing_Machine_Custom_1.get(2L, new Object[0]), - CI.bits, - new Object[]{ - "PhP", - "PFP", - "PwP", - 'P', - OrePrefixes.plate.get(Materials.Bronze), - 'F', - OrePrefixes.frameGt.get(Materials.Bronze) - } - ); - - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Casing_Machine_Custom_2.get(2L, new Object[0]), - CI.bits, - new Object[]{ - "PhP", - "PFP", - "PwP", - 'P', - OrePrefixes.plate.get(Materials.Aluminium), - 'F', - OrePrefixes.frameGt.get(Materials.Aluminium) - } - ); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedBioCircuit(19), - CI.getTieredGTPPMachineCasing(1, 6), - CI.getTieredComponentOfMaterial(Materials.Steel, OrePrefixes.gearGt, 6), - CI.getTieredComponentOfMaterial(Materials.Aluminium, OrePrefixes.plate, 32), - CI.getTieredComponentOfMaterial(Materials.CobaltBrass, OrePrefixes.dust, 16), - CI.getTieredComponent(OrePrefixes.frameGt, 2, 4), - }, - ALLOY.STEEL.getFluidStack(2 * (144 * 4)), - GregtechItemList.ChemicalPlant_Controller.get(1), - 120 * 20, - MaterialUtils.getVoltageForTier(2)); - - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedBioCircuit(15), - CI.getTieredGTPPMachineCasing(1, 2), - ItemList.Hatch_Input_Bus_MV.get(1), - CI.getTieredComponentOfMaterial(Materials.Bronze, OrePrefixes.gearGt, 8), - CI.getTieredComponentOfMaterial(Materials.Lead, OrePrefixes.plate, 48), - CI.getTieredComponentOfMaterial(Materials.SolderingAlloy, OrePrefixes.wireFine, 16), - }, - ALLOY.BRONZE.getFluidStack(2 * (144 * 4)), - GregtechItemList.Bus_Catalysts.get(1), - 60 * 20, - MaterialUtils.getVoltageForTier(2)); - - } - - private static void algaeFarm() { - - // Give the shitty algae a use :) - CORE.RA.addDistilleryRecipe( - ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, 32), - null, - null, - ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 4), - 20 * 15, - 16, - false); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedBioCircuit(21), - CI.getTieredGTPPMachineCasing(0, 4), - CI.getTieredComponentOfMaterial(Materials.Iron, OrePrefixes.rod, 12), - CI.getTieredComponentOfMaterial(Materials.Wood, OrePrefixes.plate, 32), - CI.getTieredComponentOfMaterial(Materials.Bronze, OrePrefixes.bolt, 16), - CI.getTieredComponentOfMaterial(Materials.Redstone, OrePrefixes.dust, 32), - }, - ALLOY.POTIN.getFluidStack(2 * (144 * 4)), - GregtechItemList.AlgaeFarm_Controller.get(1), - 60 * 20, - MaterialUtils.getVoltageForTier(1)); - - - } - - private static void distillus() { - - CORE.RA.addChemicalPlantRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(19), - ItemList.Distillation_Tower.get(2), - GregtechItemList.GTPP_Casing_IV.get(16), - CI.getTieredComponent(OrePrefixes.circuit, 6, 8) - }, - new FluidStack[] { - ALLOY.AQUATIC_STEEL.getFluidStack(144 * 32), - ALLOY.BABBIT_ALLOY.getFluidStack(144 * 16), - ALLOY.BRONZE.getFluidStack(144 * 64), - ALLOY.KANTHAL.getFluidStack(144 * 16), - }, - new ItemStack[] { - GregtechItemList.Machine_Adv_DistillationTower.get(1) - }, - new FluidStack[] { - - }, - 20 * 600, - MaterialUtils.getVoltageForTier(6), - 5); - - } - - private static void chunkloaders() { - - ItemStack aOutputs[] = new ItemStack[] { - GregtechItemList.GT_Chunkloader_HV.get(1L), - GregtechItemList.GT_Chunkloader_IV.get(1L), - GregtechItemList.GT_Chunkloader_ZPM.get(1L), - }; - - int aIndex = 0; - - for (int i=3;i<8;i++) { - if (i == 4 || i == 6) { - continue; - } - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(21), - CI.getElectricPiston(i, 10), - CI.getFieldGenerator(i + 1, 6), - CI.getPlate(i, 16), - CI.getTransmissionComponent(i - 1, 8), - CI.getTieredComponent(OrePrefixes.cableGt08, i, 16) - }, - ALLOY.EGLIN_STEEL.getFluidStack(i * (144 * 4)), - aOutputs[aIndex++].copy(), - 300 * 20, - MaterialUtils.getVoltageForTier(i)); - } - - - } - - private static void overflowValveCovers() { - ItemStack aOutputs[] = new ItemStack[] { - GregtechItemList.Cover_Overflow_ULV.get(1L), - GregtechItemList.Cover_Overflow_LV.get(1L), - GregtechItemList.Cover_Overflow_MV.get(1L), - GregtechItemList.Cover_Overflow_HV.get(1L), - GregtechItemList.Cover_Overflow_EV.get(1L), - GregtechItemList.Cover_Overflow_IV.get(1L), - }; - - for (int i=0;i<6;i++) { - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedBioCircuit(19), - CI.getElectricPump(i, 2), - CI.getElectricMotor(i, 2), - CI.getPlate(i, 4) - }, - FluidUtils.getWater((i+1) * 750), - aOutputs[i].copy(), - 20 * 20, - MaterialUtils.getVoltageForTier(i)); - } - - } - - private static void tieredMachineHulls() { - - GregtechItemList[] aHulls = new GregtechItemList[] { - GregtechItemList.GTPP_Casing_ULV, - GregtechItemList.GTPP_Casing_LV, - GregtechItemList.GTPP_Casing_MV, - GregtechItemList.GTPP_Casing_HV, - GregtechItemList.GTPP_Casing_EV, - GregtechItemList.GTPP_Casing_IV, - GregtechItemList.GTPP_Casing_LuV, - GregtechItemList.GTPP_Casing_ZPM, - GregtechItemList.GTPP_Casing_UV, - GregtechItemList.GTPP_Casing_MAX - }; - - for (int i=0;i<10;i++) { - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedBioCircuit(20), - CI.getTieredMachineCasing(i), - CI.getPlate(i, 8), - CI.getGear(i, 2), - CI.getTieredComponent(OrePrefixes.cableGt02, i, 4), - CI.getTieredComponent(OrePrefixes.circuit, i, 2) - }, - CI.getAlternativeTieredFluid(i, 144 * (i+1) * 2), - aHulls[i].get(1), - 20 * 20, - MaterialUtils.getVoltageForTier(i)); - } - - } - - private static void initModItems(){ - if (LoadedMods.IndustrialCraft2){ - IC2MFE = ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:blockElectric", "IC2_MFE", 1, 1); - IC2MFSU = ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:blockElectric", "IC2_MFSU", 2, 1); - } - if (LoadedMods.Gregtech){ - - //Lava Boiler - boiler_Coal = ItemList.Machine_Bronze_Boiler.get(1); - - //IV MACHINES - if (!GTNH){ - EV_MACHINE_Electrolyzer = ItemList.Machine_EV_Electrolyzer.get(1); - EV_MACHINE_BendingMachine= ItemList.Machine_EV_Bender.get(1); - EV_MACHINE_Wiremill= ItemList.Machine_EV_Wiremill.get(1); - HV_MACHINE_Macerator= ItemList.Machine_HV_Macerator.get(1); - EV_MACHINE_Macerator= ItemList.Machine_EV_Macerator.get(1); - EV_MACHINE_MassFabricator= ItemList.Machine_EV_Massfab.get(1); - EV_MACHINE_Centrifuge= ItemList.Machine_EV_Centrifuge.get(1); - EV_MACHINE_Cutter = ItemList.Machine_EV_Cutter.get(1); - EV_MACHINE_Extruder = ItemList.Machine_EV_Extruder.get(1); - EV_MACHINE_Sifter = ItemList.Machine_HV_Sifter.get(1); - EV_MACHINE_ThermalCentrifuge = ItemList.Machine_EV_ThermalCentrifuge.get(1); - EV_MACHINE_OreWasher = ItemList.Machine_EV_OreWasher.get(1); - EV_MACHINE_AlloySmelter = ItemList.Machine_EV_AlloySmelter.get(1); - EV_MACHINE_Mixer = ItemList.Machine_EV_Mixer.get(1); - } - //Balanced opposites - else { - EV_MACHINE_Electrolyzer = ItemList.Machine_IV_Electrolyzer.get(1); - EV_MACHINE_BendingMachine= ItemList.Machine_IV_Bender.get(1); - EV_MACHINE_Wiremill= ItemList.Machine_IV_Wiremill.get(1); - HV_MACHINE_Macerator= ItemList.Machine_EV_Macerator.get(1); - EV_MACHINE_Macerator= ItemList.Machine_IV_Macerator.get(1); - EV_MACHINE_MassFabricator= CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? ItemUtils.getValueOfItemList("Machine_LuV_Massfab", ItemList.Machine_IV_Massfab).get(1) : ItemList.Machine_IV_Massfab.get(1); - EV_MACHINE_Centrifuge= ItemList.Machine_IV_Centrifuge.get(1); - EV_MACHINE_Cutter = ItemList.Machine_IV_Cutter.get(1); - EV_MACHINE_Extruder = ItemList.Machine_IV_Extruder.get(1); - EV_MACHINE_Sifter = ItemList.Machine_HV_Sifter.get(1); - EV_MACHINE_ThermalCentrifuge = ItemList.Machine_IV_ThermalCentrifuge.get(1); - EV_MACHINE_OreWasher = ItemList.Machine_IV_OreWasher.get(1); - EV_MACHINE_AlloySmelter = ItemList.Machine_IV_AlloySmelter.get(1); - EV_MACHINE_Mixer = ItemList.Machine_IV_Mixer.get(1); - } - - - - } - if (CORE.ConfigSwitches.enableMultiblock_IndustrialCokeOven){ - if(LoadedMods.Railcraft){ - //Misc - INPUT_RCCokeOvenBlock = ItemUtils.getItemStackWithMeta(LoadedMods.Railcraft, "Railcraft:machine.alpha", "Coke_Oven_RC", 7, 1); - } - if(LoadedMods.ImmersiveEngineering){ - //Misc - INPUT_IECokeOvenBlock = ItemUtils.getItemStackWithMeta(LoadedMods.ImmersiveEngineering, "ImmersiveEngineering:stoneDecoration", "Coke_Oven_IE", 1, 1); - } - } - runModRecipes(); - } - - private static void runModRecipes(){ - if (LoadedMods.Gregtech){ - - //Computer Cube - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - ItemUtils.getSimpleStack(CI.getDataOrb(), 4 * (GTNH ? 2 : 1)), - ItemList.Cover_Screen.get(4), - CI.machineHull_IV, - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(7), 2) - }, - ELEMENT.getInstance().TANTALUM.getFluidStack(144 * 16), - GregtechItemList.Gregtech_Computer_Cube.get(1), - 60 * 20 * 3, - 8000); - - //Circuit programmer - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - ItemUtils.getSimpleStack(CI.robotArm_LV, 4 * (GTNH ? 2 : 1)), - ItemList.Cover_Controller.get(1, CI.electricMotor_MV), - CI.machineHull_MV, - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(1), 2), - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(2), 2) - }, - ELEMENT.getInstance().IRON.getFluidStack(144 * 4), - ItemUtils.getSimpleStack(ModBlocks.blockCircuitProgrammer), - 60 * 10 * 1, - 30); - - //Lead Lined Chest - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.machineHull_LV, - ItemUtils.getItemStackOfAmountFromOreDict("plateRubber", 32), - ItemUtils.getItemStackOfAmountFromOreDict("plateDenseLead", 9), - ItemUtils.getSimpleStack(Blocks.chest) - }, - ELEMENT.getInstance().LEAD.getFluidStack(144 * 16), - ItemUtils.getSimpleStack(ModBlocks.blockDecayablesChest), - 60 * 10 * 3, - 60); - - //RTG - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - ItemUtils.getItemStackWithMeta(true, "IC2:blockGenerator:6", "IC2-RTG", 6, 1), - ALLOY.NITINOL_60.getPlate(GTNH ? 32 : 8), - ALLOY.MARAGING350.getGear(GTNH ? 16 : 4), - ItemUtils.getSimpleStack(GTNH ? CI.fieldGenerator_IV : CI.fieldGenerator_EV, 8 ), - ItemUtils.getItemStackOfAmountFromOreDict("wireFinePlatinum", GTNH ? 64 : 32), - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(GTNH ? 7 : 6), GTNH ? 5 : 4) - }, - ALLOY.NIOBIUM_CARBIDE.getFluidStack(144 * 16), - GregtechItemList.RTG.get(1), - 60 * 20 * 10, - 8000); - - // Super Jukebox - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.machineHull_LV, - ItemUtils.getItemStackOfAmountFromOreDict("circuitBasic", 4), - ItemUtils.getItemStackOfAmountFromOreDict("plateTumbaga", 8), - ItemUtils.getSimpleStack(Blocks.jukebox) - }, - ELEMENT.getInstance().COPPER.getFluidStack(144 * 2), - ItemUtils.getSimpleStack(ModBlocks.blockCustomJukebox), - 20 * 30, - 30); - - ItemStack aFluidRegulator1 = ItemUtils.getValueOfItemList("FluidRegulator_MV",GTNH ? 4 : 2, ItemList.Electric_Pump_HV); - ItemStack aFluidRegulator2 = ItemUtils.getValueOfItemList("FluidRegulator_IV", GTNH ? 4 : 2, ItemUtils.getValueOfItemList("Electric_Pump_LuV", GTNH ? 8 : 4, ItemList.Electric_Pump_IV)); - - //Poo Collector - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.machineHull_MV, - aFluidRegulator1, - CI.getTieredComponent(OrePrefixes.pipeMedium, 2, GTNH ? 4 : 2), - ALLOY.EGLIN_STEEL.getPlate(GTNH ? 8 : 4), - ALLOY.POTIN.getScrew(GTNH ? 12 : 6) - }, - ALLOY.TUMBAGA.getFluidStack(144 * 4), - ItemUtils.getSimpleStack(ModBlocks.blockPooCollector), - 20 * 60, - 30); - - //Adv. Poo Collector - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getTieredMachineHull(-1), - ItemUtils.getSimpleStack(ModBlocks.blockPooCollector), - aFluidRegulator2, - CI.getTieredComponent(OrePrefixes.pipeHuge, 6, GTNH ? 8 : 4), - CI.getTieredComponent(OrePrefixes.screw, 6, GTNH ? 32 : 16) - }, - CI.getAlternativeTieredFluid(5, 144 * 9), - ItemUtils.getSimpleStack(ModBlocks.blockPooCollector, 8, 1), - 20 * 60 * 5, - 500); - - - //Basic Steam Turbine - RecipeUtils.addShapedGregtechRecipe( - CI.getTieredComponent(OrePrefixes.pipeSmall, 0, 1), "circuitPrimitive", CI.getTieredComponent(OrePrefixes.pipeSmall, 0, 1), - ALLOY.TUMBAGA.getRotor(1), CI.machineCasing_ULV, ALLOY.TUMBAGA.getRotor(1), - CI.getElectricMotor(0, 1), "cableGt01RedAlloy", CI.getElectricMotor(0, 1), - GregtechItemList.Generator_Steam_Turbine_ULV.get(1)); - - //Basic Gas Turbine - RecipeUtils.addShapedGregtechRecipe( - "circuitPrimitive", ALLOY.TUMBAGA.getRotor(1), "circuitPrimitive", - ALLOY.TUMBAGA.getRotor(1), CI.machineCasing_ULV, ALLOY.TUMBAGA.getRotor(1), - CI.getElectricMotor(0, 1), "cableGt01RedAlloy", CI.getElectricMotor(0, 1), - GregtechItemList.Generator_Gas_Turbine_ULV.get(1)); - - //Basic Combustion Turbine - RecipeUtils.addShapedGregtechRecipe( - CI.getElectricPiston(0, 1), "circuitPrimitive", CI.getElectricPiston(0, 1), - CI.getElectricMotor(0, 1), CI.machineCasing_ULV, CI.getElectricMotor(0, 1), - ALLOY.TUMBAGA.getGear(1), "cableGt01RedAlloy", ALLOY.TUMBAGA.getGear(1), - GregtechItemList.Generator_Diesel_ULV.get(1)); - - - - //Steam Condenser - if (CORE.ConfigSwitches.enableMachine_SteamConverter ){ - RECIPE_SteamCondenser = GregtechItemList.Condensor_MAX.get(1); - RecipeUtils.addShapedGregtechRecipe( - pipeLargeCopper, pipeHugeSteel, pipeLargeCopper, - plateEnergeticAlloy, CI.electricPump_HV, plateEnergeticAlloy, - plateEnergeticAlloy, pipeLargeCopper, plateEnergeticAlloy, - RECIPE_SteamCondenser); - } - - ItemStack aBronzeBricks = ItemUtils.simpleMetaStack(GregTech_API.sBlockCasings1, 10, 1); - // Steam Macerator Multi - RecipeUtils.addShapedGregtechRecipe( - aBronzeBricks, ALLOY.TUMBAGA.getGear(1), aBronzeBricks, - aBronzeBricks, ALLOY.TUMBAGA.getFrameBox(1), aBronzeBricks, - aBronzeBricks, ALLOY.TUMBAGA.getGear(1), aBronzeBricks, - GregtechItemList.Controller_SteamMaceratorMulti.get(1)); - - // Steam Hatch - RecipeUtils.addShapedGregtechRecipe( - "plateBronze", "pipeMediumBronze", "plateBronze", - "plateBronze", GregtechItemList.GT_FluidTank_ULV.get(1), "plateBronze", - "plateBronze", "pipeMediumBronze", "plateBronze", - GregtechItemList.Hatch_Input_Steam.get(1)); - - // Steam Input Bus - RecipeUtils.addShapedGregtechRecipe( - "plateBronze", ALLOY.TUMBAGA.getPlate(1), "plateBronze", - "plateTin", ItemUtils.getSimpleStack(Blocks.hopper), "plateTin", - "plateBronze", ALLOY.TUMBAGA.getPlate(1), "plateBronze", - GregtechItemList.Hatch_Input_Bus_Steam.get(1)); - - // Steam Output Bus - RecipeUtils.addShapedGregtechRecipe( - "plateBronze", "plateTin", "plateBronze", - ALLOY.TUMBAGA.getPlate(1), ItemUtils.getSimpleStack(Blocks.hopper), ALLOY.TUMBAGA.getPlate(1), - "plateBronze", "plateTin", "plateBronze", - GregtechItemList.Hatch_Output_Bus_Steam.get(1)); - - - //RF Convertor - if (LoadedMods.CoFHCore && CORE.ConfigSwitches.enableMachine_RF_Convetor){ - RecipeUtils.addShapedGregtechRecipe( - CI.getPlate(4, 1), CI.getTieredCircuitOreDictName(5), CI.getPlate(4, 1), - CI.getTransmissionComponent(3, 1), CI.getTieredGTPPMachineCasing(4, 1), CI.getTransmissionComponent(3, 1), - CI.getPlate(4, 1), plateEnergeticAlloy, CI.getPlate(4, 1), - GregtechItemList.Energy_Buffer_RF_Convertor.get(1)); - } - - // Egg Box - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(8), - CI.getTieredMachineHull(3), - ItemUtils.getSimpleStack(Items.egg, 64), - ItemUtils.getSimpleStack(ModItems.itemRope, 32), - CI.getPlate(4, GTNH ? 16 : 8) - }, - FluidUtils.getFluidStack("mobessence", 4096), - ItemUtils.getSimpleStack(ModBlocks.blockEggBox, 1), - 20 * 60, - 480); - - //Flask Configurator - if (Meta_GT_Proxy.sDoesVolumetricFlaskExist) { - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(8), - CI.getTieredMachineHull(2), - ItemUtils.getSimpleStack(ModBlocks.blockCircuitProgrammer), - VolumetricFlaskHelper.getVolumetricFlask(8), - CI.getTieredComponent(OrePrefixes.pipeSmall, 2, GTNH ? 4 : 2), - CI.getPlate(2, GTNH ? 8 : 4) - }, - CI.getAlternativeTieredFluid(1, 144 * 8), - ItemUtils.getSimpleStack(ModBlocks.blockVolumetricFlaskSetter, 1), - 20 * 60, - 120); - } - - - if (CORE.ConfigSwitches.enableMultiblock_IronBlastFurnace){ - - RECIPE_IronBlastFurnace = GregtechItemList.Machine_Iron_BlastFurnace.get(1); - RECIPE_IronPlatedBricks = GregtechItemList.Casing_IronPlatedBricks.get(Casing_Amount); - - //Iron BF - RecipeUtils.addShapedGregtechRecipe( - "plateDoubleAnyIron", "craftingFurnace", "plateDoubleAnyIron", - boiler_Coal, CI.machineCasing_ULV, boiler_Coal, - "plateDoubleAnyIron", "bucketLava", "plateDoubleAnyIron", - RECIPE_IronBlastFurnace); - //Iron plated Bricks - RecipeUtils.addShapedGregtechRecipe( - "plateAnyIron", RECIPES_Tools.craftingToolHardHammer, "plateAnyIron", - "plateAnyIron", blockBricks, "plateAnyIron", - "plateAnyIron", RECIPES_Tools.craftingToolWrench, "plateAnyIron", - RECIPE_IronPlatedBricks); - - //Add recycle recipes for the Iron Plated Bricks - //GT_ModHandler.addPulverisationRecipe(RECIPE_IronPlatedBricks, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustIron", 6), ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustClay", 2), true); - CORE.RA.addPulverisationRecipe( - RECIPE_IronPlatedBricks, - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustIron", 6), - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustClay", 2), - null); - GT_Values.RA.addArcFurnaceRecipe(RECIPE_IronPlatedBricks, new ItemStack[]{ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotWroughtIron", 6), ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustAsh", 2)}, new int[]{0}, 32*20, 32); - } - - if (CORE.ConfigSwitches.enableMultiblock_IndustrialCentrifuge){ - //Industrial Centrifuge - RECIPE_IndustrialCentrifugeController = GregtechItemList.Industrial_Centrifuge.get(1); - RECIPE_IndustrialCentrifugeCasing = GregtechItemList.Casing_Centrifuge1.get(Casing_Amount); - - //Industrial Centrifuge - RecipeUtils.addShapedGregtechRecipe( - CI.circuitTier5, pipeHugeStainlessSteel, CI.circuitTier5, - CI.component_Plate[6], EV_MACHINE_Centrifuge, CI.component_Plate[6], - CI.component_Plate[8], CI.machineCasing_IV, CI.component_Plate[8], - RECIPE_IndustrialCentrifugeController); - //Centrifuge Casing - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[6], "stickTumbaga", CI.component_Plate[6], - CI.component_Plate[8], "stickTumbaga", CI.component_Plate[8], - CI.component_Plate[6], "stickTumbaga", CI.component_Plate[6], - RECIPE_IndustrialCentrifugeCasing); - } - - if (CORE.ConfigSwitches.enableMultiblock_IndustrialCokeOven){ - //Industrial Coke Oven - RECIPE_IndustrialCokeOvenController = GregtechItemList.Industrial_CokeOven.get(1); - RECIPE_IndustrialCokeOvenFrame = GregtechItemList.Casing_CokeOven.get(Casing_Amount); - RECIPE_IndustrialCokeOvenCasingA = GregtechItemList.Casing_CokeOven_Coil1.get(Casing_Amount); - RECIPE_IndustrialCokeOvenCasingB = GregtechItemList.Casing_CokeOven_Coil2.get(Casing_Amount); - - if (LoadedMods.Railcraft){ - //Industrial Coke Oven - RecipeUtils.addShapedGregtechRecipe( - plateCobalt, CI.circuitTier4, plateCobalt, - CI.machineCasing_HV, INPUT_RCCokeOvenBlock, CI.machineCasing_HV, - plateCobalt, CI.circuitTier5, plateCobalt, - RECIPE_IndustrialCokeOvenController); - } - if (LoadedMods.ImmersiveEngineering){ - //Industrial Coke Oven - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[8], CI.circuitTier4, CI.component_Plate[8], - CI.machineCasing_HV, INPUT_IECokeOvenBlock, CI.machineCasing_HV, - CI.component_Plate[8], CI.circuitTier3, CI.component_Plate[8], - RECIPE_IndustrialCokeOvenController); - } - //Coke Oven Frame Casing - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[7], CI.component_Rod[7], CI.component_Plate[7], - CI.component_Rod[7], "frameGtTantalloy61", CI.component_Rod[7], - CI.component_Plate[7], CI.component_Rod[7], CI.component_Plate[7], - RECIPE_IndustrialCokeOvenFrame); - //Coke Oven Coil 1 - RecipeUtils.addShapedGregtechRecipe( - plateBronze, plateBronze, plateBronze, - "frameGtBronze", CI.gearboxCasing_Tier_1, "frameGtBronze", - plateBronze, plateBronze, plateBronze, - RECIPE_IndustrialCokeOvenCasingA); - //Coke Oven Coil 2 - RecipeUtils.addShapedGregtechRecipe( - plateSteel, plateSteel, plateSteel, - "frameGtSteel", CI.gearboxCasing_Tier_2, "frameGtSteel", - plateSteel, plateSteel, plateSteel, - RECIPE_IndustrialCokeOvenCasingB); - } - - if (CORE.ConfigSwitches.enableMultiblock_IndustrialElectrolyzer){ - //Industrial Electrolyzer - RECIPE_IndustrialElectrolyzerController = GregtechItemList.Industrial_Electrolyzer.get(1); - RECIPE_IndustrialElectrolyzerFrame = GregtechItemList.Casing_Electrolyzer.get(Casing_Amount); - - //Electrolyzer Frame Casing - RecipeUtils.addShapedGregtechRecipe( - "platePotin", "stickLongChrome", "platePotin", - "stickLongPotin", "frameGtPotin", "stickLongPotin", - "platePotin", "stickLongPotin", "platePotin", - RECIPE_IndustrialElectrolyzerFrame); - //Industrial Electrolyzer - RecipeUtils.addShapedGregtechRecipe( - "plateStellite", CI.circuitTier5, "plateStellite", - CI.machineCasing_EV, EV_MACHINE_Electrolyzer, CI.machineCasing_EV, - "plateStellite", "rotorStellite", "plateStellite", - RECIPE_IndustrialElectrolyzerController); - } - - if (CORE.ConfigSwitches.enableMultiblock_IndustrialPlatePress){ - //Industrial Material Press - RECIPE_IndustrialMaterialPressController = GregtechItemList.Industrial_PlatePress.get(1); - RECIPE_IndustrialMaterialPressFrame = GregtechItemList.Casing_MaterialPress.get(Casing_Amount); - - //Material Press Frame Casing - RecipeUtils.addShapedGregtechRecipe( - "plateTitanium", "stickLongTumbaga", "plateTitanium", - "stickTantalloy60", "frameGtTumbaga", "stickTantalloy60", - "plateTitanium", "stickLongTumbaga", "plateTitanium", - RECIPE_IndustrialMaterialPressFrame); - //Industrial Material Press - RecipeUtils.addShapedGregtechRecipe( - "plateTitanium", CI.circuitTier5, "plateTitanium", - CI.machineCasing_EV, EV_MACHINE_BendingMachine, CI.machineCasing_EV, - "plateTitanium", CI.circuitTier5, "plateTitanium", - RECIPE_IndustrialMaterialPressController); - } - - if (CORE.ConfigSwitches.enableMultiblock_IndustrialMacerationStack){ - //Industrial Maceration Stack - RECIPE_IndustrialMacerationStackController = GregtechItemList.Industrial_MacerationStack.get(1); - RECIPE_IndustrialMacerationStackFrame = GregtechItemList.Casing_MacerationStack.get(Casing_Amount); - - //Maceration Frame Casing - RecipeUtils.addShapedGregtechRecipe( - "platePalladium", "platePalladium", "platePalladium", - "stickPlatinum", "frameGtInconel625", "stickPlatinum", - "platePalladium", "stickLongPalladium", "platePalladium", - RECIPE_IndustrialMacerationStackFrame); - //Industrial Maceration stack - RecipeUtils.addShapedGregtechRecipe( - "plateTungstenCarbide", EV_MACHINE_Macerator, "plateTungstenCarbide", - HV_MACHINE_Macerator, CI.circuitTier7, HV_MACHINE_Macerator, - "plateTungstenCarbide", CI.machineCasing_IV, "plateTungstenCarbide", - RECIPE_IndustrialMacerationStackController); - } - - if (CORE.ConfigSwitches.enableMultiblock_IndustrialWireMill){ - //Industrial Wire Factory - RECIPE_IndustrialWireFactoryController = GregtechItemList.Industrial_WireFactory.get(1); - RECIPE_IndustrialWireFactoryFrame = GregtechItemList.Casing_WireFactory.get(Casing_Amount); - - //Wire Factory Frame Casing - RecipeUtils.addShapedGregtechRecipe( - "plateBlueSteel", "stickBlueSteel", "plateBlueSteel", - "stickBlueSteel", "frameGtBlueSteel", "stickBlueSteel", - "plateBlueSteel", "stickBlueSteel", "plateBlueSteel", - RECIPE_IndustrialWireFactoryFrame); - //Industrial Wire Factory - RecipeUtils.addShapedGregtechRecipe( - "plateZeron100", CI.machineCasing_IV, "plateZeron100", - CI.circuitTier5, EV_MACHINE_Wiremill, CI.circuitTier5, - "plateZeron100", CI.machineCasing_IV, "plateZeron100", - RECIPE_IndustrialWireFactoryController); - } - - - - //Tiered Tanks - if (CORE.ConfigSwitches.enableMachine_FluidTanks){ - Logger.WARNING("Is New Horizons Loaded? "+GTNH); - if (!GTNH){ - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[1], CI.component_Plate[1], CI.component_Plate[1], - CI.component_Plate[1], pipeTier1, CI.component_Plate[1], - CI.component_Plate[1], GregtechItemList.Fluid_Cell_144L.get(1), CI.component_Plate[1], - GregtechItemList.GT_FluidTank_ULV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[2], CI.component_Plate[2], CI.component_Plate[2], - CI.component_Plate[2], pipeTier2, CI.component_Plate[2], - CI.component_Plate[2], CI.electricPump_LV, CI.component_Plate[2], - GregtechItemList.GT_FluidTank_LV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[3], CI.component_Plate[3], CI.component_Plate[3], - CI.component_Plate[3], pipeTier3, CI.component_Plate[3], - CI.component_Plate[3], CI.electricPump_MV, CI.component_Plate[3], - GregtechItemList.GT_FluidTank_MV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[4], CI.component_Plate[4], CI.component_Plate[4], - CI.component_Plate[4], pipeTier4, CI.component_Plate[4], - CI.component_Plate[4], CI.electricPump_HV, CI.component_Plate[4], - GregtechItemList.GT_FluidTank_HV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[5], CI.component_Plate[5], CI.component_Plate[5], - CI.component_Plate[5], pipeTier5, CI.component_Plate[5], - CI.component_Plate[5], CI.electricPump_EV, CI.component_Plate[5], - GregtechItemList.GT_FluidTank_EV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[6], CI.component_Plate[6], CI.component_Plate[6], - CI.component_Plate[6], pipeTier6, CI.component_Plate[6], - CI.component_Plate[6], CI.electricPump_IV, CI.component_Plate[6], - GregtechItemList.GT_FluidTank_IV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[7], CI.component_Plate[7], CI.component_Plate[7], - CI.component_Plate[7], pipeTier7, CI.component_Plate[7], - CI.component_Plate[7], CI.electricPump_LuV, CI.component_Plate[7], - GregtechItemList.GT_FluidTank_LuV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[8], CI.component_Plate[8], CI.component_Plate[8], - CI.component_Plate[8], pipeTier8, CI.component_Plate[8], - CI.component_Plate[8], CI.electricPump_ZPM, CI.component_Plate[8], - GregtechItemList.GT_FluidTank_ZPM.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[9], CI.component_Plate[9], CI.component_Plate[9], - CI.component_Plate[9], pipeTier9, CI.component_Plate[9], - CI.component_Plate[9], CI.electricPump_UV, CI.component_Plate[9], - GregtechItemList.GT_FluidTank_UV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[10], CI.component_Plate[10], CI.component_Plate[10], - CI.component_Plate[10], pipeTier10, CI.component_Plate[10], - CI.component_Plate[10], CI.electricPump_MAX, CI.component_Plate[10], - GregtechItemList.GT_FluidTank_MAX.get(1)); - } - else { - - CI.component_Plate[1] = "plateTin"; - pipeTier1 = "pipeLargeClay"; - CI.circuitTier1 = ItemList.Circuit_Primitive.get(1); - CI.component_Plate[2] = "plateCopper"; - pipeTier2 = "pipeHugeClay"; - CI.component_Plate[3] = "plateBronze"; - pipeTier3 = "pipeMediumBronze"; - CI.component_Plate[4] = "plateIron"; - pipeTier4 = "pipeMediumSteel"; - CI.component_Plate[5] = "plateSteel"; - CI.component_Plate[6] = "plateRedstone"; - CI.component_Plate[7] = "plateAluminium"; - CI.component_Plate[8] = "plateDarkSteel"; - ItemStack waterBucket = ItemUtils.getSimpleStack(Items.water_bucket); - - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[1], CI.component_Plate[5], CI.component_Plate[1], - CI.component_Plate[4], pipeTier1, CI.component_Plate[4], - CI.component_Plate[4], waterBucket, CI.component_Plate[4], - GregtechItemList.GT_FluidTank_ULV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[5], CI.component_Plate[4], CI.component_Plate[5], - CI.component_Plate[3], pipeTier2, CI.component_Plate[3], - CI.component_Plate[3], CI.electricPump_LV, CI.component_Plate[3], - GregtechItemList.GT_FluidTank_LV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[8], CI.component_Plate[3], CI.component_Plate[8], - CI.component_Plate[5], pipeTier3, CI.component_Plate[5], - CI.component_Plate[5], CI.electricPump_LV, CI.component_Plate[5], - GregtechItemList.GT_FluidTank_MV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.circuitTier1, CI.component_Plate[7], CI.circuitTier1, - CI.component_Plate[8], pipeTier4, CI.component_Plate[8], - CI.circuitTier1, CI.electricPump_MV, CI.circuitTier1, - GregtechItemList.GT_FluidTank_HV.get(1)); - } - } - - if (CORE.ConfigSwitches.enableMultiblock_MultiTank){ - //Industrial Multi Tank - //RECIPE_IndustrialMultiTankController = GregtechItemList.Industrial_MultiTank.get(1); - RECIPE_IndustrialMultiTankFrame = GregtechItemList.Casing_MultitankExterior.get(Casing_Amount); - - //Industrial Multi Tank Casing - RecipeUtils.addShapedGregtechRecipe( - "stickGrisium", "plateGrisium", "stickGrisium", - "plateGrisium", "frameGtGrisium", "plateGrisium", - "plateGrisium", "plateGrisium", "plateGrisium", - RECIPE_IndustrialMultiTankFrame); - //Industrial Multi Tank - RecipeUtils.addShapedGregtechRecipe( - "pipeHugeTantalloy60", "gearGrisium", "pipeHugeTantalloy60", - CI.circuitTier4, RECIPE_IndustrialMultiTankFrame, CI.circuitTier4, - "plateDoubleGrisium", "rotorGrisium", "plateDoubleGrisium", - RECIPE_IndustrialMultiTankController); - } - //TODO - - //Semi-Fluid Generators - ItemStack[][] aSemiFluidInputs = new ItemStack[3][6]; - aSemiFluidInputs[0] = new ItemStack[]{ - CI.getNumberedBioCircuit(14), - CI.getTieredMachineHull(1, 1), - CI.getElectricPiston(1, GTNH ? 4 : 2), - CI.getTieredComponent(OrePrefixes.circuit, 1, GTNH ? 4 : 2), - CI.getPlate(1, GTNH ? 8 : 4), - CI.getGear(1, GTNH ? 4 : 2) - }; - aSemiFluidInputs[1] = new ItemStack[]{ - CI.getNumberedCircuit(14), - CI.getTieredMachineHull(2, 1), - CI.getElectricPiston(2, GTNH ? 4 : 2), - CI.getTieredComponent(OrePrefixes.circuit, 2, GTNH ? 4 : 2), - CI.getPlate(2, GTNH ? 8 : 4), - CI.getGear(2, GTNH ? 4 : 2) - }; - aSemiFluidInputs[2] = new ItemStack[]{ - CI.getNumberedAdvancedCircuit(14), - CI.getTieredMachineHull(3, 1), - CI.getElectricPiston(3, GTNH ? 4 : 2), - CI.getTieredComponent(OrePrefixes.circuit, 3, GTNH ? 4 : 2), - CI.getPlate(3, GTNH ? 8 : 4), - CI.getGear(3, GTNH ? 4 : 2) - }; - FluidStack[] aSemiFluidFluidInputs = new FluidStack[] { - ALLOY.BRONZE.getFluidStack(144 * 8), - ALLOY.STEEL.getFluidStack(144 * 8), - ELEMENT.getInstance().ALUMINIUM.getFluidStack(144 * 8), - }; - - //ItemUtils.simpleMetaStack("IC2:blockGenerator:7", 7, 1); - ItemStack[] aSemifluids = new ItemStack[] {GregtechItemList.Generator_SemiFluid_LV.get(1), GregtechItemList.Generator_SemiFluid_MV.get(1), GregtechItemList.Generator_SemiFluid_HV.get(1)}; - for (int o=0;o<3;o++) { - CORE.RA.addSixSlotAssemblingRecipe( - aSemiFluidInputs[o], - aSemiFluidFluidInputs[o], - aSemifluids[o], - 20 * 30, - MaterialUtils.getVoltageForTier(o+1)); - } - - if (CORE.ConfigSwitches.enableMultiblock_AlloyBlastSmelter){ - //Industrial Blast Smelter - RECIPE_IndustrialBlastSmelterController = GregtechItemList.Industrial_AlloyBlastSmelter.get(1); - RECIPE_IndustrialBlastSmelterFrame = GregtechItemList.Casing_BlastSmelter.get(Casing_Amount); - RECIPE_IndustrialBlastSmelterCoil = GregtechItemList.Casing_Coil_BlastSmelter.get(Casing_Amount); - - //Blast Smelter - RecipeUtils.addShapedGregtechRecipe( - "plateZirconiumCarbide", CI.circuitTier4, "plateZirconiumCarbide", - cableTier4, EV_MACHINE_AlloySmelter, cableTier4, - "plateZirconiumCarbide", CI.circuitTier3, "plateZirconiumCarbide", - RECIPE_IndustrialBlastSmelterController); - //Blast Smelter Frame Casing - RecipeUtils.addShapedGregtechRecipe( - "plateZirconiumCarbide", CI.component_Rod[5], "plateZirconiumCarbide", - CI.component_Rod[5], "frameGtTumbaga", CI.component_Rod[5], - "plateZirconiumCarbide", CI.component_Rod[5], "plateZirconiumCarbide", - RECIPE_IndustrialBlastSmelterFrame); - //Blast Smelter Coil - RecipeUtils.addShapedGregtechRecipe( - "plateStaballoy", "plateStaballoy", "plateStaballoy", - "frameGtStaballoy", CI.gearboxCasing_Tier_3, "frameGtStaballoy", - "plateStaballoy", "plateStaballoy", "plateStaballoy", - RECIPE_IndustrialBlastSmelterCoil); - } - - if (CORE.ConfigSwitches.enableMultiblock_MatterFabricator){ - //Industrial Matter Fabricator - RECIPE_IndustrialMatterFabController = GregtechItemList.Industrial_MassFab.get(1); - RECIPE_IndustrialMatterFabFrame = GregtechItemList.Casing_MatterFab.get(Casing_Amount); - RECIPE_IndustrialMatterFabCoil = GregtechItemList.Casing_MatterGen.get(Casing_Amount); - - //Matter Fabricator CPU - RecipeUtils.addShapedGregtechRecipe( - CI.getDoublePlate(8, 1), CI.circuitTier5, CI.getPlate(8, 1), - cableTier8, CI.machineCasing_LuV, cableTier8, - CI.getPlate(8, 1), CI.circuitTier5, CI.getPlate(8, 1), - RECIPE_IndustrialMatterFabController); - //Matter Fabricator Frame Casing - RecipeUtils.addShapedGregtechRecipe( - "plateNiobiumCarbide", CI.component_Rod[8], "plateNiobiumCarbide", - CI.component_Rod[8], "frameGtInconel690", CI.component_Rod[8], - "plateNiobiumCarbide", CI.component_Rod[8], "plateNiobiumCarbide", - RECIPE_IndustrialMatterFabFrame); - //Matter Fabricator Coil - RecipeUtils.addShapedGregtechRecipe( - CI.getPlate(6, 1), CI.getPlate(7, 1), CI.getPlate(6, 1), - "frameGtStellite", CI.machineCasing_UV, "frameGtStellite", - CI.getPlate(6, 1), CI.getPlate(7, 1), CI.getPlate(6, 1), - RECIPE_IndustrialMatterFabCoil); - } - - if (CORE.ConfigSwitches.enableMultiblock_IndustrialSifter){ - //Industrial Sieve - RECIPE_IndustrialSieveController = GregtechItemList.Industrial_Sifter.get(1); - RECIPE_IndustrialSieveFrame = GregtechItemList.Casing_Sifter.get(Casing_Amount); - RECIPE_IndustrialSieveGrate = GregtechItemList.Casing_SifterGrate.get(Casing_Amount); - - //Industrial Sieve - RecipeUtils.addShapedGregtechRecipe( - "plateEglinSteel", CI.circuitTier2, "plateEglinSteel", - cableTier3, EV_MACHINE_Sifter, cableTier3, - "plateEglinSteel", CI.circuitTier2, "plateEglinSteel", - RECIPE_IndustrialSieveController); - //Industrial Sieve Casing - RecipeUtils.addShapedGregtechRecipe( - "plateEglinSteel", "plateEglinSteel", "plateEglinSteel", - "plateEglinSteel", "frameGtTumbaga", "plateEglinSteel", - "plateEglinSteel", "plateEglinSteel", "plateEglinSteel", - RECIPE_IndustrialSieveFrame); - //Industrial Sieve Grate - RecipeUtils.addShapedGregtechRecipe( - "frameGtEglinSteel", "wireFineSteel", "frameGtEglinSteel", - "wireFineSteel", "wireFineSteel", "wireFineSteel", - "frameGtEglinSteel", "wireFineSteel", "frameGtEglinSteel", - RECIPE_IndustrialSieveGrate); - } - - if (CORE.ConfigSwitches.enableMultiblock_TreeFarmer){ - //Industrial Tree Farmer - RECIPE_TreeFarmController = GregtechItemList.Industrial_TreeFarm.get(1); - RECIPE_TreeFarmFrame = GregtechItemList.Casing_PLACEHOLDER_TreeFarmer.get(Casing_Amount); - //Industrial Tree Farm Controller - if (!GTNH) { - RecipeUtils.addShapedGregtechRecipe( - "plateEglinSteel", "rotorEglinSteel", "plateEglinSteel", - "cableGt02Steel", "pipeMediumSteel", "cableGt02Steel", - "plateEglinSteel", CI.machineCasing_MV, "plateEglinSteel", - RECIPE_TreeFarmController); - } - else { - RecipeUtils.addShapedGregtechRecipe( - "plateEglinSteel", "rotorEglinSteel", "plateEglinSteel", - "cableGt02Silver", "pipeMediumStainlessSteel", "cableGt02Silver", - "plateEglinSteel", CI.machineCasing_HV, "plateEglinSteel", - RECIPE_TreeFarmController); - } - //Industrial Tree Farm Frame - RecipeUtils.addShapedGregtechRecipe( - ItemUtils.getSimpleStack(Blocks.dirt), ItemUtils.getSimpleStack(Blocks.dirt), ItemUtils.getSimpleStack(Blocks.dirt), - "plankWood", "frameGtTumbaga", "plankWood", - "plankWood", "plankWood", "plankWood", - RECIPE_TreeFarmFrame); - } - - if (CORE.ConfigSwitches.enableMachine_Tesseracts){ - //Tesseracts - RECIPE_TesseractGenerator = GregtechItemList.GT4_Tesseract_Generator.get(1); - RECIPE_TesseractTerminal = GregtechItemList.GT4_Tesseract_Terminal.get(1); - //Tesseract Generator - RecipeUtils.addShapedGregtechRecipe( - "plateTitanium","circuitMaster","plateTitanium", - "circuitMaster",ItemUtils.getSimpleStack(Blocks.ender_chest),"circuitMaster", - "plateTitanium",GregtechItemList.Gregtech_Computer_Cube.get(1),"plateTitanium", - RECIPE_TesseractGenerator); - //Tesseract Terminal - RecipeUtils.addShapedGregtechRecipe( - "plateTitanium","circuitElite","plateTitanium", - "circuitElite",ItemUtils.getSimpleStack(Blocks.ender_chest),"circuitElite", - "plateTitanium",CI.machineHull_EV,"plateTitanium", - RECIPE_TesseractTerminal); - } - - if (CORE.ConfigSwitches.enableMachine_SimpleWasher){ - ItemStack plateWrought = ItemUtils.getItemStackOfAmountFromOreDict("plateWroughtIron", 1); - ItemStack washerPipe; - - - if (CORE.ConfigSwitches.enableCustom_Pipes){ - washerPipe = ItemUtils.getItemStackOfAmountFromOreDict("pipeLargeClay", 1); - RecipeUtils.addShapedGregtechRecipe( - plateWrought, CI.electricPump_LV, plateWrought, - plateWrought, washerPipe, plateWrought, - plateWrought, CI.machineCasing_ULV, plateWrought, - GregtechItemList.SimpleDustWasher_ULV.get(1)); - } - //Add Recipe - washerPipe = ItemUtils.getItemStackOfAmountFromOreDict("pipeLargeCopper", 1); - RecipeUtils.addShapedGregtechRecipe( - plateWrought, CI.electricPump_LV, plateWrought, - plateWrought, washerPipe, plateWrought, - plateWrought, CI.machineCasing_ULV, plateWrought, - GregtechItemList.SimpleDustWasher_ULV.get(1)); - - int aSimpleWasherTier = 2; - int aSlot = 0; - ItemStack[][] aInputsForSimpleWashers = new ItemStack[4][6]; - - aInputsForSimpleWashers[0] = new ItemStack[] { - CI.getTieredMachineHull(2), - CI.getTieredComponent(OrePrefixes.screw, 2, GTNH ? 16 : 8), - CI.getTieredComponent(OrePrefixes.plate, 1, GTNH ? 8 : 4), - CI.getTieredComponent(OrePrefixes.rod, 2, GTNH ? 4 : 2), - CI.getTieredComponent(OrePrefixes.circuit, 2, GTNH ? 3 : 1), - - }; - aInputsForSimpleWashers[1] = new ItemStack[] { - CI.getTieredMachineHull(4), - CI.getTieredComponent(OrePrefixes.screw, 4, GTNH ? 24 : 12), - CI.getTieredComponent(OrePrefixes.plate, 3, GTNH ? 12 : 6), - CI.getTieredComponent(OrePrefixes.rod, 4, GTNH ? 6 : 3), - CI.getTieredComponent(OrePrefixes.circuit, 4, GTNH ? 4 : 2), - - }; - aInputsForSimpleWashers[2] = new ItemStack[] { - CI.getTieredMachineHull(6), - CI.getTieredComponent(OrePrefixes.screw, 6, GTNH ? 48 : 24), - CI.getTieredComponent(OrePrefixes.plate, 5, GTNH ? 16 : 8), - CI.getTieredComponent(OrePrefixes.rod, 6, GTNH ? 8 : 4), - CI.getTieredComponent(OrePrefixes.circuit, 6, GTNH ? 6 : 3), - - }; - aInputsForSimpleWashers[3] = new ItemStack[] { - CI.getTieredMachineHull(8), - CI.getTieredComponent(OrePrefixes.screw, 8, GTNH ? 64 : 32), - CI.getTieredComponent(OrePrefixes.plate, 7, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.rod, 8, GTNH ? 10 : 5), - CI.getTieredComponent(OrePrefixes.circuit, 8, GTNH ? 8 : 4), - - }; - - - - - - - ItemStack[] aSimpleWashers = new ItemStack[] {GregtechItemList.SimpleDustWasher_MV.get(1), GregtechItemList.SimpleDustWasher_EV.get(1), GregtechItemList.SimpleDustWasher_LuV.get(1), GregtechItemList.SimpleDustWasher_UV.get(1)}; - for (int i=0;i<4;i++) { - - CORE.RA.addSixSlotAssemblingRecipe( - aInputsForSimpleWashers[aSlot], - CI.getTieredFluid(aSimpleWasherTier, 144 * aSimpleWasherTier), - aSimpleWashers[aSlot], - 20 * 15 * aSimpleWasherTier, - (int) GT_Values.V[aSimpleWasherTier]); - - aSimpleWasherTier += 2; - aSlot++; - } - } - - if (CORE.ConfigSwitches.enableMachine_Pollution && PollutionUtils.isPollutionEnabled()){ - - RecipeUtils.addShapedGregtechRecipe( - "plateCarbon", "plateCarbon", "plateCarbon", - "dustCarbon", "dustCarbon", "dustCarbon", - "plateCarbon", "plateCarbon", "plateCarbon", - ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 0, 1)); - - RecipeUtils.addShapedGregtechRecipe( - "plateCarbon", "plateCarbon", "plateCarbon", - "cellLithiumPeroxide", "dustCarbon", "cellLithiumPeroxide", - "plateCarbon", "plateCarbon", "plateCarbon", - ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 1, 1)); - - //Pollution Detector - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[1], CI.sensor_MV, CI.component_Plate[1], - CI.component_Plate[2], CI.electricMotor_ULV, CI.component_Plate[2], - CI.getTieredCircuit(1), CI.machineHull_LV, CI.getTieredCircuit(0), - GregtechItemList.Pollution_Detector.get(1)); - - //ULV - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[0], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 0, 1), CI.component_Plate[0], - CI.component_Plate[0], CI.electricMotor_ULV, CI.component_Plate[0], - CI.getTieredCircuit(0), CI.machineHull_ULV, CI.getTieredCircuit(0), - GregtechItemList.Pollution_Cleaner_ULV.get(1)); - //LV - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[1], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 0, 1), CI.component_Plate[1], - CI.component_Plate[1], CI.electricMotor_LV, CI.component_Plate[1], - CI.getTieredCircuit(1), CI.machineHull_LV, CI.getTieredCircuit(1), - GregtechItemList.Pollution_Cleaner_LV.get(1)); - //MV - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[2], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 0, 1), CI.component_Plate[2], - CI.component_Plate[2], CI.electricMotor_MV, CI.component_Plate[2], - CI.getTieredCircuit(2), CI.machineHull_MV, CI.getTieredCircuit(2), - GregtechItemList.Pollution_Cleaner_MV.get(1)); - //HV - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[3], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 0, 1), CI.component_Plate[3], - CI.component_Plate[3], CI.electricMotor_HV, CI.component_Plate[3], - CI.getTieredCircuit(3), CI.machineHull_HV, CI.getTieredCircuit(3), - GregtechItemList.Pollution_Cleaner_HV.get(1)); - //EV - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[4], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 0, 1), CI.component_Plate[4], - CI.component_Plate[4], CI.electricMotor_EV, CI.component_Plate[4], - CI.getTieredCircuit(4), CI.machineHull_EV, CI.getTieredCircuit(4), - GregtechItemList.Pollution_Cleaner_EV.get(1)); - //IV - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[5], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 1, 1), CI.component_Plate[5], - CI.component_Plate[5], CI.electricMotor_IV, CI.component_Plate[5], - CI.getTieredCircuit(5), CI.machineHull_IV, CI.getTieredCircuit(5), - GregtechItemList.Pollution_Cleaner_IV.get(1)); - //LuV - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[6], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 1, 1), CI.component_Plate[6], - CI.component_Plate[6], CI.electricMotor_LuV, CI.component_Plate[6], - CI.getTieredCircuit(6), CI.machineHull_LuV, CI.getTieredCircuit(6), - GregtechItemList.Pollution_Cleaner_LuV.get(1)); - //ZPM - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[7], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 1, 1), CI.component_Plate[7], - CI.component_Plate[7], CI.electricMotor_ZPM, CI.component_Plate[7], - CI.getTieredCircuit(7), CI.machineHull_ZPM, CI.getTieredCircuit(7), - GregtechItemList.Pollution_Cleaner_ZPM.get(1)); - //UV - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[8], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 1, 1), CI.component_Plate[8], - CI.component_Plate[8], CI.electricMotor_UV, CI.component_Plate[8], - CI.getTieredCircuit(8), CI.machineHull_UV, CI.getTieredCircuit(8), - GregtechItemList.Pollution_Cleaner_UV.get(1)); - //MAX - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[9], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 1, 1), CI.component_Plate[9], - CI.component_Plate[9], CI.electricMotor_MAX, CI.component_Plate[9], - CI.getTieredCircuit(9), CI.machineHull_MAX, CI.getTieredCircuit(9), - GregtechItemList.Pollution_Cleaner_MAX.get(1)); - - - } - - if (CORE.ConfigSwitches.enableMultiblock_ThermalBoiler){ - RECIPE_ThermalBoilerController = GregtechItemList.GT4_Thermal_Boiler.get(1); - RECIPE_ThermalBoilerCasing = GregtechItemList.Casing_ThermalContainment.get(GTNH ? 1 : 2); - ItemStack centrifugeHV = GTNH ? ItemList.Machine_IV_Centrifuge.get(1) : ItemList.Machine_EV_Centrifuge.get(1); - - RecipeUtils.addShapedGregtechRecipe( - "craftingGeothermalGenerator", centrifugeHV, "craftingGeothermalGenerator", - "gearGtTitanium", CI.getTieredCircuitOreDictName(6), "gearGtTitanium", - "craftingGeothermalGenerator", centrifugeHV, "craftingGeothermalGenerator", - RECIPE_ThermalBoilerController); - - RecipeUtils.addShapedGregtechRecipe( - "craftingGeothermalGenerator", centrifugeHV, "craftingGeothermalGenerator", - "gearGtTungstenSteel", CI.getTieredCircuitOreDictName(5), "gearGtTungstenSteel", - "craftingGeothermalGenerator", centrifugeHV, "craftingGeothermalGenerator", - RECIPE_ThermalBoilerController); - - RecipeUtils.addShapedGregtechRecipe( - ALLOY.MARAGING350.getPlate(1), "plateStainlessSteel", ALLOY.MARAGING350.getPlate(1), - "circuitAdvanced", CI.machineCasing_HV, "circuitAdvanced", - ALLOY.MARAGING350.getPlate(1), ALLOY.MARAGING350.getPlate(1), ALLOY.MARAGING350.getPlate(1), - RECIPE_ThermalBoilerCasing); - - //Lava Filter Recipe - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - CI.getNumberedCircuit(18), - ItemUtils.getItemStackOfAmountFromOreDict("dustCarbon", GTNH ? 64 : 32), - ItemUtils.getItemStackOfAmountFromOreDict("wireFineSteel", GTNH ? 64 : 32), - ItemUtils.getItemStackOfAmountFromOreDict("ringTumbaga", GTNH ? 32 : 16), - ItemUtils.getItemStackOfAmountFromOreDict("foilCopper", GTNH ? 8 : 4), - ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:itemPartCarbonMesh", "RawCarbonMesh", 0, 64), - - }, - CI.getTieredFluid(3, 144), - ItemUtils.getSimpleStack(ModItems.itemLavaFilter, GTNH ? 8 : 16), - 1600, - 240 - ); - } - - //Air Intake Hatch - ItemList FluidRegulator_IV = ItemUtils.getValueOfItemList("FluidRegulator_IV", ItemList.Pump_IV); - ItemStack aTieredFluidRegulator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? FluidRegulator_IV.get(1) : ItemList.Pump_IV.get(1); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[6], ItemList.Casing_Grate.get(1), CI.component_Plate[6], - CI.component_Plate[6], aTieredFluidRegulator, CI.component_Plate[6], - CI.getTieredCircuit(4), ItemList.Hatch_Input_IV.get(1), CI.getTieredCircuit(4), - GregtechItemList.Hatch_Air_Intake.get(1)); - - if (CORE.ConfigSwitches.enableMultiblock_LiquidFluorideThoriumReactor){ - - //Thorium Reactor - RECIPE_LFTRController = GregtechItemList.ThoriumReactor.get(1); - RECIPE_LFTRInnerCasing = GregtechItemList.Casing_Reactor_II.get(1); //Zeron - RECIPE_LFTROuterCasing = GregtechItemList.Casing_Reactor_I.get(1); //Hastelloy - - ItemStack controlCircuit = ItemUtils.getSimpleStack(ModItems.itemCircuitLFTR); - if(!GTNH) { - RecipeUtils.addShapedGregtechRecipe( - controlCircuit, "cableGt12NaquadahAlloy", controlCircuit, - "plateDoubleHastelloyN", GregtechItemList.Gregtech_Computer_Cube.get(1), "plateDoubleHastelloyN", - "plateThorium232", CI.machineHull_EV, "plateThorium232", - RECIPE_LFTRController); - } else { - RecipeUtils.addShapedGregtechRecipe( - controlCircuit, "cableGt12NaquadahAlloy", controlCircuit, - "plateDoubleHastelloyN", GregtechItemList.Gregtech_Computer_Cube.get(1), "plateDoubleHastelloyN", - "plateThorium232", CI.machineHull_IV, "plateThorium232", - RECIPE_LFTRController); - } - RecipeUtils.addShapedGregtechRecipe( - "plateDoubleZeron100", CI.craftingToolScrewdriver, "plateDoubleZeron100", - "gearGtTalonite", CI.fieldGenerator_MV, "gearGtTalonite", - "plateDoubleZeron100", CI.craftingToolHammer_Hard, "plateDoubleZeron100", - RECIPE_LFTRInnerCasing); - - ItemStack IC2HeatPlate = ItemUtils.getItemStackFromFQRN("IC2:reactorPlatingHeat", 1); - RecipeUtils.addShapedGregtechRecipe( - "plateDoubleHastelloyN", IC2HeatPlate, "plateDoubleHastelloyN", - IC2HeatPlate, "frameGtHastelloyC276", IC2HeatPlate, - "plateDoubleHastelloyN", IC2HeatPlate, "plateDoubleHastelloyN", - RECIPE_LFTROuterCasing); - - //LFTR Control Circuit - ItemStack circuitT5 = ItemList.Circuit_Master.get(1); - GT_Values.RA.addAssemblerRecipe(circuitT5, CI.fieldGenerator_HV, controlCircuit, 240*20, 500); - - - //Fission Fuel Plant - RecipeUtils.addShapedGregtechRecipe( - CI.getTieredCircuitOreDictName(5), CI.craftingToolSolderingIron, CI.getTieredCircuitOreDictName(5), - "plateDenseTungstenSteel", GregtechItemList.Gregtech_Computer_Cube.get(1), "plateDenseTungstenSteel", - "gearGtStellite", CI.machineHull_IV, "gearGtStellite", - GregtechItemList.Industrial_FuelRefinery.get(1)); - - ItemStack mInnerTank; - - if (GTNH || !CORE.ConfigSwitches.enableMachine_FluidTanks){ - mInnerTank = ItemList.Quantum_Tank_LV.get(1); - } - else { - mInnerTank = GregtechItemList.GT_FluidTank_EV.get(1); - } - - //Incoloy Casing - RecipeUtils.addShapedGregtechRecipe( - "plateIncoloyDS", "pipeHugeStaballoy", "plateIncoloyDS", - "gearGtIncoloyDS", mInnerTank, "gearGtIncoloyDS", - "plateIncoloyDS", "pipeHugeStaballoy", "plateIncoloyDS", - GregtechItemList.Casing_Refinery_Internal.get(Casing_Amount)); - - //Hastelloy-N Sealant Casing - RecipeUtils.addShapedGregtechRecipe( - "plateIncoloyMA956", "plateHastelloyN", "plateIncoloyMA956", - "plateHastelloyN", "frameGtHastelloyC276", "plateHastelloyN", - "plateIncoloyMA956", "plateHastelloyN", "plateIncoloyMA956", - GregtechItemList.Casing_Refinery_External.get(Casing_Amount)); - - //Hastelloy-X Structural Casing - RecipeUtils.addShapedGregtechRecipe( - "ringInconel792", "gearGtHastelloyX", CI.component_Plate[5], - CI.craftingToolHammer_Hard, "frameGtHastelloyC276", CI.craftingToolWrench, - CI.component_Plate[5], CI.getTieredMachineCasing(4), "ringInconel792", - GregtechItemList.Casing_Refinery_Structural.get(Casing_Amount)); - - RecipeUtils.addShapedGregtechRecipe( - CI.getPlate(5, 1), ALLOY.HASTELLOY_X.getPlateDouble(1), CI.getPlate(5, 1), - CI.getPlate(5, 1), CI.getTieredMachineCasing(5), CI.getPlate(5, 1), - CI.getRobotArm(5, 1), ItemList.Casing_FrostProof.get(1), CI.getRobotArm(5, 1), - GregtechItemList.ColdTrap_IV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.getPlate(7, 1), ALLOY.HS188A.getPlateDouble(1), CI.getPlate(7, 1), - CI.getPlate(7, 1), GregtechItemList.ColdTrap_IV.get(1), CI.getPlate(7, 1), - CI.getRobotArm(7, 1), ItemList.Casing_FrostProof.get(1), CI.getRobotArm(7, 1), - GregtechItemList.ColdTrap_ZPM.get(1)); - - RecipeUtils.addShapedGregtechRecipe( - CI.getFieldGenerator(3, 1), CI.getRobotArm(5, 1), CI.getPlate(5, 1), - ALLOY.HASTELLOY_N.getPlateDouble(1), ItemList.Machine_IV_ChemicalReactor.get(1), ALLOY.HASTELLOY_N.getPlateDouble(1), - CI.getPlate(5, 1), ALLOY.HASTELLOY_N.getPlateDouble(1), CI.getFieldGenerator(3, 1), - GregtechItemList.ReactorProcessingUnit_IV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - CI.getFieldGenerator(5, 1), CI.getRobotArm(7, 1), CI.getPlate(7, 1), - ALLOY.HS188A.getPlateDouble(1), GregtechItemList.ReactorProcessingUnit_IV.get(1), ALLOY.HS188A.getPlateDouble(1), - CI.getPlate(7, 1), ALLOY.HS188A.getPlateDouble(1), CI.getFieldGenerator(5, 1), - GregtechItemList.ReactorProcessingUnit_ZPM.get(1)); - - } - - //Shelves - RecipeUtils.addShapedGregtechRecipe( - "screwWood", "plateWood", "screwWood", - CI.craftingToolHammer_Hard, "frameGtWood", CI.craftingToolHammer_Soft, - "plateWood", "plateWood", "plateWood", - GregtechItemList.GT4_Shelf.get(2)); - - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] {GregtechItemList.GT4_Shelf.get(1)}, GregtechItemList.GT4_Shelf_Compartment.get(1)); - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] {GregtechItemList.GT4_Shelf_Compartment.get(1)}, GregtechItemList.GT4_Shelf_Desk.get(1)); - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] {GregtechItemList.GT4_Shelf_Desk.get(1)}, GregtechItemList.GT4_Shelf_Iron.get(1)); - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] {GregtechItemList.GT4_Shelf_Iron.get(1)}, GregtechItemList.GT4_Shelf_FileCabinet.get(1)); - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] {GregtechItemList.GT4_Shelf_FileCabinet.get(1)}, GregtechItemList.GT4_Shelf.get(1)); - - - //Cyclotron - if (CORE.ConfigSwitches.enableMultiblock_Cyclotron){ - RECIPE_CyclotronController = GregtechItemList.COMET_Cyclotron.get(1); - RECIPE_CyclotronOuterCasing = GregtechItemList.Casing_Cyclotron_External.get(Casing_Amount); - RECIPE_CyclotronInnerCoil = GregtechItemList.Casing_Cyclotron_Coil.get(1); - - //Outer Casing - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - ItemList.Casing_FrostProof.get(1), - ItemUtils.simpleMetaStack("miscutils:itemDehydratorCoilWire", 0, GTNH ? 8 : 4), - ALLOY.INCOLOY_DS.getPlate(GTNH ? 16 : 8), - ALLOY.INCONEL_690.getScrew(GTNH ? 32 : 16), - ALLOY.EGLIN_STEEL.getLongRod(GTNH ? 16 : 4), - CI.getElectricPiston(3, GTNH ? 4 : 2) - }, - ALLOY.ZIRCONIUM_CARBIDE.getFluidStack(144 * 8), //Input Fluid - RECIPE_CyclotronOuterCasing, - 30 * 20 * 2, - MaterialUtils.getVoltageForTier(4)); - - - //Inner Coil - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - ItemList.Casing_Coil_Nichrome.get(1), - ItemUtils.simpleMetaStack("miscutils:itemDehydratorCoilWire", 1, GTNH ? 32 : 8), - ALLOY.INCOLOY_MA956.getPlate(GTNH ? 16 : 8), - ALLOY.TANTALLOY_61.getBolt(GTNH ? 32 : 16), - ALLOY.INCOLOY_020.getScrew(GTNH ? 64 : 32), - CI.getFieldGenerator(4, GTNH ? 2 : 1) - }, - ALLOY.HG1223.getFluidStack(144 * 5), //Input Fluid - RECIPE_CyclotronInnerCoil, - 60 * 20 * 2, - MaterialUtils.getVoltageForTier(5)); - - - //Controller - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.machineHull_IV, - ItemUtils.getSimpleStack(RECIPE_CyclotronInnerCoil, GTNH ? 4 : 2), - ALLOY.INCOLOY_020.getPlate(GTNH ? 16 : 8), - ALLOY.TANTALLOY_61.getGear(GTNH ? 4 : 2), - ALLOY.INCOLOY_MA956.getScrew(GTNH ? 64 : 16), - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(GTNH ? 6 : 5), GTNH ? 8 : 16) - }, - ALLOY.INCOLOY_020.getFluidStack(144 * 9), //Input Fluid - RECIPE_CyclotronController, - 60 * 20 * 5, - MaterialUtils.getVoltageForTier(5)); - } - - // Mazut - GT_ModHandler.addCraftingRecipe( - GregtechItemList.Controller_LargeSemifluidGenerator.get(1L), - CI.bitsd, - new Object[]{ - "PCP", - "EME", - "GWG", - 'M', ItemList.Hull_EV, - 'P', ItemList.Electric_Piston_EV, - 'E', ItemList.Electric_Pump_EV, - 'C', OrePrefixes.circuit.get(Materials.Data), - 'W', OrePrefixes.cableGt08.get(Materials.Electrum), - 'G', ALLOY.INCONEL_792.getGear(1) - }); - - - if (CORE.ConfigSwitches.enableMultiblock_PowerSubstation){ - RecipeUtils.addShapedRecipe( - "screwTitanium", "plateIncoloy020", "screwTitanium", - "plateIncoloy020", "frameGtIncoloyMA956", "plateIncoloy020", - "screwTitanium", "plateIncoloy020", "screwTitanium", - GregtechItemList.Casing_Power_SubStation.get(Casing_Amount)); - - ItemStack mBattery = ItemUtils.getSimpleStack(ModItems.itemCircuitLFTR); - - RecipeUtils.addShapedRecipe( - "plateIncoloyMA956", mBattery, "plateIncoloyMA956", - GregtechItemList.Casing_Power_SubStation.get(1), GregtechItemList.Casing_Vanadium_Redox.get(1), GregtechItemList.Casing_Power_SubStation.get(1), - "plateIncoloy020", "plateIncoloyMA956", "plateIncoloy020", - GregtechItemList.PowerSubStation.get(1)); - } - - if (CORE.ConfigSwitches.enableMultiblock_IndustrialThermalCentrifuge){ - RecipeUtils.addShapedRecipe( - "plateRedSteel", CI.craftingToolHammer_Hard, "plateRedSteel", - "plateRedSteel", "frameGtBlackSteel", "plateRedSteel", - "plateRedSteel", CI.craftingToolWrench, "plateRedSteel", - GregtechItemList.Casing_ThermalCentrifuge.get(Casing_Amount)); - - RecipeUtils.addShapedRecipe( - "plateRedSteel","circuitData","plateRedSteel", - "stickTalonite",EV_MACHINE_ThermalCentrifuge,"stickTalonite", - "plateRedSteel","gearGtTalonite","plateRedSteel", - GregtechItemList.Industrial_ThermalCentrifuge.get(1)); - } - - if (CORE.ConfigSwitches.enableMultiblock_IndustrialWashPlant){ - RecipeUtils.addShapedRecipe( - "plateGrisium", CI.craftingToolHammer_Hard, "plateGrisium", - "plateTalonite", "frameGtGrisium", "plateTalonite", - "plateGrisium", CI.craftingToolWrench, "plateGrisium", - GregtechItemList.Casing_WashPlant.get(Casing_Amount)); - - RecipeUtils.addShapedRecipe( - "plateGrisium",CI.electricPump_MV,"plateGrisium", - "plateTalonite",EV_MACHINE_OreWasher,"plateTalonite", - "plateGrisium","circuitData","plateGrisium", - GregtechItemList.Industrial_WashPlant.get(1)); - } - - if (CORE.ConfigSwitches.enableMultiblock_LargeAutoCrafter) { - - ItemStack aCoreBlock = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK - ? ItemUtils.getValueOfItemList("Block_IridiumTungstensteel", 1, ItemUtils.getItemStackOfAmountFromOreDict("blockOsmiridium", 1)) - : ItemUtils.getItemStackOfAmountFromOreDict("blockOsmiridium", 1); - - aCoreBlock.stackSize = GTNH ? 2 : 1; - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - ItemUtils.getSimpleStack(GregtechItemList.Casing_Multi_Use.get(1), GTNH ? 2 : 1), - aCoreBlock, - CI.getTieredComponent(OrePrefixes.circuit, GTNH ? 3 : 2, 16), - CI.getTieredComponent(OrePrefixes.screw, GTNH ? 6 : 5, 32), - CI.getTieredComponent(OrePrefixes.bolt, GTNH ? 6 : 5, 12), - CI.getTieredComponent(OrePrefixes.plate, GTNH ? 7 : 6, 8), }, - CI.getTertiaryTieredFluid(6, 144 * (GTNH ? 12 : 4)), - GregtechItemList.Casing_Autocrafter.get(Casing_Amount), 20 * 60 * 2, - MaterialUtils.getVoltageForTier(GTNH ? 6 : 5)); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - GregtechItemList.Casing_Refinery_Structural.get(4), - ItemUtils.getSimpleStack(ModItems.itemCircuitLFTR, GTNH ? 2 : 1), - CI.getTieredComponent(OrePrefixes.cableGt08, GTNH ? 7 : 6, GTNH ? 32 : 16), - CI.getTransmissionComponent(GTNH ? 6 : 5, 2), - GregtechItemList.Gregtech_Computer_Cube.get(1), - }, - CI.getTieredFluid(7, 144 * (GTNH ? 32 : 8)), GregtechItemList.GT4_Multi_Crafter.get(1), - 20 * 60 * 5, MaterialUtils.getVoltageForTier(GTNH ? 6 : 5)); - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - ItemUtils.getSimpleStack(GregtechItemList.Casing_Multi_Use.get(1), Casing_Amount), - CI.getEmitter(GTNH ? 5 : 4, GTNH ? 4 : 2), CI.getRobotArm(GTNH ? 5 : 4, GTNH ? 4 : 2), - CI.getTieredComponent(OrePrefixes.circuit, GTNH ? 3 : 2, 8), - CI.getTieredComponent(OrePrefixes.screw, GTNH ? 4 : 3, 8), - CI.getTieredComponent(OrePrefixes.plate, 5, GTNH ? 16 : 4), }, - CI.getAlternativeTieredFluid(5, 144 * 4), ItemUtils.getSimpleStack(ModBlocks.blockProjectTable), - 20 * 30 * 3, MaterialUtils.getVoltageForTier(GTNH ? 5 : 4)); - - } - - if (CORE.ConfigSwitches.enableMultiblock_IndustrialCuttingMachine){ - ItemStack plate = ALLOY.MARAGING300.getPlate(1); - RecipeUtils.addShapedRecipe( - plate, CI.craftingToolHammer_Hard, plate, - "plateStellite", "frameGtTalonite", "plateStellite", - plate, CI.craftingToolWrench, plate, - GregtechItemList.Casing_CuttingFactoryFrame.get(Casing_Amount)); - - RecipeUtils.addShapedRecipe( - plate,CI.getTieredCircuit(3),plate, - "wireFinePlatinum", EV_MACHINE_Cutter, "wireFinePlatinum", - plate,CI.getTieredCircuit(4),plate, - GregtechItemList.Industrial_CuttingFactoryController.get(1)); - } - - //EV_MACHINE_Extruder - if (CORE.ConfigSwitches.enableMultiblock_IndustrialExtrudingMachine){ - ItemStack plate = ALLOY.INCONEL_690.getPlate(1); - RecipeUtils.addShapedRecipe( - plate, CI.craftingToolHammer_Hard, plate, - "plateTalonite", "frameGtStaballoy", "plateTalonite", - plate, CI.craftingToolWrench, plate, - GregtechItemList.Casing_Extruder.get(Casing_Amount)); - - RecipeUtils.addShapedRecipe( - plate,CI.getTieredCircuit(4),plate, - CI.electricPiston_EV, EV_MACHINE_Extruder, CI.electricPiston_EV, - plate,CI.getTieredCircuit(4),plate, - GregtechItemList.Industrial_Extruder.get(1)); - } - - if (CORE.ConfigSwitches.enableMultiblock_IndustrialFishingPort){ - ItemStack plate = ALLOY.AQUATIC_STEEL.getPlate(1); - RecipeUtils.addShapedRecipe( - plate, CI.craftingToolHammer_Hard, plate, - "plateEglinSteel", "frameGtEglinSteel", "plateEglinSteel", - plate, CI.craftingToolWrench, plate, - GregtechItemList.Casing_FishPond.get(Casing_Amount)); - - RecipeUtils.addShapedRecipe( - plate,CI.getTieredCircuit(3),plate, - "wireFineElectrum", ItemUtils.getSimpleStack(ModBlocks.blockFishTrap), "wireFineElectrum", - plate,CI.getTieredCircuit(2),plate, - GregtechItemList.Industrial_FishingPond.get(1)); - } - - if (true) { - //Advanced Vacuum Freezer - ItemStack plate = ALLOY.HG1223.getPlateDouble(1); - ItemStack gear = ALLOY.INCOLOY_MA956.getGear(1); - ItemStack frame = ALLOY.LAFIUM.getFrameBox(1); - ItemStack cell1 = ItemList.Reactor_Coolant_He_6.get(1); - ItemStack cell2 = ItemList.Reactor_Coolant_NaK_6.get(1); - - RecipeUtils.addShapedRecipe( - plate, gear, plate, - cell1, frame, cell2, - plate, gear, plate, - GregtechItemList.Casing_AdvancedVacuum.get(Casing_Amount)); - RecipeUtils.addShapedRecipe( - gear,CI.getTieredCircuit(6),gear, - CI.electricPiston_IV, GregtechItemList.Casing_AdvancedVacuum.get(1), CI.electricPiston_IV, - plate, GregtechItemList.Gregtech_Computer_Cube.get(1), plate, - GregtechItemList.Industrial_Cryogenic_Freezer.get(1)); - - //Advanced Blast Furnace - plate = ALLOY.HASTELLOY_N.getPlateDouble(1); - gear = ALLOY.HASTELLOY_W.getGear(1); - frame = ALLOY.HASTELLOY_X.getFrameBox(1); - cell1 = ItemUtils.simpleMetaStack("IC2:reactorHeatSwitchDiamond:1", 1, 1); - cell2 = ItemUtils.simpleMetaStack("IC2:reactorVentGold:1", 1, 1); - ItemStack cell3 = ItemUtils.simpleMetaStack("IC2:reactorVentDiamond:1:1", 1, 1); - - RecipeUtils.addShapedRecipe( - plate, cell1, plate, - cell3, frame, cell2, - plate, gear, plate, - GregtechItemList.Casing_Adv_BlastFurnace.get(Casing_Amount)); - RecipeUtils.addShapedRecipe( - gear,CI.getTieredCircuit(6),gear, - CI.robotArm_IV, GregtechItemList.Casing_Adv_BlastFurnace.get(1), CI.robotArm_IV, - plate, GregtechItemList.Gregtech_Computer_Cube.get(1), plate, - GregtechItemList.Machine_Adv_BlastFurnace.get(1)); - - //Advanced Implosion Compressor - plate = ItemUtils.getItemStackOfAmountFromOreDict("plateAlloyIridium", 1); - gear = ALLOY.LEAGRISIUM.getGear(1); - frame = ALLOY.CINOBITE.getFrameBox(1); - cell1 = ItemUtils.simpleMetaStack("IC2:reactorHeatSwitchDiamond:1", 1, 1); - cell2 = ItemUtils.simpleMetaStack("IC2:reactorVentGold:1", 1, 1); - - RecipeUtils.addShapedRecipe( - gear,CI.getTieredCircuit(6),gear, - CI.fieldGenerator_IV, CI.machineHull_ZPM, CI.robotArm_IV, - plate, GregtechItemList.Gregtech_Computer_Cube.get(1), plate, - GregtechItemList.Machine_Adv_ImplosionCompressor.get(1)); - - - - //Supply Depot - plate = ALLOY.TUNGSTEN_CARBIDE.getPlateDouble(1); - gear = ALLOY.TRINIUM_TITANIUM.getRing(1); - frame = ALLOY.TUNGSTEN_CARBIDE.getFrameBox(1); - cell1 = CI.conveyorModule_EV; - cell2 = CI.electricMotor_IV; - ItemStack casingAmazon = GregtechItemList.Casing_AmazonWarehouse.get(1); - ItemStack aTieredUnboxinator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? ItemUtils.getValueOfItemList("Machine_LuV_Unboxinator", 1, ItemList.Machine_IV_Unboxinator.get(1)) : ItemList.Machine_IV_Unboxinator.get(1); - - - RecipeUtils.addShapedRecipe( - plate, ItemUtils.getItemStackOfAmountFromOreDict("cableGt12VanadiumGallium", 1), plate, - cell1, frame, cell2, - plate, gear, plate, - GregtechItemList.Casing_AmazonWarehouse.get(Casing_Amount)); - RecipeUtils.addShapedRecipe( - casingAmazon, CI.getTieredCircuit(7), casingAmazon, - CI.robotArm_LuV, aTieredUnboxinator, CI.robotArm_LuV, - CI.conveyorModule_LuV, GregtechItemList.Gregtech_Computer_Cube.get(1), CI.conveyorModule_LuV, - GregtechItemList.Amazon_Warehouse_Controller.get(1)); - - - //Industrial Mixing Machine - RecipeUtils.addShapedRecipe( - "plateStaballoy",CI.getTieredCircuit(5),"plateStaballoy", - "plateZirconiumCarbide", EV_MACHINE_Mixer, "plateZirconiumCarbide", - "plateStaballoy",CI.getTieredCircuit(5),"plateStaballoy", - GregtechItemList.Industrial_Mixer.get(1)); - - } - - if (CORE.ConfigSwitches.enableMultiblock_IndustrialMultiMachine){ - ItemStack plate = ALLOY.STABALLOY.getPlate(1); - - - ItemStack o_Compressor; - ItemStack o_Lathe; - ItemStack o_Electromagnet; - ItemStack o_Fermenter; - ItemStack o_Distillery; - ItemStack o_Extractor; - if (GTNH) { - o_Compressor = ItemList.Machine_IV_Compressor.get(1); - o_Lathe = ItemList.Machine_IV_Lathe.get(1); - o_Electromagnet = ItemList.Machine_IV_Polarizer.get(1); - o_Fermenter = ItemList.Machine_IV_Fermenter.get(1); - o_Distillery = ItemList.Machine_IV_FluidExtractor.get(1); - o_Extractor = ItemList.Machine_IV_Extractor.get(1); - } - else { - o_Compressor = ItemList.Machine_EV_Compressor.get(1); - o_Lathe = ItemList.Machine_EV_Lathe.get(1); - o_Electromagnet = ItemList.Machine_EV_Polarizer.get(1); - o_Fermenter = ItemList.Machine_EV_Fermenter.get(1); - o_Distillery = ItemList.Machine_EV_FluidExtractor.get(1); - o_Extractor = ItemList.Machine_EV_Extractor.get(1); - } - RecipeUtils.addShapedRecipe( - plate, CI.craftingToolHammer_Hard, plate, - "plateStainlessSteel", "frameGtZirconiumCarbide", "plateStainlessSteel", - plate, CI.craftingToolWrench, plate, - GregtechItemList.Casing_Multi_Use.get(Casing_Amount)); - - RecipeUtils.addShapedRecipe( - o_Compressor, o_Lathe, o_Electromagnet, - plate, ItemUtils.getSimpleStack(ModBlocks.blockProjectTable), plate, - o_Fermenter, o_Distillery, o_Extractor, - GregtechItemList.Industrial_MultiMachine.get(1)); - } - - - - - /* - * 6/1/19 - Content additions - */ - - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { - - /* - * Fusion MK4 - */ - - //Fusion MK4 Controller - CORE.RA.addAssemblylineRecipe( - ItemList.FusionComputer_UV.get(1), - (int) GT_Values.V[5], - new Object[] { - new Object[] {CI.getTieredCircuitOreDictName(9), 4 * (GTNH ? 2 : 1)}, - new Object[] {CI.getTieredCircuitOreDictName(7), 32 * (GTNH ? 2 : 1)}, - ItemUtils.getItemStackOfAmountFromOreDict("wireGt16Superconductor", 8 * (GTNH ? 4 : 2)), - ItemUtils.getItemStackOfAmountFromOreDict("plateDenseNeutronium", 2 * (GTNH ? 4 : 1)), - ItemUtils.getSimpleStack((GTNH ? CI.fieldGenerator_MAX : CI.fieldGenerator_ZPM), 5), - ItemList.Energy_LapotronicOrb2.get(1 * (GTNH ? 64 : 8)), - GTNH ? GregtechItemList.Compressed_Fusion_Reactor.get(1) : ItemList.FusionComputer_UV.get(1), - GregtechItemList.Casing_Fusion_Internal.get(1) - }, - new FluidStack[] { - ALLOY.PIKYONIUM.getFluidStack(32 * 144 * (GTNH ? 2 : 1)), - ALLOY.HG1223.getFluidStack(64 * 144) - }, - GregtechItemList.FusionComputer_UV2.get(1), - (int) GT_Values.V[6], - (int) GT_Values.V[8]); - - //Fusion MK4 Casing - CORE.RA.addAssemblylineRecipe( - ItemList.Casing_Fusion2.get(1), - (int) GT_Values.V[4], - new Object[] { - new Object[] {CI.getTieredCircuitOreDictName(5), 8 * (GTNH ? 2 : 1)}, - new Object[] {CI.getTieredCircuitOreDictName(4), 16 * (GTNH ? 2 : 1)}, - ItemUtils.getItemStackOfAmountFromOreDict("blockTungstenCarbide", 4 * (GTNH ? 2 : 1)), - ItemUtils.getItemStackOfAmountFromOreDict("plateNeutronium", 2 * (GTNH ? 2 : 1)), - ItemUtils.getSimpleStack((GTNH ? CI.electricMotor_MAX : CI.electricMotor_ZPM), 3 * (GTNH ? 2 : 1)), - ItemUtils.getSimpleStack((GTNH ? CI.electricPiston_UV : CI.electricPiston_LuV), 4 * (GTNH ? 2 : 1)), - ItemUtils.getSimpleStack((GTNH ? CI.machineHull_MAX : CI.machineHull_ZPM), 1 * (GTNH ? 2 : 1)), - ItemList.Casing_Fusion2.get(1) - }, - new FluidStack[] { - Materials.NaquadahAlloy.getMolten(576 * (GTNH ? 2 : 1)), - ALLOY.ZERON_100.getFluidStack(16 * 144) - }, - GregtechItemList.Casing_Fusion_External.get(1), - (int) GT_Values.V[5], - (int) GT_Values.V[7]); - - //Fusion MK4 Coil - CORE.RA.addAssemblylineRecipe( - ItemList.Casing_Fusion_Coil.get(1), - (int) GT_Values.V[4], - new Object[] { - new Object[] {CI.getTieredCircuitOreDictName(8), 4 * (GTNH ? 2 : 1)}, - new Object[] {CI.getTieredCircuitOreDictName(6), 8 * (GTNH ? 2 : 1)}, - ItemUtils.getItemStackOfAmountFromOreDict("plateNeutronium", 2 * (GTNH ? 3 : 1)), - ItemUtils.getSimpleStack((GTNH ? CI.emitter_MAX : CI.emitter_ZPM), 2 * (GTNH ? 2 : 1)), - ItemUtils.getSimpleStack((GTNH ? CI.sensor_MAX : CI.sensor_ZPM), 2 * (GTNH ? 2 : 1)), - ItemUtils.getSimpleStack((GTNH ? CI.fieldGenerator_MAX : CI.fieldGenerator_LuV), 2 * (GTNH ? 2 : 1)), - new Object[] {CI.getTieredCircuitOreDictName(8), 8}, - ItemList.Energy_LapotronicOrb2.get(2 * (GTNH ? 16 : 1)), - ItemList.Casing_Fusion_Coil.get(1) - }, - new FluidStack[] { - ALLOY.CINOBITE.getFluidStack(16 * 144 * (GTNH ? 2 : 1)), - ALLOY.ABYSSAL.getFluidStack(64 * 144) - }, - GregtechItemList.Casing_Fusion_Internal.get(1), - (int) GT_Values.V[5], - (int) GT_Values.V[7]); - - - - - ItemStack aDrillController = ItemUtils.getValueOfItemList("OreDrill4", ItemList.Hull_UV).get(1); - - //Drilling Platform - /*CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - aDrillController, - ItemUtils.getItemStackOfAmountFromOreDict("frameGtTriniumNaquadahCarbonite", 3), - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(9), 2 * (GTNH ? 4 : 1)), - ItemUtils.getSimpleStack((GTNH ? CI.conveyorModule_UV : CI.conveyorModule_ZPM), 2 * (GTNH ? 2 : 1)), - ItemUtils.getSimpleStack((GTNH ? CI.electricPump_UV : CI.electricPump_ZPM), 4 * (GTNH ? 2 : 1)), - }, - ALLOY.LAFIUM.getFluid(144 * 8 * (GTNH ? 2 : 1)), - GregtechItemList.BedrockMiner_MKI.get(1), - (int) GT_Values.V[5], - (int) GT_Values.V[7]);*/ - - //Drilling Platform Casings - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("frameGtTriniumNaquadahCarbonite", 4), - ItemUtils.getItemStackOfAmountFromOreDict("plateDoubleTriniumTitaniumAlloy", 1 * (GTNH ? 2 : 1)), - ItemUtils.getItemStackOfAmountFromOreDict("gearGtPikyonium64B", 2 * (GTNH ? 2 : 1)), - ALLOY.TRINIUM_REINFORCED_STEEL.getPlateDouble(4 * (GTNH ? 2 : 1)), - ItemUtils.getSimpleStack((GTNH ? CI.machineHull_UV : CI.machineHull_LuV), 1 * (GTNH ? 2 : 1)), - }, - ALLOY.MARAGING350.getFluidStack(144 * 16 * (GTNH ? 2 : 1)), - GregtechItemList.Casing_BedrockMiner.get(1), - (int) GT_Values.V[4], - (int) GT_Values.V[6]); - - - - - - - - - - } - - - - - - - - - - - } - - int aCostMultiplier = GTNH ? 2 : 1; - - //Mystic Frame - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - GregtechItemList.Casing_Multi_Use.get(1), - ItemList.Field_Generator_MV.get(1, CI.circuitTier7), - ItemList.Field_Generator_HV.get(1, CI.circuitTier7), - ItemList.Emitter_HV.get(1, CI.circuitTier7), - ItemList.Sensor_HV.get(1, CI.circuitTier7), - CI.getTieredComponent(OrePrefixes.plate, 7, 8 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.wireGt08, 8, 4 * aCostMultiplier), - }, - CI.getTieredFluid(6, (144 * 8)), //Input Fluid - ItemUtils.getSimpleStack(Dimension_Everglades.blockPortalFrame, 2), - 45 * 20 * 1 * (6), - MaterialUtils.getVoltageForTier(6)); - - - //Player Doors - ItemStack[] aDoorInputs = new ItemStack[] { - ItemUtils.getSimpleStack(Blocks.log2), - ItemUtils.getSimpleStack(Blocks.iron_block), - ItemUtils.getSimpleStack(Blocks.glass), - ItemUtils.getSimpleStack(Blocks.packed_ice), - ItemUtils.getSimpleStack(Blocks.cactus), - }; - ItemStack[] aDoorOutputs = new ItemStack[] { - ItemUtils.getSimpleStack(ModBlocks.blockPlayerDoorWooden), - ItemUtils.getSimpleStack(ModBlocks.blockPlayerDoorIron), - ItemUtils.getSimpleStack(ModBlocks.blockPlayerDoorCustom_Glass), - ItemUtils.getSimpleStack(ModBlocks.blockPlayerDoorCustom_Ice), - ItemUtils.getSimpleStack(ModBlocks.blockPlayerDoorCustom_Cactus), - }; - - for (int y = 0; y < aDoorInputs.length; y++) { - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - ItemUtils.getSimpleStack(Items.iron_door), - aDoorInputs[y], - ItemList.Sensor_LV.get(1, CI.circuitTier7), - CI.getTieredComponent(OrePrefixes.plate, 1, 2 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.wireGt02, 1, 2 * aCostMultiplier), - ItemUtils.getSimpleStack(Items.redstone, 16) - }, - CI.getTieredFluid(1, (144 * 2)), //Input Fluid - aDoorOutputs[y], - 100, - MaterialUtils.getVoltageForTier(1)); - } - - - - - - - Logger.INFO("Done loading recipes for the Various machine blocks."); - } - - - private static void controlCores() { - - Material[] aMat_A = new Material[] { - ALLOY.POTIN, - ALLOY.ZIRCONIUM_CARBIDE, - ALLOY.TANTALLOY_61, - ALLOY.INCONEL_792, - ALLOY.STABALLOY, - ALLOY.TALONITE, - ALLOY.HASTELLOY_N, - ALLOY.HG1223, - ALLOY.LAFIUM, - ALLOY.PIKYONIUM - }; - Material[] aMat_B = new Material[] { - ALLOY.TUMBAGA, - ALLOY.SILICON_CARBIDE, - ALLOY.EGLIN_STEEL, - ALLOY.NICHROME, - ALLOY.TUNGSTEN_CARBIDE, - ALLOY.STELLITE, - ALLOY.HASTELLOY_C276, - ALLOY.NITINOL_60, - ALLOY.ZERON_100, - ALLOY.CINOBITE - }; - - Item aBaseCore = ModItems.itemControlCore; - ItemStack[] aInputPrevTier = new ItemStack[] { - GTNH ? ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore3", 1) : ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore2", 1), - ItemUtils.simpleMetaStack(aBaseCore, 0, 1), - ItemUtils.simpleMetaStack(aBaseCore, 1, 1), - ItemUtils.simpleMetaStack(aBaseCore, 2, 1), - ItemUtils.simpleMetaStack(aBaseCore, 3, 1), - ItemUtils.simpleMetaStack(aBaseCore, 4, 1), - ItemUtils.simpleMetaStack(aBaseCore, 5, 1), - ItemUtils.simpleMetaStack(aBaseCore, 6, 1), - ItemUtils.simpleMetaStack(aBaseCore, 7, 1), - ItemUtils.simpleMetaStack(aBaseCore, 8, 1), - }; - ItemStack[] aOutput = new ItemStack[] { - ItemUtils.simpleMetaStack(aBaseCore, 0, 1), - ItemUtils.simpleMetaStack(aBaseCore, 1, 1), - ItemUtils.simpleMetaStack(aBaseCore, 2, 1), - ItemUtils.simpleMetaStack(aBaseCore, 3, 1), - ItemUtils.simpleMetaStack(aBaseCore, 4, 1), - ItemUtils.simpleMetaStack(aBaseCore, 5, 1), - ItemUtils.simpleMetaStack(aBaseCore, 6, 1), - ItemUtils.simpleMetaStack(aBaseCore, 7, 1), - ItemUtils.simpleMetaStack(aBaseCore, 8, 1), - ItemUtils.simpleMetaStack(aBaseCore, 9, 1), - - }; - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.machineHull_HV, - aOutput[1], - aMat_A[1].getGear(GTNH ? 4 : 2), - aMat_B[2].getPlateDouble(GTNH ? 16 : 8), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+(GTNH ? "2" : "1"), GTNH ? 4 : 2), - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(GTNH ? 3 : 2), GTNH ? 10 : 5) - }, - aMat_B[3].getFluidStack(144 * 8), //Input Fluid - GregtechItemList.Hatch_Control_Core.get(1), - 60 * 20 * 5, - MaterialUtils.getVoltageForTier(3)); - - - for (int i = 0; i < 10; i++) { - boolean aDub = false; - ItemStack aPlateStack = aMat_A[i].getPlateDouble((GTNH ? 16 : 8) * (aDub ? 2 : 1)); - ItemStack aGearStack = aMat_B[i].getGear(GTNH ? 4 : 2 * (aDub ? 2 : 1)); - ItemStack aRodStack = aMat_A[i].getLongRod(GTNH ? 16 : 8 * (aDub ? 2 : 1)); - ItemStack aScrewStack = aMat_B[i].getScrew(32 * (aDub ? 2 : 1)); - - if (!ItemUtils.checkForInvalidItems(aPlateStack)) { - aPlateStack = aMat_A[i].getPlate((GTNH ? 16 : 8) * (aDub ? 2 : 1) * 2); - if (!ItemUtils.checkForInvalidItems(aPlateStack)) { - aPlateStack = aMat_B[i].getPlateDouble((GTNH ? 16 : 8) * (aDub ? 2 : 1)); - if (!ItemUtils.checkForInvalidItems(aPlateStack)) { - aPlateStack = aMat_B[i].getPlate((GTNH ? 16 : 8) * (aDub ? 2 : 1) * 2); - } - } - } - if (!ItemUtils.checkForInvalidItems(aGearStack)) { - aGearStack = aMat_A[i].getGear(GTNH ? 8 : 4 * (aDub ? 2 : 1)); - } - if (!ItemUtils.checkForInvalidItems(aRodStack)) { - aRodStack = aMat_B[i].getLongRod(GTNH ? 32 : 16 * (aDub ? 2 : 1)); - } - if (!ItemUtils.checkForInvalidItems(aScrewStack)) { - aScrewStack = aMat_A[i].getScrew(32 * (aDub ? 2 : 1)); - } - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getEnergyCore(i, 4), - aPlateStack, - aGearStack, - aRodStack, - aScrewStack, - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName((int) (4+Math.ceil((double) i / (double) 2))), GTNH ? (i * 2 * 2) : (i * 2)) - }, - CI.getTieredFluid(i, 144 * 4 * (i+1)), //Input Fluid - aOutput[i], - 60 * 20 * 1 * (i+1), - MaterialUtils.getVoltageForTier(i)); - } - } - - private static void energyCores() { - - //Simpler Recipes for normal Players, Force assembly crafting in GTNH - if (!GTNH) { - //Buffer Core - /*RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[1], cableTier1, CI.component_Plate[1], - "circuitPrimitive", "plateStaballoy", "circuitPrimitive", - CI.component_Plate[1], cableTier1, CI.component_Plate[1], - RECIPE_BufferCore_ULV); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[2], cableTier2, CI.component_Plate[2], - RECIPE_BufferCore_ULV, CI.machineHull_HV, RECIPE_BufferCore_ULV, - CI.component_Plate[2], cableTier2, CI.component_Plate[2], - RECIPE_BufferCore_LV); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[3], cableTier3, CI.component_Plate[3], - RECIPE_BufferCore_LV, CI.circuitTier2, RECIPE_BufferCore_LV, - CI.component_Plate[3], cableTier3, CI.component_Plate[3], - RECIPE_BufferCore_MV); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[4], cableTier4, CI.component_Plate[4], - RECIPE_BufferCore_MV, CI.circuitTier3, RECIPE_BufferCore_MV, - CI.component_Plate[4], cableTier4, CI.component_Plate[4], - RECIPE_BufferCore_HV); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[5], cableTier5, CI.component_Plate[5], - RECIPE_BufferCore_HV, CI.circuitTier4, RECIPE_BufferCore_HV, - CI.component_Plate[5], cableTier5, CI.component_Plate[5], - RECIPE_BufferCore_EV); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[6], cableTier6, CI.component_Plate[6], - RECIPE_BufferCore_EV, CI.circuitTier5, RECIPE_BufferCore_EV, - CI.component_Plate[6], cableTier6, CI.component_Plate[6], - RECIPE_BufferCore_IV); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[7], cableTier7, CI.component_Plate[7], - RECIPE_BufferCore_IV, CI.circuitTier6, RECIPE_BufferCore_IV, - CI.component_Plate[7], cableTier7, CI.component_Plate[7], - RECIPE_BufferCore_LuV); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[8], cableTier8, CI.component_Plate[8], - RECIPE_BufferCore_LuV, CI.circuitTier7, RECIPE_BufferCore_LuV, - CI.component_Plate[8], cableTier8, CI.component_Plate[8], - RECIPE_BufferCore_ZPM); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[9], cableTier9, CI.component_Plate[9], - RECIPE_BufferCore_ZPM, CI.circuitTier8, RECIPE_BufferCore_ZPM, - CI.component_Plate[9], cableTier9, CI.component_Plate[9], - RECIPE_BufferCore_UV); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[10], cableTier10, CI.component_Plate[10], - RECIPE_BufferCore_UV, CI.circuitTier9, RECIPE_BufferCore_UV, - CI.component_Plate[10], cableTier10, CI.component_Plate[10], - RECIPE_BufferCore_MAX);*/ - - - /*RecipeUtils.addShapedGregtechRecipe( - wireTier1, RECIPE_BufferCore_ULV, wireTier1, - wireTier1, CI.machineCasing_ULV, wireTier1, - CI.circuitPrimitive, CI.circuitTier1, CI.circuitPrimitive, - RECIPE_Buffer_ULV); - RecipeUtils.addShapedGregtechRecipe( - wireTier2, RECIPE_BufferCore_LV, wireTier2, - wireTier2, CI.machineCasing_LV, wireTier2, - CI.circuitTier1, RECIPE_BufferCore_LV, CI.circuitTier1, - RECIPE_Buffer_LV); - RecipeUtils.addShapedGregtechRecipe( - wireTier3, RECIPE_BufferCore_MV, wireTier3, - wireTier3, CI.machineCasing_MV, wireTier3, - CI.circuitTier2, RECIPE_BufferCore_MV, CI.circuitTier2, - RECIPE_Buffer_MV); - RecipeUtils.addShapedGregtechRecipe( - wireTier4, RECIPE_BufferCore_HV, wireTier4, - wireTier4, CI.machineCasing_HV, wireTier4, - CI.circuitTier3, RECIPE_BufferCore_HV, CI.circuitTier3, - RECIPE_Buffer_HV); - RecipeUtils.addShapedGregtechRecipe( - wireTier5, RECIPE_BufferCore_EV, wireTier5, - wireTier5, CI.machineCasing_EV, wireTier5, - CI.circuitTier4, RECIPE_BufferCore_EV, CI.circuitTier4, - RECIPE_Buffer_EV); - RecipeUtils.addShapedGregtechRecipe( - wireTier6, RECIPE_BufferCore_IV, wireTier6, - wireTier6, CI.machineCasing_IV, wireTier6, - CI.circuitTier5, RECIPE_BufferCore_IV, CI.circuitTier5, - RECIPE_Buffer_IV); - RecipeUtils.addShapedGregtechRecipe( - wireTier7, RECIPE_BufferCore_LuV, wireTier7, - wireTier7, CI.machineCasing_LuV, wireTier7, - CI.circuitTier6, RECIPE_BufferCore_LuV, CI.circuitTier6, - RECIPE_Buffer_LuV); - RecipeUtils.addShapedGregtechRecipe( - wireTier8, RECIPE_BufferCore_ZPM, wireTier8, - wireTier8, CI.machineCasing_ZPM, wireTier8, - CI.circuitTier7, RECIPE_BufferCore_ZPM, CI.circuitTier7, - RECIPE_Buffer_ZPM); - RecipeUtils.addShapedGregtechRecipe( - wireTier9, RECIPE_BufferCore_UV, wireTier9, - wireTier9, CI.machineCasing_UV, wireTier9, - CI.circuitTier8, RECIPE_BufferCore_UV, CI.circuitTier8, - RECIPE_Buffer_UV); - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[11], RECIPE_BufferCore_MAX, CI.component_Plate[11], - wireTier10, CI.machineCasing_MAX, wireTier10, - CI.circuitTier9, RECIPE_BufferCore_MAX, CI.circuitTier9, - RECIPE_Buffer_MAX);*/ - } - - - ItemStack[] aBufferOutput = new ItemStack[] { - RECIPE_Buffer_ULV, RECIPE_Buffer_LV, RECIPE_Buffer_MV, - RECIPE_Buffer_HV, RECIPE_Buffer_EV, RECIPE_Buffer_IV, - RECIPE_Buffer_LuV, RECIPE_Buffer_ZPM, RECIPE_Buffer_UV, RECIPE_Buffer_MAX }; - - - - ItemStack[] aOutput = new ItemStack[] { - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"1", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"2", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"3", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"4", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"5", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"6", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"7", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"8", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"9", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"10", 1) - }; - - int aCostMultiplier = GTNH ? 4 : 1; - - for (int i = 0; i < 10; i++) { - - ItemStack aPrevTier = (i == 0 ? CI.getTieredMachineHull(GTNH ? 2 : 1) : aOutput[i-1]); - aPrevTier.stackSize = GTNH ? 2 : 1; - int aTier = (i + 1); - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - aPrevTier, - CI.getTieredComponent(OrePrefixes.plate, aTier, 4 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.cableGt04, i, 2 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.circuit, aTier, 2 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.screw, aTier, 6 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.bolt, i, 12 * (GTNH ? 2 : 1)), - }, - CI.getTieredFluid(i, (144 * 4 * aTier)), //Input Fluid - aOutput[i], - 45 * 10 * 1 * (aTier), - MaterialUtils.getVoltageForTier(i)); - - //Energy Buffer - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - ItemUtils.getSimpleStack(aOutput[i], 4), - CI.getTieredComponent(OrePrefixes.plate, aTier, 8 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.wireGt08, i, 4 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.circuit, i, 4 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.stickLong, aTier, 4 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.gearGt, i, 5 * (GTNH ? 2 : 1)), - }, - CI.getTieredFluid(aTier, (144 * 16 * aTier)), //Input Fluid - aBufferOutput[i], - 45 * 20 * 1 * (aTier), - MaterialUtils.getVoltageForTier(i)); - - } - - - - - } - - private static void wirelessChargers() { - - ItemStack[] aChargers = new ItemStack[] { - null, - GregtechItemList.Charger_LV.get(1), - GregtechItemList.Charger_MV.get(1), - GregtechItemList.Charger_HV.get(1), - GregtechItemList.Charger_EV.get(1), - GregtechItemList.Charger_IV.get(1), - GregtechItemList.Charger_LuV.get(1), - GregtechItemList.Charger_ZPM.get(1), - GregtechItemList.Charger_UV.get(1), - GregtechItemList.Charger_MAX.get(1) - }; - - int aCostMultiplier = GTNH ? 2 : 1; - - for (int i = 0; i < 10; i++) { - if (i == 0) { - continue; - } - int aTier = (i + 1); - ItemStack[] aInputs = new ItemStack[] { - CI.getTieredMachineHull(i, 1 * aCostMultiplier), - CI.getTransmissionComponent(i, 2 * aCostMultiplier), - CI.getFieldGenerator(i, 1 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.plate, aTier, 4 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.circuit, aTier, 2 * aCostMultiplier), - }; - CORE.RA.addSixSlotAssemblingRecipe( - aInputs, - CI.getAlternativeTieredFluid(i, (144 * 2 * aTier)), //Input Fluid - aChargers[i], - 45 * 10 * 1 * (aTier), - MaterialUtils.getVoltageForTier(i)); - - } - } - - private static void largeArcFurnace() { - int aCostMultiplier = GTNH ? 2 : 1; - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getTieredMachineHull(-1, 1 * aCostMultiplier), - CI.getTransmissionComponent(2, 2 * aCostMultiplier), - CI.getElectricPiston(4, 2 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.plate, 5, 4 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.pipeSmall, 4, 1 * aCostMultiplier), - }, - CI.getAlternativeTieredFluid(5, (144 * 2 * 4)), //Input Fluid - GregtechItemList.Casing_Industrial_Arc_Furnace.get(Casing_Amount), - 20 * 10 * 1 * (6), - MaterialUtils.getVoltageForTier(5)); - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - GregtechItemList.Casing_Industrial_Arc_Furnace.get(Casing_Amount), - CI.getFieldGenerator(4, 2 * aCostMultiplier), - CI.getRobotArm(5, 4 * aCostMultiplier), - CI.getEnergyCore(4, 2 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.plate, 6, 8 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.circuit, 5, 8 * aCostMultiplier), - }, - CI.getAlternativeTieredFluid(6, (144 * 4 * 5)), //Input Fluid - GregtechItemList.Industrial_Arc_Furnace.get(1), - 60 * 20 * 8, - MaterialUtils.getVoltageForTier(6)); - } - - private static void industrialVacuumFurnace() { - int aCostMultiplier = GTNH ? 2 : 1; - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getTieredMachineHull(-1, 1 * aCostMultiplier), - CI.getHeatCoil(2), - CI.getElectricPiston(3, 2 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.plate, 6, 4 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.gearGt, 6, 2 * aCostMultiplier), - }, - CI.getTertiaryTieredFluid(5, (144 * 2 * 4 * aCostMultiplier)), //Input Fluid - GregtechItemList.Casing_Vacuum_Furnace.get(Casing_Amount), - 20 * 10 * 6, - MaterialUtils.getVoltageForTier(6)); - - ; - - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - GregtechItemList.Casing_Vacuum_Furnace.get(aCostMultiplier), - CI.getTieredComponent(OrePrefixes.wireGt16, 7, 4 * aCostMultiplier), - CI.getEnergyCore(6, 1 * aCostMultiplier), - CI.getRobotArm(4, 4 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.plate, 7, 8 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.circuit, 6, 8 * aCostMultiplier), - }, - CI.getTieredFluid(7, (144 * 4 * 5 * aCostMultiplier)), //Input Fluid - GregtechItemList.Controller_Vacuum_Furnace.get(1), - 60 * 20 * 12, - MaterialUtils.getVoltageForTier(7)); - } - - private static void milling() { - - - /*public static ItemStack RECIPE_ISAMill_Controller; - public static ItemStack RECIPE_ISAMill_Gearbox; - public static ItemStack RECIPE_ISAMill_Casing; - public static ItemStack RECIPE_ISAMill_Hatch; - public static ItemStack RECIPE_Flotation_Controller; - public static ItemStack RECIPE_Flotation_Casing;*/ - - // Isa Mill Controller - CORE.RA.addAssemblylineRecipe( - ItemList.Machine_IV_Macerator.get(1), - 20 * 60 * 20, - new Object[] { - GregtechItemList.Casing_IsaMill_Gearbox.get(4), - CI.getTieredGTPPMachineCasing(6, 4), - ItemList.Component_Grinder_Tungsten.get(16), - new Object[] {CI.getTieredCircuitOreDictName(6), 8}, - ALLOY.INCONEL_625.getGear(8), - ALLOY.INCONEL_625.getPlate(32), - ALLOY.ZERON_100.getPlateDouble(8), - ALLOY.ZERON_100.getPlateDouble(8), - ALLOY.ZERON_100.getScrew(64), - CI.getTieredComponentOfMaterial(Materials.NiobiumTitanium, OrePrefixes.wireFine, 32), - CI.getTieredComponentOfMaterial(Materials.NiobiumTitanium, OrePrefixes.wireFine, 32), - CI.getTieredComponentOfMaterial(Materials.Titanium, OrePrefixes.foil, 16), - CI.getTieredComponentOfMaterial(Materials.Titanium, OrePrefixes.foil, 16), - - }, - new FluidStack[] { - CI.getTieredFluid(6, 16 * 144), - CI.getAlternativeTieredFluid(6, 32 * 144), - CI.getTertiaryTieredFluid(6, 32 * 144) - }, - GregtechItemList.Controller_IsaMill.get(1), - 20 * 60 * 10, - MaterialUtils.getVoltageForTier(6)); - - // Isa Mill Gearbox - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(7), - ItemList.Casing_Gearbox_Titanium.get(2), - ALLOY.INCONEL_625.getGear(4), - CI.getTieredComponentOfMaterial(Materials.HSSE, OrePrefixes.gearGtSmall, 8), - ALLOY.INCONEL_625.getPlate(16), - ALLOY.ZERON_100.getBolt(16), - }, - ALLOY.TUNGSTENSTEEL.getFluidStack(8 * 144), - GregtechItemList.Casing_IsaMill_Gearbox.get(1), - 60 * 20 * 2, - MaterialUtils.getVoltageForTier(6)); - - // Isa Mill Casing - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(7), - CI.getTieredGTPPMachineCasing(5, 1), - ALLOY.INCONEL_625.getPlate(8), - ALLOY.ZERON_100.getRod(4), - CI.getTieredComponentOfMaterial(Materials.HSSG, OrePrefixes.gearGtSmall, 4), - ALLOY.ZERON_100.getScrew(8), - }, - ELEMENT.getInstance().TITANIUM.getFluidStack(4 * 144), - GregtechItemList.Casing_IsaMill_Casing.get(1), - 60 * 20 * 2, - MaterialUtils.getVoltageForTier(6)); - - // Isa Mill Pipe - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(7), - CI.getTieredGTPPMachineCasing(4, 2), - ALLOY.INCONEL_625.getPlateDouble(4), - ALLOY.INCOLOY_MA956.getRing(8), - CI.getTieredComponentOfMaterial(Materials.HSSE, OrePrefixes.plate, 8), - ALLOY.INCOLOY_MA956.getBolt(16), - }, - ELEMENT.getInstance().ALUMINIUM.getFluidStack(8 * 144), - GregtechItemList.Casing_IsaMill_Pipe.get(1), - 60 * 20 * 8, - MaterialUtils.getVoltageForTier(4)); - - // Flotation Cell Controller - CORE.RA.addAssemblylineRecipe( - ItemList.Distillation_Tower.get(1), - 20 * 60 * 20, - new Object[] { - GregtechItemList.Casing_Flotation_Cell.get(4), - CI.getTieredGTPPMachineCasing(5, 4), - ItemList.Machine_IV_Distillery.get(1), - new Object[] {CI.getTieredCircuitOreDictName(6), 8}, - ALLOY.STELLITE.getGear(8), - ALLOY.STELLITE.getPlate(32), - ALLOY.HASTELLOY_N.getPlateDouble(8), - ALLOY.HASTELLOY_N.getPlateDouble(8), - ALLOY.HASTELLOY_N.getScrew(64), - CI.getTieredComponentOfMaterial(Materials.YttriumBariumCuprate, OrePrefixes.wireFine, 64), - CI.getTieredComponentOfMaterial(Materials.YttriumBariumCuprate, OrePrefixes.wireFine, 64), - CI.getTieredComponentOfMaterial(Materials.Platinum, OrePrefixes.foil, 32), - CI.getTieredComponentOfMaterial(Materials.Platinum, OrePrefixes.foil, 32), - - }, - new FluidStack[] { - CI.getTieredFluid(5, 16 * 144), - CI.getAlternativeTieredFluid(4, 32 * 144), - CI.getTertiaryTieredFluid(4, 32 * 144) - }, - GregtechItemList.Controller_Flotation_Cell.get(1), - 20 * 60 * 10, - MaterialUtils.getVoltageForTier(6)); - - // Flotation Cell Casing - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(7), - CI.getTieredGTPPMachineCasing(4, 1), - ALLOY.AQUATIC_STEEL.getPlate(8), - ALLOY.STELLITE.getRing(8), - CI.getTieredComponentOfMaterial(Materials.HSSG, OrePrefixes.plateDouble, 4), - ALLOY.HASTELLOY_N.getScrew(8), - }, - ALLOY.STAINLESS_STEEL.getFluidStack(8 * 144), - GregtechItemList.Casing_Flotation_Cell.get(1), - 60 * 20 * 2, - MaterialUtils.getVoltageForTier(6)); - - // Milling Bus - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(7), - CI.getTieredGTPPMachineCasing(5, 1), - ItemList.Hatch_Input_Bus_EV.get(1), - CI.getTieredComponentOfMaterial(Materials.Titanium, OrePrefixes.gearGt, 8), - CI.getTieredComponentOfMaterial(Materials.TungstenSteel, OrePrefixes.plate, 32), - CI.getTieredComponentOfMaterial(Materials.SolderingAlloy, OrePrefixes.wireFine, 16), - }, - ELEMENT.getInstance().TUNGSTEN.getFluidStack(8 * 144), - GregtechItemList.Bus_Milling_Balls.get(1), - 60 * 20 * 4, - MaterialUtils.getVoltageForTier(5)); - - } - - private static void sparging() { - - // Sparge Tower Research - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(8), - ELEMENT.getInstance().HELIUM.getCell(8), - ELEMENT.getInstance().FLUORINE.getCell(8), - ALLOY.HS188A.getIngot(8), - ItemList.Distillation_Tower.get(1) - }, - null, - ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_10_SPARGING, 1), - 60 * 20 * 5, - MaterialUtils.getVoltageForTier(5)); - - // Sparge Tower Controller - CORE.RA.addAssemblylineRecipe( - ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_10_SPARGING, 1), - 20 * 60 * 20, - new Object[] { - GregtechItemList.Casing_Sparge_Tower_Exterior.get(4), - CI.getTieredGTPPMachineCasing(4, 4), - ItemList.Machine_IV_Distillery.get(1), - new Object[] {CI.getTieredCircuitOreDictName(5), 8}, - ALLOY.HS188A.getGear(8), - ALLOY.HS188A.getPlate(32), - ALLOY.HASTELLOY_N.getPlateDouble(8), - ALLOY.HASTELLOY_N.getPlateDouble(8), - ALLOY.HASTELLOY_N.getScrew(64), - CI.getTieredComponentOfMaterial(Materials.YttriumBariumCuprate, OrePrefixes.wireFine, 64), - CI.getTieredComponentOfMaterial(Materials.YttriumBariumCuprate, OrePrefixes.wireFine, 64), - CI.getTieredComponentOfMaterial(Materials.Platinum, OrePrefixes.foil, 32), - CI.getTieredComponentOfMaterial(Materials.Platinum, OrePrefixes.foil, 32), - - }, - new FluidStack[] { - CI.getTieredFluid(4, 16 * 144), - CI.getAlternativeTieredFluid(3, 32 * 144), - CI.getTertiaryTieredFluid(3, 32 * 144) - }, - GregtechItemList.Controller_Sparge_Tower.get(1), - 20 * 60 * 10, - MaterialUtils.getVoltageForTier(6)); - - // Sparge Tower Casing - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(8), - CI.getTieredGTPPMachineCasing(3, 1), - ALLOY.HS188A.getPlate(8), - ALLOY.HASTELLOY_N.getRing(4), - CI.getTieredComponentOfMaterial(Materials.TungstenSteel, OrePrefixes.plateDouble, 4), - ALLOY.HASTELLOY_N.getScrew(4), - }, - ALLOY.STAINLESS_STEEL.getFluidStack(8 * 144), - GregtechItemList.Casing_Sparge_Tower_Exterior.get(1), - 60 * 20 * 2, - MaterialUtils.getVoltageForTier(5)); - } - - private static void fakeMachineCasingCovers() { - GregtechItemList[] mMachineCasingCovers = new GregtechItemList[] { - GregtechItemList.FakeMachineCasingPlate_ULV, - GregtechItemList.FakeMachineCasingPlate_LV, - GregtechItemList.FakeMachineCasingPlate_MV, - GregtechItemList.FakeMachineCasingPlate_HV, - GregtechItemList.FakeMachineCasingPlate_EV, - GregtechItemList.FakeMachineCasingPlate_IV, - GregtechItemList.FakeMachineCasingPlate_LuV, - GregtechItemList.FakeMachineCasingPlate_ZPM, - GregtechItemList.FakeMachineCasingPlate_UV, - GregtechItemList.FakeMachineCasingPlate_MAX, - }; - int aMaxTier = GT_Values.VOLTAGE_NAMES.length; - if (!GTNH) { - aMaxTier = 10; - } - ItemStack aTier[] = new ItemStack[aMaxTier]; - for (int i=0;i<aMaxTier;i++) { - aTier[i] = ItemUtils.simpleMetaStack(CoverManager.Cover_Gt_Machine_Casing, i, 7); - } - // Deprecate old recipes - for (int i=0;i<10;i++) { - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] {mMachineCasingCovers[i].get(1)}, ItemUtils.getSimpleStack(aTier[i], 1)); - } - // Add recipes for new ones - for (int i = 0;i<aMaxTier;i++) { - GT_Values.RA.addCutterRecipe( - CI.getTieredMachineCasing(i), - aTier[i], - null, - 20 * 5 * i, - (int) GT_Values.V[i]); - } - } - - private static void ztonesCoverRecipes() { - - if (!Loader.isModLoaded("Ztones")) { - return; - } - Class ModBlocksClass = ReflectionUtils.getClass("com.riciJak.Ztones.init.ModBlocks"); - Block agon = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "agonBlock")); - Block korp = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "korpBlock")); - Block jelt = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "jeltBlock")); - Block bitt = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "bittBlock")); - Block iszm = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "iszmBlock")); - - // "agon", "iszm", "korp", "jelt", "bitt" - - ItemStack[] aBlocks = new ItemStack[] { - ItemUtils.getSimpleStack(agon), - ItemUtils.getSimpleStack(iszm), - ItemUtils.getSimpleStack(korp), - ItemUtils.getSimpleStack(jelt), - ItemUtils.getSimpleStack(bitt) - }; - MetaCustomCoverItem[] aCovers = new MetaCustomCoverItem[] { - CoverManager.Cover_Agon, - CoverManager.Cover_Iszm, - CoverManager.Cover_Korp, - CoverManager.Cover_Jelt, - CoverManager.Cover_Bitt - }; - - ItemStack aInputs[][] = new ItemStack[5][16]; - ItemStack aOutputs[][] = new ItemStack[5][16]; - for (int a=0;a<5;a++) { - for (int i=0;i<16;i++) { - aInputs[a][i] = ItemUtils.simpleMetaStack(aBlocks[a].getItem(), i, 1); - aOutputs[a][i] = ItemUtils.simpleMetaStack(aCovers[a], i, 9); - } - } - for (int a=0;a<5;a++) { - for (int i = 0;i<16;i++) { - ItemStack aInput = aInputs[a][i]; - ItemStack aOutput = aOutputs[a][i]; - if (GT_Values.RA.addCutterRecipe( - aInput, - aOutput, - null, - 20 * 5, - 16)) { - Logger.INFO("Added Cutting recipe for "+aInput.getDisplayName()); - } - - if (CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedCircuit((i/4)+4), - aOutput - }, - FluidUtils.getWildcardFluidStack("glue", 250), - aInput, - 20 * 10, - 16)) { - Logger.INFO("Added Assembly recipe for "+aInput.getDisplayName()); - } - } - } - } - - private static void superBuses() { - GregtechItemList[] mSuperBusesInput = new GregtechItemList[] { - GregtechItemList.Hatch_SuperBus_Input_ULV, - GregtechItemList.Hatch_SuperBus_Input_LV, - GregtechItemList.Hatch_SuperBus_Input_MV, - GregtechItemList.Hatch_SuperBus_Input_HV, - GregtechItemList.Hatch_SuperBus_Input_EV, - GregtechItemList.Hatch_SuperBus_Input_IV, - GregtechItemList.Hatch_SuperBus_Input_LuV, - GregtechItemList.Hatch_SuperBus_Input_ZPM, - GregtechItemList.Hatch_SuperBus_Input_UV, - GregtechItemList.Hatch_SuperBus_Input_MAX, - }; - - GregtechItemList[] mSuperBusesOutput = new GregtechItemList[] { - GregtechItemList.Hatch_SuperBus_Output_ULV, - GregtechItemList.Hatch_SuperBus_Output_LV, - GregtechItemList.Hatch_SuperBus_Output_MV, - GregtechItemList.Hatch_SuperBus_Output_HV, - GregtechItemList.Hatch_SuperBus_Output_EV, - GregtechItemList.Hatch_SuperBus_Output_IV, - GregtechItemList.Hatch_SuperBus_Output_LuV, - GregtechItemList.Hatch_SuperBus_Output_ZPM, - GregtechItemList.Hatch_SuperBus_Output_UV, - GregtechItemList.Hatch_SuperBus_Output_MAX, - }; - - ItemStack[] mInputHatch = new ItemStack[] { - ItemList.Hatch_Input_Bus_EV.get(1), - ItemList.Hatch_Input_Bus_IV.get(1), - ItemList.Hatch_Input_Bus_LuV.get(1), - ItemList.Hatch_Input_Bus_ZPM.get(1), - ItemList.Hatch_Input_Bus_UV.get(1), - ItemList.Hatch_Input_Bus_MAX.get(1), - GregtechItemList.Hatch_SuperBus_Input_LV.get(1), - GregtechItemList.Hatch_SuperBus_Input_MV.get(1), - GregtechItemList.Hatch_SuperBus_Input_HV.get(1), - GregtechItemList.Hatch_SuperBus_Input_EV.get(1), - }; - - ItemStack[] mOutputHatch = new ItemStack[] { - ItemList.Hatch_Output_Bus_EV.get(1), - ItemList.Hatch_Output_Bus_IV.get(1), - ItemList.Hatch_Output_Bus_LuV.get(1), - ItemList.Hatch_Output_Bus_ZPM.get(1), - ItemList.Hatch_Output_Bus_UV.get(1), - ItemList.Hatch_Output_Bus_MAX.get(1), - GregtechItemList.Hatch_SuperBus_Output_LV.get(1), - GregtechItemList.Hatch_SuperBus_Output_MV.get(1), - GregtechItemList.Hatch_SuperBus_Output_HV.get(1), - GregtechItemList.Hatch_SuperBus_Output_EV.get(1), - }; - - // Special Case recipes for ULV buses - { - - int i = 0; - ItemStack[] aInputs1 = new ItemStack[] { - CI.getNumberedCircuit(17), - mInputHatch[i], - CI.getElectricMotor(i, GTNH ? 8 : 2), - CI.getConveyor(i, GTNH ? 10 : 5), - CI.getBolt(i, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2) - }; - Logger.INFO("[FIND] "+ItemUtils.getArrayStackNames(aInputs1)); - ItemStack[] aOutputs1 = new ItemStack[] { - CI.getNumberedCircuit(18), - mOutputHatch[i], - CI.getElectricPiston(i, GTNH ? 8 : 2), - CI.getConveyor(i, GTNH ? 10 : 5), - CI.getGear(i, GTNH ? 6 : 3), - CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2) - }; - Logger.INFO("[FIND] "+ItemUtils.getArrayStackNames(aOutputs1)); - - FluidStack a1 = CI.getAlternativeTieredFluid(i, 144 * 8); - FluidStack a2 = CI.getTertiaryTieredFluid(i, 144 * 8); - - - Logger.INFO("[FIND] Input Bus Fluid: "+ItemUtils.getFluidName(a1)); - Logger.INFO("[FIND] Output Bus Fluid: "+ItemUtils.getFluidName(a2)); - - - CORE.RA.addSixSlotAssemblingRecipe(aInputs1, - a1, - mSuperBusesInput[i].get(1), - 20 * 30 * 2 * i, - (int) GT_Values.V[i]); - - CORE.RA.addSixSlotAssemblingRecipe(aOutputs1, - a2, - mSuperBusesOutput[i].get(1), - 20 * 30 * 2 * i, - (int) GT_Values.V[i]); - - - } - - //Input Buses - for (int i = 1; i < 10; i++) { - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - CI.getNumberedCircuit(17), - mInputHatch[i], - CI.getElectricMotor(i, GTNH ? 8 : 2), - CI.getConveyor(i, GTNH ? 10 : 5), - CI.getBolt(i, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2) - }, - CI.getAlternativeTieredFluid(i, 144 * 8), - mSuperBusesInput[i].get(1), 20 * 30 * 2 * i, - (int) GT_Values.V[i]); - } - //Output Buses - for (int i = 1; i < 10; i++) { - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - CI.getNumberedCircuit(18), - mOutputHatch[i], - CI.getElectricPiston(i, GTNH ? 8 : 2), - CI.getConveyor(i, GTNH ? 10 : 5), - CI.getGear(i, GTNH ? 6 : 3), - CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2) - }, - CI.getTertiaryTieredFluid(i, 144 * 8), - mSuperBusesOutput[i].get(1), 20 * 30 * 2 * i, - (int) GT_Values.V[i]); - } - - - } - - private static void roundRobinators() { - - RecipeUtils.addShapedGregtechRecipe( - ItemUtils.getSimpleStack(Blocks.hopper), "circuitPrimitive", ItemUtils.getSimpleStack(Blocks.hopper), - CI.craftingToolWrench, CI.machineCasing_ULV, CI.craftingToolScrewdriver, - ItemUtils.getSimpleStack(Blocks.hopper), "circuitPrimitive", ItemUtils.getSimpleStack(Blocks.hopper), - ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 0, 1)); - - ItemStack[] aRobinators = new ItemStack[] { - ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 0, 1), - ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 1, 1), - ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 2, 1), - ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 3, 1), - ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 4, 1), - }; - - int aCostMultiplier = GTNH ? 2 : 1; - - for (int i = 0; i < 5; i++) { - if (i == 0) { - CORE.RA.addSixSlotAssemblingRecipe( - new ItemStack[] { - CI.getNumberedCircuit(17), - CI.getTieredMachineCasing(0), - ItemUtils.getSimpleStack(Blocks.hopper, 4), - CI.getTieredComponent(OrePrefixes.circuit, 0, 2) - }, - GT_Values.NF, //Input Fluid - aRobinators[i], - 45 * 10 * 1, - 8); - continue; - } - int aTier = i+1; - ItemStack[] aInputs = new ItemStack[] { - aRobinators[i-1], - CI.getTieredMachineHull(aTier, 1 * aCostMultiplier), - CI.getConveyor(aTier, 2 * aCostMultiplier), - CI.getElectricMotor(aTier, 2 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.plate, aTier, 4 * aCostMultiplier), - CI.getTieredComponent(OrePrefixes.circuit, i, 2 * aCostMultiplier), - }; - - CORE.RA.addSixSlotAssemblingRecipe( - aInputs, - GT_Values.NF, //Input Fluid - aRobinators[i], - 45 * 10 * 1 * (i+1), - MaterialUtils.getVoltageForTier(i)); - - } - } - -} diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java deleted file mode 100644 index 3ed2f5f168..0000000000 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java +++ /dev/null @@ -1,458 +0,0 @@ -package gtPlusPlus.core.recipe; - -import cpw.mods.fml.common.Loader; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OreDictNames; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.SubTag; -import gregtech.api.interfaces.IOreRecipeRegistrator; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import net.minecraft.item.ItemStack; - -public class RECIPES_Old_Circuits implements IOreRecipeRegistrator { - public RECIPES_Old_Circuits() { - OrePrefixes.crafting.add(this); - } - - @Override - public void registerOre(final OrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, final String aModName, final ItemStack aStack) { - if (aOreDictName.equals(OreDictNames.craftingLensRed.toString())) { - Logger.INFO("[Old Feature - Circuits] Adding recipes for old circuits. (Part 2)"); - GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Copper, 1L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Old_Circuit_Parts_Wiring_Basic.get(1L, new Object[0]), 64, 30); - GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.AnnealedCopper, 1L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Old_Circuit_Parts_Wiring_Basic.get(1L, new Object[0]), 64, 30); - GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Gold, 1L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Old_Circuit_Parts_Wiring_Advanced.get(1L, new Object[0]), 64, 120); - GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Electrum, 1L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Old_Circuit_Parts_Wiring_Advanced.get(1L, new Object[0]), 64, 120); - GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Platinum, 1L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Old_Circuit_Parts_Wiring_Elite.get(1L, new Object[0]), 64, 480); - } - - else if (aOreDictName.equals(OreDictNames.craftingLensGreen.toString())) { - Logger.INFO("[Old Feature - Circuits] Adding recipes for old circuits. (Part 3)"); - GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Olivine, 1L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Old_Circuit_Parts_Crystal_Chip_Elite.get(1L, new Object[0]), 256, 480); - GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Emerald, 1L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Old_Circuit_Parts_Crystal_Chip_Elite.get(1L, new Object[0]), 256, 480); - } - - else if (aOreDictName.equals(OreDictNames.craftingLensBlue.toString()) || aOreDictName.equals(OreDictNames.craftingLensCyan.toString()) || aOreDictName.equals(OreDictNames.craftingLensLightBlue.toString())) { - Logger.INFO("[Old Feature - Circuits] Adding recipes for old circuits. (Part 4)"); - GT_Values.RA.addLaserEngraverRecipe(ItemList.IC2_LapotronCrystal.getWildcard(1L, new Object[0]), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Old_Circuit_Parts_Crystal_Chip_Master.get(3L, new Object[0]), 256, 480); - } - } - - - private static boolean addCircuitRecipes(){ - Logger.INFO("[Old Feature - Circuits] Adding recipes for old circuits. (Part 1)"); - GT_ModHandler.addShapelessCraftingRecipe(GregtechItemList.Old_Circuit_Primitive.get(1L, new Object[0]), new Object[]{GT_ModHandler.getIC2Item("casingadviron", 1L), OrePrefixes.wireGt01.get(Materials.RedAlloy), OrePrefixes.wireGt01.get(Materials.RedAlloy), OrePrefixes.wireGt01.get(Materials.Tin)}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Old_Circuit_Basic.get(1L, new Object[0]), new Object[]{"WWW", "CPC", "WWW", 'C', OrePrefixes.circuit.get(Materials.Primitive), 'W', OreDictNames.craftingWireCopper, 'P', OrePrefixes.plate.get(Materials.Steel)}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Old_Circuit_Basic.get(1L, new Object[0]), new Object[]{"WCW", "WPW", "WCW", 'C', OrePrefixes.circuit.get(Materials.Primitive), 'W', OreDictNames.craftingWireCopper, 'P', OrePrefixes.plate.get(Materials.Steel)}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Old_Circuit_Basic.get(1L, new Object[0]), new Object[]{"WWW", "CPC", "WWW", 'C', OrePrefixes.circuit.get(Materials.Primitive), 'W', OrePrefixes.cableGt01.get(Materials.RedAlloy), 'P', OrePrefixes.plate.get(Materials.Steel)}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Old_Circuit_Basic.get(1L, new Object[0]), new Object[]{"WCW", "WPW", "WCW", 'C', OrePrefixes.circuit.get(Materials.Primitive), 'W', OrePrefixes.cableGt01.get(Materials.RedAlloy), 'P', OrePrefixes.plate.get(Materials.Steel)}); - - GT_Values.RA.addFormingPressRecipe(GregtechItemList.Old_Empty_Board_Basic.get(1L, new Object[0]), GregtechItemList.Old_Circuit_Parts_Wiring_Basic.get(4L, new Object[0]), GregtechItemList.Old_Circuit_Board_Basic.get(1L, new Object[0]), 32, 16); - GT_Values.RA.addFormingPressRecipe(GregtechItemList.Old_Empty_Board_Basic.get(1L, new Object[0]), GregtechItemList.Old_Circuit_Parts_Wiring_Advanced.get(4L, new Object[0]), GregtechItemList.Old_Circuit_Board_Advanced.get(1L, new Object[0]), 32, 64); - GT_Values.RA.addFormingPressRecipe(GregtechItemList.Old_Empty_Board_Elite.get(1L, new Object[0]), GregtechItemList.Old_Circuit_Parts_Wiring_Elite.get(4L, new Object[0]), GregtechItemList.Old_Circuit_Board_Elite.get(1L, new Object[0]), 32, 256); - - GT_Values.RA.addFormingPressRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Lapis, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Glowstone, 1L), GregtechItemList.Old_Circuit_Parts_Advanced.get(2L, new Object[0]), 32, 64); - GT_Values.RA.addFormingPressRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Lazurite, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Glowstone, 1L), GregtechItemList.Old_Circuit_Parts_Advanced.get(2L, new Object[0]), 32, 64); - - int tMultiplier; - for (Materials tMat : Materials.values()) { - if ((tMat.mStandardMoltenFluid != null) && (tMat.contains(SubTag.SOLDERING_MATERIAL))) - { - tMultiplier = tMat.contains(SubTag.SOLDERING_MATERIAL_BAD) ? 4 : tMat.contains(SubTag.SOLDERING_MATERIAL_GOOD) ? 1 : 2; - - GT_Values.RA.addAssemblerRecipe(ItemList.IC2_Item_Casing_Steel.get(1L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.RedAlloy, 2L), tMat.getMolten(144L * tMultiplier / 8L), GregtechItemList.Old_Circuit_Primitive.get(1L, new Object[0]), 16, 8); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Plastic, 1L), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.RedAlloy, 1L), tMat.getMolten(144L * tMultiplier / 8L), GregtechItemList.Old_Circuit_Primitive.get(1L, new Object[0]), 16, 8); - GT_Values.RA.addAssemblerRecipe(GregtechItemList.Old_Circuit_Board_Basic.get(1L, new Object[0]), GregtechItemList.Old_Circuit_Primitive.get(2L, new Object[0]), tMat.getMolten(144L * tMultiplier / 4L), GregtechItemList.Old_Circuit_Basic.get(1L, new Object[0]), 32, 16); - GT_Values.RA.addAssemblerRecipe(GregtechItemList.Old_Circuit_Basic.get(1L, new Object[0]), GregtechItemList.Old_Circuit_Primitive.get(2L, new Object[0]), tMat.getMolten(144L * tMultiplier / 4L), GregtechItemList.Old_Circuit_Good.get(1L, new Object[0]), 32, 16); - GT_Values.RA.addAssemblerRecipe(GregtechItemList.Old_Circuit_Board_Advanced.get(1L, new Object[0]), GregtechItemList.Old_Circuit_Parts_Advanced.get(2L, new Object[0]), tMat.getMolten(144L * tMultiplier / 2L), GregtechItemList.Old_Circuit_Advanced.get(1L, new Object[0]), 32, 64); - GT_Values.RA.addAssemblerRecipe(GregtechItemList.Old_Circuit_Board_Advanced.get(1L, new Object[0]), GregtechItemList.Old_Circuit_Parts_Crystal_Chip_Elite.get(1L, new Object[0]), tMat.getMolten(144L * tMultiplier / 2L), GregtechItemList.Old_Circuit_Data.get(1L, new Object[0]), 32, 64); - GT_Values.RA.addAssemblerRecipe(GregtechItemList.Old_Circuit_Board_Elite.get(1L, new Object[0]), GregtechItemList.Old_Circuit_Data.get(3L, new Object[0]), tMat.getMolten(144L * tMultiplier / 1L), GregtechItemList.Old_Circuit_Elite.get(1L, new Object[0]), 32, 256); - GT_Values.RA.addAssemblerRecipe(GregtechItemList.Old_Circuit_Board_Elite.get(1L, new Object[0]), ItemList.Circuit_Parts_Crystal_Chip_Master.get(3L, new Object[0]), tMat.getMolten(144L * tMultiplier / 1L), GregtechItemList.Old_Circuit_Master.get(1L, new Object[0]), 32, 256); - GT_Values.RA.addAssemblerRecipe(GregtechItemList.Old_Circuit_Board_Elite.get(1L, new Object[0]), GregtechItemList.Old_Circuit_Parts_Crystal_Chip_Master.get(3L, new Object[0]), tMat.getMolten(144L * tMultiplier / 1L), GregtechItemList.Old_Circuit_Master.get(1L, new Object[0]), 32, 256); - GT_Values.RA.addAssemblerRecipe(GregtechItemList.Old_Circuit_Data.get(1L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Plastic, 2L), tMat.getMolten(144L * tMultiplier / 2L), GregtechItemList.Old_Tool_DataStick.get(1L, new Object[0]), 128, 64); - } - } - - GT_Values.RA.addAssemblerRecipe(GregtechItemList.Old_Circuit_Elite.get(2L, new Object[0]), GregtechItemList.Old_Circuit_Parts_Crystal_Chip_Elite.get(18L, new Object[0]), GT_Values.NF, GregtechItemList.Old_Tool_DataOrb.get(1L, new Object[0]), 512, 256); - GT_Values.RA.addAssemblerRecipe(GregtechItemList.Old_Circuit_Master.get(2L, new Object[0]), ItemList.Circuit_Parts_Crystal_Chip_Master.get(18L, new Object[0]), GT_Values.NF, ItemList.Energy_LapotronicOrb.get(1L, new Object[0]), 512, 1024); - GT_Values.RA.addAssemblerRecipe(GregtechItemList.Old_Circuit_Master.get(2L, new Object[0]), GregtechItemList.Old_Circuit_Parts_Crystal_Chip_Master.get(18L, new Object[0]), GT_Values.NF, ItemList.Energy_LapotronicOrb.get(1L, new Object[0]), 512, 1024); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Silicon, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Plastic, 1L), GregtechItemList.Old_Empty_Board_Basic.get(1L, new Object[0]), 32, 16); - - Materials plasticType = Materials.get("Polytetrafluoroethylene") != null ? Materials.get("Polytetrafluoroethylene") : Materials.Plastic; - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Silicon, 2L), GT_OreDictUnificator.get(OrePrefixes.plate, plasticType, 1L), GregtechItemList.Old_Empty_Board_Elite.get(1L, new Object[0]), 32, 256); - - - - return true; - } - - public static boolean handleCircuits(){ - hideCircuitsNEI(); - addCircuitRecipes(); - removeNewCircuits(); - generateTradeRecipes(); - return true; - } - - private static boolean setItemList(ItemList Set, GregtechItemList Get) { - try{ - Set.set(Get.get(1)); - return true; - } - catch (Throwable t) {} - return false; - } - - private static boolean removeNewCircuits(){ - Logger.INFO("[Old Feature - Circuits] Overriding .28+ circuit values in the GT5u Itemlist with values from GT++."); - - boolean newVersion = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && Utils.getGregtechSubVersion() >= 30; - - setItemList(ItemList.Circuit_Primitive, GregtechItemList.Old_Circuit_Primitive); - setItemList(ItemList.Circuit_Basic, GregtechItemList.Old_Circuit_Basic); - setItemList(ItemList.Circuit_Good, GregtechItemList.Old_Circuit_Good); - setItemList(ItemList.Circuit_Advanced, GregtechItemList.Old_Circuit_Advanced); - //ItemList.Circuit_Data, GregtechItemList.Old_Circuit_Data); - setItemList(ItemList.Circuit_Elite, GregtechItemList.Old_Circuit_Elite); - setItemList(ItemList.Circuit_Master, GregtechItemList.Old_Circuit_Master); - setItemList(ItemList.Circuit_Ultimate, GregtechItemList.Old_Circuit_Ultimate); - - /** - * Try Set New circuits to have old replacements - */ - - //Basic - if (newVersion) { - setItemList(ItemList.valueOf("Circuit_Microprocessor"), GregtechItemList.Old_Circuit_Basic); //NEW - } - //Good - if (newVersion) { - setItemList(ItemList.valueOf("Circuit_Integrated_Good"), GregtechItemList.Old_Circuit_Good); //New - } - //Advanced - if (newVersion) { - setItemList(ItemList.valueOf("Circuit_Nanoprocessor"), GregtechItemList.Old_Circuit_Advanced); - } - //Data - if (newVersion) { - setItemList(ItemList.valueOf("Circuit_Quantumprocessor"), GregtechItemList.Old_Circuit_Data); - } - if (newVersion) { - setItemList(ItemList.valueOf("Circuit_Nanocomputer"), GregtechItemList.Old_Circuit_Data); - } - //Elite - if (newVersion) { - setItemList(ItemList.valueOf("Circuit_Crystalprocessor"), GregtechItemList.Old_Circuit_Elite); - } - if (newVersion) { - setItemList(ItemList.valueOf("Circuit_Quantumcomputer"), GregtechItemList.Old_Circuit_Elite); - } - if (newVersion) { - setItemList(ItemList.valueOf("Circuit_Elitenanocomputer"), GregtechItemList.Old_Circuit_Elite); - } - //Master - if (newVersion) { - setItemList(ItemList.valueOf("Circuit_Neuroprocessor"), GregtechItemList.Old_Circuit_Master); - } - if (newVersion) { - setItemList(ItemList.valueOf("Circuit_Masterquantumcomputer"), GregtechItemList.Old_Circuit_Master); - } - //Ultimate - if (newVersion) { - setItemList(ItemList.valueOf("Circuit_Wetwarecomputer"), GregtechItemList.Old_Circuit_Ultimate); - } - if (newVersion) { - setItemList(ItemList.valueOf("Circuit_Ultimatecrystalcomputer"), GregtechItemList.Old_Circuit_Ultimate); - } - if (newVersion) { - setItemList(ItemList.valueOf("Circuit_Quantummainframe"), GregtechItemList.Old_Circuit_Ultimate); - } - //Superconductor - if (newVersion) { - setItemList(ItemList.valueOf("Circuit_Wetwaresupercomputer"), GregtechItemList.Circuit_IV); - } - if (newVersion) { - setItemList(ItemList.valueOf("Circuit_Crystalmainframe"), GregtechItemList.Circuit_IV); - } - //Infinite - if (newVersion) { - setItemList(ItemList.valueOf("Circuit_Wetwaremainframe"), GregtechItemList.Circuit_LuV); - } - - //set data orbs and sticks to their new replacements - setItemList(ItemList.Tool_DataStick, GregtechItemList.Old_Tool_DataStick); - setItemList(ItemList.Tool_DataOrb, GregtechItemList.Old_Tool_DataOrb); - - setItemList(ItemList.Circuit_Board_Basic, GregtechItemList.Old_Circuit_Board_Basic); - setItemList(ItemList.Circuit_Board_Advanced, GregtechItemList.Old_Circuit_Board_Advanced); - setItemList(ItemList.Circuit_Board_Elite, GregtechItemList.Old_Circuit_Board_Elite); - setItemList(ItemList.Circuit_Parts_Advanced, GregtechItemList.Old_Circuit_Parts_Advanced); - setItemList(ItemList.Circuit_Parts_Wiring_Basic, GregtechItemList.Old_Circuit_Parts_Wiring_Basic); - setItemList(ItemList.Circuit_Parts_Wiring_Advanced, GregtechItemList.Old_Circuit_Parts_Wiring_Advanced); - setItemList(ItemList.Circuit_Parts_Wiring_Elite, GregtechItemList.Old_Circuit_Parts_Wiring_Elite); - setItemList(ItemList.Circuit_Parts_Crystal_Chip_Elite, GregtechItemList.Old_Circuit_Parts_Crystal_Chip_Elite); - setItemList(ItemList.Circuit_Parts_Crystal_Chip_Master, GregtechItemList.Old_Circuit_Parts_Crystal_Chip_Master); - - return true; - } - - private static boolean generateTradeRecipes(){ - - //Data stick and Data orbs. - //GT Type to GT++ Type - RecipeUtils.recipeBuilder( - CI.craftingToolScrewdriver, null, null, - ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32708", 32708, 1), null, null, - null, null, null, - GregtechItemList.Old_Tool_DataStick.get(1)); - RecipeUtils.recipeBuilder( - CI.craftingToolScrewdriver, null, null, - ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32707", 32707, 1), null, null, - null, null, null, - GregtechItemList.Old_Tool_DataOrb.get(1)); - - //GT++ Type to GT Type - RecipeUtils.recipeBuilder( - CI.craftingToolScrewdriver, null, null, - GregtechItemList.Old_Tool_DataStick.get(1), null, null, - null, null, null, - ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32708", 32708, 1)); - RecipeUtils.recipeBuilder( - CI.craftingToolScrewdriver, null, null, - GregtechItemList.Old_Tool_DataOrb.get(1), null, null, - null, null, null, - ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32707", 32707, 1)); - - - - //Primitive - RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[]{ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32700", 32700, 1)}, - ItemUtils.getItemStackOfAmountFromOreDict("circuitPrimitive", 1)); - - //Basic - RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[]{ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32701", 32701, 1)}, - ItemUtils.getItemStackOfAmountFromOreDict("circuitBasic", 1)); - RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[]{ItemUtils.simpleMetaStack("gregtech:gt.metaitem.03:32078", 32078, 1)}, - ItemUtils.getItemStackOfAmountFromOreDict("circuitBasic", 1)); - - //Good - RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[]{ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32702", 32702, 1)}, - ItemUtils.getItemStackOfAmountFromOreDict("circuitGood", 1)); - RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[]{ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32702", 32702, 1)}, - ItemUtils.getItemStackOfAmountFromOreDict("circuitGood", 1)); - - //Advanced - RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[]{ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32703", 32703, 1)}, - ItemUtils.getItemStackOfAmountFromOreDict("circuitAdvanced", 1)); - RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[]{ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32703", 32703, 1)}, - ItemUtils.getItemStackOfAmountFromOreDict("circuitAdvanced", 1)); - - //Data - RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[]{ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32704", 32704, 1)}, - ItemUtils.getItemStackOfAmountFromOreDict("circuitData", 1)); - - //Elite - RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[]{ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32705", 32705, 1)}, - ItemUtils.getItemStackOfAmountFromOreDict("circuitElite", 1)); - - //Master - RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[]{ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32706", 32706, 1)}, - ItemUtils.getItemStackOfAmountFromOreDict("circuitMaster", 1)); - - - - //Components - //Green Chip - RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[]{ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32713", 32713, 1)}, - GregtechItemList.Old_Circuit_Parts_Crystal_Chip_Elite.get(1)); - //Blue Chip - RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[]{ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32714", 32714, 1)}, - GregtechItemList.Old_Circuit_Parts_Crystal_Chip_Master.get(1)); - - //Basic Board - RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[]{ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32710", 32710, 1)}, - GregtechItemList.Old_Circuit_Board_Basic.get(1)); - //Advanced Board - RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[]{ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32711", 32711, 1)}, - GregtechItemList.Old_Circuit_Board_Advanced.get(1)); - //Elite Board - RecipeUtils.addShapelessGregtechRecipe( - new ItemStack[]{ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32712", 32712, 1)}, - GregtechItemList.Old_Circuit_Board_Elite.get(1)); - - - //remove a few recipes - /*GT_ModHandler.removeRecipeByOutput(ItemUtils.simpleMetaStack("gregtech:gt.metaitem.03:32070", 32070, 1)); - GT_ModHandler.removeRecipeByOutput(ItemUtils.simpleMetaStack("gregtech:gt.metaitem.03:32069", 32069, 1)); - if (LoadedMods.Extra_Utils){ - ItemStack EQU = ItemUtils.simpleMetaStack("ExtraUtilities:enderQuarryUpgrade", 0, 1); - if (EQU != null){ - GT_ModHandler.removeRecipeByOutput(EQU); - GT_Values.RA.addAssemblerRecipe( - ItemUtils.simpleMetaStack("ExtraUtilities:decorativeBlock1:12", 12, 1), - GregtechItemList.Old_Circuit_Master.get(1), - EQU, - 80*20, - 2); - } - } - if (LoadedMods.GalacticraftCore){ - ItemStack ACW = ItemUtils.simpleMetaStack("GalacticraftCore:item.basicItem:14", 14, 1); - if (ACW != null){ - GT_ModHandler.removeRecipeByOutput(ACW); - GT_Values.RA.addAssemblerRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("gemDiamond", 1), - GregtechItemList.Old_Circuit_Board_Advanced.get(1), - ACW, - 160*20, - 4); - } - ItemStack ACW2 = ItemUtils.simpleMetaStack("GalacticraftCore:item.basicItem:13", 13, 1); - if (ACW2 != null){ - GT_ModHandler.removeRecipeByOutput(ACW2); - GT_Values.RA.addAssemblerRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("gemDiamond", 1), - GregtechItemList.Old_Circuit_Board_Basic.get(1), - ACW2, - 80*20, - 2); - } - }*/ - - return true; - } - - private static boolean hideCircuitsNEI(){ - Boolean isNEILoaded = Loader.isModLoaded("NotEnoughItems"); - if (isNEILoaded && !CORE.ConfigSwitches.showHiddenNEIItems){ - Logger.INFO("[Old Feature - Circuits] Hiding .28+ circuits in NEI."); - String[] CircuitToHide = { - "Circuit_Board_Basic", - "Circuit_Board_Advanced", - "Circuit_Board_Elite", - "Circuit_Parts_Advanced", - "Circuit_Parts_Wiring_Basic", - "Circuit_Parts_Wiring_Advanced", - "Circuit_Parts_Wiring_Elite", - "Circuit_Parts_Crystal_Chip_Elite", - "Circuit_Parts_Crystal_Chip_Master", - "Circuit_Primitive", - "Circuit_Basic", - "Circuit_Integrated_Good", - "Circuit_Good", - "Circuit_Advanced", - "Circuit_Data", - "Circuit_Elite", - "Circuit_Master", - "Circuit_Ultimate", - "Circuit_Board_Coated", - "Circuit_Board_Phenolic", - "Circuit_Board_Epoxy", - "Circuit_Board_Fiberglass", - "Circuit_Board_Multifiberglass", - "Circuit_Board_Wetware", - "Circuit_Parts_Resistor", - "Circuit_Parts_ResistorSMD", - "Circuit_Parts_Glass_Tube", - "Circuit_Parts_Vacuum_Tube", - "Circuit_Parts_Coil", - "Circuit_Parts_Diode", - "Circuit_Parts_DiodeSMD", - "Circuit_Parts_Transistor", - "Circuit_Parts_TransistorSMD", - "Circuit_Parts_Capacitor", - "Circuit_Parts_CapacitorSMD", - "Circuit_Silicon_Ingot", - "Circuit_Silicon_Ingot2", - "Circuit_Silicon_Ingot3", - "Circuit_Silicon_Wafer", - "Circuit_Silicon_Wafer2", - "Circuit_Silicon_Wafer3", - "Circuit_Wafer_ILC", - "Circuit_Chip_ILC", - "Circuit_Wafer_Ram", - "Circuit_Chip_Ram", - "Circuit_Wafer_NAND", - "Circuit_Chip_NAND", - "Circuit_Wafer_NOR", - "Circuit_Chip_NOR", - "Circuit_Wafer_CPU", - "Circuit_Chip_CPU", - "Circuit_Wafer_SoC", - "Circuit_Chip_SoC", - "Circuit_Wafer_SoC2", - "Circuit_Chip_SoC2", - "Circuit_Wafer_PIC", - "Circuit_Chip_PIC", - "Circuit_Wafer_HPIC", - "Circuit_Chip_HPIC", - "Circuit_Wafer_NanoCPU", - "Circuit_Chip_NanoCPU", - "Circuit_Wafer_QuantumCPU", - "Circuit_Chip_QuantumCPU", - "Circuit_Chip_CrystalCPU", - "Circuit_Chip_CrystalSoC", - "Circuit_Chip_NeuroCPU", - "Circuit_Chip_Stemcell", - "Circuit_Processor", - "Circuit_Computer", - "Circuit_Nanoprocessor", - "Circuit_Nanocomputer", - "Circuit_Elitenanocomputer", - "Circuit_Quantumprocessor", - "Circuit_Quantumcomputer", - "Circuit_Masterquantumcomputer", - "Circuit_Quantummainframe", - "Circuit_Crystalprocessor", - "Circuit_Crystalcomputer", - "Circuit_Ultimatecrystalcomputer", - "Circuit_Crystalmainframe", - "Circuit_Neuroprocessor", - "Circuit_Wetwarecomputer", - "Circuit_Wetwaresupercomputer", - "Circuit_Wetwaremainframe", - "Circuit_Parts_RawCrystalChip", - //Circuits Additions in .30/.31 - "Circuit_Board_Plastic", - "Circuit_Parts_GlassFiber", - "Circuit_Parts_PetriDish", - "Circuit_Microprocessor" - }; - - for (String component : CircuitToHide){ - try { - ItemUtils.hideItemFromNEI(ItemUtils.getValueOfItemList(component, null).get(1L, new Object[0])); - } catch (IllegalArgumentException I){ - Logger.INFO("Could not find "+component+" in the Gregtech item list."); - Logger.INFO("This is NOT an error, simply a notification."); - } - } - } - return true; - } - -} diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_RareEarthProcessing.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_RareEarthProcessing.java deleted file mode 100644 index 864d0bcca8..0000000000 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_RareEarthProcessing.java +++ /dev/null @@ -1,239 +0,0 @@ -package gtPlusPlus.core.recipe; - -import static gtPlusPlus.core.material.MISC_MATERIALS.BRINE; -import static gtPlusPlus.core.material.MISC_MATERIALS.HYDROGEN_CHLORIDE; -import static gtPlusPlus.core.material.MISC_MATERIALS.RARE_EARTH_HIGH; -import static gtPlusPlus.core.material.MISC_MATERIALS.RARE_EARTH_LOW; -import static gtPlusPlus.core.material.MISC_MATERIALS.RARE_EARTH_MID; -import static gtPlusPlus.core.material.MISC_MATERIALS.SALT_WATER; -import static gtPlusPlus.core.material.MISC_MATERIALS.SODIUM_CHLORIDE; -import static gtPlusPlus.core.material.MISC_MATERIALS.SODIUM_HYDROXIDE; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.MISC_MATERIALS; -import gtPlusPlus.core.material.MaterialGenerator; -import gtPlusPlus.core.material.ORES; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -public class RECIPES_RareEarthProcessing { - - private static ItemStack mDustSodiumHydroxide; - private static ItemStack mDustSalt; - private static FluidStack mSaltWater; - private static FluidStack mBrine; - private static FluidStack mHydrogenChloride; - - public static void init() { - - // Salt Check and Assignment - mDustSalt = ItemUtils.getItemStackOfAmountFromOreDict("dustSalt", 1); - if (mDustSalt == null) { - MaterialUtils.generateSpecialDustAndAssignToAMaterial(SODIUM_CHLORIDE, false); - mDustSalt = SODIUM_CHLORIDE.getDust(1); - } - else { - SODIUM_CHLORIDE.registerComponentForMaterial(OrePrefixes.dust, mDustSalt); - } - - // Salt water Check and Assignment - mSaltWater = FluidUtils.getFluidStack("saltwater", 1000); - if (mSaltWater == null) { - Fluid f = SALT_WATER.generateFluid(); - SALT_WATER.registerComponentForMaterial(FluidUtils.getFluidStack(f, 1000)); - mSaltWater = SALT_WATER.getFluidStack(1000); - } - else { - SALT_WATER.registerComponentForMaterial(FluidUtils.getFluidStack(mSaltWater, 1000)); - } - - // Brine Check and assignment - mBrine = FluidUtils.getFluidStack("brine", 1000); - if (mBrine == null) { - Fluid f = BRINE.generateFluid(); - BRINE.registerComponentForMaterial(FluidUtils.getFluidStack(f, 1000)); - mBrine = BRINE.getFluidStack(1000); - } - else { - BRINE.registerComponentForMaterial(FluidUtils.getFluidStack(mBrine, 1000)); - } - - // Check Sodium Hydroxide Exists, generate if not. - mDustSodiumHydroxide = ItemUtils.getItemStackOfAmountFromOreDict("dustSodiumHydroxide", 1); - if (mDustSodiumHydroxide == null) { - mDustSodiumHydroxide = ItemUtils.getItemStackOfAmountFromOreDict("dustSodiumHydroxide_GT5U", 1); - if (mDustSodiumHydroxide == null) { - MaterialUtils.generateSpecialDustAndAssignToAMaterial(SODIUM_HYDROXIDE, false); - mDustSodiumHydroxide = SODIUM_HYDROXIDE.getDust(1); - } - else { - SODIUM_HYDROXIDE.registerComponentForMaterial(OrePrefixes.dust, mDustSodiumHydroxide); - } - } - else { - SODIUM_HYDROXIDE.registerComponentForMaterial(OrePrefixes.dust, mDustSodiumHydroxide); - } - - // Hydrogen Chloride Check and assignment - mHydrogenChloride = FluidUtils.getFluidStack("hydrogenchloride", 1000); - if (mHydrogenChloride == null) { - HYDROGEN_CHLORIDE.generateFluid(); - mHydrogenChloride = BRINE.getFluidStack(1000); - } - else { - HYDROGEN_CHLORIDE.registerComponentForMaterial(FluidUtils.getFluidStack(mHydrogenChloride, 1000)); - } - - - // Add Process for creating Brine - CORE.RA.addBrewingRecipe( - ItemUtils.getSimpleStack(mDustSalt, 16), - MISC_MATERIALS.SALT_WATER.getFluidStack(2000), - FluidUtils.getFluidStack(mBrine, 4000), - 20 * 20, - 120, - false); - - // Chloralkali process - GT_Values.RA.addElectrolyzerRecipe( - CI.getNumberedCircuit(16), - CI.emptyCells(4), - FluidUtils.getFluidStack(mBrine, 4000), - null, // Out - ItemUtils.getItemStackOfAmountFromOreDict("cellChlorine", 2), - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogen", 2), - ItemUtils.getSimpleStack(mDustSodiumHydroxide, 2), - null, - null, - null, - new int[] {10000, 10000, 10000}, - 20 * 30, - (int) GT_Values.V[2]); - - // Generate Special Laser Recipe - CORE.RA.addUvLaserRecipe( - ELEMENT.getInstance().CHLORINE.getCell(2), - ELEMENT.getInstance().HYDROGEN.getCell(2), - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenChloride", 4), - 20 * 30, - 480); - - - // Set Material Tiers correctly - ORES.GREENOCKITE.vTier = 1; - RARE_EARTH_LOW.vTier = 1; - RARE_EARTH_MID.vTier = 3; - RARE_EARTH_HIGH.vTier = 5; - - // Set Material Voltages correctly - ORES.GREENOCKITE.vVoltageMultiplier = 30; - RARE_EARTH_LOW.vVoltageMultiplier = 30; - RARE_EARTH_MID.vVoltageMultiplier = 480; - RARE_EARTH_HIGH.vVoltageMultiplier = 7680; - - // Set Material Tooltips to be shorter - RARE_EARTH_LOW.vChemicalFormula = "??????"; - RARE_EARTH_MID.vChemicalFormula = "??????"; - RARE_EARTH_HIGH.vChemicalFormula = "??????"; - - // Set Material Tooltips to be shorter - RARE_EARTH_LOW.vChemicalSymbol = "??"; - RARE_EARTH_MID.vChemicalSymbol = "??"; - RARE_EARTH_HIGH.vChemicalSymbol = "??"; - - // Generate Ore Materials - MaterialGenerator.generateOreMaterial(RARE_EARTH_LOW); - MaterialGenerator.generateOreMaterial(RARE_EARTH_MID); - MaterialGenerator.generateOreMaterial(RARE_EARTH_HIGH); - - ItemStack aRareEarth = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.RareEarth, 1L); - - Fluid aSulfuric = FluidUtils.getFluidStack("sulfuricacid", 1).getFluid(); - Fluid aHydrocholric = FluidUtils.getFluidStack("hydrogenchloride", 1).getFluid(); - Fluid aNitric = FluidUtils.getFluidStack("hydrofluoricacid", 1).getFluid(); - - - - // LV Rare Earth - GT_Values.RA.addChemicalBathRecipe( - ItemUtils.getSimpleStack(aRareEarth, 3), - FluidUtils.getFluidStack(aSulfuric, 1000), - RARE_EARTH_LOW.getCrushed(2), - RARE_EARTH_LOW.getCrushed(2), - RARE_EARTH_LOW.getCrushed(2), - new int[] {10000, 10000, 10000}, - 20 * 30, - MaterialUtils.getVoltageForTier(1)); - - // HV Rare Earth - GT_Values.RA.addChemicalBathRecipe( - ItemUtils.getSimpleStack(aRareEarth, 6), - FluidUtils.getFluidStack(aHydrocholric, 2000), - RARE_EARTH_MID.getCrushed(4), - RARE_EARTH_MID.getCrushed(4), - RARE_EARTH_MID.getCrushed(4), - new int[] {10000, 9000, 8000}, - 20 * 30, - MaterialUtils.getVoltageForTier(3)); - - // IV Rare Earth - GT_Values.RA.addChemicalBathRecipe( - ItemUtils.getSimpleStack(aRareEarth, 9), - FluidUtils.getHydrofluoricAcid(3000), - RARE_EARTH_HIGH.getCrushed(6), - RARE_EARTH_HIGH.getCrushed(6), - RARE_EARTH_HIGH.getCrushed(6), - new int[] {10000, 9000, 8000}, - 20 * 30, - MaterialUtils.getVoltageForTier(5)); - - if (FluidUtils.doesHydrofluoricAcidGtExist()) { - // IV Rare Earth - GT_Values.RA.addChemicalBathRecipe( - ItemUtils.getSimpleStack(aRareEarth, 9), - FluidUtils.getHydrofluoricAcidGT(6000), - RARE_EARTH_HIGH.getCrushed(6), - RARE_EARTH_HIGH.getCrushed(6), - RARE_EARTH_HIGH.getCrushed(6), - new int[] {9000, 8000, 7000}, - 20 * 30, - MaterialUtils.getVoltageForTier(5)); - } - - - } - - - public static void processCopperRecipes() { - - // Rare Earth Processing - /*GT_Values.RA.addSifterRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustRareEarth", 1), - new ItemStack[] { - ELEMENT.getInstance().YTTRIUM.getSmallDust(1), - ELEMENT.getInstance().NEODYMIUM.getSmallDust(1), - ELEMENT.getInstance().LANTHANUM.getSmallDust(1), - ELEMENT.getInstance().CERIUM.getSmallDust(1), - ELEMENT.getInstance().CADMIUM.getSmallDust(1), - ELEMENT.getInstance().CAESIUM.getSmallDust(1), - ORES.SAMARSKITE_YB.getSmallDust(1), - ORES.FLORENCITE.getSmallDust(1), - ORES.FLUORCAPHITE.getSmallDust(1), - //ELEMENT.getInstance().YTTERBIUM.getTinyDust(1), - //ELEMENT.getInstance().SAMARIUM.getTinyDust(1), - //ELEMENT.getInstance().GADOLINIUM.getTinyDust(1) - }, - new int[] { 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000 }, 20 * 30, 500);*/ - - } - -} diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_SeleniumProcessing.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_SeleniumProcessing.java deleted file mode 100644 index 9a2ea8bad0..0000000000 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_SeleniumProcessing.java +++ /dev/null @@ -1,222 +0,0 @@ -package gtPlusPlus.core.recipe; - -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.MISC_MATERIALS; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.core.util.reflect.AddGregtechRecipe; -import net.minecraft.item.ItemStack; - -public class RECIPES_SeleniumProcessing { - - public static void init() { - - //We need this - MaterialUtils.generateSpecialDustAndAssignToAMaterial(MISC_MATERIALS.SELENIUM_DIOXIDE, false); - - // Makes Selenium Dioxide - processCopperRecipes(); - - //Liquify the Dried Dioxide - AddGregtechRecipe.addCokeAndPyrolyseRecipes(MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), 13, FluidUtils.getSteam(500), null, MISC_MATERIALS.SELENIUM_DIOXIDE.getFluidStack(1000), 20, 1024); - - // Produce Selenious Acid - AddGregtechRecipe.addCokeAndPyrolyseRecipes(MISC_MATERIALS.SELENIUM_DIOXIDE.getCell(1), 14, FluidUtils.getHotWater(4000), CI.emptyCells(1), MISC_MATERIALS.SELENIOUS_ACID.getFluidStack(1000), 20, 2048); - - // Make Selenium - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(14), - ItemUtils.getItemStackOfAmountFromOreDict("cellSulfuricAcid", 8), - ELEMENT.getInstance().CARBON.getDust(16), - }, - MISC_MATERIALS.SELENIOUS_ACID.getFluidStack(750), - ELEMENT.getInstance().SELENIUM.getFluidStack(144 * 1), - new ItemStack[] { - CI.emptyCells(8), - ELEMENT.getInstance().SELENIUM.getIngot(1), - ELEMENT.getInstance().SELENIUM.getIngot(1), - }, - new int[] {10000, 2000, 2000}, - 20 * 300, - 7200); - - - /*// Old recipes for Selenium Roasting - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(16), - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedPyrite", 8), - ELEMENT.getInstance().CARBON.getDust(32), - }, - Materials.SulfuricAcid.getFluid(4000), - ELEMENT.getInstance().SELENIUM.getFluid(144), - 0, - 20 * 300, - 2000); - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(17), - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedChalcopyrite", 8), - ELEMENT.getInstance().CARBON.getDust(32), - }, - Materials.SulfuricAcid.getFluid(4000), - ELEMENT.getInstance().SELENIUM.getFluid(144), - 0, - 20 * 300, - 2000); - CORE.RA.addBlastSmelterRecipe( - new ItemStack[] { - ItemUtils.getGregtechCircuit(18), - ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedGalena", 8), - ELEMENT.getInstance().CARBON.getDust(32), - }, - Materials.SulfuricAcid.getFluid(4000), - ELEMENT.getInstance().SELENIUM.getFluid(144), - 0, - 20 * 300, - 2000);*/ - } - - - public static void processCopperRecipes() { - - //Copper - CORE.RA.addDehydratorRecipe( - new ItemStack[]{ - CI.getNumberedAdvancedCircuit(23), - ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Copper, 1), // Item Input - }, - FluidUtils.getHotWater(1000), // Fluid - MISC_MATERIALS.SELENIUM_DIOXIDE.getFluidStack(20), // Fluid - new ItemStack[] { - ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Copper, 1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getTinyDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getTinyDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getTinyDust(1), - }, // Output - new int[] { - 10000, - 100, - 100, - 500, - 500, - 500, - 1000, - 1000, - 1000 - }, - 40 * 20, // Time in ticks - 1024); // EU - - //Tetra - CORE.RA.addDehydratorRecipe( - new ItemStack[]{ - CI.getNumberedAdvancedCircuit(23), - ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Tetrahedrite, 1), // Item Input - }, - FluidUtils.getHotWater(1000), // Fluid - MISC_MATERIALS.SELENIUM_DIOXIDE.getFluidStack(10), // Fluid - new ItemStack[] { - ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Tetrahedrite, 1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getTinyDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getTinyDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getTinyDust(1), - }, // Output - new int[] { - 10000, - 100, - 100, - 300, - 300, - 300, - 800, - 800, - 800 - }, - 40 * 20, // Time in ticks - 1024); // EU - - //Chalco - CORE.RA.addDehydratorRecipe( - new ItemStack[]{ - CI.getNumberedAdvancedCircuit(23), - ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Chalcopyrite, 1), // Item Input - }, - FluidUtils.getHotWater(1000), // Fluid - MISC_MATERIALS.SELENIUM_DIOXIDE.getFluidStack(10), // Fluid - new ItemStack[] { - ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Chalcopyrite, 1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getTinyDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getTinyDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getTinyDust(1), - }, // Output - new int[] { - 10000, - 100, - 100, - 300, - 300, - 300, - 800, - 800, - 800 - }, - 40 * 20, // Time in ticks - 1024); // EU - - //Malachite - CORE.RA.addDehydratorRecipe( - new ItemStack[]{ - CI.getNumberedAdvancedCircuit(23), - ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Malachite, 1), // Item Input - }, - FluidUtils.getHotWater(1000), // Fluid - MISC_MATERIALS.SELENIUM_DIOXIDE.getFluidStack(10), // Fluid - new ItemStack[] { - ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Malachite, 1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getTinyDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getTinyDust(1), - MISC_MATERIALS.SELENIUM_DIOXIDE.getTinyDust(1), - }, // Output - new int[] { - 10000, - 100, - 100, - 300, - 300, - 300, - 800, - 800, - 800 - }, - 40 * 20, // Time in ticks - 1024); // EU - } - -} diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Shapeless.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Shapeless.java deleted file mode 100644 index 7ffdcf295b..0000000000 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Shapeless.java +++ /dev/null @@ -1,35 +0,0 @@ -package gtPlusPlus.core.recipe; - -import net.minecraft.item.ItemStack; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.LoadedMods; - -public class RECIPES_Shapeless { - - static ItemStack dustStaballoy; - - //Circuits - static String circuitPrimitive = "circuitPrimitive"; - static String circuitBasic = "circuitBasic"; - static String circuitGood = "circuitGood"; - static String circuitAdvanced = "circuitAdvanced"; - static String circuitData = "circuitData"; - static String circuitElite = "circuitElite"; - static String circuitMaster = "circuitMaster"; - static String circuitUltimate = "circuitUltimate"; - static ItemStack gearboxCasing_Tier_1; - - public static final void loadRecipes(){ - //run(); - Logger.INFO("Loading Shapeless Recipes."); - } - - private static void run(){ - //Gregtech items - if (LoadedMods.Gregtech){ - - } - } - -} diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java deleted file mode 100644 index 42448e6b74..0000000000 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java +++ /dev/null @@ -1,181 +0,0 @@ -package gtPlusPlus.core.recipe; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; -import net.minecraftforge.oredict.OreDictionary; - -public class RECIPES_Tools { - - //Outputs - public static ItemStack RECIPE_StaballoyPickaxe = new ItemStack(ModItems.itemStaballoyPickaxe); - public static ItemStack RECIPE_StaballoyAxe = new ItemStack(ModItems.itemStaballoyAxe); - public static ItemStack RECIPE_SandstoneHammer = new ItemStack(ModItems.itemSandstoneHammer); - //public static ItemStack RECIPE_StaballoyIngot = new ItemStack(ModItems.itemIngotStaballoy); - public static ItemStack RECIPE_SandStone = new ItemStack(Blocks.sandstone, 2); - public static ItemStack RECIPE_Sand = new ItemStack(Blocks.sand, 4); - public static ItemStack RECIPE_FireStarter = ItemUtils.getSimpleStack(ModItems.itemBasicFireMaker); - - public static ItemStack RECIPE_DivisionSigil; - - //MC Items - public static Item Apple = Items.apple; - - //MC Blocks - public static Block CobbleStone = Blocks.cobblestone; - public static Block Dirt = Blocks.dirt; - public static Block Sand = Blocks.sand; - public static Block Gravel = Blocks.gravel; - public static Block Sandstone = Blocks.sandstone; - - //null - public static String empty = " "; - - //Batteries - public static String batteryBasic = "batteryBasic"; - public static String batteryAdvanced = "batteryAdvanced"; - public static String batteryElite = "batteryElite"; - public static String batteryMaster = "batteryMaster"; - public static String batteryUltimate = "batteryUltimate"; - - //Circuits - public static String circuitPrimitive = "circuitPrimitive"; - public static String circuitBasic = "circuitBasic"; - public static String circuitGood = "circuitGood"; - public static String circuitAdvanced = "circuitAdvanced"; - public static String circuitElite = "circuitElite"; - public static String circuitMaster = "circuitMaster"; - public static String circuitUltimate = "circuitUltimate"; - - //Cables - public static String cableGt01Electrum = "cableGt01Electrum"; - public static String cableGt02Electrum = "cableGt02Electrum"; - public static String cableGt01RedstoneAlloy = "cableGt01RedstoneAlloy"; - public static String cableGt02RedstoneAlloy = "cableGt02RedstoneAlloy"; - public static String cableGt01Copper = "cableGt01Copper"; - public static String cableGt02Copper = "cableGt02Copper"; - public static String cableGt01AnnealedCopper = "cableGt01AnnealedCopper"; - public static String cableGt02AnnealedCopper = "cableGt02AnnealedCopper"; - - //Rods - public static String stickWood = "stickWood"; - public static String stickStaballoy= "stickStaballoy"; - public static String stickTitanium= "stickTitanium"; - public static String stickIron= "stickIron"; - public static String stickGold= "stickGold"; - public static String stickSilver= "stickSilver"; - public static String stickSteel= "stickSteel"; - public static String stickBronze= "stickBronze"; - public static String stickTungsten= "stickTungsten"; - public static String stickRedAlloy= "stickRedAlloy"; - public static String stickInvar= "stickInvar"; - public static String stickElectrum= "stickElectrum"; - public static String stickElectricalSteel= "stickElectricalSteel"; - - //Plates - public static String plateStaballoy= "plateStaballoy"; - public static String plateTitanium= "plateTitanium"; - public static String plateIron= "plateIron"; - public static String plateGold= "plateGold"; - public static String plateSilver= "plateSilver"; - public static String plateSteel= "plateSteel"; - public static String plateBronze= "plateBronze"; - public static String plateTungsten= "plateTungsten"; - public static String plateRedAlloy= "plateRedAlloy"; - public static String plateInvar= "plateInvar"; - public static String plateElectrum= "plateElectrum"; - public static String plateElectricalSteel= "plateElectricalSteel"; - - //Ingots - public static String ingotStaballoy= "ingotStaballoy"; - public static String ingotTitanium= "ingotTitanium"; - public static String ingotIron= "ingotIron"; - public static String ingotGold= "ingotGold"; - public static String ingotSilver= "ingotSilver"; - public static String ingotSteel= "ingotSteel"; - public static String ingotBronze= "ingotBronze"; - public static String ingotTungsten= "ingotTungsten"; - public static String ingotRedAlloy= "ingotRedAlloy"; - public static String ingotInvar= "ingotInvar"; - public static String ingotElectrum= "ingotElectrum"; - public static String ingotUranium= "ingotUranium"; - public static String ingotElectricalSteel= "ingotElectricalSteel"; - - //Crafting Tools - public static String craftingToolHardHammer = "craftingToolHardHammer"; - public static String craftingToolSoftHammer = "craftingToolSoftHammer"; - public static String craftingToolFile = "craftingToolFile"; - public static String craftingToolSaw = "craftingToolSaw"; - public static String craftingToolPickaxe = "craftingToolPickaxe"; - public static String craftingToolWrench = "craftingToolWrench"; - public static String craftingToolCrowbar = "craftingToolCrowbar"; - public static String craftingToolKnife = "craftingToolKnife"; - public static String craftingToolScrewdriver = "craftingToolScrewdriver"; - - public static ItemStack sandHammer = new ItemStack (ModItems.itemSandstoneHammer, 1, OreDictionary.WILDCARD_VALUE); - public static String craftingToolSandHammer = "craftingToolSandHammer"; - - public static ItemStack personalCloakingDevice = ItemUtils.getSimpleStack(ModItems.itemPersonalCloakingDevice); - public static String plateDoubleNiChrome = "plateDoubleNichrome"; - public static String plateIridiumAlloy = "plateAlloyIridium"; - - public static final void loadRecipes(){ - - - run(); - - } - - private static void run(){ - //Staballoy Pickaxe - RecipeUtils.addShapedRecipe( - plateStaballoy, plateStaballoy, ingotStaballoy, - craftingToolFile, stickTungsten, craftingToolHardHammer, - craftingToolWrench, stickTungsten, craftingToolHardHammer, - RECIPE_StaballoyPickaxe); - - //Staballoy Axe - RecipeUtils.addShapedRecipe( - plateStaballoy, ingotStaballoy, craftingToolHardHammer, - plateStaballoy, stickTungsten, craftingToolHardHammer, - craftingToolFile, stickTungsten, craftingToolWrench, - RECIPE_StaballoyAxe); - - //Cobble to Sand - RecipeUtils.addShapedRecipe( - CobbleStone, CobbleStone, CobbleStone, - CobbleStone, sandHammer, CobbleStone, - CobbleStone, CobbleStone, CobbleStone, - RECIPE_Sand); - - //Sand to Sandstone - RecipeUtils.addShapedRecipe( - Sand, Sand, Sand, - Sand, sandHammer, Sand, - Sand, Sand, Sand, - RECIPE_SandStone); - - //Sandstone Hammer - RecipeUtils.addShapedRecipe( - plateElectrum, ingotElectrum, plateElectrum, - craftingToolScrewdriver, stickBronze, craftingToolHardHammer, - null, stickSteel, null, - RECIPE_SandstoneHammer); - - //Basic Firemaker - RecipeUtils.addShapedRecipe( - "cropWheat", "cropWheat", "cropWheat", - ItemUtils.getSimpleStack(Items.string), stickWood, ItemUtils.getSimpleStack(Items.string), - "cropWheat", "cropWheat", "cropWheat", - RECIPE_FireStarter); - - } - -} diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPE_Batteries.java b/src/Java/gtPlusPlus/core/recipe/RECIPE_Batteries.java deleted file mode 100644 index 5476ef0e8d..0000000000 --- a/src/Java/gtPlusPlus/core/recipe/RECIPE_Batteries.java +++ /dev/null @@ -1,52 +0,0 @@ -package gtPlusPlus.core.recipe; - -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.ItemList; - -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; - -public class RECIPE_Batteries { - - static ItemStack RECIPE_Battery_Sodium = GregtechItemList.Battery_RE_EV_Sodium.get(1); - static ItemStack RECIPE_Battery_Cadmium = GregtechItemList.Battery_RE_EV_Cadmium.get(1); - static ItemStack RECIPE_Battery_Lithium = GregtechItemList.Battery_RE_EV_Lithium.get(1); - static ItemStack GT_Battery_Sodium = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32539, 1); - static ItemStack GT_Battery_Cadmium = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32537, 1); - static ItemStack GT_Battery_Lithium = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32538, 1); - static ItemStack machineTransformer_EV; - - public static void loadRecipes(){ - - if (LoadedMods.Gregtech){ - machineTransformer_EV = ItemList.Transformer_EV_HV.get(1); - run(); - } - } - - private static void run(){ - - - RecipeUtils.addShapedGregtechRecipe( - GT_Battery_Sodium, RECIPES_Machines.cableTier4, GT_Battery_Sodium, - CI.circuitTier3, machineTransformer_EV, CI.circuitTier3, - GT_Battery_Sodium, RECIPES_Machines.cableTier4, GT_Battery_Sodium, - RECIPE_Battery_Sodium); - RecipeUtils.addShapedGregtechRecipe( - GT_Battery_Cadmium, RECIPES_Machines.cableTier4, GT_Battery_Cadmium, - CI.circuitTier3, machineTransformer_EV, CI.circuitTier3, - GT_Battery_Cadmium, RECIPES_Machines.cableTier4, GT_Battery_Cadmium, - RECIPE_Battery_Cadmium); - RecipeUtils.addShapedGregtechRecipe( - GT_Battery_Lithium, RECIPES_Machines.cableTier4, GT_Battery_Lithium, - CI.circuitTier3, machineTransformer_EV, CI.circuitTier3, - GT_Battery_Lithium, RECIPES_Machines.cableTier4, GT_Battery_Lithium, - RECIPE_Battery_Lithium); - - } - -} diff --git a/src/Java/gtPlusPlus/core/recipe/ShapedRecipeObject.java b/src/Java/gtPlusPlus/core/recipe/ShapedRecipeObject.java deleted file mode 100644 index 0d25d2bec9..0000000000 --- a/src/Java/gtPlusPlus/core/recipe/ShapedRecipeObject.java +++ /dev/null @@ -1,43 +0,0 @@ -package gtPlusPlus.core.recipe; - -import net.minecraft.item.ItemStack; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.minecraft.RecipeUtils; - -public class ShapedRecipeObject { - - public Object object_A; - public Object object_B; - public Object object_C; - public Object object_D; - public Object object_E; - public Object object_F; - public Object object_G; - public Object object_H; - public Object object_I; - public ItemStack object_OUTPUT; - - public ShapedRecipeObject( - final Object input_A,final Object input_B,final Object input_C, - final Object input_D,final Object input_E,final Object input_F, - final Object input_G,final Object input_H,final Object input_I, - final ItemStack input_Output){ - this.object_A = input_A; - this.object_B = input_B; - this.object_C = input_C; - this.object_D = input_D; - this.object_E = input_E; - this.object_F = input_F; - this.object_G = input_G; - this.object_H = input_H; - this.object_I = input_I; - this.object_OUTPUT = input_Output; - Logger.SPECIFIC_WARNING("ShapedRecipeObject", "New object created.", 36); - } - - public void buildRecipe(){ - RecipeUtils.recipeBuilder(this.object_A, this.object_B, this.object_C, this.object_D, this.object_E, this.object_F, this.object_G, this.object_H, this.object_I, this.object_OUTPUT); - } - -} diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java deleted file mode 100644 index 0a1b762a97..0000000000 --- a/src/Java/gtPlusPlus/core/recipe/common/CI.java +++ /dev/null @@ -1,1343 +0,0 @@ -package gtPlusPlus.core.recipe.common; - -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.item.chemistry.AgriculturalChem; -import gtPlusPlus.core.item.chemistry.GenericChem; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.recipe.LOADER_Machine_Components; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.StaticFields59; -import ic2.core.Ic2Items; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -public class CI { - - //null - public static ItemStack _NULL = ItemUtils.getErrorStack(1); - - //bits - public static long bits = GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE - | GT_ModHandler.RecipeBits.BUFFERED; - public static long bitsd = GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED; - - //Circuits - public static Object circuitPrimitive; - public static Object circuitTier1; - public static Object circuitTier2; - public static Object circuitTier3; - public static Object circuitTier4; - public static Object circuitTier5; - public static Object circuitTier6; - public static Object circuitTier7; - public static Object circuitTier8; - public static Object circuitTier9; - - //Machine Components - public static ItemStack electricMotor_ULV; - public static ItemStack electricMotor_LV; - public static ItemStack electricMotor_MV; - public static ItemStack electricMotor_HV; - public static ItemStack electricMotor_EV; - public static ItemStack electricMotor_IV; - public static ItemStack electricMotor_LuV; - public static ItemStack electricMotor_ZPM; - public static ItemStack electricMotor_UV; - public static ItemStack electricMotor_MAX; - public static ItemStack electricPump_ULV; - public static ItemStack electricPump_LV; - public static ItemStack electricPump_MV; - public static ItemStack electricPump_HV; - public static ItemStack electricPump_EV; - public static ItemStack electricPump_IV; - public static ItemStack electricPump_LuV; - public static ItemStack electricPump_ZPM; - public static ItemStack electricPump_UV; - public static ItemStack electricPump_MAX; - public static ItemStack electricPiston_ULV; - public static ItemStack electricPiston_LV; - public static ItemStack electricPiston_MV; - public static ItemStack electricPiston_HV; - public static ItemStack electricPiston_EV; - public static ItemStack electricPiston_IV; - public static ItemStack electricPiston_LuV; - public static ItemStack electricPiston_ZPM; - public static ItemStack electricPiston_UV ; - public static ItemStack electricPiston_MAX; - public static ItemStack robotArm_ULV; - public static ItemStack robotArm_LV; - public static ItemStack robotArm_MV; - public static ItemStack robotArm_HV; - public static ItemStack robotArm_EV; - public static ItemStack robotArm_IV; - public static ItemStack robotArm_LuV; - public static ItemStack robotArm_ZPM; - public static ItemStack robotArm_UV; - public static ItemStack robotArm_MAX; - public static ItemStack conveyorModule_ULV; - public static ItemStack conveyorModule_LV; - public static ItemStack conveyorModule_MV; - public static ItemStack conveyorModule_HV; - public static ItemStack conveyorModule_EV; - public static ItemStack conveyorModule_IV; - public static ItemStack conveyorModule_LuV; - public static ItemStack conveyorModule_ZPM; - public static ItemStack conveyorModule_UV; - public static ItemStack conveyorModule_MAX; - public static ItemStack emitter_ULV; - public static ItemStack emitter_LV; - public static ItemStack emitter_MV; - public static ItemStack emitter_HV; - public static ItemStack emitter_EV; - public static ItemStack emitter_IV; - public static ItemStack emitter_LuV; - public static ItemStack emitter_ZPM; - public static ItemStack emitter_UV; - public static ItemStack emitter_MAX; - public static ItemStack fieldGenerator_ULV; - public static ItemStack fieldGenerator_LV; - public static ItemStack fieldGenerator_MV; - public static ItemStack fieldGenerator_HV; - public static ItemStack fieldGenerator_EV; - public static ItemStack fieldGenerator_IV; - public static ItemStack fieldGenerator_LuV; - public static ItemStack fieldGenerator_ZPM; - public static ItemStack fieldGenerator_UV; - public static ItemStack fieldGenerator_MAX; - public static ItemStack sensor_ULV; - public static ItemStack sensor_LV; - public static ItemStack sensor_MV; - public static ItemStack sensor_HV; - public static ItemStack sensor_EV; - public static ItemStack sensor_IV; - public static ItemStack sensor_LuV; - public static ItemStack sensor_ZPM; - public static ItemStack sensor_UV; - public static ItemStack sensor_MAX; - - //Machine Casings - public static ItemStack machineCasing_ULV; - public static ItemStack machineCasing_LV; - public static ItemStack machineCasing_MV; - public static ItemStack machineCasing_HV; - public static ItemStack machineCasing_EV; - public static ItemStack machineCasing_IV; - public static ItemStack machineCasing_LuV; - public static ItemStack machineCasing_ZPM; - public static ItemStack machineCasing_UV; - public static ItemStack machineCasing_MAX; - - //Machine Hulls - public static ItemStack machineHull_ULV; - public static ItemStack machineHull_LV; - public static ItemStack machineHull_MV; - public static ItemStack machineHull_HV; - public static ItemStack machineHull_EV; - public static ItemStack machineHull_IV; - public static ItemStack machineHull_LuV; - public static ItemStack machineHull_ZPM; - public static ItemStack machineHull_UV; - public static ItemStack machineHull_MAX; - - //Gearbox Casings - public static ItemStack gearboxCasing_Tier_1; - public static ItemStack gearboxCasing_Tier_2; - public static ItemStack gearboxCasing_Tier_3; - public static ItemStack gearboxCasing_Tier_4; - - public static String[] component_Plate; - public static String[] component_Rod; - public static String[] component_Ingot; - - //Crafting Tools - public static String craftingToolWrench = "craftingToolWrench"; - public static String craftingToolHammer_Hard = "craftingToolHardHammer"; - public static String craftingToolHammer_Soft = "craftingToolSoftHammer"; - public static String craftingToolScrewdriver = "craftingToolScrewdriver"; - public static String craftingToolFile = "craftingToolFile"; - public static String craftingToolMortar = "craftingToolMortar"; - public static String craftingToolKnife = "craftingToolKnife"; - public static String craftingToolCrowbar = "craftingToolCrowbar"; - public static String craftingToolSaw = "craftingToolSaw"; - public static String craftingToolWireCutter = "craftingToolWirecutter"; - public static String craftingToolSolderingIron = "craftingToolSolderingIron"; - - //Explosives - public static ItemStack explosivePowderKeg; - public static ItemStack explosiveTNT; - public static ItemStack explosiveITNT; - - public static void preInit(){ - - //Tiered Components - component_Plate = new String[]{ - getTieredComponent(OrePrefixes.plate, 0), - getTieredComponent(OrePrefixes.plate, 1), - getTieredComponent(OrePrefixes.plate, 2), - getTieredComponent(OrePrefixes.plate, 3), - getTieredComponent(OrePrefixes.plate, 4), - getTieredComponent(OrePrefixes.plate, 5), - getTieredComponent(OrePrefixes.plate, 6), - getTieredComponent(OrePrefixes.plate, 7), - getTieredComponent(OrePrefixes.plate, 8), - getTieredComponent(OrePrefixes.plate, 9), - getTieredComponent(OrePrefixes.plate, 10), - getTieredComponent(OrePrefixes.plate, 11) - }; - component_Rod = new String[]{ - getTieredComponent(OrePrefixes.stick, 0), - getTieredComponent(OrePrefixes.stick, 1), - getTieredComponent(OrePrefixes.stick, 2), - getTieredComponent(OrePrefixes.stick, 3), - getTieredComponent(OrePrefixes.stick, 4), - getTieredComponent(OrePrefixes.stick, 5), - getTieredComponent(OrePrefixes.stick, 6), - getTieredComponent(OrePrefixes.stick, 7), - getTieredComponent(OrePrefixes.stick, 8), - getTieredComponent(OrePrefixes.stick, 9), - getTieredComponent(OrePrefixes.stick, 10), - getTieredComponent(OrePrefixes.stick, 11) - }; - component_Ingot = new String[]{ - getTieredComponent(OrePrefixes.ingot, 0), - getTieredComponent(OrePrefixes.ingot, 1), - getTieredComponent(OrePrefixes.ingot, 2), - getTieredComponent(OrePrefixes.ingot, 3), - getTieredComponent(OrePrefixes.ingot, 4), - getTieredComponent(OrePrefixes.ingot, 5), - getTieredComponent(OrePrefixes.ingot, 6), - getTieredComponent(OrePrefixes.ingot, 7), - getTieredComponent(OrePrefixes.ingot, 8), - getTieredComponent(OrePrefixes.ingot, 9), - getTieredComponent(OrePrefixes.ingot, 10), - getTieredComponent(OrePrefixes.ingot, 11) - }; - - //Circuits - circuitPrimitive = getTieredCircuit(0); - circuitTier1 = getTieredCircuit(1); - circuitTier2 = getTieredCircuit(2); - circuitTier3 = getTieredCircuit(3); - circuitTier4 = getTieredCircuit(4); - circuitTier5 = getTieredCircuit(5); - circuitTier6 = getTieredCircuit(6); - circuitTier7 = getTieredCircuit(7); - circuitTier8 = getTieredCircuit(8); - circuitTier9 = getTieredCircuit(9); - - } - - public static Object getTieredCircuit(int tier){ - if (CORE.ConfigSwitches.enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && !CORE.GTNH){ - if (tier == 0){ - return GregtechItemList.Old_Circuit_Primitive.get(1); - } - else if (tier == 1){ - return GregtechItemList.Old_Circuit_Basic.get(1); - } - else if (tier == 2){ - return GregtechItemList.Old_Circuit_Good.get(1); - } - else if (tier == 3){ - return GregtechItemList.Old_Circuit_Advanced.get(1); - } - else if (tier == 4){ - return GregtechItemList.Old_Circuit_Data.get(1); - } - else if (tier == 5){ - return GregtechItemList.Old_Circuit_Elite.get(1); - } - else if (tier == 6){ - return GregtechItemList.Old_Circuit_Master.get(1); - } - else if (tier == 7){ - return GregtechItemList.Old_Circuit_Ultimate.get(1); - } - else if (tier == 8){ - return GregtechItemList.Circuit_IV.get(1); - } - else if (tier == 9){ - return GregtechItemList.Circuit_LuV.get(1); - } - else if (tier == 10){ - return GregtechItemList.Circuit_ZPM.get(1); - } - } - else { - return getTieredCircuitOreDictName(tier); - } - return _NULL; - } - - public static ItemStack[] getAllCircuitsOfTier(int tier){ - return ItemUtils.getStackOfAllOreDictGroup(getTieredCircuitOreDictName(tier)); - } - - public static String getTieredCircuitOreDictName(int tier){ - if (tier == 0){ - return "circuitPrimitive"; - } - else if (tier == 1){ - return "circuitBasic"; - } - else if (tier == 2){ - return "circuitGood"; - } - else if (tier == 3){ - return "circuitAdvanced"; - } - else if (tier == 4){ - return "circuitData"; - } - else if (tier == 5){ - return "circuitElite"; - } - else if (tier == 6){ - return "circuitMaster"; - } - else if (tier == 7){ - return "circuitUltimate"; - } - else if (tier == 8){ - return "circuitSuperconductor"; - } - else if (tier == 9){ - return "circuitInfinite"; - } - else if (tier == 10){ - return "circuitQuantum"; - } - else { - return "circuitPrimitive"; - } - } - - public static ItemStack getNumberedCircuit(int Meta){ - return ItemUtils.getGregtechCircuit(Meta); - } - - private static Object getMaterialFromTier(int tier){ - if (tier == 0){ - return Materials.Wood; - } - else if (tier == 1){ - return Materials.Lead; - } - else if (tier == 2){ - return Materials.Bronze; - } - else if (tier == 3){ - return Materials.Steel; - } - else if (tier == 4){ - return ALLOY.EGLIN_STEEL; - } - else if (tier == 5){ - return Materials.Aluminium; - } - else if (tier == 6){ - return ALLOY.MARAGING250; - } - else if (tier == 7){ - return ALLOY.TANTALLOY_61; - } - else if (tier == 8){ - return ALLOY.INCONEL_792; - } - else if (tier == 9){ - return ALLOY.ZERON_100; - } - else if (tier == 10){ - return Materials.NaquadahEnriched; - } - else if (tier == 11){ - return Materials.Neutronium; - } - return Materials._NULL; - } - - @Deprecated - public static String getTieredComponent(OrePrefixes type, int tier){ - Object material = getMaterialFromTier(tier); - if (material != null){ - if (material instanceof Materials){ - //return (ItemStack) type.get(material); - String materialName = ((Materials) material).mDefaultLocalName; - Logger.INFO("Searching for a component named "+type.name()+materialName); - //return ItemUtils.getItemStackOfAmountFromOreDict(type.name()+materialName, 1); - return (type.name()+materialName); - } - else { - String materialName = (Utils.sanitizeString(((Material) material).getLocalizedName())); - Logger.INFO("Searching for a component named "+type.name()+materialName); - //return ItemUtils.getItemStackOfAmountFromOreDict(type.name()+materialName, 1); - return (type.name()+materialName); - } - } - Logger.INFO("[Components] Failed getting a tiered component. "+type.name()+" | "+tier); - return null; - } - - public static ItemStack getDataOrb(){ - if (CORE.ConfigSwitches.enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && !CORE.GTNH){ - return GregtechItemList.Old_Tool_DataOrb.get(1); - } - else { - return ItemList.Tool_DataOrb.get(1); - } - } - - public static ItemStack getDataStick(){ - if (CORE.ConfigSwitches.enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && !CORE.GTNH){ - return GregtechItemList.Old_Tool_DataStick.get(1); - } - else { - return ItemList.Tool_DataStick.get(1); - } - } - - public static final ItemStack getTieredMachineHull(int tier){ - if (tier == 0){ - return machineHull_ULV; - } - else if (tier == 1){ - return machineHull_LV; - } - else if (tier == 2){ - return machineHull_MV; - } - else if (tier == 3){ - return machineHull_HV; - } - else if (tier == 4){ - return machineHull_EV; - } - else if (tier == 5){ - return machineHull_IV; - } - else if (tier == 6){ - return machineHull_LuV; - } - else if (tier == 7){ - return machineHull_ZPM; - } - else if (tier == 8){ - return machineHull_UV; - } - else if (tier == 9){ - return machineHull_MAX; - } - else { - return GregtechItemList.Casing_Multi_Use.get(1); - } - } - - public static final ItemStack getTieredMachineCasing(int tier){ - if (tier == 0){ - if (machineCasing_ULV == null) { - machineCasing_ULV = ItemList.Casing_ULV.get(1); - } - return machineCasing_ULV; - } - else if (tier == 1){ - return machineCasing_LV; - } - else if (tier == 2){ - return machineCasing_MV; - } - else if (tier == 3){ - return machineCasing_HV; - } - else if (tier == 4){ - return machineCasing_EV; - } - else if (tier == 5){ - return machineCasing_IV; - } - else if (tier == 6){ - return machineCasing_LuV; - } - else if (tier == 7){ - return machineCasing_ZPM; - } - else if (tier == 8){ - return machineCasing_UV; - } - else if (tier == 9){ - return machineCasing_MAX; - } - else { - return GregtechItemList.Casing_Multi_Use.get(1); - } - } - - public static void init() { - //Set Explosives - explosivePowderKeg = ItemUtils.getValueOfItemList("Block_Powderbarrel", 1, ItemUtils.getSimpleStack(Items.gunpowder, 16)); - explosiveTNT = ItemUtils.getSimpleStack(Blocks.tnt).copy(); - explosiveITNT = Ic2Items.industrialTnt.copy(); - - //Machine Casings - machineCasing_ULV = ItemList.Casing_ULV.get(1); - machineCasing_LV = ItemList.Casing_LV.get(1); - machineCasing_MV = ItemList.Casing_MV.get(1); - machineCasing_HV = ItemList.Casing_HV.get(1); - machineCasing_EV = ItemList.Casing_EV.get(1); - machineCasing_IV = ItemList.Casing_IV.get(1); - machineCasing_LuV = ItemList.Casing_LuV.get(1); - machineCasing_ZPM = ItemList.Casing_ZPM.get(1); - machineCasing_UV = ItemList.Casing_UV.get(1); - machineCasing_MAX = ItemList.Casing_MAX.get(1); - - //Machine Hulls - machineHull_ULV = ItemList.Hull_ULV.get(1); - machineHull_LV = ItemList.Hull_LV.get(1); - machineHull_MV = ItemList.Hull_MV.get(1); - machineHull_HV = ItemList.Hull_HV.get(1); - machineHull_EV = ItemList.Hull_EV.get(1); - machineHull_IV = ItemList.Hull_IV.get(1); - machineHull_LuV = ItemList.Hull_LuV.get(1); - machineHull_ZPM = ItemList.Hull_ZPM.get(1); - machineHull_UV = ItemList.Hull_UV.get(1); - machineHull_MAX = ItemList.Hull_MAX.get(1); - - //Gear box Casings - gearboxCasing_Tier_1 = ItemList.Casing_Gearbox_Bronze.get(1); - gearboxCasing_Tier_2 = ItemList.Casing_Gearbox_Steel.get(1); - gearboxCasing_Tier_3 = ItemList.Casing_Gearbox_Titanium.get(1); - gearboxCasing_Tier_4 = ItemList.Casing_Gearbox_TungstenSteel.get(1); - - //Machine Components - LOADER_Machine_Components.initialise(); - } - - public static ItemStack emptyCells(int i) { - return ItemUtils.getEmptyCell(i); - } - - private static final Material[] aMaterial_Main = new Material[] { - ALLOY.POTIN, - ALLOY.TUMBAGA, - ALLOY.EGLIN_STEEL, - ALLOY.INCONEL_792, - ALLOY.TUNGSTEN_TITANIUM_CARBIDE, - ALLOY.NITINOL_60, - ALLOY.ZERON_100, - ALLOY.PIKYONIUM, - ELEMENT.STANDALONE.ADVANCED_NITINOL, - ALLOY.ABYSSAL, - ALLOY.QUANTUM, - ELEMENT.STANDALONE.HYPOGEN - }; - - private static final Material[] aMaterial_Secondary = new Material[] { - ALLOY.STEEL, - ALLOY.SILICON_CARBIDE, - ALLOY.BABBIT_ALLOY, - ALLOY.INCONEL_690, - ALLOY.STELLITE, - ALLOY.ARCANITE, - ALLOY.LAFIUM, - ALLOY.CINOBITE, - ALLOY.TITANSTEEL, - ALLOY.OCTIRON, - ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN, - ELEMENT.STANDALONE.HYPOGEN - }; - - private static final Material[] aMaterial_Tertiary = new Material[] { - ELEMENT.getInstance().LEAD, - ELEMENT.getInstance().ALUMINIUM, - ELEMENT.STANDALONE.BLACK_METAL, - ELEMENT.getInstance().TUNGSTEN, - ALLOY.HASTELLOY_N, - ALLOY.ENERGYCRYSTAL, - ALLOY.TRINIUM_NAQUADAH_CARBON, - ALLOY.TRINIUM_REINFORCED_STEEL, //Arceus - ALLOY.TITANSTEEL, - ELEMENT.STANDALONE.ASTRAL_TITANIUM, - ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN, - ELEMENT.STANDALONE.HYPOGEN - }; - - private static final Materials[] aMaterial_Cables = new Materials[] { - !CORE.GTNH ? Materials.Lead : Materials.Tin, - Materials.Cobalt, - Materials.AnnealedCopper, - Materials.Gold, - Materials.Titanium, - Materials.Nichrome, - Materials.Platinum, - Materials.YttriumBariumCuprate, - Materials.Naquadah, - Materials.Duranium, - Materials.Superconductor, - }; - - private static final Materials[] aMaterial_Circuits = new Materials[] { - Materials.Primitive, - Materials.Basic, - Materials.Good, - Materials.Advanced, - Materials.Data, - Materials.Data, - Materials.Elite, - Materials.Master, - Materials.Ultimate, - Materials.Superconductor, - Materials.Infinite, - }; - - private static final Material[][] aMaster = new Material[][] {aMaterial_Main, aMaterial_Secondary, aMaterial_Tertiary}; - - - public static FluidStack getTieredFluid(int aTier, int aAmount) { - return getTieredFluid(aTier, aAmount, 0); - } - - public static FluidStack getAlternativeTieredFluid(int aTier, int aAmount) { - return getTieredFluid(aTier, aAmount, 1); - } - - public static FluidStack getTertiaryTieredFluid(int aTier, int aAmount) { - return getTieredFluid(aTier, aAmount, 2); - } - - public static FluidStack getTieredFluid(int aTier, int aAmount, int aType) { - // Weird Legacy handling - /*ItemStack aCell = getTieredComponent(OrePrefixes.liquid, aTier, 1); - FluidStack a = GT_Utility.getFluidForFilledItem(aCell, true); - if (a == null) { - a = aMaster[aType][aTier].getFluid(aAmount); - }*/ - - // Modern Handling - FluidStack a = aMaster[aType][aTier].getFluidStack(aAmount); - if (a == null) { - ItemStack aCell = getTieredComponent(OrePrefixes.liquid, aTier, 1); - if (aCell != null) { - a = GT_Utility.getFluidForFilledItem(aCell, true); - a.amount = aAmount; - } - } - return a; - } - - public static ItemStack getEnergyCore(int aTier, int aAmount) { - ItemStack[] aOutput = new ItemStack[] { - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"1", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"2", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"3", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"4", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"5", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"6", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"7", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"8", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"9", 1), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore"+"10", 1) - }; - return ItemUtils.getSimpleStack(aOutput[MathUtils.balance(aTier, 0, 9)], aAmount); - } - - public static ItemStack getPlate(int aTier, int aAmount) { - return getTieredComponent(OrePrefixes.plate, aTier, aAmount); - } - - public static ItemStack getDoublePlate(int aTier, int aAmount) { - return getTieredComponent(OrePrefixes.plateDouble, aTier, aAmount); - } - - public static ItemStack getGear(int aTier, int aAmount) { - return getTieredComponent(OrePrefixes.gearGt, aTier, aAmount); - } - - public static ItemStack getIngot(int aTier, int aAmount) { - return getTieredComponent(OrePrefixes.ingot, aTier, aAmount); - } - - public static ItemStack getBolt(int aTier, int aAmount) { - return getTieredComponent(OrePrefixes.bolt, aTier, aAmount); - } - - public static ItemStack getTieredComponent(OrePrefixes aPrefix, int aTier, int aAmount) { - aTier = Math.max(0, aTier); - - Material m = null; - - if (aPrefix == OrePrefixes.liquid) { - int aMatID = (aTier == 0 || aTier == 2 || aTier == 5 || aTier == 8 ? 0 : (aTier == 1 || aTier == 3 || aTier == 6 || aTier == 9 ? 1 : 2)); - ItemStack aCell = aMaster[aMatID][aTier].getCell(aAmount); - return aCell; - } - - if (aPrefix == OrePrefixes.circuit) { - if (aTier == 4) { - return ItemUtils.getSimpleStack(CI.getDataStick(), aAmount); - } - else if (aTier == 5) { - return ItemUtils.getSimpleStack(CI.getDataOrb(), aAmount); - } - return ItemUtils.getOrePrefixStack(OrePrefixes.circuit, aMaterial_Circuits[aTier], aAmount); - } - - //Check for Cables first, catch SuperConductor case and swap to wire. - if (aPrefix == OrePrefixes.cableGt01 || aPrefix == OrePrefixes.cableGt02 || aPrefix == OrePrefixes.cableGt04 || aPrefix == OrePrefixes.cableGt08 || aPrefix == OrePrefixes.cableGt12) { - //Special Handler - if (aTier == 10) { - if (aPrefix == OrePrefixes.cableGt01) { - aPrefix = OrePrefixes.wireGt02; - } - else if (aPrefix == OrePrefixes.cableGt02) { - aPrefix = OrePrefixes.wireGt04; - } - else if (aPrefix == OrePrefixes.cableGt04) { - aPrefix = OrePrefixes.wireGt08; - } - else if (aPrefix == OrePrefixes.cableGt08) { - aPrefix = OrePrefixes.wireGt12; - } - else if (aPrefix == OrePrefixes.cableGt12) { - aPrefix = OrePrefixes.wireGt16; - } - } - else { - return ItemUtils.getOrePrefixStack(aPrefix, aMaterial_Cables[aTier], aAmount); - } - - - } - if (aPrefix == OrePrefixes.wireGt01 || aPrefix == OrePrefixes.wireGt02 || aPrefix == OrePrefixes.wireGt04 || aPrefix == OrePrefixes.wireGt08 || aPrefix == OrePrefixes.wireGt12 || aPrefix == OrePrefixes.wireGt16) { - return ItemUtils.getOrePrefixStack(aPrefix, aMaterial_Cables[aTier], aAmount); - } - - if (aPrefix == OrePrefixes.pipeTiny || aPrefix == OrePrefixes.pipeSmall || aPrefix == OrePrefixes.pipe || aPrefix == OrePrefixes.pipeMedium || aPrefix == OrePrefixes.pipeLarge || aPrefix == OrePrefixes.pipeHuge) { - - if (aPrefix == OrePrefixes.pipe) { - aPrefix = OrePrefixes.pipeMedium; - } - - if (aTier == 0) { - return ItemUtils.getOrePrefixStack(aPrefix, Materials.Lead, aAmount); - } - else if (aTier == 1) { - return ItemUtils.getOrePrefixStack(aPrefix, Materials.Steel, aAmount); - } - else if (aTier == 2) { - return ItemUtils.getOrePrefixStack(aPrefix, Materials.StainlessSteel, aAmount); - } - else if (aTier == 3) { - return ItemUtils.getOrePrefixStack(aPrefix, Materials.Tungsten, aAmount); - } - else if (aTier == 4) { - return ItemUtils.getOrePrefixStack(aPrefix, Materials.TungstenSteel, aAmount); - } - else if (aTier == 5) { - return ItemUtils.getOrePrefixStack(aPrefix, ALLOY.MARAGING350, aAmount); - } - else if (aTier == 6) { - return ItemUtils.getOrePrefixStack(aPrefix, ALLOY.STABALLOY, aAmount); - } - else if (aTier == 7) { - return ItemUtils.getOrePrefixStack(aPrefix, ALLOY.HASTELLOY_X, aAmount); - } - else if (aTier == 8) { - return ItemUtils.getOrePrefixStack(aPrefix, Materials.Ultimate, aAmount); - } - else if (aTier == 9) { - return ItemUtils.getOrePrefixStack(OrePrefixes.pipeMedium, Materials.Superconductor, aAmount); - } - else if (aTier == 10) { - return ItemUtils.getOrePrefixStack(aPrefix, Materials.Europium, aAmount); - } - else { - return ItemUtils.getOrePrefixStack(aPrefix, Materials.Titanium, aAmount); - } - } - - if (aPrefix == OrePrefixes.rod) { - aPrefix = OrePrefixes.stick; - } - - if (aPrefix == OrePrefixes.gear || aPrefix == OrePrefixes.gearGt) { - m = aMaster[0][aTier]; - } - else if (aPrefix == OrePrefixes.rod || aPrefix == OrePrefixes.stick) { - m = aMaster[0][aTier]; - } - else if (aPrefix == OrePrefixes.stickLong) { - m = aMaster[1][aTier]; - } - else if (aPrefix == OrePrefixes.bolt) { - m = aMaster[2][aTier]; - } - else if (aPrefix == OrePrefixes.screw) { - m = aMaster[0][aTier]; - } - else if (aPrefix == OrePrefixes.rotor) { - m = aMaster[1][aTier]; - } - else if (aPrefix == OrePrefixes.frame || aPrefix == OrePrefixes.frameGt) { - m = aMaster[2][aTier]; - } - else if (aPrefix == OrePrefixes.ingot) { - m = aMaster[1][aTier]; - } - else if (aPrefix == OrePrefixes.plate) { - m = aMaster[0][aTier]; - } - else if (aPrefix == OrePrefixes.plateDouble) { - m = aMaster[0][aTier]; - } - else if (aPrefix == OrePrefixes.ring) { - m = aMaster[2][aTier]; - } - else if (aPrefix == OrePrefixes.cell) { - m = aMaster[1][aTier]; - } - else { - m = aMaterial_Main[aTier]; - } - - ItemStack aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount); - - //If Invalid, Try First Material - if (!ItemUtils.checkForInvalidItems(aReturn)) { - m = aMaster[0][aTier]; - aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount); - - //If Invalid, Try Second Material - if (!ItemUtils.checkForInvalidItems(aReturn)) { - m = aMaster[1][aTier]; - aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount); - - //If Invalid, Try Third Material - if (!ItemUtils.checkForInvalidItems(aReturn)) { - m = aMaster[2][aTier]; - aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount); - - //All Invalid? Ok, shit. - //Let's add a special error ingot. - if (!ItemUtils.checkForInvalidItems(aReturn)) { - aReturn = ItemUtils.getErrorStack(1, (aPrefix.toString()+m.getLocalizedName()+" x"+aAmount)); - } - } - } - } - - return aReturn; - - - } - - public static ItemStack getElectricMotor(int aTier, int aSize) { - ItemStack aType; - int aLazyTier = 0; - if (aTier == aLazyTier++) { - aType = CI.electricMotor_ULV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricMotor_LV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricMotor_MV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricMotor_HV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricMotor_EV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricMotor_IV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricMotor_LuV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricMotor_ZPM; - } - else if (aTier == aLazyTier++) { - aType = CI.electricMotor_UV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricMotor_MAX; - } - else { - aType = CI.electricMotor_LV; - } - return ItemUtils.getSimpleStack(aType, aSize); - } - - public static ItemStack getElectricPiston(int aTier, int aSize) { - ItemStack aType; - int aLazyTier = 0; - if (aTier == aLazyTier++) { - aType = CI.electricPiston_ULV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricPiston_LV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricPiston_MV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricPiston_HV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricPiston_EV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricPiston_IV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricPiston_LuV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricPiston_ZPM; - } - else if (aTier == aLazyTier++) { - aType = CI.electricPiston_UV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricPiston_MAX; - } - else { - aType = CI.electricPiston_LV; - } - return ItemUtils.getSimpleStack(aType, aSize); - } - - public static ItemStack getElectricPump(int aTier, int aSize) { - ItemStack aType; - int aLazyTier = 0; - if (aTier == aLazyTier++) { - aType = CI.electricPump_ULV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricPump_LV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricPump_MV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricPump_HV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricPump_EV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricPump_IV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricPump_LuV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricPump_ZPM; - } - else if (aTier == aLazyTier++) { - aType = CI.electricPump_UV; - } - else if (aTier == aLazyTier++) { - aType = CI.electricPump_MAX; - } - else { - aType = CI.electricPump_LV; - } - return ItemUtils.getSimpleStack(aType, aSize); - } - - public static ItemStack getRobotArm(int aTier, int aSize) { - ItemStack aType; - int aLazyTier = 0; - if (aTier == aLazyTier++) { - aType = CI.robotArm_ULV; - } - else if (aTier == aLazyTier++) { - aType = CI.robotArm_LV; - } - else if (aTier == aLazyTier++) { - aType = CI.robotArm_MV; - } - else if (aTier == aLazyTier++) { - aType = CI.robotArm_HV; - } - else if (aTier == aLazyTier++) { - aType = CI.robotArm_EV; - } - else if (aTier == aLazyTier++) { - aType = CI.robotArm_IV; - } - else if (aTier == aLazyTier++) { - aType = CI.robotArm_LuV; - } - else if (aTier == aLazyTier++) { - aType = CI.robotArm_ZPM; - } - else if (aTier == aLazyTier++) { - aType = CI.robotArm_UV; - } - else if (aTier == aLazyTier++) { - aType = CI.robotArm_MAX; - } - else { - aType = CI.robotArm_LV; - } - return ItemUtils.getSimpleStack(aType, aSize); - } - - public static ItemStack getConveyor(int aTier, int aSize) { - ItemStack aType; - int aLazyTier = 0; - if (aTier == aLazyTier++) { - aType = CI.conveyorModule_ULV; - } - else if (aTier == aLazyTier++) { - aType = CI.conveyorModule_LV; - } - else if (aTier == aLazyTier++) { - aType = CI.conveyorModule_MV; - } - else if (aTier == aLazyTier++) { - aType = CI.conveyorModule_HV; - } - else if (aTier == aLazyTier++) { - aType = CI.conveyorModule_EV; - } - else if (aTier == aLazyTier++) { - aType = CI.conveyorModule_IV; - } - else if (aTier == aLazyTier++) { - aType = CI.conveyorModule_LuV; - } - else if (aTier == aLazyTier++) { - aType = CI.conveyorModule_ZPM; - } - else if (aTier == aLazyTier++) { - aType = CI.conveyorModule_UV; - } - else if (aTier == aLazyTier++) { - aType = CI.conveyorModule_MAX; - } - else { - aType = CI.conveyorModule_LV; - } - return ItemUtils.getSimpleStack(aType, aSize); - } - - public static ItemStack getEmitter(int aTier, int aSize) { - ItemStack aType; - int aLazyTier = 0; - if (aTier == aLazyTier++) { - aType = CI.emitter_ULV; - } - else if (aTier == aLazyTier++) { - aType = CI.emitter_LV; - } - else if (aTier == aLazyTier++) { - aType = CI.emitter_MV; - } - else if (aTier == aLazyTier++) { - aType = CI.emitter_HV; - } - else if (aTier == aLazyTier++) { - aType = CI.emitter_EV; - } - else if (aTier == aLazyTier++) { - aType = CI.emitter_IV; - } - else if (aTier == aLazyTier++) { - aType = CI.emitter_LuV; - } - else if (aTier == aLazyTier++) { - aType = CI.emitter_ZPM; - } - else if (aTier == aLazyTier++) { - aType = CI.emitter_UV; - } - else if (aTier == aLazyTier++) { - aType = CI.emitter_MAX; - } - else { - aType = CI.emitter_LV; - } - return ItemUtils.getSimpleStack(aType, aSize); - } - - public static ItemStack getSensor(int aTier, int aSize) { - ItemStack aType; - int aLazyTier = 0; - if (aTier == aLazyTier++) { - aType = CI.sensor_ULV; - } - else if (aTier == aLazyTier++) { - aType = CI.sensor_LV; - } - else if (aTier == aLazyTier++) { - aType = CI.sensor_MV; - } - else if (aTier == aLazyTier++) { - aType = CI.sensor_HV; - } - else if (aTier == aLazyTier++) { - aType = CI.sensor_EV; - } - else if (aTier == aLazyTier++) { - aType = CI.sensor_IV; - } - else if (aTier == aLazyTier++) { - aType = CI.sensor_LuV; - } - else if (aTier == aLazyTier++) { - aType = CI.sensor_ZPM; - } - else if (aTier == aLazyTier++) { - aType = CI.sensor_UV; - } - else if (aTier == aLazyTier++) { - aType = CI.sensor_MAX; - } - else { - aType = CI.sensor_LV; - } - return ItemUtils.getSimpleStack(aType, aSize); - } - - public static ItemStack getFieldGenerator(int aTier, int aSize) { - ItemStack aType; - int aLazyTier = 0; - if (aTier == aLazyTier++) { - aType = CI.fieldGenerator_ULV; - } - else if (aTier == aLazyTier++) { - aType = CI.fieldGenerator_LV; - } - else if (aTier == aLazyTier++) { - aType = CI.fieldGenerator_MV; - } - else if (aTier == aLazyTier++) { - aType = CI.fieldGenerator_HV; - } - else if (aTier == aLazyTier++) { - aType = CI.fieldGenerator_EV; - } - else if (aTier == aLazyTier++) { - aType = CI.fieldGenerator_IV; - } - else if (aTier == aLazyTier++) { - aType = CI.fieldGenerator_LuV; - } - else if (aTier == aLazyTier++) { - aType = CI.fieldGenerator_ZPM; - } - else if (aTier == aLazyTier++) { - aType = CI.fieldGenerator_UV; - } - else if (aTier == aLazyTier++) { - aType = CI.fieldGenerator_MAX; - } - else { - aType = CI.fieldGenerator_LV; - } - return ItemUtils.getSimpleStack(aType, aSize); - } - - - - public static ItemStack getTieredMachineHull(int aTier, int aSize) { - ItemStack aType; - int aLazyTier = 0; - if (aTier == aLazyTier++) { - aType = CI.machineHull_ULV; - } - else if (aTier == aLazyTier++) { - aType = CI.machineHull_LV; - } - else if (aTier == aLazyTier++) { - aType = CI.machineHull_MV; - } - else if (aTier == aLazyTier++) { - aType = CI.machineHull_HV; - } - else if (aTier == aLazyTier++) { - aType = CI.machineHull_EV; - } - else if (aTier == aLazyTier++) { - aType = CI.machineHull_IV; - } - else if (aTier == aLazyTier++) { - aType = CI.machineHull_LuV; - } - else if (aTier == aLazyTier++) { - aType = CI.machineHull_ZPM; - } - else if (aTier == aLazyTier++) { - aType = CI.machineHull_UV; - } - else if (aTier == aLazyTier++) { - aType = CI.machineHull_MAX; - } - else { - aType = GregtechItemList.Casing_Multi_Use.get(1, CI.machineHull_MV); - } - return ItemUtils.getSimpleStack(aType, aSize); - } - - public static ItemStack getHeatCoil(int i) { - if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { - if (i == 1) { - return ItemList.Casing_Coil_Kanthal.get(1); - } else if (i == 2) { - return ItemList.Casing_Coil_Nichrome.get(1); - } else { - return ItemList.Casing_Coil_Cupronickel.get(1); - } - } else { - if (!CORE.GTNH) { - if (i > 6) { - i = 6; - } - } else { - if (i > 8) { - i = 8; - } - } - return ItemUtils.simpleMetaStack(StaticFields59.getBlockCasings5(), i, 1); - } - - } - - public static ItemStack getNumberedBioCircuit(int i) { - return ItemUtils.simpleMetaStack(AgriculturalChem.mBioCircuit, i, 0); - } - - public static ItemStack getNumberedAdvancedCircuit(int i) { - return ItemUtils.simpleMetaStack(GenericChem.mAdvancedCircuit, i, 0); - } - - public static ItemStack getTieredGTPPMachineCasing(int aTier, int aAmount) { - GregtechItemList[] aHulls = new GregtechItemList[] { - GregtechItemList.GTPP_Casing_ULV, - GregtechItemList.GTPP_Casing_LV, - GregtechItemList.GTPP_Casing_MV, - GregtechItemList.GTPP_Casing_HV, - GregtechItemList.GTPP_Casing_EV, - GregtechItemList.GTPP_Casing_IV, - GregtechItemList.GTPP_Casing_LuV, - GregtechItemList.GTPP_Casing_ZPM, - GregtechItemList.GTPP_Casing_UV, - GregtechItemList.GTPP_Casing_MAX - }; - return aHulls[aTier].get(aAmount); - } - - public static ItemStack getTieredComponentOfMaterial(Materials aMaterial, OrePrefixes aPrefix, int aAmount) { - return ItemUtils.getOrePrefixStack(aPrefix, aMaterial, aAmount); - } - - public static ItemStack getTransmissionComponent(int aTier, int aAmount) { - GregtechItemList[] aTransParts = new GregtechItemList[] { - GregtechItemList.TransmissionComponent_ULV, - GregtechItemList.TransmissionComponent_LV, - GregtechItemList.TransmissionComponent_MV, - GregtechItemList.TransmissionComponent_HV, - GregtechItemList.TransmissionComponent_EV, - GregtechItemList.TransmissionComponent_IV, - GregtechItemList.TransmissionComponent_LuV, - GregtechItemList.TransmissionComponent_ZPM, - GregtechItemList.TransmissionComponent_UV, - GregtechItemList.TransmissionComponent_MAX, - }; - return aTransParts[aTier].get(aAmount); - } - - public static ItemStack getEmptyCatalyst(int aAmount) { - return ItemUtils.simpleMetaStack(AgriculturalChem.mAgrichemItem1, 13, aAmount); - } - - /** - * Aluminium + Silver Catalyst - * @param aAmount - Stacksize - * @return - A Catalyst stack of given size - */ - public static ItemStack getGreenCatalyst(int aAmount) { - return ItemUtils.simpleMetaStack(AgriculturalChem.mAgrichemItem1, 14, aAmount); - } - - /** - * Iron + Copper Catalyst - * @param aAmount - Stacksize - * @return - A Catalyst stack of given size - */ - public static ItemStack getRedCatalyst(int aAmount) { - return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 0, aAmount); - } - - /** - * Tungsten + Nickel Catalyst - * @param aAmount - Stacksize - * @return - A Catalyst stack of given size - */ - public static ItemStack getYellowCatalyst(int aAmount) { - return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 1, aAmount); - } - - /** - * Cobalt + Titanium Catalyst - * @param aAmount - Stacksize - * @return - A Catalyst stack of given size - */ - public static ItemStack getBlueCatalyst(int aAmount) { - return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 2, aAmount); - } - - /** - * Vanadium + Palladium Catalyst - * @param aAmount - Stacksize - * @return - A Catalyst stack of given size - */ - public static ItemStack getOrangeCatalyst(int aAmount) { - return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 3, aAmount); - } - - /** - * Iridium + Ruthenium Catalyst - * @param aAmount - Stacksize - * @return - A Catalyst stack of given size - */ - public static ItemStack getPurpleCatalyst(int aAmount) { - return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 4, aAmount); - } - - /** - * Aluminium + Nickel Catalyst - * @param aAmount - Stacksize - * @return - A Catalyst stack of given size - */ - public static ItemStack getBrownCatalyst(int aAmount) { - return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 5, aAmount); - } - - /** - * Platinum + Rhodium Catalyst - * @param aAmount - Stacksize - * @return - A Catalyst stack of given size - */ - public static ItemStack getPinkCatalyst(int aAmount) { - return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 6, aAmount); - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotAirFilter.java b/src/Java/gtPlusPlus/core/slots/SlotAirFilter.java deleted file mode 100644 index 92e9bebe21..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotAirFilter.java +++ /dev/null @@ -1,30 +0,0 @@ -package gtPlusPlus.core.slots; - -import gtPlusPlus.core.item.general.ItemAirFilter; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class SlotAirFilter extends Slot { - - public SlotAirFilter(final IInventory inventory, final int slot, final int x, final int y) { - super(inventory, slot, x, y); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - if (itemstack == null) { - return false; - } - if (itemstack.getItem() instanceof ItemAirFilter){ - return true; - } - return false; - } - - @Override - public int getSlotStackLimit() { - return 1; - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java b/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java deleted file mode 100644 index 532f2f0822..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java +++ /dev/null @@ -1,31 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.interfaces.IItemBlueprint; - -public class SlotBlueprint extends Slot { - - public SlotBlueprint(final IInventory inventory, final int x, final int y, final int z) { - super(inventory, x, y, z); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - if (itemstack.getItem() instanceof IItemBlueprint) { - Logger.WARNING(itemstack.getDisplayName() + " is a valid Blueprint."); - return true; - } - Logger.WARNING(itemstack.getDisplayName() + " is not a valid Blueprint."); - return false; - } - - @Override - public int getSlotStackLimit() { - return 1; - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java b/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java deleted file mode 100644 index 94b0b9ecc7..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java +++ /dev/null @@ -1,77 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.OrePrefixes; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.common.items.GT_MetaGenerated_Item_02; - -public class SlotBuzzSaw extends Slot { - - public SAWTOOL currentTool = SAWTOOL.NONE; - - public SlotBuzzSaw(final IInventory inventory, final int slot, final int x, final int y) { - super(inventory, slot, x, y); - - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - boolean isValid = false; - - if (itemstack != null) { - if ((itemstack.getItem() instanceof GT_MetaGenerated_Item_02) - || (itemstack.getItem() instanceof GT_MetaGenerated_Tool)) { - // Buzzsaw Blade //TODO - /* - * if (OrePrefixes.toolHeadBuzzSaw.contains(itemstack)){ isValid - * = false; } - */ - if (OrePrefixes.craftingTool.contains(itemstack)) { - if (itemstack.getDisplayName().toLowerCase().contains("saw") - || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.10") - || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.110") - || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.112") - || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.114") - || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.140")) { - if (itemstack.getItemDamage() == 10) { - isValid = true; - this.currentTool = SAWTOOL.SAW; - } - else if (itemstack.getItemDamage() == 110) { - isValid = true; - this.currentTool = SAWTOOL.CHAINSAW; - } - else if (itemstack.getItemDamage() == 112) { - isValid = true; - this.currentTool = SAWTOOL.CHAINSAW; - } - else if (itemstack.getItemDamage() == 114) { - isValid = true; - this.currentTool = SAWTOOL.CHAINSAW; - } - else if (itemstack.getItemDamage() == 140) { - isValid = true; - this.currentTool = SAWTOOL.BUZZSAW; - } - return isValid; - } - } - } - } - this.currentTool = SAWTOOL.NONE; - return isValid; - } - - @Override - public int getSlotStackLimit() { - return 1; - } - - public enum SAWTOOL { - NONE, SAW, BUZZSAW, CHAINSAW - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java b/src/Java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java deleted file mode 100644 index 1029d37a78..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java +++ /dev/null @@ -1,45 +0,0 @@ -package gtPlusPlus.core.slots; - -import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; -import gregtech.api.util.GT_Recipe; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; - -public class SlotChemicalPlantInput extends Slot { - - public SlotChemicalPlantInput(final IInventory inventory, final int index, final int x, final int y) { - super(inventory, index, x, y); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - return isItemValidForChemicalPlantSlot(itemstack); - } - - public static boolean isItemValidForChemicalPlantSlot(ItemStack aStack) { - boolean validItem = GTPP_Recipe_Map.sChemicalPlantRecipes.containsInput(aStack); - if (!validItem) { - for (GT_Recipe f : GTPP_Recipe_Map.sChemicalPlantRecipes.mRecipeList) { - if (f.mFluidInputs.length > 0) { - for (FluidStack g : f.mFluidInputs) { - if (g != null) { - if (FluidContainerRegistry.containsFluid(aStack, g)) { - return true; - } - } - } - } - } - } - return validItem; - } - - @Override - public int getSlotStackLimit() { - return 64; - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotCrafting.java b/src/Java/gtPlusPlus/core/slots/SlotCrafting.java deleted file mode 100644 index 42b7b585e2..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotCrafting.java +++ /dev/null @@ -1,151 +0,0 @@ -package gtPlusPlus.core.slots; - -import cpw.mods.fml.common.FMLCommonHandler; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.*; -import net.minecraft.stats.AchievementList; - -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; - -public class SlotCrafting extends Slot { - /** The craft matrix inventory linked to this result slot. */ - private final IInventory craftMatrix; - /** The player that is using the GUI where this slot resides. */ - private final EntityPlayer thePlayer; - /** - * The number of items that have been crafted so far. Gets passed to - * ItemStack.onCrafting before being reset. - */ - private int amountCrafted; - private static final String __OBFID = "CL_00001761"; - - public SlotCrafting(final EntityPlayer p_i1823_1_, final IInventory p_i1823_2_, final IInventory p_i1823_3_, - final int p_i1823_4_, final int p_i1823_5_, final int p_i1823_6_) { - super(p_i1823_3_, p_i1823_4_, p_i1823_5_, p_i1823_6_); - this.thePlayer = p_i1823_1_; - this.craftMatrix = p_i1823_2_; - } - - /** - * Check if the stack is a valid item for this slot. Always true beside for - * the armor slots. - */ - @Override - public boolean isItemValid(final ItemStack p_75214_1_) { - return false; - } - - /** - * Decrease the size of the stack in slot (first int arg) by the amount of - * the second int arg. Returns the new stack. - */ - @Override - public ItemStack decrStackSize(final int p_75209_1_) { - if (this.getHasStack()) { - this.amountCrafted += Math.min(p_75209_1_, this.getStack().stackSize); - } - - return super.decrStackSize(p_75209_1_); - } - - /** - * the itemStack passed in is the output - ie, iron ingots, and pickaxes, - * not ore and wood. Typically increases an internal count then calls - * onCrafting(item). - */ - @Override - protected void onCrafting(final ItemStack p_75210_1_, final int p_75210_2_) { - this.amountCrafted += p_75210_2_; - this.onCrafting(p_75210_1_); - } - - /** - * the itemStack passed in is the output - ie, iron ingots, and pickaxes, - * not ore and wood. - */ - @Override - protected void onCrafting(final ItemStack p_75208_1_) { - p_75208_1_.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted); - this.amountCrafted = 0; - - if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.crafting_table)) { - this.thePlayer.addStat(AchievementList.buildWorkBench, 1); - } - - if (p_75208_1_.getItem() instanceof ItemPickaxe) { - this.thePlayer.addStat(AchievementList.buildPickaxe, 1); - } - - if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.furnace)) { - this.thePlayer.addStat(AchievementList.buildFurnace, 1); - } - - if (p_75208_1_.getItem() instanceof ItemHoe) { - this.thePlayer.addStat(AchievementList.buildHoe, 1); - } - - if (p_75208_1_.getItem() == Items.bread) { - this.thePlayer.addStat(AchievementList.makeBread, 1); - } - - if (p_75208_1_.getItem() == Items.cake) { - this.thePlayer.addStat(AchievementList.bakeCake, 1); - } - - if ((p_75208_1_.getItem() instanceof ItemPickaxe) - && (((ItemPickaxe) p_75208_1_.getItem()).func_150913_i() != Item.ToolMaterial.WOOD)) { - this.thePlayer.addStat(AchievementList.buildBetterPickaxe, 1); - } - - if (p_75208_1_.getItem() instanceof ItemSword) { - this.thePlayer.addStat(AchievementList.buildSword, 1); - } - - if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.enchanting_table)) { - this.thePlayer.addStat(AchievementList.enchantments, 1); - } - - if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.bookshelf)) { - this.thePlayer.addStat(AchievementList.bookcase, 1); - } - } - - @Override - public void onPickupFromSlot(final EntityPlayer p_82870_1_, final ItemStack p_82870_2_) { - FMLCommonHandler.instance().firePlayerCraftingEvent(p_82870_1_, p_82870_2_, this.craftMatrix); - this.onCrafting(p_82870_2_); - - for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i) { - final ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); - - if (itemstack1 != null) { - this.craftMatrix.decrStackSize(i, 1); - - if (itemstack1.getItem().hasContainerItem(itemstack1)) { - final ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); - - if ((itemstack2 != null) && itemstack2.isItemStackDamageable() - && (itemstack2.getItemDamage() > itemstack2.getMaxDamage())) { - MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(this.thePlayer, itemstack2)); - continue; - } - - if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) - || !this.thePlayer.inventory.addItemStackToInventory(itemstack2)) { - if (this.craftMatrix.getStackInSlot(i) == null) { - this.craftMatrix.setInventorySlotContents(i, itemstack2); - } else { - this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); - } - } - } - } - } - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/slots/SlotCraftingNoCollect.java b/src/Java/gtPlusPlus/core/slots/SlotCraftingNoCollect.java deleted file mode 100644 index 3608c3724c..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotCraftingNoCollect.java +++ /dev/null @@ -1,147 +0,0 @@ -package gtPlusPlus.core.slots; - -import cpw.mods.fml.common.FMLCommonHandler; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.*; -import net.minecraft.stats.AchievementList; - -public class SlotCraftingNoCollect extends SlotCrafting { - /** The craft matrix inventory linked to this result slot. */ - private final IInventory craftMatrix; - /** The player that is using the GUI where this slot resides. */ - private EntityPlayer thePlayer; - /** - * The number of items that have been crafted so far. Gets passed to - * ItemStack.onCrafting before being reset. - */ - private int amountCrafted; - - public SlotCraftingNoCollect(EntityPlayer player, IInventory inventory, IInventory inventory2, int x, int y, - int z) { - super(player, inventory, inventory2, x, y, z); - this.thePlayer = player; - this.craftMatrix = inventory; - } - - /** - * Check if the stack is a valid item for this slot. Always true beside for - * the armor slots. - */ - @Override - public boolean isItemValid(ItemStack p_75214_1_) { - return false; - } - - /** - * Decrease the size of the stack in slot (first int arg) by the amount of - * the second int arg. Returns the new stack. - */ - @Override - public ItemStack decrStackSize(int amount) { - if (this.getHasStack()) { - this.amountCrafted += Math.min(amount, this.getStack().stackSize); - } - - return super.decrStackSize(amount); - } - - /** - * the itemStack passed in is the output - ie, iron ingots, and pickaxes, - * not ore and wood. Typically increases an internal count then calls - * onCrafting(item). - */ - @Override - protected void onCrafting(ItemStack output, int amount) { - this.amountCrafted += amount; - this.onCrafting(output); - } - - /** - * the itemStack passed in is the output - ie, iron ingots, and pickaxes, - * not ore and wood. - */ - @Override - protected void onCrafting(ItemStack output) { - output.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted); - this.amountCrafted = 0; - - if (output.getItem() == Item.getItemFromBlock(Blocks.crafting_table)) { - this.thePlayer.addStat(AchievementList.buildWorkBench, 1); - } - - if (output.getItem() instanceof ItemPickaxe) { - this.thePlayer.addStat(AchievementList.buildPickaxe, 1); - } - - if (output.getItem() == Item.getItemFromBlock(Blocks.furnace)) { - this.thePlayer.addStat(AchievementList.buildFurnace, 1); - } - - if (output.getItem() instanceof ItemHoe) { - this.thePlayer.addStat(AchievementList.buildHoe, 1); - } - - if (output.getItem() == Items.bread) { - this.thePlayer.addStat(AchievementList.makeBread, 1); - } - - if (output.getItem() == Items.cake) { - this.thePlayer.addStat(AchievementList.bakeCake, 1); - } - - if (output.getItem() instanceof ItemPickaxe - && ((ItemPickaxe) output.getItem()).func_150913_i() != Item.ToolMaterial.WOOD) { - this.thePlayer.addStat(AchievementList.buildBetterPickaxe, 1); - } - - if (output.getItem() instanceof ItemSword) { - this.thePlayer.addStat(AchievementList.buildSword, 1); - } - - if (output.getItem() == Item.getItemFromBlock(Blocks.enchanting_table)) { - this.thePlayer.addStat(AchievementList.enchantments, 1); - } - - if (output.getItem() == Item.getItemFromBlock(Blocks.bookshelf)) { - this.thePlayer.addStat(AchievementList.bookcase, 1); - } - } - - @Override - public void onPickupFromSlot(EntityPlayer player, ItemStack output) { - FMLCommonHandler.instance().firePlayerCraftingEvent(player, output, craftMatrix); - this.onCrafting(output); - - /* - * for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i) { - * ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); - * - * if (itemstack1 != null) { this.craftMatrix.decrStackSize(i, 1); - * - * if (itemstack1.getItem().hasContainerItem(itemstack1)) { ItemStack - * itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); - * - * if (itemstack2 != null && itemstack2.isItemStackDamageable() && - * itemstack2.getItemDamage() > itemstack2.getMaxDamage()) { - * MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, - * itemstack2)); continue; } - * - * if - * (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) - * || !this.thePlayer.inventory.addItemStackToInventory(itemstack2)) { - * if (this.craftMatrix.getStackInSlot(i) == null) { - * this.craftMatrix.setInventorySlotContents(i, itemstack2); } else { - * this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); } } - * } } } - */ - } - - @Override - public boolean canTakeStack(EntityPlayer player) { - return false; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/slots/SlotDataStick.java b/src/Java/gtPlusPlus/core/slots/SlotDataStick.java deleted file mode 100644 index ce97a2fdbf..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotDataStick.java +++ /dev/null @@ -1,42 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.recipe.common.CI; - -public class SlotDataStick extends Slot { - - public SlotDataStick(final IInventory inventory, final int slot, final int x, final int y) { - super(inventory, slot, x, y); - - } - - public static ItemStack[] mDataItems = new ItemStack[2]; - - @Override - public synchronized boolean isItemValid(final ItemStack itemstack) { - boolean isValid = false; - if (itemstack != null) { - if (mDataItems[0] == null) { - mDataItems[0] = CI.getDataStick(); - } - if (mDataItems[1] == null) { - mDataItems[1] = CI.getDataOrb(); - } - if (mDataItems[0] != null && mDataItems[1] != null) { - if (GT_Utility.areStacksEqual(itemstack, mDataItems[0], true) || GT_Utility.areStacksEqual(itemstack, mDataItems[1], true) ) { - isValid = true; - } - } - } - return isValid; - } - - @Override - public int getSlotStackLimit() { - return 1; - } -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotElectric.java b/src/Java/gtPlusPlus/core/slots/SlotElectric.java deleted file mode 100644 index a747432a74..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotElectric.java +++ /dev/null @@ -1,45 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_MetaGenerated_Tool; - -import ic2.api.info.Info; -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; - -public class SlotElectric extends Slot { - - public SlotElectric(final IInventory inventory, final int x, final int y, final int z) { - super(inventory, x, y, z); - } - - public SlotElectric(IGregTechTileEntity mTileEntity, int i, int j, int k) { - this(mTileEntity.getIInventory(mTileEntity.getXCoord(), mTileEntity.getYCoord(), mTileEntity.getZCoord()), i, j, k); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - if ((accepts(itemstack)) || (itemstack.getItem() instanceof GT_MetaGenerated_Tool) || (itemstack.getItem() instanceof IElectricItem)) { - return true; - } - return false; - } - - public boolean accepts(final ItemStack stack) { - if (stack == null) { - return false; - } - return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) - || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), 4, true, true, true) > 0.0D); - } - - @Override - public int getSlotStackLimit() { - return 1; - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotFrame.java b/src/Java/gtPlusPlus/core/slots/SlotFrame.java deleted file mode 100644 index 4168ded5bc..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotFrame.java +++ /dev/null @@ -1,26 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import forestry.api.apiculture.IHiveFrame; - -public class SlotFrame extends Slot { - - public SlotFrame(final IInventory inventory, final int x, final int y, final int z) { - super(inventory, x, y, z); - - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - return itemstack.getItem() instanceof IHiveFrame; - } - - @Override - public int getSlotStackLimit() { - return 1; - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotFuelRod.java b/src/Java/gtPlusPlus/core/slots/SlotFuelRod.java deleted file mode 100644 index b50b679665..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotFuelRod.java +++ /dev/null @@ -1,55 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.ItemList; - -import ic2.core.Ic2Items; - -public class SlotFuelRod extends Slot { - - public SlotFuelRod(final IInventory inventory, final int index, final int x, final int y) { - super(inventory, index, x, y); - - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - boolean returnValue = false; - // Uranium Rods - if (itemstack.getItem() == Ic2Items.reactorUraniumSimple.getItem()) { - returnValue = true; - } else if (itemstack.getItem() == Ic2Items.reactorUraniumDual.getItem()) { - returnValue = true; - } else if (itemstack.getItem() == Ic2Items.reactorUraniumQuad.getItem()) { - returnValue = true; - } - - // Mox Rods - if (itemstack.getItem() == Ic2Items.reactorMOXSimple.getItem()) { - returnValue = true; - } else if (itemstack.getItem() == Ic2Items.reactorMOXDual.getItem()) { - returnValue = true; - } else if (itemstack.getItem() == Ic2Items.reactorMOXQuad.getItem()) { - returnValue = true; - } - - // Thorium Rods - if (itemstack.getItem() == ItemList.ThoriumCell_1.getItem()) { - returnValue = true; - } else if (itemstack.getItem() == ItemList.ThoriumCell_2.getItem()) { - returnValue = true; - } else if (itemstack.getItem() == ItemList.ThoriumCell_4.getItem()) { - returnValue = true; - } - return returnValue; - } - - @Override - public int getSlotStackLimit() { - return 1; - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotGeneric.java b/src/Java/gtPlusPlus/core/slots/SlotGeneric.java deleted file mode 100644 index 533539d914..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotGeneric.java +++ /dev/null @@ -1,23 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class SlotGeneric extends Slot { - - public SlotGeneric(final IInventory inventory, final int aSlotID, final int x, final int y) { - super(inventory, aSlotID, x, y); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - return true; - } - - @Override - public int getSlotStackLimit() { - return 64; - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotGtTool.java b/src/Java/gtPlusPlus/core/slots/SlotGtTool.java deleted file mode 100644 index 54e25362db..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotGtTool.java +++ /dev/null @@ -1,33 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import gregtech.api.items.GT_MetaGenerated_Tool; - -import gtPlusPlus.api.objects.Logger; - -public class SlotGtTool extends Slot { - - public SlotGtTool(final IInventory inventory, final int x, final int y, final int z) { - super(inventory, x, y, z); - - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - if (itemstack.getItem() instanceof GT_MetaGenerated_Tool) { - Logger.WARNING(itemstack.getDisplayName() + " is a valid Tool."); - return true; - } - Logger.WARNING(itemstack.getDisplayName() + " is not a valid Tool."); - return false; - } - - @Override - public int getSlotStackLimit() { - return 1; - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java b/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java deleted file mode 100644 index c0e3340769..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java +++ /dev/null @@ -1,94 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.init.Items; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; - -import gregtech.api.items.GT_MetaGenerated_Tool; - -import gtPlusPlus.api.objects.Logger; -import ic2.api.info.Info; -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; - -public class SlotGtToolElectric extends SlotGtTool { - public int tier; - private ItemStack content; - - public SlotGtToolElectric(final IInventory base, final int x, final int y, final int z, final int tier, - final boolean allowRedstoneDust) { - super(base, x, y, z); - this.tier = tier; - this.allowRedstoneDust = allowRedstoneDust; - } - - public boolean accepts(final ItemStack stack) { - if (stack == null) { - return false; - } - if ((stack.getItem() == Items.redstone) && (!this.allowRedstoneDust)) { - return false; - } - return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) - || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), this.tier, true, true, true) > 0.0D); - } - - public double discharge(final double amount, final boolean ignoreLimit) { - if (amount <= 0.0D) { - throw new IllegalArgumentException("Amount must be > 0."); - } - final ItemStack stack = this.get(0); - if (stack == null) { - return 0.0D; - } - double realAmount = ElectricItem.manager.discharge(stack, amount, this.tier, ignoreLimit, true, false); - if (realAmount <= 0.0D) { - realAmount = Info.itemEnergy.getEnergyValue(stack); - if (realAmount <= 0.0D) { - return 0.0D; - } - stack.stackSize -= 1; - if (stack.stackSize <= 0) { - this.put(0, null); - } - } - return realAmount; - } - - public void setTier(final int tier1) { - this.tier = tier1; - } - - public boolean allowRedstoneDust = true; - - public ItemStack get() { - return this.get(0); - } - - public ItemStack get(final int index) { - return this.content; - } - - public void put(final ItemStack content) { - this.put(0, content); - } - - public void put(final int index, final ItemStack content) { - this.content = content; - this.onChanged(); - } - - public void onChanged() { - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - if ((itemstack.getItem() instanceof GT_MetaGenerated_Tool) || (itemstack.getItem() instanceof IElectricItem)) { - Logger.WARNING(itemstack.getDisplayName() + " is a valid Tool."); - return true; - } - Logger.WARNING(itemstack.getDisplayName() + " is not a valid Tool."); - return false; - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotIntegratedCircuit.java b/src/Java/gtPlusPlus/core/slots/SlotIntegratedCircuit.java deleted file mode 100644 index 8c8a118abb..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotIntegratedCircuit.java +++ /dev/null @@ -1,105 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.recipe.common.CI; - -public class SlotIntegratedCircuit extends Slot { - - public static Item mCircuitItem; - public static Item mCircuitItem2; - public static Item mCircuitItem3; - private final short mCircuitLock; - - public SlotIntegratedCircuit(final IInventory inventory, final int slot, final int x, final int y) { - this(Short.MAX_VALUE+1, inventory, slot, x, y); - } - - public SlotIntegratedCircuit(int mTypeLock, final IInventory inventory, final int slot, final int x, final int y) { - super(inventory, slot, x, y); - if (mTypeLock > Short.MAX_VALUE || mTypeLock < Short.MIN_VALUE) { - mCircuitLock = -1; - } - else { - mCircuitLock = (short) mTypeLock; - } - } - - @Override - public synchronized boolean isItemValid(final ItemStack itemstack) { - return isItemValidForSlot(mCircuitLock, itemstack); - } - - public static synchronized boolean isItemValidForSlot(final ItemStack itemstack) { - return isItemValidForSlot(-1, itemstack); - } - - public static synchronized boolean isItemValidForSlot(int aLockedCircuitNumber, final ItemStack itemstack) { - boolean isValid = false; - if (mCircuitItem == null) { - mCircuitItem = CI.getNumberedCircuit(0).getItem(); - } - if (mCircuitItem2 == null) { - mCircuitItem2 = CI.getNumberedBioCircuit(0).getItem(); - } - if (mCircuitItem3 == null) { - mCircuitItem3 = CI.getNumberedAdvancedCircuit(0).getItem(); - } - if (mCircuitItem != null && mCircuitItem2 != null && mCircuitItem3 != null) { - if (itemstack != null) { - if (itemstack.getItem() == mCircuitItem || itemstack.getItem() == mCircuitItem2 || itemstack.getItem() == mCircuitItem3) { - if (aLockedCircuitNumber == -1) { - isValid = true; - } - else { - if (itemstack.getItemDamage() == aLockedCircuitNumber) { - isValid = true; - } - } - } - } - } - return isValid; - } - - /** - * Returns the circuit type. -1 is invalid, 0 is standard, 1 is GT++ bio. - * @param itemstack - the Circuit Stack. - * @return - */ - public static synchronized int isRegularProgrammableCircuit(final ItemStack itemstack) { - if (mCircuitItem == null) { - mCircuitItem = CI.getNumberedCircuit(0).getItem(); - } - if (mCircuitItem2 == null) { - mCircuitItem2 = CI.getNumberedBioCircuit(0).getItem(); - } - if (mCircuitItem3 == null) { - mCircuitItem3 = CI.getNumberedAdvancedCircuit(0).getItem(); - } - if (mCircuitItem != null && mCircuitItem2 != null && mCircuitItem3 != null) { - if (itemstack != null) { - if (itemstack.getItem() == mCircuitItem || itemstack.getItem() == mCircuitItem2 || itemstack.getItem() == mCircuitItem3) { - if (itemstack.getItem() == mCircuitItem) { - return 0; - } - else if (itemstack.getItem() == mCircuitItem2) { - return 1; - } - else if (itemstack.getItem() == mCircuitItem3) { - return 2; - } - } - } - } - return -1; - } - - @Override - public int getSlotStackLimit() { - return 64; - } -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java b/src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java deleted file mode 100644 index 3aa551f966..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java +++ /dev/null @@ -1,26 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.item.base.BaseItemBackpack; - -public class SlotItemBackpackInv extends Slot { - public SlotItemBackpackInv(final IInventory inv, final int index, final int xPos, final int yPos) { - super(inv, index, xPos, yPos); - } - - // This is the only method we need to override so that - // we can't place our inventory-storing Item within - // its own inventory (thus making it permanently inaccessible) - // as well as preventing abuse of storing backpacks within backpacks - /** - * Check if the stack is a valid item for this slot. - */ - @Override - public boolean isItemValid(final ItemStack itemstack) { - // Everything returns true except an instance of our Item - return !(itemstack.getItem() instanceof BaseItemBackpack); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/slots/SlotJukebox.java b/src/Java/gtPlusPlus/core/slots/SlotJukebox.java deleted file mode 100644 index 0f8af988a1..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotJukebox.java +++ /dev/null @@ -1,37 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemRecord; -import net.minecraft.item.ItemStack; - -public class SlotJukebox extends SlotGeneric { - - private final boolean isDisplay; - - - public SlotJukebox(IInventory inventory, int x, int y, int z) { - this(inventory, x, y, z, false); - } - - public SlotJukebox(IInventory inventory, int x, int y, int z, boolean display) { - super(inventory, x, y, z); - isDisplay = display; - } - - @Override - public boolean isItemValid(ItemStack itemstack) { - return (itemstack != null && itemstack.getItem() instanceof ItemRecord); - } - - @Override - public int getSlotStackLimit() { - return 1; - } - - @Override - public boolean canTakeStack(EntityPlayer p_82869_1_) { - return !isDisplay; - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotLockedInput.java b/src/Java/gtPlusPlus/core/slots/SlotLockedInput.java deleted file mode 100644 index c67f8acfeb..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotLockedInput.java +++ /dev/null @@ -1,57 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_TieredChest; - -public class SlotLockedInput extends Slot { - - private ItemStack mLockStack; - private final IGregTechTileEntity mEntity; - private boolean mChecked = false; - - public SlotLockedInput(final IGregTechTileEntity inventory, final int index, final int x, final int y, ItemStack lockStack) { - super(inventory, index, x, y); - mLockStack = lockStack; - mEntity = inventory; - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - if (mEntity == null) { - return false; - } - else { - if (!mChecked) { - try { - mLockStack = (ItemStack) ReflectionUtils.getField(this.mEntity.getMetaTileEntity().getClass(), "mItemStack").get(this.mEntity.getMetaTileEntity()); - } - catch (Throwable t) { - t.printStackTrace(); - mLockStack = null; - } - mChecked = true; - } - } - - if (mLockStack == null) { - return true; - } - else { - if (ItemStack.areItemStacksEqual(itemstack, mLockStack)) { - return true; - } - } - return false; - } - - @Override - public int getSlotStackLimit() { - return mLockStack == null ? 64 : mLockStack.getMaxStackSize(); - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotLunchBox.java b/src/Java/gtPlusPlus/core/slots/SlotLunchBox.java deleted file mode 100644 index bb82a28936..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotLunchBox.java +++ /dev/null @@ -1,30 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemFood; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.minecraft.FoodUtils; - -public class SlotLunchBox extends SlotGtTool { - - public SlotLunchBox(final IInventory base, final int x, final int y, final int z) { - super(base, x, y, z); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - return isItemValid_STATIC(itemstack); - } - - public static boolean isItemValid_STATIC(final ItemStack itemstack) { - if ((itemstack.getItem() instanceof ItemFood) || (FoodUtils.isFood(itemstack))) { - Logger.WARNING(itemstack.getDisplayName() + " is a valid food."); - return true; - } - Logger.WARNING(itemstack.getDisplayName() + " is not a valid food."); - return false; - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotMagicToolBag.java b/src/Java/gtPlusPlus/core/slots/SlotMagicToolBag.java deleted file mode 100644 index d555f10a44..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotMagicToolBag.java +++ /dev/null @@ -1,29 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemFood; -import net.minecraft.item.ItemStack; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.minecraft.FoodUtils; - -public class SlotMagicToolBag extends SlotGtTool { - - public SlotMagicToolBag(final IInventory base, final int x, final int y, final int z) { - super(base, x, y, z); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - return isItemValid_STATIC(itemstack); - } - - public static boolean isItemValid_STATIC(final ItemStack itemstack) { - if ((itemstack.getItem() instanceof ItemFood) || (FoodUtils.isFood(itemstack))) { - Logger.WARNING(itemstack.getDisplayName() + " is a valid food."); - return true; - } - Logger.WARNING(itemstack.getDisplayName() + " is not a valid food."); - return false; - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotModularBauble.java b/src/Java/gtPlusPlus/core/slots/SlotModularBauble.java deleted file mode 100644 index 4aef5bc877..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotModularBauble.java +++ /dev/null @@ -1,32 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.item.bauble.ModularBauble; - -public class SlotModularBauble extends Slot { - - public SlotModularBauble(final IInventory inventory, final int slot, final int x, final int y) { - super(inventory, slot, x, y); - - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - boolean isValid = false; - - if (itemstack != null) { - if (itemstack.getItem() instanceof ModularBauble) { - isValid = true; - } - } - return isValid; - } - - @Override - public int getSlotStackLimit() { - return 1; - } -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotModularBaubleUpgrades.java b/src/Java/gtPlusPlus/core/slots/SlotModularBaubleUpgrades.java deleted file mode 100644 index dae62f0415..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotModularBaubleUpgrades.java +++ /dev/null @@ -1,56 +0,0 @@ -package gtPlusPlus.core.slots; - -import static gtPlusPlus.core.tileentities.machines.TileEntityModularityTable.*; - -import java.util.Iterator; -import java.util.Map.Entry; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils.BT; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils.Modifiers; - -public class SlotModularBaubleUpgrades extends Slot { - - public SlotModularBaubleUpgrades(final IInventory inventory, final int slot, final int x, final int y) { - super(inventory, slot, x, y); - - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - boolean isValid = false; - if (itemstack != null) { - Logger.INFO("trying to insert " + itemstack.getDisplayName()); - Logger.INFO("Valid Upgrade count: " + mValidUpgradeList.size()); - - Iterator<Entry<ItemStack, BT>> it = mValidUpgradeListFormChange.entrySet().iterator(); - while (it.hasNext()) { - Entry<ItemStack, BT> pair = it.next(); - if (pair.getKey().getItem() == itemstack.getItem() - && pair.getKey().getItemDamage() == itemstack.getItemDamage()) { - isValid = true; - } - } - - Iterator<Entry<ItemStack, Pair<Modifiers, Integer>>> it2 = mValidUpgradeList.entrySet().iterator(); - while (it2.hasNext()) { - Entry<ItemStack, Pair<Modifiers, Integer>> pair = it2.next(); - if (pair.getKey().getItem() == itemstack.getItem() - && pair.getKey().getItemDamage() == itemstack.getItemDamage()) { - isValid = true; - } - } - } - return isValid; - } - - @Override - public int getSlotStackLimit() { - return 64; - } -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotNoInput.java b/src/Java/gtPlusPlus/core/slots/SlotNoInput.java deleted file mode 100644 index 1a1cf62e2b..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotNoInput.java +++ /dev/null @@ -1,23 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class SlotNoInput extends Slot { - - public SlotNoInput(final IInventory inventory, final int index, final int x, final int y) { - super(inventory, index, x, y); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - return false; - } - - @Override - public int getSlotStackLimit() { - return 0; - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotNoInputLogging.java b/src/Java/gtPlusPlus/core/slots/SlotNoInputLogging.java deleted file mode 100644 index 762714ac94..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotNoInputLogging.java +++ /dev/null @@ -1,36 +0,0 @@ -package gtPlusPlus.core.slots; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.block.Block; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; - -public class SlotNoInputLogging extends SlotNoInput { - - private final int aSlotIndex; - - public SlotNoInputLogging(final IInventory inventory, final int index, final int x, final int y) { - super(inventory, index, x, y); - aSlotIndex = index; - Logger.INFO("Slot "+index+" is doing logging"); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - if (ItemUtils.checkForInvalidItems(itemstack)) { - Logger.INFO("Tried Inserting "+ItemUtils.getItemName(itemstack)+" into slot "+aSlotIndex); - Block b = Block.getBlockFromItem(itemstack.getItem()); - Logger.INFO(""+itemstack.getUnlocalizedName()); - if (b != null) { - Logger.INFO(""+b.getLocalizedName()); - Logger.INFO(""+b.getUnlocalizedName()); - } - } - else { - Logger.INFO("Bad Itemstack"); - } - return false; - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotOutput.java b/src/Java/gtPlusPlus/core/slots/SlotOutput.java deleted file mode 100644 index f22e0645f5..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotOutput.java +++ /dev/null @@ -1,96 +0,0 @@ -package gtPlusPlus.core.slots; - -import cpw.mods.fml.common.FMLCommonHandler; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; - -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; - -public class SlotOutput extends SlotCrafting { - - private final IInventory craftMatrix; - private final EntityPlayer thePlayer; - private int amountCrafted; - - public SlotOutput(final EntityPlayer player, final InventoryCrafting craftingInventory, - final IInventory p_i45790_3_, final int slotIndex, final int xPosition, final int yPosition) { - super(player, craftingInventory, p_i45790_3_, slotIndex, xPosition, yPosition); - this.thePlayer = player; - this.craftMatrix = craftingInventory; - } - - /** - * Check if the stack is a valid item for this slot. Always true beside for - * the armor slots. - */ - @Override - public boolean isItemValid(final ItemStack par1ItemStack) { - return false; - } - - /** - * Decrease the size of the stack in slot (first int arg) by the amount of - * the second int arg. Returns the new stack. - */ - @Override - public ItemStack decrStackSize(final int par1) { - if (this.getHasStack()) { - this.amountCrafted += Math.min(par1, this.getStack().stackSize); - } - return super.decrStackSize(par1); - } - - /** - * the itemStack passed in is the output - ie, iron ingots, and pickaxes, - * not ore and wood. Typically increases an internal count then calls - * onCrafting(item). - */ - @Override - protected void onCrafting(final ItemStack par1ItemStack, final int par2) { - this.amountCrafted += par2; - this.onCrafting(par1ItemStack); - } - - /** - * the itemStack passed in is the output - ie, iron ingots, and pickaxes, - * not ore and wood. - */ - @Override - protected void onCrafting(final ItemStack stack) { - stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted); - this.amountCrafted = 0; - } - - @Override - public void onPickupFromSlot(final EntityPlayer playerIn, final ItemStack stack) { - { - FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, this.craftMatrix); - this.onCrafting(stack); - for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i) { - final ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); - if (itemstack1 != null) { - this.craftMatrix.decrStackSize(i, 1); - if (itemstack1.getItem().hasContainerItem(itemstack1)) { - ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); - if (itemstack2.isItemStackDamageable() - && (itemstack2.getItemDamage() > itemstack2.getMaxDamage())) { - MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(this.thePlayer, itemstack2)); - itemstack2 = null; - } - if (!this.thePlayer.inventory.addItemStackToInventory(itemstack2)) { - if (this.craftMatrix.getStackInSlot(i) == null) { - this.craftMatrix.setInventorySlotContents(i, itemstack2); - } else { - this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); - } - } - } - } - } - } - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/slots/SlotPollutionScrubber.java b/src/Java/gtPlusPlus/core/slots/SlotPollutionScrubber.java deleted file mode 100644 index 6dd3745d09..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotPollutionScrubber.java +++ /dev/null @@ -1,66 +0,0 @@ -package gtPlusPlus.core.slots; - -import java.util.HashMap; - -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.item.general.ItemAirFilter; -import gtPlusPlus.core.item.general.ItemBasicScrubberTurbine; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class SlotPollutionScrubber extends Slot { - - private final int mType; - private final int mTier; - - private static HashMap<Integer, ItemStack> mConveyorMap = new HashMap<Integer, ItemStack>(); - - static { - for (int i=0; i<(CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? 9 : 5); i++) { - mConveyorMap.put(i, CI.getConveyor(i, 1)); - } - } - - public SlotPollutionScrubber(final int aType, final int aTier, final IInventory inventory, final int slot, final int x, final int y) { - super(inventory, slot, x, y); - mType = aType; - mTier = aTier; - } - - @Override - public synchronized boolean isItemValid(final ItemStack itemstack) { - return isItemValidForSlot(this, itemstack); - } - - public static synchronized boolean isItemValidForSlot(final SlotPollutionScrubber aSlot, final ItemStack itemstack) { - if (aSlot.mType == 0) { - if (itemstack.getItem() instanceof ItemBasicScrubberTurbine) { - return true; - } - if (itemstack.getItem() instanceof GT_MetaGenerated_Tool && itemstack.getItemDamage() >= 170 && itemstack.getItemDamage() <= 179){ - return true; - } - } - else if (aSlot.mType == 1) { - if (itemstack.getItem() instanceof ItemAirFilter) { - return true; - } - } - else if (aSlot.mType == 2) { - ItemStack aConveyorStack = mConveyorMap.get(aSlot.mTier); - if (GT_Utility.areStacksEqual(itemstack, aConveyorStack, true)) { - return true; - } - } - return false; - } - - @Override - public int getSlotStackLimit() { - return 1; - } -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotRTG.java b/src/Java/gtPlusPlus/core/slots/SlotRTG.java deleted file mode 100644 index 181052cc57..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotRTG.java +++ /dev/null @@ -1,26 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import ic2.core.Ic2Items; - -public class SlotRTG extends Slot { - - public SlotRTG(final IInventory inventory, final int x, final int y, final int z) { - super(inventory, x, y, z); - - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - return itemstack.getItem().getClass() == Ic2Items.RTGPellets.getItem().getClass(); - } - - @Override - public int getSlotStackLimit() { - return 1; - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotToolBox.java b/src/Java/gtPlusPlus/core/slots/SlotToolBox.java deleted file mode 100644 index 87967b75b5..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotToolBox.java +++ /dev/null @@ -1,113 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemTool; -import gregtech.api.items.GT_MetaGenerated_Tool; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class SlotToolBox extends SlotGtTool { - - private static final AutoMap<Class> mSupportedCustomTools = new AutoMap<Class>(); - - static { - //Look for Supported custom tool types - Class temp; - - //IHL Pumps - temp = ReflectionUtils.getClass("ihl.handpump.IHLHandPump"); - if (temp != null) { - mSupportedCustomTools.put(temp); - temp = null; - } - - //IC2 Electrics - temp = ReflectionUtils.getClass("ic2.api.item.IElectricItem"); - if (temp != null) { - mSupportedCustomTools.put(temp); - temp = null; - } - - //IC2 Boxables - temp = ReflectionUtils.getClass(" ic2.api.item.IBoxable"); - if (temp != null) { - mSupportedCustomTools.put(temp); - temp = null; - } - - //Tinkers Tools - temp = ReflectionUtils.getClass("tconstruct.library.tools.Weapon"); - if (temp != null) { - mSupportedCustomTools.put(temp); - temp = null; - } - //BattleGear Weapons - temp = ReflectionUtils.getClass("mods.battlegear2.api.weapons.IBattlegearWeapon"); - if (temp != null) { - mSupportedCustomTools.put(temp); - temp = null; - } - - - //OpenMods - String[] OpenModsContent = new String[] {"openblocks.common.item.ItemDevNull", "openblocks.common.item.ItemHangGlider", "openblocks.common.item.ItemWrench", "openblocks.common.item.ItemSleepingBag"}; - for (String t : OpenModsContent) { - temp = ReflectionUtils.getClass(t); - if (temp != null) { - mSupportedCustomTools.put(temp); - temp = null; - } - } - - //GC Wrench - temp = ReflectionUtils.getClass("micdoodle8.mods.galacticraft.core.items.ItemUniversalWrench"); - if (temp != null) { - mSupportedCustomTools.put(temp); - temp = null; - } - - //EIO - String[] EioContent = new String[] {"crazypants.enderio.api.tool.ITool", "crazypants.enderio.item.ItemMagnet", "crazypants.enderio.item.ItemConduitProbe"}; - for (String t : EioContent) { - temp = ReflectionUtils.getClass(t); - if (temp != null) { - mSupportedCustomTools.put(temp); - temp = null; - } - } - - //Forestry - temp = ReflectionUtils.getClass("forestry.core.items.ItemForestryTool"); - if (temp != null) { - mSupportedCustomTools.put(temp); - temp = null; - } - } - - public SlotToolBox(final IInventory base, final int x, final int y, final int z) { - super(base, x, y, z); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - return isItemValid_STATIC(itemstack); - } - - public static boolean isItemValid_STATIC(final ItemStack itemstack) { - if ((itemstack.getItem() instanceof GT_MetaGenerated_Tool) || (itemstack.getItem() instanceof ItemTool)) { - Logger.WARNING(itemstack.getDisplayName() + " is a valid Tool."); - return true; - } - for (Class C : mSupportedCustomTools) { - if (C.isInstance(itemstack.getItem())) { - return true; - } - } - Logger.WARNING(itemstack.getDisplayName() + " is not a valid Tool."); - return false; - } - -} diff --git a/src/Java/gtPlusPlus/core/slots/SlotVolumetricFlask.java b/src/Java/gtPlusPlus/core/slots/SlotVolumetricFlask.java deleted file mode 100644 index b8955f6dc8..0000000000 --- a/src/Java/gtPlusPlus/core/slots/SlotVolumetricFlask.java +++ /dev/null @@ -1,30 +0,0 @@ -package gtPlusPlus.core.slots; - -import gtPlusPlus.xmod.gregtech.common.helpers.VolumetricFlaskHelper; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public class SlotVolumetricFlask extends Slot { - - public static Item mFlask; - - public SlotVolumetricFlask(final IInventory inventory, final int slot, final int x, final int y) { - super(inventory, slot, x, y); - } - - @Override - public synchronized boolean isItemValid(final ItemStack itemstack) { - return isItemValidForSlot(itemstack); - } - - public static synchronized boolean isItemValidForSlot(final ItemStack itemstack) { - return VolumetricFlaskHelper.isVolumetricFlask(itemstack); - } - - @Override - public int getSlotStackLimit() { - return 16; - } -} diff --git a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java deleted file mode 100644 index 62b545c5c8..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java +++ /dev/null @@ -1,63 +0,0 @@ -package gtPlusPlus.core.tileentities; - -import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.general.BlockSuperLight.TileEntitySuperLight; -import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.tileentities.general.*; -import gtPlusPlus.core.tileentities.machines.TileEntityAdvPooCollector; -import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; -import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller; -import gtPlusPlus.core.tileentities.machines.TileEntityPooCollector; -import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; -import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; -import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; -import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; - -public class ModTileEntities { - - public static void init() { - Logger.INFO("Registering Tile Entities."); - GameRegistry.registerTileEntity(TileEntityPooCollector.class, "TileEntityPooCollector"); - GameRegistry.registerTileEntity(TileEntityAdvPooCollector.class, "TileEntityAdvPooCollector"); - GameRegistry.registerTileEntity(TileEntityWorkbench.class, "TileWorkbench"); - GameRegistry.registerTileEntity(TileEntityWorkbenchAdvanced.class, "TileWorkbenchAdvanced"); - GameRegistry.registerTileEntity(TileEntityFishTrap.class, "TileFishTrap"); - GameRegistry.registerTileEntity(TileEntityFirepit.class, "TileFirePit"); - GameRegistry.registerTileEntity(TileEntityInfiniteFluid.class, "TileInfiniteFluid"); - GameRegistry.registerTileEntity(TileEntityProjectTable.class, "TileProjectTable"); - GameRegistry.registerTileEntity(TileEntityTradeTable.class, "TileTradeTable"); - GameRegistry.registerTileEntity(TileEntityModularityTable.class, "TileEntityModularityTable"); - GameRegistry.registerTileEntity(TileEntityXpConverter.class, "TileEntityXpConverter"); - GameRegistry.registerTileEntity(TileEntityGenericSpawner.class, "TileEntityGenericSpawner"); - GameRegistry.registerTileEntity(TileEntityCircuitProgrammer.class, "TileCircuitProgrammer"); - GameRegistry.registerTileEntity(TileEntityPlayerDoorBase.class, "TilePlayerDoorBase"); - GameRegistry.registerTileEntity(TileEntityDecayablesChest.class, "TileDecayablesChest"); - GameRegistry.registerTileEntity(TileEntitySuperJukebox.class, "TileEntitySuperJukebox"); - GameRegistry.registerTileEntity(TileEntitySuperLight.class, "TileEntitySuperLight"); - GameRegistry.registerTileEntity(TileEntityPestKiller.class, "TileEntityPestKiller"); - GameRegistry.registerTileEntity(TileEntityRoundRobinator.class, "TileEntityRoundRobinator"); - GameRegistry.registerTileEntity(TileEntityEggBox.class, "TileEggBox"); - - if (Meta_GT_Proxy.sDoesVolumetricFlaskExist) { - GameRegistry.registerTileEntity(TileEntityVolumetricFlaskSetter.class, "TileEntityVolumetricFlaskSetter"); - } - - //Mod TEs - if (LoadedMods.Thaumcraft){ - - } - blacklistTilesFromAcceleration(); - } - - private static void blacklistTilesFromAcceleration() { - Meta_GT_Proxy.setTileEntityClassAsBlacklistedInWorldAccelerator("gtPlusPlus.core.tileentities.general.TileEntityFishTrap"); - Meta_GT_Proxy.setTileEntityClassAsBlacklistedInWorldAccelerator("gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest"); - Meta_GT_Proxy.setTileEntityClassAsBlacklistedInWorldAccelerator("gtPlusPlus.core.tileentities.general.TileEggBox"); - } - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/base/TILE_ENTITY_BASE.java b/src/Java/gtPlusPlus/core/tileentities/base/TILE_ENTITY_BASE.java deleted file mode 100644 index 839bcc353a..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/base/TILE_ENTITY_BASE.java +++ /dev/null @@ -1,39 +0,0 @@ -package gtPlusPlus.core.tileentities.base; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.tileentity.TileEntity; - -public class TILE_ENTITY_BASE extends TileEntity { - - @Override - public void writeToNBT(final NBTTagCompound tag) { - super.writeToNBT(tag); - this.writeCustomNBT(tag); - } - - @Override - public void readFromNBT(final NBTTagCompound tag) { - super.readFromNBT(tag); - this.readCustomNBT(tag); - } - - public void writeCustomNBT(final NBTTagCompound tag) {} - public void readCustomNBT(final NBTTagCompound tag) {} - - @Override - public Packet getDescriptionPacket() { - final NBTTagCompound tag = new NBTTagCompound(); - this.writeCustomNBT(tag); - return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, -999, tag); - } - - @Override - public void onDataPacket(final NetworkManager net, final S35PacketUpdateTileEntity packet) { - super.onDataPacket(net, packet); - this.readCustomNBT(packet.func_148857_g()); - } - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/base/TileBasicTank.java b/src/Java/gtPlusPlus/core/tileentities/base/TileBasicTank.java deleted file mode 100644 index 671a49fca5..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/base/TileBasicTank.java +++ /dev/null @@ -1,150 +0,0 @@ -package gtPlusPlus.core.tileentities.base; - -import gtPlusPlus.api.objects.minecraft.BTF_FluidTank; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; -import net.minecraftforge.fluids.IFluidTank; - -public class TileBasicTank extends TileEntityBase implements IFluidHandler, IFluidTank { - - public final BTF_FluidTank mTank; - - public TileBasicTank(int aMaxSlots, int aFluidCapacity) { - super(aMaxSlots); - mTank = new BTF_FluidTank(aFluidCapacity); - } - - @Override - public boolean onPreTick(long aTick) { - - if (this.isServerSide()) { - if (mTank.isFluidChangingAllowed() && mTank.getFillableStack() != null - && mTank.getFillableStack().amount <= 0) { - mTank.setFillableStack((FluidStack) null); - } - } - - return super.onPreTick(aTick); - - } - - - private final boolean canFillEx(ForgeDirection aSide, Fluid aFluid) { - return this.fill(aSide, new FluidStack(aFluid, 1), false) == 1; - } - - - private final boolean canDrainEx(ForgeDirection aSide, Fluid aFluid) { - return this.drain(aSide, new FluidStack(aFluid, 1), false) != null; - } - - - private final FluidTankInfo[] getTankInfoEx(ForgeDirection aSide) { - return mTank.getCapacity() <= 0 ? new FluidTankInfo[0] - : new FluidTankInfo[]{mTank.getInfo()}; - } - - private final int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - return mTank.fill(aFluid, doFill); - } - - - private final int fillEx(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - return this.fill_default(aSide, aFluid, doFill); - } - - - private final FluidStack drainEx(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) { - return mTank.getFluid() != null && aFluid != null && mTank.getFluid().isFluidEqual(aFluid) - ? mTank.drain(aFluid.amount, doDrain) - : null; - } - - - private final FluidStack drainEx(ForgeDirection aSide, int maxDrain, boolean doDrain) { - return mTank.drain(maxDrain, doDrain); - } - - - public boolean isLiquidInput(byte aSide) { - return true; - } - - public boolean isLiquidOutput(byte aSide) { - return true; - } - - @Override - public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mInputDisabled) && (aSide == ForgeDirection.UNKNOWN || (this.isLiquidInput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), aFluid == null ? null : aFluid.getFluid(), this)))) - return this.fillEx(aSide, aFluid, doFill); - return 0; - } - - @Override - public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) { - if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mOutputDisabled) && (aSide == ForgeDirection.UNKNOWN || (this.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), this.getFluid() == null ? null : this.getFluid().getFluid(), this)))) - return this.drainEx(aSide, maxDrain, doDrain); - return null; - } - - @Override - public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) { - if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mOutputDisabled) && (aSide == ForgeDirection.UNKNOWN || (this.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), aFluid == null ? null : aFluid.getFluid(), this)))) - return this.drainEx(aSide, aFluid, doDrain); - return null; - } - - @Override - public boolean canFill(ForgeDirection aSide, Fluid aFluid) { - if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mInputDisabled) && (aSide == ForgeDirection.UNKNOWN || (this.isLiquidInput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), aFluid, this)))) - return this.canFillEx(aSide, aFluid); - return false; - } - - @Override - public boolean canDrain(ForgeDirection aSide, Fluid aFluid) { - if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mOutputDisabled) && (aSide == ForgeDirection.UNKNOWN || (this.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), aFluid, this)))) - return this.canDrainEx(aSide, aFluid); - return false; - } - - @Override - public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { - if (canAccessData() && (aSide == ForgeDirection.UNKNOWN || (this.isLiquidInput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), null, this)) || (this.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), null, this)))) - return this.getTankInfoEx(aSide); - return new FluidTankInfo[]{}; - } - - @Override - public FluidStack getFluid() { - return mTank.getFluid(); - } - - @Override - public int getFluidAmount() { - return mTank.getFluidAmount(); - } - - @Override - public FluidTankInfo getInfo() { - return mTank.getInfo(); - } - - @Override - public int fill(FluidStack resource, boolean doFill) { - return mTank.fill(resource, doFill); - } - - @Override - public FluidStack drain(int maxDrain, boolean doDrain) { - return mTank.drain(maxDrain, doDrain); - } - - - - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java b/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java deleted file mode 100644 index dba96c6ebc..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java +++ /dev/null @@ -1,1347 +0,0 @@ -package gtPlusPlus.core.tileentities.base; - -import java.util.UUID; - -import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.interfaces.IDescribable; -import gregtech.api.interfaces.tileentity.IGregTechDeviceInformation; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.net.GT_Packet_Block_Event; -import gregtech.api.util.GT_CoverBehavior; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import net.minecraft.block.Block; -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.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.IFluidHandler; -import gtPlusPlus.api.interfaces.ILazyCoverable; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.minecraft.BTF_Inventory; -import gtPlusPlus.core.util.data.ArrayUtils; -import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import ic2.api.Direction; - -public class TileEntityBase extends TileEntity implements ILazyCoverable, IGregTechDeviceInformation, IDescribable { - - private String customName; - public String mOwnerName = "null"; - public String mOwnerUUID = "null"; - private boolean mIsOwnerOP = false; - - public final BTF_Inventory mInventory; - - public TileEntityBase(int aCapacity) { - mInventory = new BTF_Inventory(aCapacity, this); - } - - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag){ - if(!nbt.hasKey(tag)) - { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound nbt){ - super.writeToNBT(nbt); - if (this.hasCustomInventoryName()) { - nbt.setString("CustomName", this.getCustomName()); - } - nbt.setBoolean("mIsOwnerOP", this.mIsOwnerOP); - nbt.setString("mOwnerName", this.mOwnerName); - nbt.setString("mOwnerUUID", this.mOwnerUUID); - } - - @Override - public void readFromNBT(final NBTTagCompound nbt){ - - super.readFromNBT(nbt); - - if (nbt.hasKey("CustomName", 8)) { - this.setCustomName(nbt.getString("CustomName")); - } - - this.mIsOwnerOP = nbt.getBoolean("mIsOwnerOP"); - this.mOwnerName = nbt.getString("mOwnerName"); - this.mOwnerUUID = nbt.getString("mOwnerUUID"); - } - - @Override - public void updateEntity() { - long aTick = System.currentTimeMillis(); - this.isDead = false; - if (!firstTicked) { - onFirstTick(); - } - try{ - if (this.isServerSide()){ - onPreTick(aTick); - } - } catch (Throwable t){ - Logger.ERROR("Tile Entity Encountered an error in it's pre-tick stage."); - t.printStackTrace(); - } - try{ - if (this.isServerSide()){ - onTick(aTick); - } - } catch (Throwable t){ - Logger.ERROR("Tile Entity Encountered an error in it's tick stage."); - t.printStackTrace(); - } - try{ - if (this.isServerSide()){ - onPostTick(aTick); - } - } catch (Throwable t){ - Logger.ERROR("Tile Entity Encountered an error in it's post-tick stage."); - t.printStackTrace(); - } - } - - public boolean onPreTick(long aTick) { - return true; - } - - public boolean onTick(long aTick){ - try{ - if (this.isServerSide()){ - processRecipe(); - } - } catch (Throwable t){ - Logger.ERROR("Tile Entity Encountered an error in it's processing of a recipe stage."); - t.printStackTrace(); - } - return true; - } - - public boolean onPostTick(long aTick){ - return true; - } - - public boolean processRecipe(){ - return true; - } - - @Override - public boolean canUpdate() { - return true; - } - - public String getOwner(){ - if (this.mOwnerName == null){ - return "null"; - } - return this.mOwnerName; - } - - public UUID getOwnerUUID(){ - return UUID.fromString(this.mOwnerUUID); - } - - public boolean isOwnerOP() { - return mIsOwnerOP; - } - - public void setOwnerInformation(String mName, String mUUID, boolean mOP){ - if (isServerSide()){ - if (this.mOwnerName == null || this.mOwnerUUID == null || this.mOwnerName.equals("null") || this.mOwnerUUID.equals("null")){ - this.mOwnerName = mName; - this.mOwnerUUID = mUUID; - this.mIsOwnerOP = mOP; - } - } - } - - public boolean isServerSide(){ - if (this.hasWorldObj()){ - if (!this.getWorldObj().isRemote){ - return true; - } - } - return false; - } - - public final boolean isClientSide() { - return this.worldObj.isRemote; - } - - public String getCustomName() { - return this.customName; - } - - public void setCustomName(String customName) { - this.customName = customName; - } - - @Override - public String getInventoryName() { - return this.hasCustomInventoryName() ? this.customName : "container.tileentity.name"; - } - - @Override - public boolean hasCustomInventoryName() { - return this.customName != null && !this.customName.equals(""); - } - - @Override - public int getSizeInventory() { - return this.mInventory.getSizeInventory(); - } - - @Override - public ItemStack getStackInSlot(int aIndex) { - return this.mInventory.getStackInSlot(aIndex); - } - - @Override - public ItemStack decrStackSize(int aIndex, int aAmount) { - if (canAccessData()) { - mInventoryChanged = true; - return mInventory.decrStackSize(aIndex, aAmount); - } - return null; - } - - @Override - public ItemStack getStackInSlotOnClosing(int p_70304_1_) { - return this.mInventory.getStackInSlotOnClosing(p_70304_1_); - } - - @Override - public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) { - this.mInventory.setInventorySlotContents(p_70299_1_, p_70299_2_); - } - - @Override - public int getInventoryStackLimit() { - return this.mInventory.getInventoryStackLimit(); - } - - @Override - public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { - return this.mInventory.isUseableByPlayer(p_70300_1_); - } - - @Override - public void openInventory() { - this.mInventory.openInventory(); - } - - @Override - public void closeInventory() { - this.mInventory.closeInventory(); - } - - /** - * Can put aStack into Slot - */ - @Override - public boolean isItemValidForSlot(int aIndex, ItemStack aStack) { - return canAccessData() && mInventory.isItemValidForSlot(aIndex, aStack); - } - - /** - * returns all valid Inventory Slots, no matter which Side (Unless it's covered). - * The Side Stuff is done in the following two Functions. - */ - @Override - public int[] getAccessibleSlotsFromSide(int aSide) { - if (canAccessData() && (getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, getCoverIDAtSide((byte) aSide), getCoverDataAtSide((byte) aSide), -1, this) || getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, getCoverIDAtSide((byte) aSide), getCoverDataAtSide((byte) aSide), -1, this))) - return mInventory.getAccessibleSlotsFromSide(aSide); - return new int[0]; - } - - /** - * Can put aStack into Slot at Side - */ - @Override - public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { - return canAccessData() && (mRunningThroughTick || !mInputDisabled) && getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, getCoverIDAtSide((byte) aSide), getCoverDataAtSide((byte) aSide), aIndex, this) && mInventory.canInsertItem(aIndex, aStack, aSide); - } - - /** - * Can pull aStack out of Slot from Side - */ - @Override - public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { - return canAccessData() && (mRunningThroughTick || !mOutputDisabled) && getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, getCoverIDAtSide((byte) aSide), getCoverDataAtSide((byte) aSide), aIndex, this) && mInventory.canExtractItem(aIndex, aStack, aSide); - } - - - @Override - public boolean isValidSlot(int aIndex) { - return this.canAccessData() ? this.mInventory.isValidSlot(aIndex) : false; - } - - - - - private final GT_CoverBehavior[] mCoverBehaviors = new GT_CoverBehavior[] { GregTech_API.sNoBehavior, - GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, - GregTech_API.sNoBehavior }; - protected TileEntityBase mMetaTileEntity; - protected long mStoredEnergy = 0; - protected int mAverageEUInputIndex = 0, mAverageEUOutputIndex = 0; - protected boolean mReleaseEnergy = false; - protected int[] mAverageEUInput = new int[11], mAverageEUOutput = new int[11]; - private boolean[] mActiveEUInputs = new boolean[] { false, false, false, false, false, false }, - mActiveEUOutputs = new boolean[] { false, false, false, false, false, false }; - private byte[] mSidedRedstone = new byte[] { 15, 15, 15, 15, 15, 15 }; - private int[] mCoverSides = new int[] { 0, 0, 0, 0, 0, 0 }, mCoverData = new int[] { 0, 0, 0, 0, 0, 0 }, - mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING]; - private boolean mHasEnoughEnergy = true; - protected boolean mRunningThroughTick = false; - protected boolean mInputDisabled = false; - protected boolean mOutputDisabled = false; - private boolean mMuffler = false; - private boolean mLockUpgrade = false; - private boolean mActive = false; - private boolean mRedstone = false; - private boolean mWorkUpdate = false; - private boolean mSteamConverter = false; - private boolean mInventoryChanged = false; - private boolean mWorks = true; - private boolean mNeedsUpdate = true; - private boolean mNeedsBlockUpdate = true; - private boolean mSendClientData = false; - private boolean oRedstone = false; - private boolean mEnergyStateReady = false; - private byte mColor = 0, oColor = 0, mStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0, - oTexturePage = 0, oLightValueClient = -1, oLightValue = -1, mLightValue = 0, mOtherUpgrades = 0, - mFacing = 0, oFacing = 0, mWorkData = 0; - private int mDisplayErrorCode = 0, oX = 0, oY = 0, oZ = 0, mTimeStatisticsIndex = 0, mLagWarningCount = 0; - private short mID = 0; - protected long mTickTimer = 0; - private long oOutput = 0; - private long mAcceptedAmperes = Long.MAX_VALUE; - - - /** - * Cover Support - */ - - public void issueClientUpdate() { - this.mSendClientData = true; - } - - protected final boolean canAccessData() { - return !isDead() && !this.isInvalid(); - } - - @Override - public void issueBlockUpdate() { - super.markDirty(); - } - - @Override - public void issueCoverUpdate(byte aSide) { - this.issueClientUpdate(); - } - - @Override - public void receiveCoverData(byte coverSide, int coverID, int coverData) { - if ((coverSide >= 0 && coverSide < 6) && (mCoverSides[coverSide] == coverID)) - setCoverDataAtSide(coverSide, coverData); - } - - @Override - public long getTimer() { - return this.mTickTimer; - } - - - - - - - - public long getOutputAmperage() { - return this.canAccessData() && this.mMetaTileEntity.isElectric() ? this.mMetaTileEntity.maxAmperesOut() : 0L; - } - - public long getOutputVoltage() { - return this.canAccessData() && this.mMetaTileEntity.isElectric() && this.mMetaTileEntity.isEnetOutput() - ? this.mMetaTileEntity.maxEUOutput() - : 0L; - } - - public long getInputAmperage() { - return this.canAccessData() && this.mMetaTileEntity.isElectric() ? this.mMetaTileEntity.maxAmperesIn() : 0L; - } - - public long getInputVoltage() { - return this.canAccessData() && this.mMetaTileEntity.isElectric() - ? this.mMetaTileEntity.maxEUInput() - : 2147483647L; - } - - @Override - public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) { - return !this.canAccessData() ? false : (this.mHasEnoughEnergy = this.decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy)); - } - - @Override - public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy) { - if (!this.canAccessData()) { - return false; - } else if (this.getStoredEU() >= this.getEUCapacity() && !aIgnoreTooMuchEnergy) { - return false; - } else { - this.setStoredEU(this.mMetaTileEntity.getEUVar() + aEnergy); - return true; - } - } - - @Override - public boolean inputEnergyFrom(byte aSide) { - return aSide == 6 - ? true - : (!this.isServerSide() - ? this.isEnergyInputSide(aSide) - : aSide >= 0 && aSide < 6 && this.mActiveEUInputs[aSide] && !this.mReleaseEnergy); - } - - @Override - public boolean outputsEnergyTo(byte aSide) { - return aSide == 6 - ? true - : (!this.isServerSide() - ? this.isEnergyOutputSide(aSide) - : aSide >= 0 && aSide < 6 && this.mActiveEUOutputs[aSide] || this.mReleaseEnergy); - } - - private boolean isEnergyInputSide(byte aSide) { - if (aSide >= 0 && aSide < 6) { - if (!this.getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, this.getCoverIDAtSide(aSide), - this.getCoverDataAtSide(aSide), this)) { - return false; - } - - if (this.isInvalid() || this.mReleaseEnergy) { - return false; - } - - if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.mMetaTileEntity.isEnetInput()) { - return this.mMetaTileEntity.isInputFacing(aSide); - } - } - - return false; - } - - private boolean isEnergyOutputSide(byte aSide) { - if (aSide >= 0 && aSide < 6) { - if (!this.getCoverBehaviorAtSide(aSide).letsEnergyOut(aSide, this.getCoverIDAtSide(aSide), - this.getCoverDataAtSide(aSide), this)) { - return false; - } - - if (this.isInvalid() || this.mReleaseEnergy) { - return this.mReleaseEnergy; - } - - if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.mMetaTileEntity.isEnetOutput()) { - return this.mMetaTileEntity.isOutputFacing(aSide); - } - } - - return false; - } - - public boolean isOutputFacing(byte aSide) { - return false; - } - - public boolean isInputFacing(byte aSide) { - return false; - } - - private final TileEntity[] mBufferedTileEntities = new TileEntity[6]; - public boolean ignoreUnloadedChunks = true; - public boolean isDead = false; - - private final void clearNullMarkersFromTileEntityBuffer() { - for (int i = 0; i < this.mBufferedTileEntities.length; ++i) { - if (this.mBufferedTileEntities[i] == this) { - this.mBufferedTileEntities[i] = null; - } - } - - } - - protected final void clearTileEntityBuffer() { - for (int i = 0; i < this.mBufferedTileEntities.length; ++i) { - this.mBufferedTileEntities[i] = null; - } - - } - - public final World getWorld() { - return this.worldObj; - } - - public final int getXCoord() { - return this.xCoord; - } - - public final short getYCoord() { - return (short) this.yCoord; - } - - public final int getZCoord() { - return this.zCoord; - } - - public final int getOffsetX(byte aSide, int aMultiplier) { - return this.xCoord + ForgeDirection.getOrientation(aSide).offsetX * aMultiplier; - } - - public final short getOffsetY(byte aSide, int aMultiplier) { - return (short) (this.yCoord + ForgeDirection.getOrientation(aSide).offsetY * aMultiplier); - } - - public final int getOffsetZ(byte aSide, int aMultiplier) { - return this.zCoord + ForgeDirection.getOrientation(aSide).offsetZ * aMultiplier; - } - - public final boolean openGUI(EntityPlayer aPlayer) { - return this.openGUI(aPlayer, 0); - } - - public final boolean openGUI(EntityPlayer aPlayer, int aID) { - if (aPlayer == null) { - return false; - } else { - aPlayer.openGui(GT_Values.GT, aID, this.worldObj, this.xCoord, this.yCoord, this.zCoord); - return true; - } - } - - public final int getRandomNumber(int aRange) { - return this.worldObj.rand.nextInt(aRange); - } - - public final BiomeGenBase getBiome(int aX, int aZ) { - return this.worldObj.getBiomeGenForCoords(aX, aZ); - } - - public final BiomeGenBase getBiome() { - return this.getBiome(this.xCoord, this.zCoord); - } - - public final Block getBlockOffset(int aX, int aY, int aZ) { - return this.getBlock(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); - } - - public final Block getBlockAtSide(byte aSide) { - return this.getBlockAtSideAndDistance(aSide, 1); - } - - public final Block getBlockAtSideAndDistance(byte aSide, int aDistance) { - return this.getBlock(this.getOffsetX(aSide, aDistance), this.getOffsetY(aSide, aDistance), - this.getOffsetZ(aSide, aDistance)); - } - - public final byte getMetaIDOffset(int aX, int aY, int aZ) { - return this.getMetaID(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); - } - - public final byte getMetaIDAtSide(byte aSide) { - return this.getMetaIDAtSideAndDistance(aSide, 1); - } - - public final byte getMetaIDAtSideAndDistance(byte aSide, int aDistance) { - return this.getMetaID(this.getOffsetX(aSide, aDistance), this.getOffsetY(aSide, aDistance), - this.getOffsetZ(aSide, aDistance)); - } - - public final byte getLightLevelOffset(int aX, int aY, int aZ) { - return this.getLightLevel(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); - } - - public final byte getLightLevelAtSide(byte aSide) { - return this.getLightLevelAtSideAndDistance(aSide, 1); - } - - public final byte getLightLevelAtSideAndDistance(byte aSide, int aDistance) { - return this.getLightLevel(this.getOffsetX(aSide, aDistance), this.getOffsetY(aSide, aDistance), - this.getOffsetZ(aSide, aDistance)); - } - - public final boolean getOpacityOffset(int aX, int aY, int aZ) { - return this.getOpacity(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); - } - - public final boolean getOpacityAtSide(byte aSide) { - return this.getOpacityAtSideAndDistance(aSide, 1); - } - - public final boolean getOpacityAtSideAndDistance(byte aSide, int aDistance) { - return this.getOpacity(this.getOffsetX(aSide, aDistance), this.getOffsetY(aSide, aDistance), - this.getOffsetZ(aSide, aDistance)); - } - - public final boolean getSkyOffset(int aX, int aY, int aZ) { - return this.getSky(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); - } - - public final boolean getSkyAtSide(byte aSide) { - return this.getSkyAtSideAndDistance(aSide, 1); - } - - public final boolean getSkyAtSideAndDistance(byte aSide, int aDistance) { - return this.getSky(this.getOffsetX(aSide, aDistance), this.getOffsetY(aSide, aDistance), - this.getOffsetZ(aSide, aDistance)); - } - - public final boolean getAirOffset(int aX, int aY, int aZ) { - return this.getAir(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); - } - - public final boolean getAirAtSide(byte aSide) { - return this.getAirAtSideAndDistance(aSide, 1); - } - - public final boolean getAirAtSideAndDistance(byte aSide, int aDistance) { - return this.getAir(this.getOffsetX(aSide, aDistance), this.getOffsetY(aSide, aDistance), - this.getOffsetZ(aSide, aDistance)); - } - - public final TileEntity getTileEntityOffset(int aX, int aY, int aZ) { - return this.getTileEntity(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); - } - - public final TileEntity getTileEntityAtSideAndDistance(byte aSide, int aDistance) { - return aDistance == 1 - ? this.getTileEntityAtSide(aSide) - : this.getTileEntity(this.getOffsetX(aSide, aDistance), this.getOffsetY(aSide, aDistance), - this.getOffsetZ(aSide, aDistance)); - } - - public final IInventory getIInventory(int aX, int aY, int aZ) { - TileEntity tTileEntity = this.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof IInventory ? (IInventory) tTileEntity : null; - } - - public final IInventory getIInventoryOffset(int aX, int aY, int aZ) { - TileEntity tTileEntity = this.getTileEntityOffset(aX, aY, aZ); - return tTileEntity instanceof IInventory ? (IInventory) tTileEntity : null; - } - - public final IInventory getIInventoryAtSide(byte aSide) { - TileEntity tTileEntity = this.getTileEntityAtSide(aSide); - return tTileEntity instanceof IInventory ? (IInventory) tTileEntity : null; - } - - public final IInventory getIInventoryAtSideAndDistance(byte aSide, int aDistance) { - TileEntity tTileEntity = this.getTileEntityAtSideAndDistance(aSide, aDistance); - return tTileEntity instanceof IInventory ? (IInventory) tTileEntity : null; - } - - public final IFluidHandler getITankContainer(int aX, int aY, int aZ) { - TileEntity tTileEntity = this.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof IFluidHandler ? (IFluidHandler) tTileEntity : null; - } - - public final IFluidHandler getITankContainerOffset(int aX, int aY, int aZ) { - TileEntity tTileEntity = this.getTileEntityOffset(aX, aY, aZ); - return tTileEntity instanceof IFluidHandler ? (IFluidHandler) tTileEntity : null; - } - - public final IFluidHandler getITankContainerAtSide(byte aSide) { - TileEntity tTileEntity = this.getTileEntityAtSide(aSide); - return tTileEntity instanceof IFluidHandler ? (IFluidHandler) tTileEntity : null; - } - - public final IFluidHandler getITankContainerAtSideAndDistance(byte aSide, int aDistance) { - TileEntity tTileEntity = this.getTileEntityAtSideAndDistance(aSide, aDistance); - return tTileEntity instanceof IFluidHandler ? (IFluidHandler) tTileEntity : null; - } - - public final IGregTechTileEntity getIGregTechTileEntity(int aX, int aY, int aZ) { - TileEntity tTileEntity = this.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof IGregTechTileEntity ? (IGregTechTileEntity) tTileEntity : null; - } - - public final IGregTechTileEntity getIGregTechTileEntityOffset(int aX, int aY, int aZ) { - TileEntity tTileEntity = this.getTileEntityOffset(aX, aY, aZ); - return tTileEntity instanceof IGregTechTileEntity ? (IGregTechTileEntity) tTileEntity : null; - } - - public final IGregTechTileEntity getIGregTechTileEntityAtSide(byte aSide) { - TileEntity tTileEntity = this.getTileEntityAtSide(aSide); - return tTileEntity instanceof IGregTechTileEntity ? (IGregTechTileEntity) tTileEntity : null; - } - - public final IGregTechTileEntity getIGregTechTileEntityAtSideAndDistance(byte aSide, int aDistance) { - TileEntity tTileEntity = this.getTileEntityAtSideAndDistance(aSide, aDistance); - return tTileEntity instanceof IGregTechTileEntity ? (IGregTechTileEntity) tTileEntity : null; - } - - public final Block getBlock(int aX, int aY, int aZ) { - return this.ignoreUnloadedChunks && this.crossedChunkBorder(aX, aZ) && !this.worldObj.blockExists(aX, aY, aZ) - ? Blocks.air - : this.worldObj.getBlock(aX, aY, aZ); - } - - public final byte getMetaID(int aX, int aY, int aZ) { - return this.ignoreUnloadedChunks && this.crossedChunkBorder(aX, aZ) && !this.worldObj.blockExists(aX, aY, aZ) - ? 0 - : (byte) this.worldObj.getBlockMetadata(aX, aY, aZ); - } - - public final byte getLightLevel(int aX, int aY, int aZ) { - return this.ignoreUnloadedChunks && this.crossedChunkBorder(aX, aZ) && !this.worldObj.blockExists(aX, aY, aZ) - ? 0 - : (byte) ((int) (this.worldObj.getLightBrightness(aX, aY, aZ) * 15.0F)); - } - - public final boolean getSky(int aX, int aY, int aZ) { - return this.ignoreUnloadedChunks && this.crossedChunkBorder(aX, aZ) && !this.worldObj.blockExists(aX, aY, aZ) - ? true - : this.worldObj.canBlockSeeTheSky(aX, aY, aZ); - } - - public final boolean getOpacity(int aX, int aY, int aZ) { - return this.ignoreUnloadedChunks && this.crossedChunkBorder(aX, aZ) && !this.worldObj.blockExists(aX, aY, aZ) - ? false - : GT_Utility.isOpaqueBlock(this.worldObj, aX, aY, aZ); - } - - public final boolean getAir(int aX, int aY, int aZ) { - return this.ignoreUnloadedChunks && this.crossedChunkBorder(aX, aZ) && !this.worldObj.blockExists(aX, aY, aZ) - ? true - : GT_Utility.isBlockAir(this.worldObj, aX, aY, aZ); - } - - public final TileEntity getTileEntity(int aX, int aY, int aZ) { - return this.ignoreUnloadedChunks && this.crossedChunkBorder(aX, aZ) && !this.worldObj.blockExists(aX, aY, aZ) - ? null - : this.worldObj.getTileEntity(aX, aY, aZ); - } - - public final TileEntity getTileEntityAtSide(byte aSide) { - if (aSide >= 0 && aSide < 6 && this.mBufferedTileEntities[aSide] != this) { - int tX = this.getOffsetX(aSide, 1); - short tY = this.getOffsetY(aSide, 1); - int tZ = this.getOffsetZ(aSide, 1); - if (this.crossedChunkBorder(tX, tZ)) { - this.mBufferedTileEntities[aSide] = null; - if (this.ignoreUnloadedChunks && !this.worldObj.blockExists(tX, tY, tZ)) { - return null; - } - } - - if (this.mBufferedTileEntities[aSide] == null) { - this.mBufferedTileEntities[aSide] = this.worldObj.getTileEntity(tX, tY, tZ); - if (this.mBufferedTileEntities[aSide] == null) { - this.mBufferedTileEntities[aSide] = this; - return null; - } else { - return this.mBufferedTileEntities[aSide]; - } - } else if (this.mBufferedTileEntities[aSide].isInvalid()) { - this.mBufferedTileEntities[aSide] = null; - return this.getTileEntityAtSide(aSide); - } else { - return this.mBufferedTileEntities[aSide].xCoord == tX && this.mBufferedTileEntities[aSide].yCoord == tY - && this.mBufferedTileEntities[aSide].zCoord == tZ ? this.mBufferedTileEntities[aSide] : null; - } - } else { - return null; - } - } - - public boolean isDead() { - return this.isDead || this.isInvalidTileEntity(); - } - - public void validate() { - this.clearNullMarkersFromTileEntityBuffer(); - super.validate(); - } - - public void invalidate() { - this.clearNullMarkersFromTileEntityBuffer(); - super.invalidate(); - } - - public void onChunkUnload() { - this.clearNullMarkersFromTileEntityBuffer(); - super.onChunkUnload(); - this.isDead = true; - } - - public final void onAdjacentBlockChange(int aX, int aY, int aZ) { - this.clearNullMarkersFromTileEntityBuffer(); - } - - public final void sendBlockEvent(byte aID, byte aValue) { - GT_Values.NW.sendPacketToAllPlayersInRange(this.worldObj, - new GT_Packet_Block_Event(this.xCoord, (short) this.yCoord, this.zCoord, aID, aValue), this.xCoord, - this.zCoord); - } - - private boolean crossedChunkBorder(int aX, int aZ) { - return aX >> 4 != this.xCoord >> 4 || aZ >> 4 != this.zCoord >> 4; - } - - public final void setOnFire() { - GT_Utility.setCoordsOnFire(this.worldObj, this.xCoord, this.yCoord, this.zCoord, false); - } - - public final void setToFire() { - this.worldObj.setBlock(this.xCoord, this.yCoord, this.zCoord, Blocks.fire); - } - - public String trans(String aKey, String aEnglish) { - return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_" + aKey, aEnglish, false); - } - - @Override - public byte getInternalInputRedstoneSignal(byte aSide) { - return (byte) (getCoverBehaviorAtSide(aSide).getRedstoneInput(aSide, getInputRedstoneSignal(aSide), getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this) & 15); - } - - @Override - public byte getInputRedstoneSignal(byte aSide) { - return (byte) (worldObj.getIndirectPowerLevelTo(getOffsetX(aSide, 1), getOffsetY(aSide, 1), getOffsetZ(aSide, 1), aSide) & 15); - } - - @Override - public byte getOutputRedstoneSignal(byte aSide) { - return getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this) ? mSidedRedstone[aSide] : getGeneralRS(aSide); - } - - public boolean allowGeneralRedstoneOutput() { - return false; - } - - public byte getGeneralRS(byte aSide){ - return allowGeneralRedstoneOutput() ? mSidedRedstone[aSide] : 0; - } - - @Override - public void setInternalOutputRedstoneSignal(byte aSide, byte aStrength) { - if (!getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this)) - setOutputRedstoneSignal(aSide, aStrength); - } - - @Override - public void setOutputRedstoneSignal(byte aSide, byte aStrength) { - aStrength = (byte) Math.min(Math.max(0, aStrength), 15); - if (aSide >= 0 && aSide < 6 && mSidedRedstone[aSide] != aStrength) { - mSidedRedstone[aSide] = aStrength; - issueBlockUpdate(); - } - } - - @Override - public boolean hasInventoryBeenModified() { - return mInventoryChanged; - } - - @Override - public void setGenericRedstoneOutput(boolean aOnOff) { - mRedstone = aOnOff; - } - - @Override - public GT_CoverBehavior getCoverBehaviorAtSide(byte aSide) { - return aSide >= 0 && aSide < mCoverBehaviors.length ? mCoverBehaviors[aSide] : GregTech_API.sNoBehavior; - } - - @Override - public void setCoverIDAtSide(byte aSide, int aID) { - if (aSide >= 0 && aSide < 6) { - mCoverSides[aSide] = aID; - mCoverData[aSide] = 0; - mCoverBehaviors[aSide] = GregTech_API.getCoverBehavior(aID); - issueCoverUpdate(aSide); - issueBlockUpdate(); - } - } - - @Override - public void setCoverItemAtSide(byte aSide, ItemStack aCover) { - GregTech_API.getCoverBehavior(aCover).placeCover(aSide, aCover, this); - } - - @Override - public int getCoverIDAtSide(byte aSide) { - if (aSide >= 0 && aSide < 6) return mCoverSides[aSide]; - return 0; - } - - @Override - public ItemStack getCoverItemAtSide(byte aSide) { - return GT_Utility.intToStack(getCoverIDAtSide(aSide)); - } - - @Override - public boolean canPlaceCoverIDAtSide(byte aSide, int aID) { - return getCoverIDAtSide(aSide) == 0; - } - - @Override - public boolean canPlaceCoverItemAtSide(byte aSide, ItemStack aCover) { - return getCoverIDAtSide(aSide) == 0; - } - - @Override - public void setCoverDataAtSide(byte aSide, int aData) { - if (aSide >= 0 && aSide < 6) mCoverData[aSide] = aData; - } - - @Override - public int getCoverDataAtSide(byte aSide) { - if (aSide >= 0 && aSide < 6) return mCoverData[aSide]; - return 0; - } - - public byte getLightValue() { - return mLightValue; - } - - @Override - public void setLightValue(byte aLightValue) { - mLightValue = (byte) (aLightValue & 15); - } - - @Override - public long getAverageElectricInput() { - int rEU = 0; - for (int i = 0; i < mAverageEUInput.length; i++) { - if (i != mAverageEUInputIndex) - rEU += mAverageEUInput[i]; - } - return rEU / (mAverageEUInput.length - 1); - } - - @Override - public long getAverageElectricOutput() { - int rEU = 0; - for (int i = 0; i < mAverageEUOutput.length; i++) { - if (i != mAverageEUOutputIndex) - rEU += mAverageEUOutput[i]; - } - return rEU / (mAverageEUOutput.length - 1); - } - - public boolean hasSidedRedstoneOutputBehavior() { - return false; - } - - @Override - public boolean dropCover(byte aSide, byte aDroppedSide, boolean aForced) { - if (getCoverBehaviorAtSide(aSide).onCoverRemoval(aSide, getCoverIDAtSide(aSide), mCoverData[aSide], this, aForced) || aForced) { - ItemStack tStack = getCoverBehaviorAtSide(aSide).getDrop(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this); - if (tStack != null) { - tStack.setTagCompound(null); - EntityItem tEntity = new EntityItem(worldObj, getOffsetX(aDroppedSide, 1) + 0.5, getOffsetY(aDroppedSide, 1) + 0.5, getOffsetZ(aDroppedSide, 1) + 0.5, tStack); - tEntity.motionX = 0; - tEntity.motionY = 0; - tEntity.motionZ = 0; - worldObj.spawnEntityInWorld(tEntity); - } - setCoverIDAtSide(aSide, 0); - if (mMetaTileEntity.hasSidedRedstoneOutputBehavior()) { - setOutputRedstoneSignal(aSide, (byte) 0); - } else { - setOutputRedstoneSignal(aSide, (byte) 15); - } - return true; - } - return false; - } - - public String getOwnerName() { - if (GT_Utility.isStringInvalid(mOwnerName)) return "Player"; - return mOwnerName; - } - - public String setOwnerName(String aName) { - if (GT_Utility.isStringInvalid(aName)) return mOwnerName = "Player"; - return mOwnerName = aName; - } - - @Override - public byte getComparatorValue(byte aSide) { - return canAccessData() ? mMetaTileEntity.getComparatorValue(aSide) : 0; - } - - @Override - public byte getStrongOutputRedstoneSignal(byte aSide) { - return aSide >= 0 && aSide < 6 && (mStrongRedstone & (1 << aSide)) != 0 ? (byte) (mSidedRedstone[aSide] & 15) : 0; - } - - @Override - public void setStrongOutputRedstoneSignal(byte aSide, byte aStrength) { - mStrongRedstone |= (1 << aSide); - setOutputRedstoneSignal(aSide, aStrength); - } - - @Override - public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - if (!canAccessData() || !mMetaTileEntity.isElectric() || !inputEnergyFrom(aSide) || aAmperage <= 0 || aVoltage <= 0 || getStoredEU() >= getEUCapacity() || mMetaTileEntity.maxAmperesIn() <= mAcceptedAmperes) - return 0; - if (aVoltage > getInputVoltage()) { - doExplosion(aVoltage); - return 0; - } - if (increaseStoredEnergyUnits(aVoltage * (aAmperage = Math.min(aAmperage, Math.min(mMetaTileEntity.maxAmperesIn() - mAcceptedAmperes, 1 + ((getEUCapacity() - getStoredEU()) / aVoltage)))), true)) { - mAverageEUInput[mAverageEUInputIndex] += aVoltage * aAmperage; - mAcceptedAmperes += aAmperage; - return aAmperage; - } - return 0; - } - - @Override - public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - if (!canAccessData() || !mMetaTileEntity.isElectric() || !outputsEnergyTo(aSide) || getStoredEU() - (aVoltage * aAmperage) < mMetaTileEntity.getMinimumStoredEU()) - return false; - if (decreaseStoredEU(aVoltage * aAmperage, false)) { - mAverageEUOutput[mAverageEUOutputIndex] += aVoltage * aAmperage; - return true; - } - return false; - } - - - public double getOutputEnergyUnitsPerTick() { - return oOutput; - } - - - public boolean isTeleporterCompatible(ForgeDirection aSide) { - return false; - } - - - public double demandedEnergyUnits() { - if (mReleaseEnergy || !canAccessData() || !mMetaTileEntity.isEnetInput()) return 0; - return getEUCapacity() - getStoredEU(); - } - - - public double injectEnergyUnits(ForgeDirection aDirection, double aAmount) { - return injectEnergyUnits((byte) aDirection.ordinal(), (int) aAmount, 1) > 0 ? 0 : aAmount; - } - - - public boolean acceptsEnergyFrom(TileEntity aEmitter, ForgeDirection aDirection) { - return inputEnergyFrom((byte) aDirection.ordinal()); - } - - - public boolean emitsEnergyTo(TileEntity aReceiver, ForgeDirection aDirection) { - return outputsEnergyTo((byte) aDirection.ordinal()); - } - - - public double getOfferedEnergy() { - return (canAccessData() && getStoredEU() - mMetaTileEntity.getMinimumStoredEU() >= oOutput) ? Math.max(0, oOutput) : 0; - } - - - public void drawEnergy(double amount) { - mAverageEUOutput[mAverageEUOutputIndex] += amount; - decreaseStoredEU((int) amount, true); - } - - - public int injectEnergy(ForgeDirection aForgeDirection, int aAmount) { - return injectEnergyUnits((byte) aForgeDirection.ordinal(), aAmount, 1) > 0 ? 0 : aAmount; - } - - - public int addEnergy(int aEnergy) { - if (!canAccessData()) return 0; - if (aEnergy > 0) - increaseStoredEnergyUnits(aEnergy, true); - else - decreaseStoredEU(-aEnergy, true); - return (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getEUVar()); - } - - - public boolean isAddedToEnergyNet() { - return false; - } - - - public int demandsEnergy() { - if (mReleaseEnergy || !canAccessData() || !mMetaTileEntity.isEnetInput()) return 0; - return getCapacity() - getStored(); - } - - - public int getCapacity() { - return (int) Math.min(Integer.MAX_VALUE, getEUCapacity()); - } - - - public int getStored() { - return (int) Math.min(Integer.MAX_VALUE, Math.min(getStoredEU(), getCapacity())); - } - - - public void setStored(int aEU) { - if (canAccessData()) setStoredEU(aEU); - } - - - public int getMaxSafeInput() { - return (int) Math.min(Integer.MAX_VALUE, getInputVoltage()); - } - - - public int getMaxEnergyOutput() { - if (mReleaseEnergy) return Integer.MAX_VALUE; - return getOutput(); - } - - - public int getOutput() { - return (int) Math.min(Integer.MAX_VALUE, oOutput); - } - - - public int injectEnergy(Direction aDirection, int aAmount) { - return injectEnergyUnits((byte) aDirection.toSideValue(), aAmount, 1) > 0 ? 0 : aAmount; - } - - public boolean acceptsEnergyFrom(TileEntity aReceiver, Direction aDirection) { - return inputEnergyFrom((byte) aDirection.toSideValue()); - } - - - public boolean emitsEnergyTo(TileEntity aReceiver, Direction aDirection) { - return outputsEnergyTo((byte) aDirection.toSideValue()); - } - - @Override - public boolean isInvalidTileEntity() { - return isInvalid(); - } - - @Override - public boolean addStackToSlot(int aIndex, ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) return true; - if (aIndex < 0 || aIndex >= getSizeInventory()) return false; - ItemStack tStack = getStackInSlot(aIndex); - if (GT_Utility.isStackInvalid(tStack)) { - setInventorySlotContents(aIndex, aStack); - return true; - } - aStack = GT_OreDictUnificator.get(aStack); - if (GT_Utility.areStacksEqual(tStack, aStack) && tStack.stackSize + aStack.stackSize <= Math.min(aStack.getMaxStackSize(), getInventoryStackLimit())) { - tStack.stackSize += aStack.stackSize; - return true; - } - return false; - } - - @Override - public boolean addStackToSlot(int aIndex, ItemStack aStack, int aAmount) { - return addStackToSlot(aIndex, GT_Utility.copyAmount(aAmount, aStack)); - } - - @Override - public void markDirty() { - super.markDirty(); - mInventoryChanged = true; - } - - - - /** - * To Do - */ - - public boolean isElectric() { - return true; - } - - public boolean isEnetOutput() { - return false; - } - - public boolean isEnetInput() { - return false; - } - - public long maxEUStore() { - return 0L; - } - - public long maxEUInput() { - return 0L; - } - - public long maxEUOutput() { - return 0L; - } - - public long maxAmperesOut() { - return 1L; - } - - public long maxAmperesIn() { - return 1L; - } - - public void doEnergyExplosion() { - if (this.getUniversalEnergyCapacity() > 0L - && this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() / 5L) { - this.doExplosion(this.oOutput * (long) (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() - ? 4 - : (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() / 2L ? 2 : 1))); - GT_Mod arg9999 = GT_Mod.instance; - GT_Mod.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(this.mOwnerName), - "electricproblems"); - } - - } - - public void doExplosion(long aAmount) { - if (this.canAccessData()) { - if (GregTech_API.sMachineWireFire && this.mMetaTileEntity.isElectric()) { - try { - this.mReleaseEnergy = true; - Util.emitEnergyToNetwork(GT_Values.V[5], Math.max(1L, this.getStoredEU() / GT_Values.V[5]), this); - } catch (Exception arg4) { - } - } - this.mReleaseEnergy = false; - this.onExplosion(); - PollutionUtils.addPollution(this, 100000); - this.mMetaTileEntity.doExplosion(aAmount); - } - - } - - public void onExplosion() { - - } - - @Override - public String[] getDescription() { - return this.canAccessData() ? this.mMetaTileEntity.getDescription() : new String[0]; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public String[] getInfoData() { - return null; - } - - public long getEUVar() { - return this.mStoredEnergy; - } - - public void setEUVar(long aEnergy) { - this.mStoredEnergy = aEnergy; - } - - public long getStoredEU() { - return this.canAccessData() ? Math.min(this.mMetaTileEntity.getEUVar(), this.getEUCapacity()) : 0L; - } - - public long getEUCapacity() { - return this.canAccessData() ? this.mMetaTileEntity.maxEUStore() : 0L; - } - - public long getMinimumStoredEU() { - return 512L; - } - - public boolean setStoredEU(long aEnergy) { - if (!this.canAccessData()) { - return false; - } else { - if (aEnergy < 0L) { - aEnergy = 0L; - } - - this.mMetaTileEntity.setEUVar(aEnergy); - return true; - } - } - - public boolean decreaseStoredEU(long aEnergy, boolean aIgnoreTooLessEnergy) { - if (!this.canAccessData()) { - return false; - } else if (this.mMetaTileEntity.getEUVar() - aEnergy < 0L && !aIgnoreTooLessEnergy) { - return false; - } else { - this.setStoredEU(this.mMetaTileEntity.getEUVar() - aEnergy); - if (this.mMetaTileEntity.getEUVar() < 0L) { - this.setStoredEU(0L); - return false; - } else { - return true; - } - } - } - - //Required as of 5.09.32-pre5 - public boolean energyStateReady() { - return false; - } - - - private boolean firstTicked = false; - - public boolean onFirstTick() { - if (!firstTicked) { - firstTicked = true; - if (this.mInventory != null) { - this.mInventory.purgeNulls(); - return true; - } - } - return false; - } - - - /** - * Adds support for the newer function added by https://github.com/Blood-Asp/GT5-Unofficial/commit/73ee102b63efd92c0f164a7ed7a79ebcd2619617#diff-3051838621d8ae87aa5ccd1345e1f07d - */ - public boolean inputEnergyFrom(byte arg0, boolean arg1) { - // TODO Auto-generated method stub - return false; - } - - - /** - * Adds support for the newer function added by https://github.com/Blood-Asp/GT5-Unofficial/commit/73ee102b63efd92c0f164a7ed7a79ebcd2619617#diff-3051838621d8ae87aa5ccd1345e1f07d - */ - public boolean outputsEnergyTo(byte arg0, boolean arg1) { - // TODO Auto-generated method stub - return false; - } - - - - - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/base/TilePoweredGT.java b/src/Java/gtPlusPlus/core/tileentities/base/TilePoweredGT.java deleted file mode 100644 index fb599b0bae..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/base/TilePoweredGT.java +++ /dev/null @@ -1,1168 +0,0 @@ -/*package gtPlusPlus.core.tileentities.base; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.init.Blocks; -import net.minecraft.inventory.IInventory; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.Packet; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.net.GT_Packet; -import gregtech.api.net.GT_Packet_Block_Event; -import gregtech.api.util.GT_Utility; - -import gtPlusPlus.api.interfaces.IGregtechPower; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import net.minecraftforge.common.util.ForgeDirection; - -public abstract class TilePoweredGT extends TileEntityBase implements IGregtechPower { - - public static AutoMap<TilePoweredGT> mPoweredEntities = new AutoMap<TilePoweredGT>(); - - //Base Tile Fields - public boolean ignoreUnloadedChunks; - public boolean isDead; - //Meta Tile Fields - private long mAcceptedAmperes; - - private boolean[] mActiveEUInputs; - private boolean[] mActiveEUOutputs; - protected int[] mAverageEUInput; - protected int mAverageEUInputIndex; - protected int[] mAverageEUOutput; - protected int mAverageEUOutputIndex; - private final TileEntity[] mBufferedTileEntities; - private byte mFacing = 0; - private boolean mHasEnoughEnergy; - private boolean mNeedsUpdate; - private boolean mNeedsBlockUpdate; - private boolean mRunningThroughTick; - private boolean mSendClientData; - protected boolean mReleaseEnergy; - private long mTickTimer; - protected long mStoredEnergy; - protected long mStoredSteam; - - public TilePoweredGT() { - super(); - this.mBufferedTileEntities = new TileEntity[6]; - this.ignoreUnloadedChunks = true; - this.isDead = false; - mPoweredEntities.put(this); - } - - @Override - public boolean acceptsRotationalEnergy(byte p0) { - return false; - } - - private boolean canAccessData() { - return this.isInvalid() ? false : true; - } - - private final void clearNullMarkersFromTileEntityBuffer() { - for (int i = 0; i < this.mBufferedTileEntities.length; ++i) { - if (this.mBufferedTileEntities[i] == this) { - this.mBufferedTileEntities[i] = null; - } - } - } - - protected final void clearTileEntityBuffer() { - for (int i = 0; i < this.mBufferedTileEntities.length; ++i) { - this.mBufferedTileEntities[i] = null; - } - } - - private boolean crossedChunkBorder(final int aX, final int aZ) { - return aX >> 4 != this.xCoord >> 4 || aZ >> 4 != this.zCoord >> 4; - } - - @Override - public boolean decreaseStoredEnergyUnits(final long aEnergy, final boolean aIgnoreTooLessEnergy) { - return this.canAccessData() && (this.mHasEnoughEnergy = (this.decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy) - || this.decreaseStoredSteam(aEnergy, false) - || (aIgnoreTooLessEnergy && this.decreaseStoredSteam(aEnergy, true)))); - } - - public boolean decreaseStoredEU(final long aEnergy, final boolean aIgnoreTooLessEnergy) { - if (!this.canAccessData()) { - return false; - } - if (this.getEUVar() - aEnergy < 0L && !aIgnoreTooLessEnergy) { - return false; - } - this.setStoredEU(this.getEUVar() - aEnergy); - if (this.getEUVar() < 0L) { - this.setStoredEU(0L); - return false; - } - return true; - } - - public boolean decreaseStoredSteam(final long aEnergy, final boolean aIgnoreTooLessEnergy) { - if (!this.canAccessData()) { - return false; - } - if (this.getSteamVar() - aEnergy < 0L && !aIgnoreTooLessEnergy) { - return false; - } - this.setStoredSteam(this.getSteamVar() - aEnergy); - if (this.getSteamVar() < 0L) { - this.setStoredSteam(0L); - return false; - } - return true; - } - - public void doExplosion(final long aExplosionPower) { - final float tStrength = (aExplosionPower < GT_Values.V[0]) - ? 1.0f - : ((aExplosionPower < GT_Values.V[1]) - ? 2.0f - : ((aExplosionPower < GT_Values.V[2]) - ? 3.0f - : ((aExplosionPower < GT_Values.V[3]) - ? 4.0f - : ((aExplosionPower < GT_Values.V[4]) - ? 5.0f - : ((aExplosionPower < GT_Values.V[4] * 2L) - ? 6.0f - : ((aExplosionPower < GT_Values.V[5]) - ? 7.0f - : ((aExplosionPower < GT_Values.V[6]) - ? 8.0f - : ((aExplosionPower < GT_Values.V[7]) - ? 9.0f - : 10.0f)))))))); - final int tX = this.getXCoord(); - final int tY = this.getYCoord(); - final int tZ = this.getZCoord(); - final World tWorld = this.getWorld(); - GT_Utility.sendSoundToPlayers(tWorld, (String) GregTech_API.sSoundList.get(209), 1.0f, -1.0f, tX, tY, tZ); - tWorld.setBlock(tX, tY, tZ, Blocks.air); - if (GregTech_API.sMachineExplosions) { - tWorld.createExplosion((Entity) null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true); - } - } - - public boolean drainEnergyUnits(final byte aSide, final long aVoltage, final long aAmperage) { - if (!this.canAccessData() || !this.isElectric() || !this.outputsEnergyTo(aSide) - || this.getStoredEU() - aVoltage * aAmperage < this.getMinimumStoredEU()) { - return false; - } - if (this.decreaseStoredEU(aVoltage * aAmperage, false)) { - final int[] mAverageEUOutput = this.mAverageEUOutput; - final int mAverageEUOutputIndex = this.mAverageEUOutputIndex; - mAverageEUOutput[mAverageEUOutputIndex] += (int) (aVoltage * aAmperage); - return true; - } - return false; - } - - @Override - public final boolean getAir(final int aX, final int aY, final int aZ) { - return (this.ignoreUnloadedChunks && this.crossedChunkBorder(aX, aZ) && !this.worldObj.blockExists(aX, aY, aZ)) - || GT_Utility.isBlockAir(this.worldObj, aX, aY, aZ); - } - - @Override - public final boolean getAirAtSide(final byte aSide) { - return this.getAirAtSideAndDistance(aSide, 1); - } - - @Override - public final boolean getAirAtSideAndDistance(final byte aSide, final int aDistance) { - return this.getAir(this.getOffsetX(aSide, aDistance), this.getOffsetY(aSide, aDistance), - this.getOffsetZ(aSide, aDistance)); - } - - @Override - public final boolean getAirOffset(final int aX, final int aY, final int aZ) { - return this.getAir(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); - } - - @Override - public long getAverageElectricInput() { - int rEU = 0; - for (int i = 0; i < this.mAverageEUInput.length; ++i) { - if (i != this.mAverageEUInputIndex) { - rEU += this.mAverageEUInput[i]; - } - } - return rEU / (this.mAverageEUInput.length - 1); - } - - public long getAverageElectricOutput() { - int rEU = 0; - for (int i = 0; i < this.mAverageEUOutput.length; ++i) { - if (i != this.mAverageEUOutputIndex) { - rEU += this.mAverageEUOutput[i]; - } - } - return rEU / (this.mAverageEUOutput.length - 1); - } - - @Override - public byte getBackFacing() { - return GT_Utility.getOppositeSide((int) this.mFacing); - } - - @Override - public final Block getBlock(final int aX, final int aY, final int aZ) { - if (this.ignoreUnloadedChunks && this.crossedChunkBorder(aX, aZ) && !this.worldObj.blockExists(aX, aY, aZ)) { - return Blocks.air; - } - return this.worldObj.getBlock(aX, aY, aZ); - } - - - @Override - public final Block getBlockAtSide(final byte aSide) { - return this.getBlockAtSideAndDistance(aSide, 1); - } - - @Override - public final Block getBlockAtSideAndDistance(final byte aSide, final int aDistance) { - return this.getBlock(this.getOffsetX(aSide, aDistance), this.getOffsetY(aSide, aDistance), - this.getOffsetZ(aSide, aDistance)); - } - - @Override - public final Block getBlockOffset(final int aX, final int aY, final int aZ) { - return this.getBlock(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); - } - - @Override - public String[] getDescription() { - // TODO Auto-generated method stub - return null; - } - - - - - - - - - @Override - public long getEUCapacity() { - if (this.canAccessData()) { - return this.maxEUStore(); - } - return 0L; - } - - public long getEUVar() { - return mStoredEnergy; - } - - @Override - public byte getFrontFacing() { - return this.mFacing; - } - - @Override - public final IGregTechTileEntity getIGregTechTileEntity(final int aX, final int aY, final int aZ) { - final TileEntity tTileEntity = this.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity) { - return (IGregTechTileEntity) tTileEntity; - } - return null; - } - - @Override - public final IGregTechTileEntity getIGregTechTileEntityAtSide(final byte aSide) { - final TileEntity tTileEntity = this.getTileEntityAtSide(aSide); - if (tTileEntity instanceof IGregTechTileEntity) { - return (IGregTechTileEntity) tTileEntity; - } - return null; - } - - @Override - public final IGregTechTileEntity getIGregTechTileEntityAtSideAndDistance(final byte aSide, final int aDistance) { - final TileEntity tTileEntity = this.getTileEntityAtSideAndDistance(aSide, aDistance); - if (tTileEntity instanceof IGregTechTileEntity) { - return (IGregTechTileEntity) tTileEntity; - } - return null; - } - - @Override - public final IGregTechTileEntity getIGregTechTileEntityOffset(final int aX, final int aY, final int aZ) { - final TileEntity tTileEntity = this.getTileEntityOffset(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity) { - return (IGregTechTileEntity) tTileEntity; - } - return null; - } - - @Override - public final IInventory getIInventory(final int aX, final int aY, final int aZ) { - final TileEntity tTileEntity = this.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IInventory) { - return (IInventory) tTileEntity; - } - return null; - } - - @Override - public final IInventory getIInventoryAtSide(final byte aSide) { - final TileEntity tTileEntity = this.getTileEntityAtSide(aSide); - if (tTileEntity instanceof IInventory) { - return (IInventory) tTileEntity; - } - return null; - } - - @Override - public final IInventory getIInventoryAtSideAndDistance(final byte aSide, final int aDistance) { - final TileEntity tTileEntity = this.getTileEntityAtSideAndDistance(aSide, aDistance); - if (tTileEntity instanceof IInventory) { - return (IInventory) tTileEntity; - } - return null; - } - - @Override - public final IInventory getIInventoryOffset(final int aX, final int aY, final int aZ) { - final TileEntity tTileEntity = this.getTileEntityOffset(aX, aY, aZ); - if (tTileEntity instanceof IInventory) { - return (IInventory) tTileEntity; - } - return null; - } - - @Override - public String[] getInfoData() { - // TODO Auto-generated method stub - return null; - } - - @Override - public long getInputAmperage() { - if (this.canAccessData() && this.isElectric()) { - return this.maxAmperesIn(); - } - return 0L; - } - - public long getInputTier() { - return GT_Utility.getTier(this.getInputVoltage()); - } - - @Override - public long getInputVoltage() { - if (this.canAccessData() && this.isElectric()) { - return this.maxEUInput(); - } - return 2147483647L; - } - - private long getMinimumStoredEU() { - return 0; - } - - @Override - public final int getOffsetX(final byte aSide, final int aMultiplier) { - return this.xCoord + ForgeDirection.getOrientation((int) aSide).offsetX * aMultiplier; - } - - public final short getOffsetY(final byte aSide, final int aMultiplier) { - return (short) (this.yCoord + ForgeDirection.getOrientation((int) aSide).offsetY * aMultiplier); - } - - public final int getOffsetZ(final byte aSide, final int aMultiplier) { - return this.zCoord + ForgeDirection.getOrientation((int) aSide).offsetZ * aMultiplier; - } - - @Override - public long getOutputAmperage() { - if (this.canAccessData() && this.isElectric()) { - return this.maxAmperesOut(); - } - return 0L; - } - - public long getOutputTier() { - return GT_Utility.getTier(this.getOutputVoltage()); - } - - @Override - public long getOutputVoltage() { - if (this.canAccessData() && this.isElectric() && this.isEnetOutput()) { - return this.maxEUOutput(); - } - return 0L; - } - - @Override - public int getRandomNumber(int p0) { - return CORE.RANDOM.nextInt(); - } - - @Override - public long getSteamCapacity() { - if (this.canAccessData()) { - return this.maxSteamStore(); - } - return 0L; - } - - public long getSteamVar() { - return mStoredSteam; - } - - @Override - public long getStoredEU() { - if (this.canAccessData()) { - return Math.min(this.getEUVar(), this.getEUCapacity()); - } - return 0L; - } - - - - - - - - - - @Override - public long getStoredSteam() { - if (this.canAccessData()) { - return Math.min(this.getSteamVar(), this.getSteamCapacity()); - } - return 0L; - } - - @Override - public final TileEntity getTileEntity(final int aX, final int aY, final int aZ) { - if (this.ignoreUnloadedChunks && this.crossedChunkBorder(aX, aZ) && !this.worldObj.blockExists(aX, aY, aZ)) { - return null; - } - return this.worldObj.getTileEntity(aX, aY, aZ); - } - - public final TileEntity getTileEntityAtSide(final byte aSide) { - if (aSide < 0 || aSide >= 6 || this.mBufferedTileEntities[aSide] == this) { - return null; - } - final int tX = this.getOffsetX(aSide, 1); - final int tY = this.getOffsetY(aSide, 1); - final int tZ = this.getOffsetZ(aSide, 1); - if (this.crossedChunkBorder(tX, tZ)) { - this.mBufferedTileEntities[aSide] = null; - if (this.ignoreUnloadedChunks && !this.worldObj.blockExists(tX, tY, tZ)) { - return null; - } - } - if (this.mBufferedTileEntities[aSide] == null) { - this.mBufferedTileEntities[aSide] = this.worldObj.getTileEntity(tX, tY, tZ); - if (this.mBufferedTileEntities[aSide] == null) { - this.mBufferedTileEntities[aSide] = this; - return null; - } - return this.mBufferedTileEntities[aSide]; - } else { - if (this.mBufferedTileEntities[aSide].isInvalid()) { - this.mBufferedTileEntities[aSide] = null; - return this.getTileEntityAtSide(aSide); - } - if (this.mBufferedTileEntities[aSide].xCoord == tX && this.mBufferedTileEntities[aSide].yCoord == tY - && this.mBufferedTileEntities[aSide].zCoord == tZ) { - return this.mBufferedTileEntities[aSide]; - } - return null; - } - } - - @Override - public final TileEntity getTileEntityAtSideAndDistance(final byte aSide, final int aDistance) { - if (aDistance == 1) { - return this.getTileEntityAtSide(aSide); - } - return this.getTileEntity(this.getOffsetX(aSide, aDistance), this.getOffsetY(aSide, aDistance), - this.getOffsetZ(aSide, aDistance)); - } - - - - - - - - - - - @Override - public final TileEntity getTileEntityOffset(final int aX, final int aY, final int aZ) { - return this.getTileEntity(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); - } - - @Override - public long getUniversalEnergyCapacity() { - return 0; - } - - @Override - public long getUniversalEnergyStored() { - return 0; - } - - @Override - public World getWorld() { - return this.getWorldObj(); - } - - - - - - - @Override - public int getXCoord() { - return this.xCoord; - } - - - - - - @Override - public short getYCoord() { - return (short) this.yCoord; - } - - @Override - public int getZCoord() { - return this.zCoord; - } - - public boolean hasEnoughEnergy() { - return (this.getStoredEU() > 0 ? (mHasEnoughEnergy = true) : (mHasEnoughEnergy = false)); - } - - - - - @Override - public boolean increaseStoredEnergyUnits(final long aEnergy, final boolean aIgnoreTooMuchEnergy) { - if (!this.canAccessData()) { - return false; - } - if (this.getStoredEU() < this.getEUCapacity() || aIgnoreTooMuchEnergy) { - this.setStoredEU(this.getEUVar() + aEnergy); - return true; - } - return false; - } - - @Override - public boolean increaseStoredSteam(final long aEnergy, final boolean aIgnoreTooMuchEnergy) { - if (!this.canAccessData()) { - return false; - } - if (this.getSteamVar() < this.getSteamCapacity() || aIgnoreTooMuchEnergy) { - this.setStoredSteam(this.getSteamVar() + aEnergy); - return true; - } - return false; - } - - public long injectEnergyUnits(final byte aSide, final long aVoltage, long aAmperage) { - if (!this.canAccessData() || !this.isElectric() || !this.inputEnergyFrom(aSide) - || aAmperage <= 0L || aVoltage <= 0L || this.getStoredEU() >= this.getEUCapacity() - || this.maxAmperesIn() <= this.mAcceptedAmperes) { - return 0L; - } - if (aVoltage > this.getInputVoltage()) { - this.doExplosion(aVoltage); - return 0L; - } - if (this.increaseStoredEnergyUnits(aVoltage - * (aAmperage = Math.min(aAmperage, Math.min(this.maxAmperesIn() - this.mAcceptedAmperes, - 1L + (this.getEUCapacity() - this.getStoredEU()) / aVoltage))), - true)) { - final int[] mAverageEUInput = this.mAverageEUInput; - final int mAverageEUInputIndex = this.mAverageEUInputIndex; - mAverageEUInput[mAverageEUInputIndex] += (int) (aVoltage * aAmperage); - this.mAcceptedAmperes += aAmperage; - return aAmperage; - } - return 0L; - } - - @Override - public boolean injectRotationalEnergy(byte p0, long p1, long p2) { - return false; - } - - @Override - public boolean inputEnergyFrom(final byte aSide) { - if (aSide == 6) { - return true; - } - if (this.isServerSide()) { - return aSide >= 0 && aSide < 6 && this.mActiveEUInputs[aSide] && !this.mReleaseEnergy; - } - return this.isEnergyInputSide(aSide); - } - - - public final boolean isClientSide() { - return this.worldObj.isRemote; - } - - @Override - public boolean isDead() { - return this.isDead; - } - - private boolean isElectric() { - return true; - } - - private boolean isEnergyInputSide(final byte aSide) { - if (aSide >= 0 && aSide < 6) { - if (this.isInvalid() || this.mReleaseEnergy) { - return false; - } - if (this.canAccessData() && this.isElectric() && this.isEnetInput()) { - return this.isInputFacing(aSide); - } - } - return false; - } - - private boolean isEnergyOutputSide(final byte aSide) { - if (aSide >= 0 && aSide < 6) { - if (this.isInvalid() || this.mReleaseEnergy) { - return this.mReleaseEnergy; - } - if (this.canAccessData() && this.isElectric() && this.isEnetOutput()) { - return this.isOutputFacing(aSide); - } - } - return false; - } - - public boolean isEnetInput() { - return false; - } - - public boolean isEnetOutput() { - return false; - } - - @Override - public boolean isGivingInformation() { - return this.canAccessData() && this.isGivingInformation(); - } - - public boolean isInputFacing(final byte aSide) { - return false; - } - - - - - @Override - public boolean isInvalidTileEntity() { - return isDead() ? true : false; - } - - public boolean isOutputFacing(final byte aSide) { - return false; - } - - public final boolean isServerSide() { - return !this.worldObj.isRemote; - } - - public boolean isUniversalEnergyStored(final long aEnergyAmount) { - return this.getUniversalEnergyStored() >= aEnergyAmount || (this.mHasEnoughEnergy = false); - } - - @Override - public boolean isValidFacing(final byte aSide) { - return this.canAccessData(); - } - - public long maxAmperesIn() { - return 1L; - } - - public long maxAmperesOut() { - return 1L; - } - - public long maxEUInput() { - return 0L; - } - - public long maxEUOutput() { - return 0L; - } - - public long maxEUStore() { - return 0L; - } - - public long maxSteamStore() { - return 256000L; - } - - public final void onAdjacentBlockChange(final int aX, final int aY, final int aZ) { - this.clearNullMarkersFromTileEntityBuffer(); - } - - @Override - public boolean outputsEnergyTo(final byte aSide) { - if (aSide == 6) { - return true; - } - if (this.isServerSide()) { - if (aSide < 0 || aSide >= 6 || !this.mActiveEUOutputs[aSide]) { - if (!this.mReleaseEnergy) { - return false; - } - } - return true; - } - return this.isEnergyOutputSide(aSide); - } - - public final void sendBlockEvent(final byte aID, final byte aValue) { - GT_Values.NW.sendPacketToAllPlayersInRange(this.worldObj, - (GT_Packet) new GT_Packet_Block_Event(this.xCoord, (short) this.yCoord, this.zCoord, aID, aValue), - this.xCoord, this.zCoord); - } - - public void setEUVar(final long aEnergy) { - mStoredEnergy = aEnergy; - } - - @Override - public void setFrontFacing(byte aFacing) { - if (this.isValidFacing(aFacing)) { - this.mFacing = aFacing; - //this.onFacingChange(); - //this.onMachineBlockUpdate(); - } - } - - public void setSteamVar(final long aSteam) { - mStoredSteam = aSteam; - } - - public boolean setStoredEU(long aEnergy) { - if (!this.canAccessData()) { - return false; - } - if (aEnergy < 0L) { - aEnergy = 0L; - } - this.setEUVar(aEnergy); - return true; - } - - public boolean setStoredSteam(long aEnergy) { - if (!this.canAccessData()) { - return false; - } - if (aEnergy < 0L) { - aEnergy = 0L; - } - this.setSteamVar(aEnergy); - return true; - } - - @Override - public void writeToNBT(NBTTagCompound nbt) { - // TODO Auto-generated method stub - super.writeToNBT(nbt); - } - - @Override - public void readFromNBT(NBTTagCompound nbt) { - // TODO Auto-generated method stub - super.readFromNBT(nbt); - } - - - - - @Override - public boolean onPreTick(long aTick) { - return onPreTick(this, this.mTickTimer); - } - - @Override - public boolean onTick(long aTick) { - return onTick(this, this.mTickTimer); - } - - @Override - public boolean onPostTick(long aTick) { - return onPostTick(this, this.mTickTimer); - } - - @Override - public boolean onPreTick(TilePoweredGT tilePoweredGT, long mTickTimer2) { - return super.onPreTick(mTickTimer2); - } - - @Override - public boolean onTick(TilePoweredGT iGregTechTileEntity, long mTickTimer2) { - return super.onTick(mTickTimer2); - } - - @Override - public boolean onPostTick(TilePoweredGT iGregTechTileEntity, long mTickTimer2) { - return super.onPostTick(mTickTimer2); - } - - @Override - public void markDirty() { - super.markDirty(); - } - - @Override - public boolean receiveClientEvent(int p_145842_1_, int p_145842_2_) { - // TODO Auto-generated method stub - return super.receiveClientEvent(p_145842_1_, p_145842_2_); - } - - @Override - public void onChunkUnload() { - this.clearNullMarkersFromTileEntityBuffer(); - super.onChunkUnload(); - this.isDead = true; - } - - - public void updateEntity() { - super.updateEntity(); - this.isDead = false; - - this.mRunningThroughTick = true; - long tTime = System.currentTimeMillis(); - int tCode = 0; - final boolean aSideServer = this.isServerSide(); - final boolean aSideClient = this.isClientSide(); - try { - for (tCode = 0; this.hasValidMetaTileEntity() && tCode >= 0; tCode = -1) { - Label_1743 : { - switch (tCode) { - case 0 : { - ++tCode; - if (this.mTickTimer++ != 0L) { - break Label_1743; - } - this.oX = this.xCoord; - this.oY = this.yCoord; - this.oZ = this.zCoord; - - this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, - (TileEntity) this); - this.onFirstTick(this); - if (!this.hasValidMetaTileEntity()) { - this.mRunningThroughTick = false; - return; - } - break Label_1743; - } - case 1 : { - ++tCode; - if (!aSideClient) { - break Label_1743; - } - if (this.mNeedsUpdate) { - this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); - this.mNeedsUpdate = false; - } - break Label_1743; - } - case 2 : - case 3 : - case 4 : - case 5 : - case 6 : - case 7 : { - if (aSideServer && this.mTickTimer > 10L) { - for (byte i = (byte) (tCode - 2); i < 6; ++i) { - - } - } - } - case 8 : { - tCode = 9; - if (aSideServer) { - if (++this.mAverageEUInputIndex >= this.mAverageEUInput.length) { - this.mAverageEUInputIndex = 0; - } - if (++this.mAverageEUOutputIndex >= this.mAverageEUOutput.length) { - this.mAverageEUOutputIndex = 0; - } - this.mAverageEUInput[this.mAverageEUInputIndex] = 0; - this.mAverageEUOutput[this.mAverageEUOutputIndex] = 0; - } - } - case 9 : { - ++tCode; - this.onPreTick(this, this.mTickTimer); - if (!this.hasValidMetaTileEntity()) { - this.mRunningThroughTick = false; - return; - } - } - case 10 : { - ++tCode; - if (!aSideServer) { - break Label_1743; - } - - if (this.xCoord != this.oX || this.yCoord != this.oY || this.zCoord != this.oZ) { - this.oX = this.xCoord; - this.oY = this.yCoord; - this.oZ = this.zCoord; - this.issueClientUpdate(); - this.clearTileEntityBuffer(); - } - if (this.mFacing != this.oFacing) { - this.oFacing = this.mFacing; - this.issueBlockUpdate(); - } - if (this.mTickTimer > 20L && this.isElectric()) { - this.mAcceptedAmperes = 0L; - if (this.getOutputVoltage() != this.oOutput) { - this.oOutput = this.getOutputVoltage(); - } - if (this.isEnetOutput() || this.isEnetInput()) { - for (byte i = 0; i < 6; ++i) { - boolean temp = this.isEnergyInputSide(i); - if (temp != this.mActiveEUInputs[i]) { - this.mActiveEUInputs[i] = temp; - } - temp = this.isEnergyOutputSide(i); - if (temp != this.mActiveEUOutputs[i]) { - this.mActiveEUOutputs[i] = temp; - } - } - } - if (this.isEnetOutput() && this.oOutput > 0L) { - final long tOutputVoltage = Math.max(this.oOutput, - this.oOutput + (1 << GT_Utility.getTier(this.oOutput))); - final long tUsableAmperage = Math.min(this.getOutputAmperage(), - (this.getStoredEU() - this.getMinimumStoredEU()) - / tOutputVoltage); - if (tUsableAmperage > 0L) { - final long tEU = tOutputVoltage * IEnergyConnected.Util.emitEnergyToNetwork( - this.oOutput, tUsableAmperage, (IEnergyConnected) this); - final int[] mAverageEUOutput = this.mAverageEUOutput; - final int mAverageEUOutputIndex = this.mAverageEUOutputIndex; - mAverageEUOutput[mAverageEUOutputIndex] += (int) tEU; - this.decreaseStoredEU(tEU, true); - } - } - if (this.getEUCapacity() > 0L) { - if (GregTech_API.sMachineFireExplosions && this.getRandomNumber(1000) == 0) { - final Block tBlock = this.getBlockAtSide((byte) this.getRandomNumber(6)); - if (tBlock instanceof BlockFire) { - this.doEnergyExplosion(); - } - } - if (!this.hasValidMetaTileEntity()) { - this.mRunningThroughTick = false; - return; - } - } - } - if (!this.hasValidMetaTileEntity()) { - this.mRunningThroughTick = false; - return; - } - break Label_1743; - } - case 13 : { - ++tCode; - this.updateStatus(); - if (!this.hasValidMetaTileEntity()) { - this.mRunningThroughTick = false; - return; - } - } - case 14 : { - ++tCode; - this.onPostTick((IGregTechTileEntity) this, this.mTickTimer); - if (!this.hasValidMetaTileEntity()) { - this.mRunningThroughTick = false; - return; - } - } - case 15 : { - ++tCode; - if (!aSideServer) { - break; - } - if (this.mTickTimer % 10L == 0L && this.mSendClientData) { - final IGT_NetworkHandler nw = GT_Values.NW; - final World worldObj = this.worldObj; - final int xCoord = this.xCoord; - final short n = (short) this.yCoord; - final int zCoord = this.zCoord; - final short mid = this.mID; - final int n2 = this.mCoverSides[0]; - final int n3 = this.mCoverSides[1]; - final int n4 = this.mCoverSides[2]; - final int n5 = this.mCoverSides[3]; - final int n6 = this.mCoverSides[4]; - final int n7 = this.mCoverSides[5]; - final byte oTextureData = (byte) ((this.mFacing & 0x7) | (this.mActive ? 8 : 0) - | (this.mRedstone ? 16 : 0) | (this.mLockUpgrade ? 32 : 0)); - this.oTextureData = oTextureData; - final byte oTexturePage = (byte) ((this.hasValidMetaTileEntity() - && this.mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) - ? ((GT_MetaTileEntity_Hatch) this.mMetaTileEntity).getTexturePage() - : 0); - this.oTexturePage = oTexturePage; - final byte oUpdateData = (byte) (this.hasValidMetaTileEntity() - ? this.mMetaTileEntity.getUpdateData() - : 0); - this.oUpdateData = oUpdateData; - final byte oRedstoneData = (byte) (((this.mSidedRedstone[0] > 0) ? 1 : 0) - | ((this.mSidedRedstone[1] > 0) ? 2 : 0) - | ((this.mSidedRedstone[2] > 0) ? 4 : 0) - | ((this.mSidedRedstone[3] > 0) ? 8 : 0) - | ((this.mSidedRedstone[4] > 0) ? 16 : 0) - | ((this.mSidedRedstone[5] > 0) ? 32 : 0)); - this.oRedstoneData = oRedstoneData; - final byte mColor = this.mColor; - this.oColor = mColor; - nw.sendPacketToAllPlayersInRange(worldObj, - (GT_Packet) new GT_Packet_TileEntity(xCoord, n, zCoord, mid, n2, n3, n4, n5, n6, - n7, oTextureData, oTexturePage, oUpdateData, oRedstoneData, mColor), - this.xCoord, this.zCoord); - this.mSendClientData = false; - } - if (this.mTickTimer > 10L) { - byte tData = (byte) ((this.mFacing & 0x7) | (this.mActive ? 8 : 0) - | (this.mRedstone ? 16 : 0) | (this.mLockUpgrade ? 32 : 0)); - if (tData != this.oTextureData) { - this.sendBlockEvent((byte) 0, this.oTextureData = tData); - } - tData = this.mMetaTileEntity.getUpdateData(); - if (tData != this.oUpdateData) { - this.sendBlockEvent((byte) 1, this.oUpdateData = tData); - } - if (this.mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) { - tData = ((GT_MetaTileEntity_Hatch) this.mMetaTileEntity).getTexturePage(); - if (tData != this.oTexturePage) { - final byte b = 1; - final byte oTexturePage2 = tData; - this.oTexturePage = oTexturePage2; - this.sendBlockEvent(b, (byte) (oTexturePage2 | 0x80)); - } - } - if (this.mColor != this.oColor) { - this.sendBlockEvent((byte) 2, this.oColor = this.mColor); - } - tData = (byte) (((this.mSidedRedstone[0] > 0) ? 1 : 0) - | ((this.mSidedRedstone[1] > 0) ? 2 : 0) - | ((this.mSidedRedstone[2] > 0) ? 4 : 0) - | ((this.mSidedRedstone[3] > 0) ? 8 : 0) - | ((this.mSidedRedstone[4] > 0) ? 16 : 0) - | ((this.mSidedRedstone[5] > 0) ? 32 : 0)); - if (tData != this.oRedstoneData) { - this.sendBlockEvent((byte) 3, this.oRedstoneData = tData); - } - if (this.mLightValue != this.oLightValue) { - this.worldObj.setLightValue(EnumSkyBlock.Block, this.xCoord, this.yCoord, - this.zCoord, (int) this.mLightValue); - this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord, - this.zCoord); - this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord + 1, this.yCoord, - this.zCoord); - this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord - 1, this.yCoord, - this.zCoord); - this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord + 1, - this.zCoord); - this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord - 1, - this.zCoord); - this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord, - this.zCoord + 1); - this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord, - this.zCoord - 1); - this.issueTextureUpdate(); - this.sendBlockEvent((byte) 7, this.oLightValue = this.mLightValue); - } - } - if (this.mNeedsBlockUpdate) { - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, - this.getBlockOffset(0, 0, 0)); - this.mNeedsBlockUpdate = false; - break; - } - break; - } - } - } - } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } - if (aSideServer && this.hasValidMetaTileEntity()) { - tTime = System.currentTimeMillis() - tTime; - if (this.mTimeStatistics.length > 0) { - this.mTimeStatistics[this.mTimeStatisticsIndex = (this.mTimeStatisticsIndex + 1) - % this.mTimeStatistics.length] = (int) tTime; - } - if (tTime > 0L && tTime > GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING && this.mTickTimer > 1000L - && this.getMetaTileEntity().doTickProfilingMessageDuringThisTick() - && this.mLagWarningCount++ < 10) { - System.out.println("WARNING: Possible Lag Source at [" + this.xCoord + ", " + this.yCoord + ", " - + this.zCoord + "] in Dimension " + this.worldObj.provider.dimensionId + " with " + tTime - + "ms caused by an instance of " + this.getMetaTileEntity().getClass()); - } - } - final boolean mWorkUpdate = false; - this.mRunningThroughTick = mWorkUpdate; - this.mInventoryChanged = mWorkUpdate; - this.mWorkUpdate = mWorkUpdate; - } - - private void onFirstTick(TilePoweredGT tilePoweredGT) { - // TODO Auto-generated method stub - - } - - private boolean hasValidMetaTileEntity() { - return Utils.invertBoolean(isDead()); - } - - public void issueBlockUpdate() { - this.mNeedsBlockUpdate = true; - } - - public void issueClientUpdate() { - this.mSendClientData = true; - } - - public Packet getDescriptionPacket() { - this.issueClientUpdate(); - return null; - } - -} -*/
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java deleted file mode 100644 index 835d9da2cd..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java +++ /dev/null @@ -1,307 +0,0 @@ -package gtPlusPlus.core.tileentities.general; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.tileentity.TileEntity; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.inventories.InventoryCircuitProgrammer; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.slots.SlotIntegratedCircuit; -import gtPlusPlus.core.util.minecraft.PlayerUtils; - -public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInventory { - - private int tickCount = 0; - private final InventoryCircuitProgrammer inventoryContents; - private String customName; - public int locationX; - public int locationY; - public int locationZ; - private int aCurrentMode = 0; - - public TileEntityCircuitProgrammer() { - this.inventoryContents = new InventoryCircuitProgrammer(); - this.setTileLocation(); - } - - public boolean setTileLocation() { - if (this.hasWorldObj()) { - if (!this.getWorldObj().isRemote) { - this.locationX = this.xCoord; - this.locationY = this.yCoord; - this.locationZ = this.zCoord; - return true; - } - } - return false; - } - - //Rename to hasCircuitToConfigure - public final boolean hasCircuitToConfigure() { - for (ItemStack i : this.getInventory().getInventory()) { - if (i == null) { - continue; - } - else { - return true; - } - } - return false; - } - - public InventoryCircuitProgrammer getInventory() { - return this.inventoryContents; - } - - public boolean addOutput() { - ItemStack[] aInputs = this.getInventory().getInventory().clone(); - //Check if there is output in slot. - Boolean hasOutput = false; - if (aInputs[25] != null) { - hasOutput = true; - } - AutoMap<Integer> aValidSlots = new AutoMap<Integer>(); - int aSlotCount = 0; - for (ItemStack i : aInputs) { - if (i != null) { - aValidSlots.put(aSlotCount); - } - aSlotCount++; - } - for (int e : aValidSlots) { - boolean doAdd = false; - ItemStack g = this.getStackInSlot(e); - int aSize = 0; - ItemStack aInputStack = null; - int aTypeInSlot = SlotIntegratedCircuit.isRegularProgrammableCircuit(g); - if (aTypeInSlot >= 0 && g != null) { - // No Existing Output - if (!hasOutput) { - aSize = g.stackSize; - doAdd = true; - } - // Existing Output - else { - ItemStack f = this.getStackInSlot(25); - int aTypeInCheckedSlot = SlotIntegratedCircuit.isRegularProgrammableCircuit(f); - // Check that the Circuit in the Output slot is not null and the same type as the circuit input. - if (aTypeInCheckedSlot >= 0 && (aTypeInSlot == aTypeInCheckedSlot) && f != null) { - if (g.getItem() == f.getItem() && f.getItemDamage() == e) { - aSize = f.stackSize + g.stackSize; - if (aSize > 64) { - aInputStack = g.copy(); - aInputStack.stackSize = (aSize-64); - } - doAdd = true; - } - } - } - if (doAdd) { - // Check Circuit Type - ItemStack aOutput; - if (aTypeInSlot == 0) { - aOutput = CI.getNumberedCircuit(e); - } - else if (aTypeInSlot == 1) { - aOutput = CI.getNumberedBioCircuit(e); - } - else if (aTypeInSlot == 2) { - aOutput = CI.getNumberedAdvancedCircuit(e); - } - else { - aOutput = null; - } - - if (aOutput != null) { - aOutput.stackSize = aSize; - this.setInventorySlotContents(e, aInputStack); - this.setInventorySlotContents(25, aOutput); - return true; - } - } - } - continue; - } - return false; - } - - @Override - public void updateEntity() { - try{ - if (!this.worldObj.isRemote) { - if (tickCount % 10 == 0) { - if (hasCircuitToConfigure()) { - this.addOutput(); - this.markDirty(); - } - } - this.tickCount++; - } - } - catch (final Throwable t){} - } - - public boolean anyPlayerInRange() { - return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null; - } - - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { - if (!nbt.hasKey(tag)) { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound nbt) { - super.writeToNBT(nbt); - // Utils.LOG_WARNING("Trying to write NBT data to TE."); - final NBTTagCompound chestData = new NBTTagCompound(); - this.inventoryContents.writeToNBT(chestData); - nbt.setTag("ContentsChest", chestData); - if (this.hasCustomInventoryName()) { - nbt.setString("CustomName", this.getCustomName()); - } - nbt.setInteger("aCurrentMode", aCurrentMode); - } - - @Override - public void readFromNBT(final NBTTagCompound nbt) { - super.readFromNBT(nbt); - // Utils.LOG_WARNING("Trying to read NBT data from TE."); - this.inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest")); - if (nbt.hasKey("CustomName", 8)) { - this.setCustomName(nbt.getString("CustomName")); - } - aCurrentMode = nbt.getInteger("aCurrentMode"); - } - - @Override - public int getSizeInventory() { - return this.getInventory().getSizeInventory(); - } - - @Override - public ItemStack getStackInSlot(final int slot) { - return this.getInventory().getStackInSlot(slot); - } - - @Override - public ItemStack decrStackSize(final int slot, final int count) { - return this.getInventory().decrStackSize(slot, count); - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) { - return this.getInventory().getStackInSlotOnClosing(slot); - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) { - this.getInventory().setInventorySlotContents(slot, stack); - } - - @Override - public int getInventoryStackLimit() { - return this.getInventory().getInventoryStackLimit(); - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) { - return this.getInventory().isUseableByPlayer(entityplayer); - } - - @Override - public void openInventory() { - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.getInventory().openInventory(); - } - - @Override - public void closeInventory() { - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.getInventory().closeInventory(); - } - - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - return this.getInventory().isItemValidForSlot(slot, itemstack); - } - - @Override - public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { - final int[] accessibleSides = new int[this.getSizeInventory()]; - for (int r=0; r<this.getInventory().getSizeInventory(); r++){ - accessibleSides[r]=r; - } - return accessibleSides; - - } - - @Override - public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) { - return p_102007_1_ >= 0 && p_102007_1_ <= 24; - } - - @Override - public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) { - return p_102008_1_ == 25; - } - - public String getCustomName() { - return this.customName; - } - - public void setCustomName(final String customName) { - this.customName = customName; - } - - @Override - public String getInventoryName() { - return this.hasCustomInventoryName() ? this.customName : "container.circuitprogrammer"; - } - - @Override - public boolean hasCustomInventoryName() { - return (this.customName != null) && !this.customName.equals(""); - } - - @Override - public Packet getDescriptionPacket() { - final NBTTagCompound tag = new NBTTagCompound(); - this.writeToNBT(tag); - return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tag); - } - - @Override - public void onDataPacket(final NetworkManager net, final S35PacketUpdateTileEntity pkt) { - final NBTTagCompound tag = pkt.func_148857_g(); - this.readFromNBT(tag); - } - - public boolean onScrewdriverRightClick(byte side, EntityPlayer player, int x, int y, int z) { - try { - if (aCurrentMode == 24) { - aCurrentMode = 0; - } - else { - aCurrentMode++; - } - PlayerUtils.messagePlayer(player, "Now configuring units for type "+aCurrentMode+"."); - return true; - } - catch (Throwable t) { - return false; - } - } - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java deleted file mode 100644 index db93e9c4fc..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java +++ /dev/null @@ -1,359 +0,0 @@ -package gtPlusPlus.core.tileentities.general; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.inventories.Inventory_DecayablesChest; -import gtPlusPlus.core.item.materials.DustDecayable; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class TileEntityDecayablesChest extends TileEntity implements ISidedInventory { - - private final Inventory_DecayablesChest inventoryContents; - - /** Determines if the check for adjacent chests has taken place. */ - public boolean adjacentChestChecked; - /** Contains the chest tile located adjacent to this one (if any) */ - public TileEntityDecayablesChest adjacentChestZNeg; - /** Contains the chest tile located adjacent to this one (if any) */ - public TileEntityDecayablesChest adjacentChestXPos; - /** Contains the chest tile located adjacent to this one (if any) */ - public TileEntityDecayablesChest adjacentChestXNeg; - /** Contains the chest tile located adjacent to this one (if any) */ - public TileEntityDecayablesChest adjacentChestZPos; - /** The current angle of the lid (between 0 and 1) */ - public float lidAngle; - /** The angle of the lid last tick */ - public float prevLidAngle; - /** The number of players currently using this chest */ - public int numPlayersUsing; - - private String customName; - - private int cachedChestType; - private int tickCount = 0; - - public TileEntityDecayablesChest() { - this.inventoryContents = new Inventory_DecayablesChest(); - } - - public Inventory_DecayablesChest getInventory() { - return this.inventoryContents; - } - - @Override - public void updateEntity() { - - // Try do chesty stuff - try { - this.updateEntityChest(); - } catch (Throwable t) { - - } - - try { - if (!this.worldObj.isRemote) { - this.tickCount++; - if ((this.tickCount % 10) == 0) { - cachedChestType = 1; - } - - if ((this.tickCount % 20) == 0) { - for (ItemStack inv : this.getInventory().getInventory()) { - if (inv == null) { - continue; - } - if (inv.getItem() instanceof DustDecayable) { - DustDecayable D = (DustDecayable) inv.getItem(); - tryUpdateDecayable(D, inv, this.worldObj); - } - } - - } - updateSlots(); - } - } catch (final Throwable t) { - } - } - - public void tryUpdateDecayable(final DustDecayable b, ItemStack iStack, final World world) { - if (world == null || iStack == null) { - return; - } - if (world.isRemote) { - return; - } - - boolean a1, a2; - int u = 0; - a1 = b.isTicking(world, iStack); - a2 = false; - int SECONDS_TO_PROCESS = 1; - while (u < (20 * SECONDS_TO_PROCESS)) { - if (!a1) { - break; - } - a1 = b.isTicking(world, iStack); - a2 = b.tickItemTag(world, iStack); - u++; - } - Logger.MACHINE_INFO("| "+b.getUnlocalizedName()+" | "+a1+"/"+a2); - - if (!a1 && !a2) { - ItemStack replacement = ItemUtils.getSimpleStack(b.getDecayResult()); - replacement.stackSize = 1; - //iStack = replacement.copy(); - for (int fff = 0; fff < this.inventoryContents.getSizeInventory(); fff++) { - if (this.inventoryContents.getStackInSlot(fff) == iStack) { - this.inventoryContents.setInventorySlotContents(fff, replacement.copy()); - } - } - - updateSlots(); - this.inventoryContents. - markDirty(); - } - } - - public boolean anyPlayerInRange() { - return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null; - } - - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { - if (!nbt.hasKey(tag)) { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound nbt) { - super.writeToNBT(nbt); - // Utils.LOG_WARNING("Trying to write NBT data to TE."); - final NBTTagCompound chestData = new NBTTagCompound(); - this.inventoryContents.writeToNBT(chestData); - nbt.setTag("ContentsChest", chestData); - if (this.hasCustomInventoryName()) { - nbt.setString("CustomName", this.getCustomName()); - } - } - - @Override - public void readFromNBT(final NBTTagCompound nbt) { - super.readFromNBT(nbt); - // Utils.LOG_WARNING("Trying to read NBT data from TE."); - this.inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest")); - if (nbt.hasKey("CustomName", 8)) { - this.setCustomName(nbt.getString("CustomName")); - } - } - - @Override - public int getSizeInventory() { - return this.getInventory().getSizeInventory(); - } - - @Override - public ItemStack getStackInSlot(final int slot) { - return this.getInventory().getStackInSlot(slot); - } - - @Override - public ItemStack decrStackSize(final int slot, final int count) { - return this.getInventory().decrStackSize(slot, count); - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) { - return this.getInventory().getStackInSlotOnClosing(slot); - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) { - this.getInventory().setInventorySlotContents(slot, stack); - } - - @Override - public int getInventoryStackLimit() { - return this.getInventory().getInventoryStackLimit(); - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) { - return this.getInventory().isUseableByPlayer(entityplayer); - } - - @Override - public void openInventory() { - if (this.numPlayersUsing < 0) { - this.numPlayersUsing = 0; - } - if (!this.worldObj.isRemote) { - this.numPlayersUsing++; - cachedChestType = 1; - } - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, this.numPlayersUsing); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.getInventory().openInventory(); - } - - @Override - public void closeInventory() { - if (!this.worldObj.isRemote) { - this.numPlayersUsing--; - cachedChestType = 1; - } - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, this.numPlayersUsing); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.getInventory().closeInventory(); - } - - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - return this.getInventory().isItemValidForSlot(slot, itemstack); - } - - @Override - public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { - final int[] accessibleSides = new int[this.getSizeInventory()]; - for (int r = 0; r < this.getInventory().getSizeInventory(); r++) { - accessibleSides[r] = r; - } - return accessibleSides; - - } - - @Override - public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) { - return this.getInventory().isItemValidForSlot(0, p_102007_2_); - } - - @Override - public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) { - return this.getInventory().isItemValidForSlot(0, p_102008_2_); - } - - public String getCustomName() { - return this.customName; - } - - public void setCustomName(final String customName) { - this.customName = customName; - } - - @Override - public String getInventoryName() { - return this.hasCustomInventoryName() ? this.customName : "container.DecayablesChest"; - } - - @Override - public boolean hasCustomInventoryName() { - return (this.customName != null) && !this.customName.equals(""); - } - - /** - * Causes the TileEntity to reset all it's cached values for it's container - * Block, metadata and in the case of chests, the adjacent chest check - */ - public void updateContainingBlockInfo() { - super.updateContainingBlockInfo(); - this.adjacentChestChecked = false; - } - - /** - * Performs the check for adjacent chests to determine if this chest is double - * or not. - */ - public void checkForAdjacentChests() { - if (!this.adjacentChestChecked) { - this.adjacentChestChecked = true; - this.adjacentChestZNeg = null; - this.adjacentChestXPos = null; - this.adjacentChestXNeg = null; - this.adjacentChestZPos = null; - } - } - - public void updateEntityChest() { - float f; - this.prevLidAngle = this.lidAngle; - f = 0.04F; - double d2; - if (this.numPlayersUsing > 0 && this.lidAngle == 0.0F && this.adjacentChestZNeg == null - && this.adjacentChestXNeg == null) { - double d1 = (double) this.xCoord + 0.5D; - d2 = (double) this.zCoord + 0.5D; - this.worldObj.playSoundEffect(d1, (double) this.yCoord + 0.5D, d2, "random.chestopen", 0.5F, - this.worldObj.rand.nextFloat() * 0.1F + 0.9F); - } - - if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F) { - float f1 = this.lidAngle; - if (this.numPlayersUsing > 0) { - //this.lidAngle += f; - this.lidAngle += (float) (f * (1 + 0.10 * 0.01)); - } else { - //this.lidAngle -= f; - this.lidAngle -= (float) (f * (1 + 0.10 * 0.01)); - } - if (this.lidAngle > 1.0F) { - this.lidAngle = 1.0F; - } - float f2 = 0.5F; - if (this.lidAngle < f2 && f1 >= f2 && this.adjacentChestZNeg == null && this.adjacentChestXNeg == null) { - d2 = (double) this.xCoord + 0.5D; - double d0 = (double) this.zCoord + 0.5D; - this.worldObj.playSoundEffect(d2, (double) this.yCoord + 0.5D, d0, "random.chestclosed", 0.5F, - this.worldObj.rand.nextFloat() * 0.1F + 0.9F); - } - - if (this.lidAngle < 0.0F) { - this.lidAngle = 0.0F; - } - } - } - - /** - * Called when a client event is received with the event number and argument, - * see World.sendClientEvent - */ - public boolean receiveClientEvent(int p_145842_1_, int p_145842_2_) { - if (p_145842_1_ == 1) - { - this.numPlayersUsing = p_145842_2_; - return true; - } - else - { - return super.receiveClientEvent(p_145842_1_, p_145842_2_); - } - } - - /** - * invalidates a tile entity - */ - public final void invalidate() { - super.invalidate(); - cachedChestType = 1; - this.updateContainingBlockInfo(); - this.checkForAdjacentChests(); - } - - private final int updateSlots() { - //Have slots changed? - if (cachedChestType == 0) { - return 0; - } - ItemUtils.organiseInventory(getInventory()); - cachedChestType = 0; - return cachedChestType; - - } - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityEggBox.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityEggBox.java deleted file mode 100644 index 0c428537cb..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityEggBox.java +++ /dev/null @@ -1,359 +0,0 @@ -package gtPlusPlus.core.tileentities.general; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.inventories.Inventory_EggBox; -import gtPlusPlus.core.item.general.ItemGiantEgg; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class TileEntityEggBox extends TileEntity implements ISidedInventory { - - private final Inventory_EggBox inventoryContents; - - /** Determines if the check for adjacent chests has taken place. */ - public boolean adjacentChestChecked; - /** Contains the chest tile located adjacent to this one (if any) */ - public TileEntityEggBox adjacentChestZNeg; - /** Contains the chest tile located adjacent to this one (if any) */ - public TileEntityEggBox adjacentChestXPos; - /** Contains the chest tile located adjacent to this one (if any) */ - public TileEntityEggBox adjacentChestXNeg; - /** Contains the chest tile located adjacent to this one (if any) */ - public TileEntityEggBox adjacentChestZPos; - /** The current angle of the lid (between 0 and 1) */ - public float lidAngle; - /** The angle of the lid last tick */ - public float prevLidAngle; - /** The number of players currently using this chest */ - public int numPlayersUsing; - - private String customName; - - private int cachedChestType; - private int tickCount = 0; - - public TileEntityEggBox() { - this.inventoryContents = new Inventory_EggBox(); - } - - public Inventory_EggBox getInventory() { - return this.inventoryContents; - } - - @Override - public void updateEntity() { - - // Try do chesty stuff - try { - this.updateEntityChest(); - } catch (Throwable t) { - - } - - try { - if (!this.worldObj.isRemote) { - this.tickCount++; - if ((this.tickCount % 10) == 0) { - cachedChestType = 1; - } - - if ((this.tickCount % 20) == 0) { - for (ItemStack inv : this.getInventory().getInventory()) { - if (inv == null) { - continue; - } - if (inv.getItem() instanceof ItemGiantEgg) { - ItemGiantEgg D = (ItemGiantEgg) inv.getItem(); - tryUpdateDecayable(D, inv, this.worldObj); - } - } - - } - updateSlots(); - } - } catch (final Throwable t) { - } - } - - public void tryUpdateDecayable(final ItemGiantEgg d, ItemStack iStack, final World world) { - if (world == null || iStack == null) { - return; - } - if (world.isRemote) { - return; - } - - boolean a1, a2; - int u = 0; - a1 = d.isTicking(world, iStack); - a2 = false; - int SECONDS_TO_PROCESS = 1; - while (u < (20 * SECONDS_TO_PROCESS)) { - if (!a1) { - break; - } - a1 = d.isTicking(world, iStack); - a2 = d.tickItemTag(world, iStack); - u++; - } - Logger.MACHINE_INFO("| "+d.getUnlocalizedName()+" | "+a1+"/"+a2); - - if (!a1 && !a2) { - ItemStack replacement = ItemUtils.getSimpleStack(d.getHatchResult(), 1); - replacement.stackSize = 1; - //iStack = replacement.copy(); - for (int fff = 0; fff < this.inventoryContents.getSizeInventory(); fff++) { - if (this.inventoryContents.getStackInSlot(fff) == iStack) { - this.inventoryContents.setInventorySlotContents(fff, replacement.copy()); - } - } - - updateSlots(); - this.inventoryContents. - markDirty(); - } - } - - public boolean anyPlayerInRange() { - return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null; - } - - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { - if (!nbt.hasKey(tag)) { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound nbt) { - super.writeToNBT(nbt); - // Utils.LOG_WARNING("Trying to write NBT data to TE."); - final NBTTagCompound chestData = new NBTTagCompound(); - this.inventoryContents.writeToNBT(chestData); - nbt.setTag("ContentsChest", chestData); - if (this.hasCustomInventoryName()) { - nbt.setString("CustomName", this.getCustomName()); - } - } - - @Override - public void readFromNBT(final NBTTagCompound nbt) { - super.readFromNBT(nbt); - // Utils.LOG_WARNING("Trying to read NBT data from TE."); - this.inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest")); - if (nbt.hasKey("CustomName", 8)) { - this.setCustomName(nbt.getString("CustomName")); - } - } - - @Override - public int getSizeInventory() { - return this.getInventory().getSizeInventory(); - } - - @Override - public ItemStack getStackInSlot(final int slot) { - return this.getInventory().getStackInSlot(slot); - } - - @Override - public ItemStack decrStackSize(final int slot, final int count) { - return this.getInventory().decrStackSize(slot, count); - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) { - return this.getInventory().getStackInSlotOnClosing(slot); - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) { - this.getInventory().setInventorySlotContents(slot, stack); - } - - @Override - public int getInventoryStackLimit() { - return this.getInventory().getInventoryStackLimit(); - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) { - return this.getInventory().isUseableByPlayer(entityplayer); - } - - @Override - public void openInventory() { - if (this.numPlayersUsing < 0) { - this.numPlayersUsing = 0; - } - if (!this.worldObj.isRemote) { - this.numPlayersUsing++; - cachedChestType = 1; - } - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, this.numPlayersUsing); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.getInventory().openInventory(); - } - - @Override - public void closeInventory() { - if (!this.worldObj.isRemote) { - this.numPlayersUsing--; - cachedChestType = 1; - } - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, this.numPlayersUsing); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.getInventory().closeInventory(); - } - - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - return this.getInventory().isItemValidForSlot(slot, itemstack); - } - - @Override - public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { - final int[] accessibleSides = new int[this.getSizeInventory()]; - for (int r = 0; r < this.getInventory().getSizeInventory(); r++) { - accessibleSides[r] = r; - } - return accessibleSides; - - } - - @Override - public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) { - return this.getInventory().isItemValidForSlot(0, p_102007_2_); - } - - @Override - public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) { - return this.getInventory().isItemValidForSlot(0, p_102008_2_); - } - - public String getCustomName() { - return this.customName; - } - - public void setCustomName(final String customName) { - this.customName = customName; - } - - @Override - public String getInventoryName() { - return this.hasCustomInventoryName() ? this.customName : "container.EggBox"; - } - - @Override - public boolean hasCustomInventoryName() { - return (this.customName != null) && !this.customName.equals(""); - } - - /** - * Causes the TileEntity to reset all it's cached values for it's container - * Block, metadata and in the case of chests, the adjacent chest check - */ - public void updateContainingBlockInfo() { - super.updateContainingBlockInfo(); - this.adjacentChestChecked = false; - } - - /** - * Performs the check for adjacent chests to determine if this chest is double - * or not. - */ - public void checkForAdjacentChests() { - if (!this.adjacentChestChecked) { - this.adjacentChestChecked = true; - this.adjacentChestZNeg = null; - this.adjacentChestXPos = null; - this.adjacentChestXNeg = null; - this.adjacentChestZPos = null; - } - } - - public void updateEntityChest() { - float f; - this.prevLidAngle = this.lidAngle; - f = 0.04F; - double d2; - if (this.numPlayersUsing > 0 && this.lidAngle == 0.0F && this.adjacentChestZNeg == null - && this.adjacentChestXNeg == null) { - double d1 = (double) this.xCoord + 0.5D; - d2 = (double) this.zCoord + 0.5D; - this.worldObj.playSoundEffect(d1, (double) this.yCoord + 0.5D, d2, "random.chestopen", 0.5F, - this.worldObj.rand.nextFloat() * 0.1F + 0.9F); - } - - if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F) { - float f1 = this.lidAngle; - if (this.numPlayersUsing > 0) { - //this.lidAngle += f; - this.lidAngle += (float) (f * (1 + 0.10 * 0.01)); - } else { - //this.lidAngle -= f; - this.lidAngle -= (float) (f * (1 + 0.10 * 0.01)); - } - if (this.lidAngle > 1.0F) { - this.lidAngle = 1.0F; - } - float f2 = 0.5F; - if (this.lidAngle < f2 && f1 >= f2 && this.adjacentChestZNeg == null && this.adjacentChestXNeg == null) { - d2 = (double) this.xCoord + 0.5D; - double d0 = (double) this.zCoord + 0.5D; - this.worldObj.playSoundEffect(d2, (double) this.yCoord + 0.5D, d0, "random.chestclosed", 0.5F, - this.worldObj.rand.nextFloat() * 0.1F + 0.9F); - } - - if (this.lidAngle < 0.0F) { - this.lidAngle = 0.0F; - } - } - } - - /** - * Called when a client event is received with the event number and argument, - * see World.sendClientEvent - */ - public boolean receiveClientEvent(int p_145842_1_, int p_145842_2_) { - if (p_145842_1_ == 1) - { - this.numPlayersUsing = p_145842_2_; - return true; - } - else - { - return super.receiveClientEvent(p_145842_1_, p_145842_2_); - } - } - - /** - * invalidates a tile entity - */ - public final void invalidate() { - super.invalidate(); - cachedChestType = 1; - this.updateContainingBlockInfo(); - this.checkForAdjacentChests(); - } - - private final int updateSlots() { - //Have slots changed? - if (cachedChestType == 0) { - return 0; - } - ItemUtils.organiseInventory(getInventory()); - cachedChestType = 0; - return cachedChestType; - - } - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFirepit.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFirepit.java deleted file mode 100644 index 49fde8ee64..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFirepit.java +++ /dev/null @@ -1,39 +0,0 @@ -package gtPlusPlus.core.tileentities.general; - -import java.util.UUID; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; - -public class TileEntityFirepit extends TileEntity{ - - private UUID ownerUUID; - - public UUID getOwnerUUID() { - return this.ownerUUID; - } - - public void setOwnerUUID(final UUID ownerUUID) { - this.ownerUUID = ownerUUID; - this.markDirty(); - } - - @Override - public void writeToNBT(final NBTTagCompound tagCompound) { - super.writeToNBT(tagCompound); - - final UUID ownerUUID = this.getOwnerUUID(); - if (ownerUUID != null){ - tagCompound.setLong("OwnerUUIDMost", ownerUUID.getMostSignificantBits()); - tagCompound.setLong("OwnerUUIDLeast", ownerUUID.getLeastSignificantBits()); - } - } - - @Override - public void readFromNBT(final NBTTagCompound tagCompound) { - super.readFromNBT(tagCompound); - - this.setOwnerUUID(new UUID(tagCompound.getLong("OwnerUUIDMost"), tagCompound.getLong("OwnerUUIDLeast"))); - } - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java deleted file mode 100644 index beff269428..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java +++ /dev/null @@ -1,410 +0,0 @@ -package gtPlusPlus.core.tileentities.general; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; - -import gregtech.api.util.GT_Utility; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.InventoryFishTrap; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraftforge.common.FishingHooks; - -public class TileEntityFishTrap extends TileEntity implements ISidedInventory { - - private int tickCount = 0; - private boolean isInWater = false; - private final InventoryFishTrap inventoryContents; - private String customName; - private int locationX; - private int locationY; - private int locationZ; - private int waterSides = 0; - private int baseTickRate = 600 * 5; - - public TileEntityFishTrap() { - this.inventoryContents = new InventoryFishTrap();// number of slots - - // without product - // slot - this.setTileLocation(); - } - - public boolean setTileLocation() { - if (this.hasWorldObj()) { - if (!this.getWorldObj().isRemote) { - this.locationX = this.xCoord; - this.locationY = this.yCoord; - this.locationZ = this.zCoord; - return true; - } - } - return false; - } - - public final boolean isSurroundedByWater() { - this.setTileLocation(); - final Block[] surroundingBlocks = new Block[6]; - if (this.hasWorldObj()) { - if (!this.getWorldObj().isRemote) { - surroundingBlocks[0] = this.worldObj.getBlock(this.locationX, this.locationY + 1, this.locationZ); // Above - surroundingBlocks[1] = this.worldObj.getBlock(this.locationX, this.locationY - 1, this.locationZ); // Below - surroundingBlocks[2] = this.worldObj.getBlock(this.locationX + 1, this.locationY, this.locationZ); - surroundingBlocks[3] = this.worldObj.getBlock(this.locationX - 1, this.locationY, this.locationZ); - surroundingBlocks[4] = this.worldObj.getBlock(this.locationX, this.locationY, this.locationZ + 1); - surroundingBlocks[5] = this.worldObj.getBlock(this.locationX, this.locationY, this.locationZ - 1); - int waterCount = 0; - int trapCount = 0; - for (final Block checkBlock : surroundingBlocks) { - if ((checkBlock == Blocks.water) || (checkBlock == Blocks.flowing_water) - || checkBlock.getUnlocalizedName().toLowerCase().contains("water") - || (checkBlock == ModBlocks.blockFishTrap)) { - if (checkBlock != ModBlocks.blockFishTrap) { - waterCount++; - } - else { - waterCount++; - trapCount++; - } - } - } - if ((waterCount >= 2) && (trapCount <= 4)) { - int aCheck = trapCount + waterCount; - this.waterSides = MathUtils.balance(aCheck, 0, 6); - Logger.MACHINE_INFO("Valid Trap. "+waterCount+" | "+(this.tickCount/20)+"/"+(this.baseTickRate/20)); - return true; - } - else if ((waterCount >= 2) && (trapCount > 4)) { - Logger.MACHINE_INFO("Too many fish traps surrounding this one."); - Logger.MACHINE_INFO("Not adding Loot to the fishtrap at x[" + this.locationX + "] y[" + this.locationY - + "] z[" + this.locationZ + "] (Ticking for loot every " + this.baseTickRate + " ticks)"); - } - } - } - // Utils.LOG_MACHINE_INFO("Error finding water"); - return false; - } - - public InventoryFishTrap getInventory() { - return this.inventoryContents; - } - - public boolean tryAddLoot() { - if (this.getInventory().getInventory() != null) { - int checkingSlot = 0; - ItemUtils.organiseInventory(getInventory()); - final ItemStack loot = this.generateLootForFishTrap().copy(); - try { - //Utils.LOG_MACHINE_INFO("Trying to add "+loot.getDisplayName()+" | "+loot.getItemDamage()); - for (final ItemStack contents : this.getInventory().getInventory()) { - - - if (GT_Utility.areStacksEqual(loot, contents)){ - if (contents.stackSize < contents.getMaxStackSize()) { - //Utils.LOG_MACHINE_INFO("3-Trying to add one more "+loot.getDisplayName()+"meta: "+loot.getItemDamage()+" to an existing stack of "+contents.getDisplayName()+" with a size of "+contents.stackSize); - contents.stackSize++; - this.markDirty(); - return true; - } - } - checkingSlot++; - } - checkingSlot = 0; - for (final ItemStack contents : this.getInventory().getInventory()) { - if (contents == null) { - //Utils.LOG_MACHINE_INFO("Adding Item To Empty Slot. "+(checkingSlot+1)); - this.getInventory().setInventorySlotContents(checkingSlot, loot); - this.markDirty(); - return true; - } - checkingSlot++; - } - } - catch (final NullPointerException n) { - } - } - this.markDirty(); - return false; - } - - private ItemStack generateLootForFishTrap() { - final int lootWeight = MathUtils.randInt(0, 100); - ItemStack loot; - if (lootWeight <= 5) { - loot = ItemUtils.getSimpleStack(Items.slime_ball); - } - else if (lootWeight <= 10) { - loot = ItemUtils.getSimpleStack(Items.bone); - } - else if (lootWeight <= 15) { - loot = ItemUtils.getSimpleStack(Blocks.sand); - } - else if (lootWeight <= 20) { - loot = ItemUtils.simpleMetaStack(Items.dye, 0, 1); - } - // Junk Loot - else if (lootWeight <= 23) { - if (LoadedMods.PamsHarvestcraft) { - loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken(seaweed, 1); - } - else { - loot = ItemUtils.getSimpleStack(Blocks.dirt); - } - } - // Pam Fish - else if (lootWeight <= 99) { - final Random xstr = new Random(); - loot = FishingHooks.getRandomFishable(xstr, 100); - } - - else if (lootWeight == 100){ - final int rareLoot = MathUtils.randInt(1, 10); - if (rareLoot <= 4) { - loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nuggetIron", 1); - if (loot == null){ - loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotIron", 1); - } - } - else if (rareLoot <= 7) { - loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nuggetGold", 1); - if (loot == null){ - loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotGold", 1); - } - } - else if (rareLoot <= 9){ - loot = ItemUtils.getSimpleStack(Items.emerald); - } - else { - loot = ItemUtils.getSimpleStack(Items.diamond); - } - } - else { - loot = ItemUtils.getSimpleStack(Blocks.diamond_ore); - } - loot.stackSize=1; - Logger.MACHINE_INFO("Adding x"+loot.stackSize+" "+loot.getDisplayName()+"."); - return loot; - } - - @Override - public void updateEntity() { - try{ - if (!this.worldObj.isRemote) { - this.tickCount++; - //Logger.MACHINE_INFO("Ticking "+this.tickCount); - // Check if the Tile is within water once per second. - if ((this.tickCount % 20) == 0) { - this.isInWater = this.isSurroundedByWater(); - } - - if (this.isInWater) { - this.calculateTickrate(); - } - - // Try add some loot once every 30 seconds. - if (this.tickCount >= this.baseTickRate) { - if (this.isInWater) { - // Add loot - Logger.MACHINE_INFO("Adding Loot to the fishtrap at x["+this.locationX+"] y["+this.locationY+"] z["+this.locationZ+"] (Ticking for loot every "+this.baseTickRate+" ticks)"); - - int aExtraLootChance = MathUtils.randInt(1, 1000); - if (aExtraLootChance >= 999) { - this.tryAddLoot(); - this.tryAddLoot(); - this.tryAddLoot(); - } - else { - this.tryAddLoot(); - } - - this.markDirty(); - } - else { - Logger.MACHINE_INFO("Not in water."); - this.markDirty(); - } - this.tickCount = 0; - } - if (this.tickCount >= (this.baseTickRate + 500)) { - Logger.MACHINE_INFO("Resetting tick counter"); - this.tickCount = 0; - } - - } - } - catch (final Throwable t){} - } - - public void calculateTickrate() { - int water = this.waterSides; - //int variance = (int) ((MathUtils.randInt(-200, 200)/water)*0.5); - if (water <= 1) { - this.baseTickRate = 0; - } else if (water == 2) { - this.baseTickRate = 6800; - } else if (water == 3) { - this.baseTickRate = 5600; - } else if (water == 4) { - this.baseTickRate = 4400; - } else if (water == 5) { - this.baseTickRate = 3200; - } else { - this.baseTickRate = 1750; - } - if (water > 1) { - //this.baseTickRate += variance; - } - } - - public boolean anyPlayerInRange() { - return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null; - } - - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { - if (!nbt.hasKey(tag)) { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound nbt) { - super.writeToNBT(nbt); - // Utils.LOG_MACHINE_INFO("Trying to write NBT data to TE."); - final NBTTagCompound chestData = new NBTTagCompound(); - this.inventoryContents.writeToNBT(chestData); - nbt.setTag("ContentsChest", chestData); - if (this.hasCustomInventoryName()) { - nbt.setString("CustomName", this.getCustomName()); - } - } - - @Override - public void readFromNBT(final NBTTagCompound nbt) { - super.readFromNBT(nbt); - // Utils.LOG_MACHINE_INFO("Trying to read NBT data from TE."); - this.inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest")); - if (nbt.hasKey("CustomName", 8)) { - this.setCustomName(nbt.getString("CustomName")); - } - } - - final static String prefix = "food"; - final static String suffix = "raw"; - final static String seaweed = "cropSeaweed"; - final static String greenheartFish = "Greenheartfish"; - private static final String[] harvestcraftFish = { "Anchovy", "Bass", "Carp", "Catfish", "Charr", "Clam", "Crab", - "Crayfish", "Eel", "Frog", "Grouper", "Herring", "Jellyfish", "Mudfish", "Octopus", "Perch", "Scallop", - "Shrimp", "Snail", "Snapper", "Tilapia", "Trout", "Tuna", "Turtle", "Walleye" }; - - public static void pamsHarvestCraftCompat() { - for (int i = 0; i < harvestcraftFish.length; i++) { - - } - } - - @Override - public int getSizeInventory() { - return this.getInventory().getSizeInventory(); - } - - @Override - public ItemStack getStackInSlot(final int slot) { - return this.getInventory().getStackInSlot(slot); - } - - @Override - public ItemStack decrStackSize(final int slot, final int count) { - return this.getInventory().decrStackSize(slot, count); - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) { - return this.getInventory().getStackInSlotOnClosing(slot); - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) { - this.getInventory().setInventorySlotContents(slot, stack); - } - - @Override - public int getInventoryStackLimit() { - return this.getInventory().getInventoryStackLimit(); - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) { - return this.getInventory().isUseableByPlayer(entityplayer); - } - - @Override - public void openInventory() { - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.getInventory().openInventory(); - } - - @Override - public void closeInventory() { - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.getInventory().closeInventory(); - } - - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - return this.getInventory().isItemValidForSlot(slot, itemstack); - } - - @Override - public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { - final int[] accessibleSides = new int[this.getSizeInventory()]; - for (int r=0; r<this.getInventory().getSizeInventory(); r++){ - accessibleSides[r]=r; - } - return accessibleSides; - - } - - @Override - public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) { - return false; - } - - @Override - public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) { - return true; - } - - public String getCustomName() { - return this.customName; - } - - public void setCustomName(final String customName) { - this.customName = customName; - } - - @Override - public String getInventoryName() { - return this.hasCustomInventoryName() ? this.customName : "container.fishtrap"; - } - - @Override - public boolean hasCustomInventoryName() { - return (this.customName != null) && !this.customName.equals(""); - } - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityHeliumGenerator.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityHeliumGenerator.java deleted file mode 100644 index 8a2d9d9f51..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityHeliumGenerator.java +++ /dev/null @@ -1,124 +0,0 @@ -package gtPlusPlus.core.tileentities.general; - -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; - -import gregtech.api.enums.GT_Values; - -import gtPlusPlus.core.inventories.InventoryHeliumGenerator; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class TileEntityHeliumGenerator extends TileEntity{ - - private int tickCount = 0; - private final InventoryHeliumGenerator inventoryContents; //TODO - private int locationX; - private int locationY; - private int locationZ; - private int baseTickRate = 1200; - - public TileEntityHeliumGenerator(){ - this.inventoryContents = new InventoryHeliumGenerator();//number of slots - without product slot - this.setTileLocation(); - } - - public boolean setTileLocation(){ - if (this.hasWorldObj()){ - if (!this.getWorldObj().isRemote){ - this.locationX = this.xCoord; - this.locationY = this.yCoord; - this.locationZ = this.zCoord; - return true; - } - } - return false; - } - - public InventoryHeliumGenerator getInventory(){ - return this.inventoryContents; - } - - public boolean tryAddLoot(){ - if (this.getInventory().getInventory() != null){ - int checkingSlot = 0; - final ItemStack loot = this.generateLootForFishTrap(); - for (final ItemStack contents : this.getInventory().getInventory()){ - if (contents == null){ - this.getInventory().setInventorySlotContents(checkingSlot, loot); - this.markDirty(); - return true; - } - else if (contents.getItem() == loot.getItem()){ - if (contents.stackSize < contents.getMaxStackSize()){ - contents.stackSize++; - this.markDirty(); - return true; - } - else { - this.getInventory().setInventorySlotContents(checkingSlot, loot); - this.markDirty(); - return true; - } - } - else { - - } - checkingSlot++; - } - } - this.markDirty(); - return false; - } - - private ItemStack generateLootForFishTrap() { - final int lootWeight = MathUtils.randInt(0, 1000); - ItemStack loot = GT_Values.NI; - if (lootWeight > 990){ - loot = ItemUtils.getSimpleStack(Items.slime_ball); - } - return loot; - } - - @Override - public void updateEntity(){ - if (!this.worldObj.isRemote){ - - } - } - - public void calculateTickrate(){ - int calculateTickrate = 0; - this.baseTickRate = calculateTickrate; - } - - public boolean anyPlayerInRange(){ - return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null; - } - - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag){ - if(!nbt.hasKey(tag)){ - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound nbt){ - super.writeToNBT(nbt); - //Utils.LOG_INFO("Trying to write NBT data to TE."); - final NBTTagCompound chestData = new NBTTagCompound(); - this.inventoryContents.writeToNBT(chestData); - nbt.setTag("ContentsChest", chestData); - } - - @Override - public void readFromNBT(final NBTTagCompound nbt){ - super.readFromNBT(nbt); - //Utils.LOG_INFO("Trying to read NBT data from TE."); - this.inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest")); - } - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityInfiniteFluid.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityInfiniteFluid.java deleted file mode 100644 index 9ddf2065bc..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityInfiniteFluid.java +++ /dev/null @@ -1,139 +0,0 @@ -package gtPlusPlus.core.tileentities.general; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.tileentity.TileEntity; - -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.*; - -public class TileEntityInfiniteFluid extends TileEntity implements IFluidHandler { - - public FluidTank tank = new FluidTank(Integer.MAX_VALUE); - private boolean needsUpdate = false; - private int updateTimer = 0; - - public TileEntityInfiniteFluid() { - } - - @Override - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { - needsUpdate = true; - return this.tank.fill(resource, doFill); - } - - @Override - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { - needsUpdate = true; - return this.tank.drain(resource.amount, doDrain); - } - - @Override - public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { - needsUpdate = true; - FluidStack fluid = this.tank.getFluid(); - // return this.tank.drain(maxDrain, doDrain); - if (fluid == null) { - return null; - } - - int drained = maxDrain; - if (fluid.amount < drained) { - drained = fluid.amount; - } - - FluidStack stack = new FluidStack(fluid, drained); - if (doDrain) { - fluid.amount -= drained; - if (fluid.amount <= 0) { - fluid = null; - } - - if (this != null) { - FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluid, this.getWorldObj(), this.xCoord, - this.yCoord, this.zCoord, this.tank, 0)); - } - } - return stack; - } - - @Override - public boolean canFill(ForgeDirection from, Fluid fluid) { - return true; - } - - @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) { - return true; - } - - @Override - public FluidTankInfo[] getTankInfo(ForgeDirection from) { - return new FluidTankInfo[] { this.tank.getInfo() }; - } - - public float getAdjustedVolume() { - needsUpdate = true; - float amount = tank.getFluidAmount(); - float capacity = tank.getCapacity(); - float volume = (amount / capacity) * 0.8F; - return volume; - } - - @Override - public void updateEntity() { - - if (this.tank.getFluid() != null){ - FluidStack bigStorage = this.tank.getFluid(); - bigStorage.amount = this.tank.getCapacity(); - this.tank.setFluid(bigStorage); - } - - if (needsUpdate) { - - if (this.tank.getFluid() != null){ - FluidStack bigStorage = this.tank.getFluid(); - bigStorage.amount = this.tank.getCapacity(); - this.tank.setFluid(bigStorage); - } - - if (updateTimer == 0) { - updateTimer = 10; // every 10 ticks it will send an update - } else { - --updateTimer; - if (updateTimer == 0) { - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - needsUpdate = false; - } - } - } - } - - @Override - public void readFromNBT(NBTTagCompound tag) { - tank.readFromNBT(tag); - super.readFromNBT(tag); - } - - @Override - public void writeToNBT(NBTTagCompound tag) { - tank.writeToNBT(tag); - super.writeToNBT(tag); - } - - @Override - public Packet getDescriptionPacket() { - NBTTagCompound tag = new NBTTagCompound(); - writeToNBT(tag); - return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tag); - } - - @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { - NBTTagCompound tag = pkt.func_148857_g(); - readFromNBT(tag); - } - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityPlayerDoorBase.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityPlayerDoorBase.java deleted file mode 100644 index 48f05fe0fd..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityPlayerDoorBase.java +++ /dev/null @@ -1,285 +0,0 @@ -package gtPlusPlus.core.tileentities.general; - -import java.util.ArrayList; -import java.util.List; - -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import net.minecraft.block.Block; -import net.minecraft.block.BlockDoor; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; - -public class TileEntityPlayerDoorBase extends TileEntity { - - public boolean mIsOpen = false; - private short mMeta = 0; - private long mTickCounter = 0; - private final Block mBlockType; - private BlockPos mNeighbourDoor; - - public TileEntityPlayerDoorBase(Block aBlock, int meta) { - mBlockType = aBlock; - } - - @Override - public void readFromNBT(NBTTagCompound aNBT) { - super.readFromNBT(aNBT); - this.mIsOpen = aNBT.getBoolean("mIsOpen"); - } - - @Override - public void writeToNBT(NBTTagCompound aNBT) { - super.writeToNBT(aNBT); - aNBT.setBoolean("mIsOpen", mIsOpen); - } - - public int getNeighbourState() { - - if (mNeighbourDoor != null) { - World aWorld = this.worldObj; - if (aWorld != null) { - TileEntity t = aWorld.getTileEntity(mNeighbourDoor.xPos, mNeighbourDoor.yPos, mNeighbourDoor.zPos); - // Custom Door - if (t != null) { - if (t instanceof TileEntityPlayerDoorBase) { - TileEntityPlayerDoorBase d = (TileEntityPlayerDoorBase) t; - if (d.mIsOpen) { - return 100; - } else { - return -100; - } - } else - return -100; - } - // Vanilla Door - else { - Block aBlock = mNeighbourDoor.getBlockAtPos(); - BlockDoor aDoor = (aBlock instanceof BlockDoor ? (BlockDoor) aBlock : null); - if (aDoor != null) { - int i1 = aDoor.func_150012_g(mNeighbourDoor.world, mNeighbourDoor.xPos, mNeighbourDoor.yPos, - mNeighbourDoor.zPos); - if ((i1 & 4) != 0) { - return 100; - } else { - return -100; - } - } - } - } - } - return 0; - } - - AutoMap<Entity> mNearbyEntityCache = new AutoMap<Entity>(); - - @Override - public void updateEntity() { - - if (this.getWorldObj().isRemote) { - return; - } - - // Look For Neighbours - if (mTickCounter % 100 == 0 || mTickCounter == 0) { - World aWorld = this.getWorldObj(); - BlockPos aThisPos = new BlockPos(xCoord, yCoord, zCoord, aWorld); - BlockPos[] aNeighbors = new BlockPos[4]; - aNeighbors[0] = aThisPos.getXNeg(); - aNeighbors[1] = aThisPos.getXPos(); - aNeighbors[2] = aThisPos.getZNeg(); - aNeighbors[3] = aThisPos.getZPos(); - boolean aFoundDoor = false; - for (BlockPos b : aNeighbors) { - Block aBlock = aWorld.getBlock(b.xPos, b.yPos, b.zPos); - BlockDoor aDoor = (aBlock instanceof BlockDoor ? (BlockDoor) aBlock : null); - if (aDoor != null) { - mNeighbourDoor = b; - aFoundDoor = true; - if (mMeta == 0) { - TileEntity t = aWorld.getTileEntity(b.xPos, b.yPos, b.zPos); - if (t != null) { - if (t instanceof TileEntityPlayerDoorBase) { - TileEntityPlayerDoorBase d = (TileEntityPlayerDoorBase) t; - if (d.mMeta != 0) { - //Logger.INFO("Found Door with Mode set other than 0, assuming slave role."); - mMeta = -1; - } - else { - //Logger.INFO("Found door with no mode set, assuming we are master."); - mMeta = 1; - } - } - else { - //Logger.INFO("Custom door from another mod, assuming slave role."); - mMeta = -1; - } - } - else { - //Logger.INFO("No Tile Entity found, Door is probably vanilla, assuming slave role."); - mMeta = -1; - } - } - break; - } - } - if (mMeta < 1 && !aFoundDoor) { - //Logger.INFO("Found No Valid Doors around, setting this one to master mode."); - mMeta = 1; - } - } - - World aWorld = this.getWorldObj(); - Block aBlock = aWorld.getBlock(xCoord, yCoord, zCoord); - BlockPos aThisPos = new BlockPos(xCoord, yCoord, zCoord, this.worldObj); - - if (mTickCounter % 20 == 0) { - int x = 0, y = 0, z = 0; - x = this.xCoord; - y = this.yCoord; - z = this.zCoord; - //List aEntityList = aWorld.loadedEntityList; - List<Entity> aEntityList = new ArrayList<Entity>(); - Chunk aThisChunk = aWorld.getChunkFromBlockCoords(x, z); - for (List l : aThisChunk.entityLists) { - aEntityList.addAll(l); - } - for (Object o : aEntityList) { - if (o != null) { - if (o instanceof Entity) { - if (o instanceof EntityPlayer) { - continue; - } - else { - Entity e = (Entity) o; - BlockPos p = EntityUtils.findBlockPosUnderEntity(e); - if (p != null) { - int newY = p.yPos+1; - if (e.getDistance(xCoord, yCoord, zCoord) <= 2){ - mNearbyEntityCache.put(e); - } - else if (aThisPos.distanceFrom(p.xPos, newY, p.zPos) <= 2) { - mNearbyEntityCache.put(e); - } - } - } - } - } - } - } - - if (mTickCounter % 4 == 0) { - for (Entity y : mNearbyEntityCache) { - if (y.getDistance(xCoord, yCoord, zCoord) > 2){ - mNearbyEntityCache.remove(y); - } - } - - boolean foundMonster = mNearbyEntityCache.size() > 0; - int aNeighbourDoorState = 0; - if (mNeighbourDoor != null) { - aNeighbourDoorState = getNeighbourState(); - } - BlockDoor aDoor = (aBlock instanceof BlockDoor ? (BlockDoor) aBlock : null); - boolean aPlayers = checkForPlayers(this.getWorldObj()); - - if (aDoor != null) { - //If neighbour state != 0 and we are in slave mode - if (aNeighbourDoorState != 0 && mMeta == -1) { - if (aNeighbourDoorState == 100) { - if (!mIsOpen && !foundMonster) { - //Logger.INFO("Opening Door (Slave)"); - aDoor.func_150014_a(aWorld, this.xCoord, this.yCoord, this.zCoord, true); - mIsOpen = true; - } - } else if (aNeighbourDoorState == -100 || foundMonster) { - if (mIsOpen) { - //Logger.INFO("Closing Door (Slave)"); - aDoor.func_150014_a(aWorld, this.xCoord, this.yCoord, this.zCoord, false); - mIsOpen = false; - } - } - //We are master, proceed - } else { - //No redstone found, allow automatic handling - if (aDoor != null && !hasRedstone()) { - //Found a nearby player - if (aPlayers) { - //If we are closed and there are no monsters nearby, open - if (!mIsOpen && !foundMonster) { - //Logger.INFO("Opening Door (Mstr)"); - aDoor.func_150014_a(aWorld, this.xCoord, this.yCoord, this.zCoord, true); - mIsOpen = true; - } else { - // Logger.INFO("Doing Nothing, Door is in correct state."); - } - //Did not find nearby player - } else { - //If we are open or there is a monster nearby, close. - if (mIsOpen || foundMonster) { - //Logger.INFO("Closing Door (Mstr)"); - aDoor.func_150014_a(aWorld, this.xCoord, this.yCoord, this.zCoord, false); - mIsOpen = false; - } else { - // Logger.INFO("Doing Nothing, Door is in correct state."); - } - } - } - } - } - - } - super.updateEntity(); - mTickCounter++; - } - - @Override - public int getBlockMetadata() { - return this.mMeta; - } - - public boolean hasRedstone() { - World aWorld = this.worldObj; - if (aWorld != null && !aWorld.isRemote) { - return aWorld.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord) - || aWorld.isBlockIndirectlyGettingPowered(xCoord, yCoord + 1, zCoord); - } - return false; - } - - @Override - public Block getBlockType() { - return mBlockType; - } - - @Override - public boolean canUpdate() { - return true; - } - - private boolean checkForPlayers(World aWorld) { - int x = 0, y = 0, z = 0; - x = this.xCoord; - y = this.yCoord; - z = this.zCoord; - EntityPlayer aPlayer = aWorld.getClosestPlayer(x, y, z, 3.5D); - if (aPlayer != null) { - return true; - } - return false; - } - - private short getClosedMeta() { - return 0; - } - - private short getOpenMeta() { - return 1; - } - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityReverter.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityReverter.java deleted file mode 100644 index 6e18834786..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityReverter.java +++ /dev/null @@ -1,312 +0,0 @@ -package gtPlusPlus.core.tileentities.general; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.tileentity.TileEntity; - -import gtPlusPlus.core.block.ModBlocks; - - - -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; - - @Override - public boolean canUpdate(){ - return true; - } - - @Override - public void updateEntity() - { - if (this.anyPlayerInRange()) - { - this.tickCount += 1; - if (this.worldObj.isRemote) - { - final double var1 = this.xCoord + this.worldObj.rand.nextFloat(); - final double var3 = this.yCoord + this.worldObj.rand.nextFloat(); - final 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) - { - this.makeRandomOutline(); - this.makeRandomOutline(); - this.makeRandomOutline(); - } - } - else - { - if ((this.blockData == null) || (this.metaData == null)) - { - this.captureBlockData(); - this.slowScan = true; - } - if ((!this.slowScan) || ((this.tickCount % 20) == 0)) { - if (this.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() - { - this.makeOutline(this.rand.nextInt(12)); - } - - private void makeOutline(final 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()) { - this.drawParticleLine(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, dx, dy, dz); - } else { - this.drawParticleLine(sx, sy, sz, this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D); - } - this.drawParticleLine(sx, sy, sz, dx, dy, dz); - } - - protected void drawParticleLine(final double srcX, final double srcY, final double srcZ, final double destX, final double destY, final double destZ) - { - final int particles = 16; - for (int i = 0; i < particles; i++) - { - final double trailFactor = i / (particles - 1.0D); - - final double tx = srcX + ((destX - srcX) * trailFactor) + (this.rand.nextFloat() * 0.005D); - final double ty = srcY + ((destY - srcY) * trailFactor) + (this.rand.nextFloat() * 0.005D); - final 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++) - { - final Block blockID = this.worldObj.getBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z); - final byte meta = (byte)this.worldObj.getBlockMetadata(this.xCoord + x, this.yCoord + y, this.zCoord + z); - if (this.blockData[index] != blockID) { - if (this.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(final int x, final int y, final int z, final Block thereBlockID, final byte thereMeta, final 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 (this.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(final Block thereBlockID, final byte thereMeta, final Block replaceBlockID, final 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++) - { - final Block blockID = this.worldObj.getBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z); - final 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/gtPlusPlus/core/tileentities/general/TileEntityVolumetricFlaskSetter.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityVolumetricFlaskSetter.java deleted file mode 100644 index 5b837397b1..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityVolumetricFlaskSetter.java +++ /dev/null @@ -1,403 +0,0 @@ -package gtPlusPlus.core.tileentities.general; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.container.Container_VolumetricFlaskSetter; -import gtPlusPlus.core.inventories.Inventory_VolumetricFlaskSetter; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.common.helpers.VolumetricFlaskHelper; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.fluids.FluidStack; - -public class TileEntityVolumetricFlaskSetter extends TileEntity implements ISidedInventory { - - private int tickCount = 0; - private final Inventory_VolumetricFlaskSetter inventoryContents; - private String customName; - public int locationX; - public int locationY; - public int locationZ; - private int aCurrentMode = 0; - private short aCustomValue = 1000; - - public TileEntityVolumetricFlaskSetter() { - this.inventoryContents = new Inventory_VolumetricFlaskSetter(); - this.setTileLocation(); - } - - public short getCustomValue() { - //Logger.INFO("Value: "+this.aCustomValue); - return this.aCustomValue; - } - - public void setCustomValue(int aVal) { - Logger.INFO("Old Value: "+this.aCustomValue); - this.aCustomValue = (short) MathUtils.balance(aVal, 0, Short.MAX_VALUE); - Logger.INFO("New Value: "+this.aCustomValue); - markDirty(); - } - - public boolean setTileLocation() { - if (this.hasWorldObj()) { - if (!this.getWorldObj().isRemote) { - this.locationX = this.xCoord; - this.locationY = this.yCoord; - this.locationZ = this.zCoord; - return true; - } - } - return false; - } - - //Rename to hasCircuitToConfigure - public final boolean hasFlask() { - for (int i=0;i<this.getInventory().getInventory().length-1;i++) { - if (i == Container_VolumetricFlaskSetter.SLOT_OUTPUT) { - continue; - } - if (this.getInventory().getInventory()[i] != null) { - return true; - } - } - return false; - } - - public Inventory_VolumetricFlaskSetter getInventory() { - return this.inventoryContents; - } - - private int getFlaskType(ItemStack aStack) { - if (VolumetricFlaskHelper.isNormalVolumetricFlask(aStack)) { - return 1; - } - else if (VolumetricFlaskHelper.isLargeVolumetricFlask(aStack)) { - return 2; - } - else if (VolumetricFlaskHelper.isGiganticVolumetricFlask(aStack)) { - return 3; - } - return 0; - } - - private int getCapacityForSlot(int aSlot) { - switch (aSlot) { - case 0: //16 - return 16; - case 1: //36 - return 36; - case 2: //144 - return 144; - case 3: //432 - return 432; - case 4: //576 - return 576; - case 5: //720 - return 720; - case 6: //864 - return 864; - case 7: //Custom - return getCustomValue(); - } - return 1000; - } - - public boolean addOutput() { - - // Don't do anything unless we have items - if (!hasFlask()) { - Logger.INFO("No Flasks."); - return false; - } - - - ItemStack[] aInputs = this.getInventory().getInventory().clone(); - - - //Check if there is output in slot. - Boolean hasOutput = false; - if (aInputs[Container_VolumetricFlaskSetter.SLOT_OUTPUT] != null) { - hasOutput = true; - if (aInputs[Container_VolumetricFlaskSetter.SLOT_OUTPUT].stackSize >= 16) { - return false; - } - } - AutoMap<Integer> aValidSlots = new AutoMap<Integer>(); - int aSlotCount = 0; - for (ItemStack i : aInputs) { - if (i != null) { - aValidSlots.put(aSlotCount); - } - aSlotCount++; - } - for (int e : aValidSlots) { - - // Skip slot 7 (Custom) unless it has a value > 0 - if (e == 7 && getCustomValue() <= 0) { - Logger.INFO("Skipping Custom slot as value <= 0"); - continue; - } - if (e == Container_VolumetricFlaskSetter.SLOT_OUTPUT) { - continue; - } - - boolean doAdd = false; - ItemStack g = this.getStackInSlot(e); - FluidStack aInputFluidStack = VolumetricFlaskHelper.getFlaskFluid(g); - int aSize = 0; - ItemStack aInputStack = null; - int aTypeInSlot = getFlaskType(g); - if (aTypeInSlot > 0 && g != null) { - // No Existing Output - if (!hasOutput) { - aSize = g.stackSize; - doAdd = true; - } - // Existing Output - else { - ItemStack f = aInputs[Container_VolumetricFlaskSetter.SLOT_OUTPUT]; - FluidStack aFluidInCheckedSlot = VolumetricFlaskHelper.getFlaskFluid(f); - int aTypeInCheckedSlot = getFlaskType(f); - // Check that the Circuit in the Output slot is not null and the same type as the circuit input. - if (aTypeInCheckedSlot > 0 && (aTypeInSlot == aTypeInCheckedSlot) && f != null) { - if (g.getItem() == f.getItem() && VolumetricFlaskHelper.getFlaskCapacity(f) == getCapacityForSlot(e) && ((aInputFluidStack == null && aFluidInCheckedSlot == null) || aInputFluidStack.isFluidEqual(aFluidInCheckedSlot))) { - Logger.INFO("Input Slot Flask Contains: "+(aInputFluidStack != null ? aInputFluidStack.getLocalizedName() : "Empty")); - Logger.INFO("Output Slot Flask Contains: "+(aFluidInCheckedSlot != null ? aFluidInCheckedSlot.getLocalizedName() : "Empty")); - aSize = f.stackSize + g.stackSize; - if (aSize > 16) { - aInputStack = g.copy(); - aInputStack.stackSize = (aSize-16); - } - doAdd = true; - } - } - } - if (doAdd) { - // Check Circuit Type - ItemStack aOutput; - FluidStack aOutputFluid = null; - if (!VolumetricFlaskHelper.isFlaskEmpty(g)) { - aOutputFluid = aInputFluidStack.copy(); - } - if (aTypeInSlot == 1) { - aOutput = VolumetricFlaskHelper.getVolumetricFlask(1); - } - else if (aTypeInSlot == 2) { - aOutput = VolumetricFlaskHelper.getLargeVolumetricFlask(1); - } - else if (aTypeInSlot == 3) { - aOutput = VolumetricFlaskHelper.getGiganticVolumetricFlask(1); - } - else { - aOutput = null; - } - if (aOutput != null) { - aOutput.stackSize = aSize; - int aCapacity = getCapacityForSlot(e); - VolumetricFlaskHelper.setNewFlaskCapacity(aOutput, aCapacity); - if (aOutputFluid != null) { - if (aOutputFluid.amount > aCapacity) { - aOutputFluid.amount = aCapacity; - } - VolumetricFlaskHelper.setFluid(aOutput, aOutputFluid); - } - this.setInventorySlotContents(e, aInputStack); - this.setInventorySlotContents(Container_VolumetricFlaskSetter.SLOT_OUTPUT, aOutput); - return true; - } - } - } - continue; - } - return false; - } - - @Override - public void updateEntity() { - try{ - if (!this.worldObj.isRemote) { - if (tickCount % 10 == 0) { - if (hasFlask()) { - this.addOutput(); - this.markDirty(); - } - } - this.tickCount++; - } - } - catch (final Throwable t){} - } - - public boolean anyPlayerInRange() { - return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null; - } - - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { - if (!nbt.hasKey(tag)) { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound nbt) { - super.writeToNBT(nbt); - // Utils.LOG_WARNING("Trying to write NBT data to TE."); - final NBTTagCompound chestData = new NBTTagCompound(); - this.inventoryContents.writeToNBT(chestData); - nbt.setTag("ContentsChest", chestData); - nbt.setShort("aCustomValue", aCustomValue); - if (this.hasCustomInventoryName()) { - nbt.setString("CustomName", this.getCustomName()); - } - nbt.setInteger("aCurrentMode", aCurrentMode); - } - - @Override - public void readFromNBT(final NBTTagCompound nbt) { - super.readFromNBT(nbt); - // Utils.LOG_WARNING("Trying to read NBT data from TE."); - this.inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest")); - this.aCustomValue = nbt.getShort("aCustomValue"); - if (nbt.hasKey("CustomName", 8)) { - this.setCustomName(nbt.getString("CustomName")); - } - aCurrentMode = nbt.getInteger("aCurrentMode"); - } - - @Override - public int getSizeInventory() { - return this.getInventory().getSizeInventory(); - } - - @Override - public ItemStack getStackInSlot(final int slot) { - return this.getInventory().getStackInSlot(slot); - } - - @Override - public ItemStack decrStackSize(final int slot, final int count) { - return this.getInventory().decrStackSize(slot, count); - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) { - return this.getInventory().getStackInSlotOnClosing(slot); - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) { - this.getInventory().setInventorySlotContents(slot, stack); - } - - @Override - public int getInventoryStackLimit() { - return this.getInventory().getInventoryStackLimit(); - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) { - return this.getInventory().isUseableByPlayer(entityplayer); - } - - @Override - public void openInventory() { - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.getInventory().openInventory(); - } - - @Override - public void closeInventory() { - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.getInventory().closeInventory(); - } - - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - return this.getInventory().isItemValidForSlot(slot, itemstack); - } - - @Override - public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { - final int[] accessibleSides = new int[this.getSizeInventory()]; - for (int r=0; r<this.getInventory().getSizeInventory(); r++){ - accessibleSides[r]=r; - } - return accessibleSides; - - } - - @Override - public boolean canInsertItem(final int aSlot, final ItemStack p_102007_2_, final int p_102007_3_) { - return aSlot == aCurrentMode; - } - - @Override - public boolean canExtractItem(final int aSlot, final ItemStack p_102008_2_, final int p_102008_3_) { - return aSlot == Container_VolumetricFlaskSetter.SLOT_OUTPUT; - } - - public String getCustomName() { - return this.customName; - } - - public void setCustomName(final String customName) { - this.customName = customName; - } - - @Override - public String getInventoryName() { - return this.hasCustomInventoryName() ? this.customName : "container.VolumetricFlaskSetter"; - } - - @Override - public boolean hasCustomInventoryName() { - return (this.customName != null) && !this.customName.equals(""); - } - - @Override - public Packet getDescriptionPacket() { - final NBTTagCompound tag = new NBTTagCompound(); - this.writeToNBT(tag); - return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tag); - } - - @Override - public void onDataPacket(final NetworkManager net, final S35PacketUpdateTileEntity pkt) { - final NBTTagCompound tag = pkt.func_148857_g(); - this.readFromNBT(tag); - } - - public boolean onScrewdriverRightClick(byte side, EntityPlayer player, int x, int y, int z) { - - if (player.isSneaking()) { - PlayerUtils.messagePlayer(player, "Value: "+this.getCustomValue()); - } - - try { - if (aCurrentMode == 7) { - aCurrentMode = 0; - } - else { - aCurrentMode++; - } - PlayerUtils.messagePlayer(player, "Slot "+aCurrentMode+" is now default."); - return true; - } - catch (Throwable t) { - return false; - } - } - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java deleted file mode 100644 index 2816596515..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java +++ /dev/null @@ -1,298 +0,0 @@ -package gtPlusPlus.core.tileentities.general; - -import org.lwjgl.input.Keyboard; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import gtPlusPlus.api.objects.minecraft.BTF_FluidTank; -import gtPlusPlus.core.tileentities.base.TileBasicTank; -import gtPlusPlus.core.util.minecraft.EnchantingUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.*; - -public class TileEntityXpConverter extends TileBasicTank { - - public BTF_FluidTank tankEssence = new BTF_FluidTank((int) (64000*EnchantingUtils.RATIO_MOB_ESSENCE_TO_LIQUID_XP)); - public BTF_FluidTank tankLiquidXp = new BTF_FluidTank(64000); - private boolean mConvertToEssence = true; - - public TileEntityXpConverter() { - super (4, 32000); - } - - private void changeMode(){ - if (this.mConvertToEssence){ - this.mConvertToEssence = false; - return; - } - else { - this.mConvertToEssence = true; - return; - } - } - - public float getAdjustedVolume() { - if (this.mConvertToEssence){ - if ((this.tankLiquidXp.getFluid() != null) && (this.tankLiquidXp.getFluidAmount() >= 100) && (this.tankEssence.getFluidAmount() <= (this.tankEssence.getCapacity()-(100*EnchantingUtils.RATIO_MOB_ESSENCE_TO_LIQUID_XP)))){ - final FluidStack bigStorage = EnchantingUtils.getEssenceFromLiquidXp(100); - this.tankEssence.fill(bigStorage, true); - this.tankLiquidXp.drain(100, true); - return (this.tankEssence.getCapacity()-this.tankEssence.getFluidAmount()); - } - } - else { - final double rm = EnchantingUtils.RATIO_MOB_ESSENCE_TO_LIQUID_XP; - if ((this.tankEssence.getFluid() != null) && (this.tankEssence.getFluidAmount() >= rm) && (this.tankLiquidXp.getFluidAmount() <= (this.tankLiquidXp.getCapacity()-rm))){ - final FluidStack bigStorage = EnchantingUtils.getLiquidXP(1); - this.tankLiquidXp.fill(bigStorage, true); - this.tankEssence.drain((int) rm, true); - return (this.tankLiquidXp.getCapacity()-this.tankLiquidXp.getFluidAmount()); - } - } - return 0f; - } - - @Override - public void readFromNBT(final NBTTagCompound tag) { - this.tankEssence.readFromNBT(tag); - this.tankLiquidXp.readFromNBT(tag); - this.mConvertToEssence = tag.getBoolean("mConvertToEssence"); - super.readFromNBT(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound tag) { - this.tankEssence.writeToNBT(tag); - this.tankLiquidXp.writeToNBT(tag); - tag.setBoolean("mConvertToEssence", this.mConvertToEssence); - super.writeToNBT(tag); - } - - @Override - public Packet getDescriptionPacket() { - final NBTTagCompound tag = new NBTTagCompound(); - this.writeToNBT(tag); - return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tag); - } - - @Override - public void onDataPacket(final NetworkManager net, final S35PacketUpdateTileEntity pkt) { - final NBTTagCompound tag = pkt.func_148857_g(); - this.readFromNBT(tag); - } - - public void onScrewdriverRightClick(final byte aSide, final EntityPlayer aPlayer, final float aX, final float aY, final float aZ) { - if (this.isServerSide()){ - if (this.mConvertToEssence){ - PlayerUtils.messagePlayer(aPlayer, "Converting from Mob Essence to Liquid Xp."); - } - else { - PlayerUtils.messagePlayer(aPlayer, "Converting from Liquid Xp to Mob Essence."); - } - //Mode Change - this.changeMode(); - } - } - - public void onRightClick(final byte aSide, final EntityPlayer aPlayer, final int aX, final int aY, final int aZ) { - if ((Keyboard.isKeyDown(42)) || (Keyboard.isKeyDown(54))) { - String mInput; - String mOutput; - - if (this.mConvertToEssence){ - mInput = "Liquid Xp"; - mOutput = "Mob Essence"; - } - else { - mInput = "Mob Essence"; - mOutput = "Liquid Xp"; - } - - PlayerUtils.messagePlayer(aPlayer, "Input: "+mInput+"."); - PlayerUtils.messagePlayer(aPlayer, "Output: "+mOutput+"."); - } - } - - @Override - public boolean onPreTick(long aTick) { - boolean aSuperResult = super.onPreTick(aTick); - long aTankSpaceLeft = 0; - double aAmount = 0; - int aRuns = 0; - if (this.mConvertToEssence) { - aTankSpaceLeft = (this.tankEssence.getCapacity()-this.tankEssence.getFluidAmount()); - aAmount = EnchantingUtils.getEssenceFromLiquidXp(100).amount; - } - else { - aTankSpaceLeft = (this.tankLiquidXp.getCapacity()-this.tankLiquidXp.getFluidAmount()); - aAmount = EnchantingUtils.RATIO_MOB_ESSENCE_TO_LIQUID_XP; - } - aRuns = (int) (aTankSpaceLeft / aAmount); - for (int i=0;i<aRuns;i++) { - if (getAdjustedVolume() == 0) { - break; - } - } - return aSuperResult; - } - - @Override - public boolean isLiquidInput(byte aSide) { - if (mConvertToEssence) { - if (aSide == 0 || aSide == 1) { - return false; - } - } else { - if (aSide == 0 || aSide == 1) { - return true; - } - } - return false; - } - - @Override - public boolean isLiquidOutput(byte aSide) { - if (mConvertToEssence) { - if (aSide == 0 || aSide == 1) { - return true; - } - } else { - if (aSide == 0 || aSide == 1) { - return false; - } - } - return false; - } - - @Override - public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - if (mConvertToEssence) { - if (aSide != ForgeDirection.UP && aSide != ForgeDirection.DOWN) { - return this.tankLiquidXp.fill(aFluid, doFill); - } - } else { - if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) { - return this.tankEssence.fill(aFluid, doFill); - } - } - return 0; - } - - @Override - public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) { - if (mConvertToEssence) { - if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) { - return this.tankEssence.drain(maxDrain, doDrain); - } - } else { - if (aSide != ForgeDirection.UP && aSide != ForgeDirection.DOWN) { - return this.tankLiquidXp.drain(maxDrain, doDrain); - } - } - return null; - } - - @Override - public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) { - if (mConvertToEssence) { - if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) { - return this.tankEssence.drain(aFluid, doDrain); - } - } else { - if (aSide != ForgeDirection.UP && aSide != ForgeDirection.DOWN) { - return this.tankLiquidXp.drain(aFluid, doDrain); - } - } - return null; - } - - @Override - public boolean canFill(ForgeDirection aSide, Fluid aFluid) { - if (mConvertToEssence) { - if (aSide != ForgeDirection.UP && aSide != ForgeDirection.DOWN) { - return this.tankLiquidXp.canTankBeFilled(); - } - } else { - if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) { - return this.tankEssence.canTankBeFilled(); - } - } - return false; - } - - @Override - public boolean canDrain(ForgeDirection aSide, Fluid aFluid) { - if (mConvertToEssence) { - if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) { - return this.tankEssence.canTankBeEmptied(); - } - } else { - if (aSide != ForgeDirection.UP && aSide != ForgeDirection.DOWN) { - return this.tankLiquidXp.canTankBeEmptied(); - } - } - return false; - } - - @Override - public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { - if (aSide == ForgeDirection.UP || aSide == ForgeDirection.DOWN) { - return new FluidTankInfo[] { this.tankEssence.getInfo() }; - } else { - return new FluidTankInfo[] { this.tankLiquidXp.getInfo() }; - - } - } - - @Override - public FluidStack getFluid() { - if (mConvertToEssence) { - return this.tankEssence.getFluid(); - } - else { - return this.tankLiquidXp.getFluid(); - } - } - - @Override - public int getFluidAmount() { - if (mConvertToEssence) { - return this.tankEssence.getFluidAmount(); - } - else { - return this.tankLiquidXp.getFluidAmount(); - } - } - - @Override - public FluidTankInfo getInfo() { - if (mConvertToEssence) { - return this.tankEssence.getInfo(); - } else { - return this.tankLiquidXp.getInfo(); - } - } - - @Override - public int fill(FluidStack resource, boolean doFill) { - if (mConvertToEssence) { - return this.tankEssence.fill(resource, doFill); - } else { - return this.tankLiquidXp.fill(resource, doFill); - } - } - - @Override - public FluidStack drain(int maxDrain, boolean doDrain) { - if (mConvertToEssence) { - return this.tankEssence.drain(maxDrain, doDrain); - } else { - return this.tankLiquidXp.drain(maxDrain, doDrain); - } - } - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java b/src/Java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java deleted file mode 100644 index eda0c65e46..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java +++ /dev/null @@ -1,468 +0,0 @@ -package gtPlusPlus.core.tileentities.general.redstone; - -import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.api.interfaces.IToolable; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.EnumSkyBlock; -import net.minecraft.world.IBlockAccess; - -public abstract class TileEntityRedstoneHandler extends TileEntity implements IToolable { - - private final int mTileType; - private BlockPos mTilePos; - private boolean mRequiresUpdate = false; - private Long mStartTime; - private Byte mRedstoneLevel; - - public boolean mLightMode = false; - public float mLightValue = 0; - - /** - * Sets the Redstone Handler Type. - * @param aTileType - A type of the handler designated by an int. 0 = receiver, 1 = emitter, 2 = both, anything else = nothing. - */ - public TileEntityRedstoneHandler(int aTileType) { - mTileType = aTileType; - registerTileEntity(); - } - - private void registerTileEntity() { - if (!EntityUtils.isTileEntityRegistered(getTileEntityClass(), getTileEntityNameForRegistration())) { - GameRegistry.registerTileEntity(getTileEntityClass(), getTileEntityNameForRegistration()); - } - } - - protected abstract Class<? extends TileEntity> getTileEntityClass(); - - protected abstract String getTileEntityNameForRegistration(); - - public Block getBlock() { - return mTilePos != null ? mTilePos.getBlockAtPos() : Blocks.redstone_block; - } - - public final boolean isLight() { - return mLightMode; - } - - public final float getLightBrightness() { - if (!isLight()) { - return 0; - } - else { - return mLightValue; - } - } - - @Override - public void readFromNBT(NBTTagCompound aNBT) { - mStartTime = aNBT.getLong("mStartTime"); - mInvName = aNBT.getString("mInvName"); - mLightValue = aNBT.getFloat("mLightValue"); - mLightMode = aNBT.getBoolean("mLightMode"); - mRedstoneLevel = aNBT.getByte("mRedstoneLevel"); - super.readFromNBT(aNBT); - } - - @Override - public void writeToNBT(NBTTagCompound aNBT) { - aNBT.setInteger("mTileType", mTileType); - aNBT.setLong("mStartTime", mStartTime); - aNBT.setString("mInvName", mInvName); - aNBT.setFloat("mLightValue", getLightBrightness()); - aNBT.setBoolean("mLightMode", isLight()); - aNBT.setByte("mRedstoneLevel", mRedstoneLevel); - super.writeToNBT(aNBT); - } - - - private boolean mHasUpdatedRecently = false; - - private final boolean init() { - if (mTilePos == null) { - try { - mTilePos = new BlockPos(this); - } catch (Throwable t) { - return false; - } - } - if (mStartTime == null) { - try { - mStartTime = System.currentTimeMillis(); - } catch (Throwable t) { - return false; - } - } - return true; - } - private Long mLastUpdate; - private String mInvName = ""; - - @Override - public void updateEntity() { - //Handle init - if (!init()) { - return; - } - if (mRequiresUpdate || mLastUpdate == null) { - mRequiresUpdate = false; - mHasUpdatedRecently = true; - mLastUpdate = System.currentTimeMillis(); - if (mTilePos.world.getBlockLightValue(xCoord, yCoord, zCoord) != getLightBrightness()/0.0625f) { - mTilePos.getBlockAtPos().setLightLevel(getLightBrightness()/0.0625f); - mTilePos.world.setLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord, (int) (getLightBrightness()/0.0625f)); - mTilePos.world.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord); - Logger.INFO("Updating Light"); - } - mTilePos.world.scheduleBlockUpdate(xCoord, yCoord, zCoord, mTilePos.getBlockAtPos(), 1); - markDirty(); - } - if (Utils.getMillisSince(mLastUpdate, System.currentTimeMillis()) >= 5000) { - if (mHasUpdatedRecently) { - mHasUpdatedRecently = false; - this.markForUpdate(); - } - } - - if (Utils.getMillisSince(mStartTime, System.currentTimeMillis()) % 50 == 0) { - - } - - - - super.updateEntity(); - } - - public final void markForUpdate() { - mRequiresUpdate = true; - } - - public final boolean hasUpdatedRecently() { - return mHasUpdatedRecently; - } - - @Override - public int getBlockMetadata() { - return super.getBlockMetadata(); - } - - @Override - public void markDirty() { - super.markDirty(); - } - - @Override - public boolean canUpdate() { - return true; - } - - public void setRedstoneState(boolean aRedstoneActive) { - - } - - public void setCurrentTextureArray(IIcon[] aTextures) { - - } - - /** - * Used to see if one of the blocks next to you or your block is getting power from a neighboring block. Used by - * items like TNT or Doors so they don't have redstone going straight into them. Args: x, y, z - */ - public boolean isGettingIndirectlyPowered() { - if (mTilePos == null) { - return false; - } - return mTilePos.world.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord); - } - - public int getStrongestIndirectPower() { - if (mTilePos == null) { - return 0; - } - return mTilePos.world.getStrongestIndirectPower(xCoord, yCoord, zCoord); - } - - /** - * Gets the power level from a certain block face. Args: x, y, z, direction - */ - public int getIndirectPowerForSide(int aSide) { - if (mTilePos == null || aSide <0 || aSide > 5) { - return 0; - } - return mTilePos.world.getIndirectPowerLevelTo(xCoord, yCoord, zCoord, aSide); - } - - /** - * Returns the highest redstone signal strength powering the given block. Args: X, Y, Z. - */ - public int getBlockPowerInput() { - if (mTilePos == null) { - return 0; - } - return mTilePos.world.getBlockPowerInput(xCoord, yCoord, zCoord); - } - - /** - * Determine if this block can make a redstone connection on the side provided, - * Useful to control which sides are inputs and outputs for redstone wires. - * - * Side: - * -1: UP - * 0: NORTH - * 1: EAST - * 2: SOUTH - * 3: WEST - * - * @param world The current world - * @param x X Position - * @param y Y Position - * @param z Z Position - * @param side The side that is trying to make the connection - * @return True to make the connection - */ - public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) { - if (mTilePos == null) { - return false; - } - return canAcceptRedstoneSignal() || canSupplyRedstoneSignal(); - } - - /** - * Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules. - * @param world The world - * @param x The x position of this block instance - * @param y The y position of this block instance - * @param z The z position of this block instance - * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side - * @return Whether Block#isProvidingWeakPower should be called when determining indirect power - */ - public boolean shouldCheckWeakPower(IBlockAccess world, int x, int y, int z, int side) { - if (mTilePos == null) { - return false; - } - return getBlock().isNormalCube(); - } - - /** - * If this block should be notified of weak changes. - * Weak changes are changes 1 block away through a solid block. - * Similar to comparators. - * - * @param world The current world - * @param x X Position - * @param y Y position - * @param z Z position - * @param side The side to check - * @return true To be notified of changes - */ - public boolean getWeakChanges(IBlockAccess world, int x, int y, int z) { - if (mTilePos == null) { - return false; - } - return false; - } - - - /** - * Override this to change the level of redstone output. - * @return - */ - public int getRedstoneLevel() { - if (mTilePos == null || mRedstoneLevel == null) { - return 0; - } - else { - if (canSupplyRedstoneSignal()) { - if (this.hasUpdatedRecently()) { - int aInputPower = getInputPowerLevel(); - mRedstoneLevel = (byte) ((aInputPower >= 0 && aInputPower <= 127) ? aInputPower : 0); - } - return mRedstoneLevel; - } - } - return 0; - } - - - public boolean providesWeakPower() { - return isProvidingPower(); - } - - public boolean providesStrongPower() { - return isProvidingPower(); - } - - - /** - * Returns the amount of week power this block is providing to a side. - * @param world - * @param x - * @param y - * @param z - * @param side - * @return - */ - public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) { - if (!providesWeakPower()) { - return 0; - } - return getOutputPowerLevel(); - } - /** - * Returns the amount of strong power this block is providing to a side. - * @param world - * @param x - * @param y - * @param z - * @param side - * @return - */ - public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) { - if (!providesStrongPower()) { - return 0; - } - return getOutputPowerLevel(); - } - - - - - - - - /* - * Alk's Simplified Redstone Handling functions (Fuck redstone) - */ - - /** - * - * @return - Does this Block supply redstone signal at all? - */ - public final boolean isPowered() { - return canAcceptRedstoneSignal() && getInputPowerLevel() > 0; - } - - /** - * - * @return - Can this Block provide redstone signal at all? - */ - public final boolean isProvidingPower() { - return canSupplyRedstoneSignal() && getOutputPowerLevel() > 0; - } - - /** - * - * @return - (0-15) Redstone Output signal level - */ - public final int getOutputPowerLevel() { - return getRedstoneLevel(); - } - - /** - * - * @return (0-15) Redstone Input Signal level - */ - public final int getInputPowerLevel() { - return getBlockPowerInput(); - } - - /** - * - * @return - Does this Tile Entity support outputting redstone? - */ - public final boolean canSupplyRedstoneSignal() { - return mTileType == 1 || mTileType == 2; - } - - /** - * - * @return - Does this Tile Entity support inputting redstone? - */ - public final boolean canAcceptRedstoneSignal() { - return mTileType == 0 || mTileType == 2; - } - - - @Override - public boolean isScrewdriverable() { - return false; - } - - - @Override - public boolean onScrewdriverLMB() { - return false; - } - - - @Override - public boolean onScrewdriverRMB() { - return false; - } - - - @Override - public boolean isWrenchable() { - return false; - } - - - @Override - public boolean onWrenchLMB() { - return false; - } - - - @Override - public boolean onWrenchRMB() { - return false; - } - - - @Override - public boolean isMalletable() { - return false; - } - - - @Override - public boolean onMalletLMB() { - return false; - } - - - @Override - public boolean onMalletRMB() { - return false; - } - - - public void setCustomName(String displayName) { - this.mInvName = displayName; - } - - public String getCustomName() { - return this.mInvName; - } - - public String getInventoryName() { - return this.hasCustomInventoryName() ? this.mInvName : "container.redstone.generic"; - } - - public boolean hasCustomInventoryName() { - return (this.mInvName != null) && !this.mInvName.equals(""); - } - - - - - - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityAdvPooCollector.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityAdvPooCollector.java deleted file mode 100644 index 6bb4c932dc..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityAdvPooCollector.java +++ /dev/null @@ -1,155 +0,0 @@ -package gtPlusPlus.core.tileentities.machines; - -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.item.chemistry.AgriculturalChem; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.passive.EntityAnimal; -import net.minecraft.entity.passive.EntityChicken; -import net.minecraft.entity.passive.EntityCow; -import net.minecraft.entity.passive.EntityHorse; -import net.minecraft.entity.passive.EntityMooshroom; -import net.minecraft.entity.passive.EntitySheep; -import net.minecraft.entity.passive.EntityVillager; -import net.minecraft.entity.passive.IAnimals; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; - -public class TileEntityAdvPooCollector extends TileEntityBaseFluidCollector { - - public TileEntityAdvPooCollector() { - super(18, 128000); - } - - - @Override - public boolean canFill(ForgeDirection from, Fluid fluid) { - return false; - } - - @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) { - return true; - } - - public void onPreLogicTick() { - - } - - public <V> boolean addDrop(V aPooMaker) { - int aChance = MathUtils.randInt(0, 50000); - if (aChance > 0) { - ItemStack aPoop; - if (aChance<= 200) { - aPoop = ItemUtils.getItemStackOfAmountFromOreDict("dustManureByproducts", 1); - } - else if (aChance <= 1000) { - aPoop = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallManureByproducts", 1); - } - else if (aChance <= 2000) { - aPoop = ItemUtils.getItemStackOfAmountFromOreDict("dustTinyManureByproducts", 1); - } - else { - return false; - } - - //Add to inventory if not full, else espawn in world - if (!this.mInventory.addItemStack(aPoop)) { - EntityItem entity = new EntityItem(worldObj, xCoord, yCoord+1.5, zCoord, aPoop); - worldObj.spawnEntityInWorld(entity); - } - - } - - - return false; - } - - private static AutoMap<Class> aEntityToDrain = new AutoMap<Class>(); - - @Override - public AutoMap<Class> aThingsToLookFor() { - if (aEntityToDrain.isEmpty()) { - aEntityToDrain.add(EntityAnimal.class); - aEntityToDrain.add(IAnimals.class); - aEntityToDrain.add(EntityVillager.class); - aEntityToDrain.add(EntityPlayer.class); - } - return aEntityToDrain; - } - - @Override - public <V> int onPostTick(V aPooMaker) { - if (this.tank.getFluidAmount() < this.tank.getCapacity()) { - int aPooAmount = 0; - // Vanilla Animals - if (aPooMaker instanceof EntityChicken) { - aPooAmount = MathUtils.randInt(1, 40); - } - else if (aPooMaker instanceof EntityHorse) { - aPooAmount = MathUtils.randInt(20, 40); - } - else if (aPooMaker instanceof EntityCow) { - aPooAmount = MathUtils.randInt(18, 45); - } - else if (aPooMaker instanceof EntityMooshroom) { - aPooAmount = 17; - } - else if (aPooMaker instanceof EntitySheep) { - aPooAmount = MathUtils.randInt(8, 30); - } - - else { - if (aPooMaker instanceof EntityAnimal || aPooMaker instanceof IAnimals) { - aPooAmount = MathUtils.randInt(5, 35); - } - else if (aPooMaker instanceof EntityVillager) { - aPooAmount = MathUtils.randInt(25, 30); - } - else if (aPooMaker instanceof EntityPlayer) { - aPooAmount = MathUtils.randInt(1, 3); - } - else { - aPooAmount = MathUtils.randInt(1, 10); - } - } - aPooAmount = Math.max(Math.min(this.tank.getCapacity()-this.tank.getFluidAmount(), aPooAmount), 1); - return Math.max(1, (aPooAmount * MathUtils.getRandomFromArray(new int[] {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4}) / 10)); - } - else { - return 0; - } - } - - @Override - public Fluid fluidToProvide() { - return AgriculturalChem.PoopJuice; - } - - @Override - public ItemStack itemToSpawnInWorldIfTankIsFull() { - int a = MathUtils.randInt(0, 75); - ItemStack aItem = null; - if (a <= 30) { - aItem = ItemUtils.getSimpleStack(AgriculturalChem.dustDirt); - } - else if (a <= 40) { - aItem = ItemUtils.getItemStackOfAmountFromOreDict("dustManureByproducts", 1); - } - else if (a <= 55) { - aItem = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallManureByproducts", 1); - } - return aItem; - } - - public int getBaseTickRate() { - return MathUtils.randInt(50, 200); - } - - - - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java deleted file mode 100644 index cdae4cf829..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java +++ /dev/null @@ -1,238 +0,0 @@ -package gtPlusPlus.core.tileentities.machines; - -import java.util.List; - -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.BTF_FluidTank; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.tileentities.base.TileEntityBase; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidEvent; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTank; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; - -public abstract class TileEntityBaseFluidCollector extends TileEntityBase implements IFluidHandler { - - public final FluidTank tank; - private boolean needsUpdate = false; - private int updateTimer = 0; - private long internalTickCounter = 0; - private BlockPos internalBlockLocation; - - public TileEntityBaseFluidCollector(int aInvSlotCount, int aTankCapcity) { - super(aInvSlotCount); - tank = new BTF_FluidTank(aTankCapcity); - } - - @Override - public final int fill(ForgeDirection from, FluidStack resource, boolean doFill) { - needsUpdate = true; - return this.tank.fill(resource, doFill); - } - - @Override - public final FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { - needsUpdate = true; - return this.tank.drain(resource.amount, doDrain); - } - - @Override - public final FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { - needsUpdate = true; - FluidStack fluid = this.tank.getFluid(); - // return this.tank.drain(maxDrain, doDrain); - if (fluid == null) { - return null; - } - - int drained = maxDrain; - if (fluid.amount < drained) { - drained = fluid.amount; - } - - FluidStack stack = new FluidStack(fluid, drained); - if (doDrain) { - fluid.amount -= drained; - if (fluid.amount <= 0) { - fluid = null; - } - - if (this != null) { - FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluid, this.getWorldObj(), this.xCoord, - this.yCoord, this.zCoord, this.tank, 0)); - } - } - return stack; - } - - @Override - public boolean canFill(ForgeDirection from, Fluid fluid) { - return false; - } - - @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) { - return true; - } - - @Override - public final FluidTankInfo[] getTankInfo(ForgeDirection from) { - return new FluidTankInfo[] { this.tank.getInfo() }; - } - - @Override - public final void updateEntity() { - super.updateEntity(); - onPreLogicTick(); - logicTick(); - if (needsUpdate) { - if (updateTimer == 0) { - updateTimer = 10; // every 10 ticks it will send an update - } else { - --updateTimer; - if (updateTimer == 0) { - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - needsUpdate = false; - } - } - } - } - - @Override - public void readFromNBT(NBTTagCompound tag) { - tank.readFromNBT(tag); - super.readFromNBT(tag); - } - - @Override - public void writeToNBT(NBTTagCompound tag) { - tank.writeToNBT(tag); - super.writeToNBT(tag); - } - - @Override - public final Packet getDescriptionPacket() { - NBTTagCompound tag = new NBTTagCompound(); - writeToNBT(tag); - return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tag); - } - - @Override - public final void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { - NBTTagCompound tag = pkt.func_148857_g(); - readFromNBT(tag); - } - - public int getBaseTickRate() { - return MathUtils.randInt(200, 300); - } - - public abstract AutoMap<Class> aThingsToLookFor(); - - public abstract void onPreLogicTick(); - - public final void logicTick() { - - if (this.worldObj == null || this.worldObj.isRemote) { - return; - } - if (internalTickCounter % getBaseTickRate() == 0) { - if (internalBlockLocation == null) { - internalBlockLocation = new BlockPos(this); - } - BlockPos p = internalBlockLocation; - if (p != null) { - if (p.world != null) { - World w = this.worldObj; - if (w == null) { - return; - } - Chunk c = w.getChunkFromBlockCoords(p.xPos, p.zPos); - if (c != null) { - if (c.isChunkLoaded) { - int startX = p.xPos - 2; - int startY = p.yPos; - int startZ = p.zPos - 2; - int endX = p.xPos + 3; - int endY = p.yPos + 5; - int endZ = p.zPos + 3; - AxisAlignedBB box = AxisAlignedBB.getBoundingBox(startX, startY, startZ, endX, endY, endZ); - if (box != null) { - for (Class c2 : aThingsToLookFor()) { - tickEntityType(w, box, c2); - } - } else { - return; - } - } - } - } - } - - } - - internalTickCounter++; - } - - @SuppressWarnings("unchecked") - public final void tickEntityType(World w, AxisAlignedBB box, Class aClassToFind) { - List<?> entities = w.getEntitiesWithinAABB(aClassToFind, box); - if (entities != null && !entities.isEmpty()) { - interactWithEntities(entities); - } - } - - public final <V> void interactWithEntities(List<V> entities) { - for (V aEntity : entities) { - addDrop(aEntity); - if (this.tank.getFluidAmount() < this.tank.getCapacity()) { - int aFluidAmount = onPostTick(aEntity); - aFluidAmount = Math.max(Math.min(this.tank.getCapacity()-this.tank.getFluidAmount(), aFluidAmount), 1); - this.tank.fill(FluidUtils.getFluidStack(fluidToProvide(), aFluidAmount), true); - } - else { - ItemStack aDirtStack = ItemUtils.getSimpleStack(itemToSpawnInWorldIfTankIsFull(), 1); - if (!ItemUtils.checkForInvalidItems(aDirtStack)) { - return; - } - if (!this.mInventory.addItemStack(aDirtStack)) { - EntityItem entity = new EntityItem(worldObj, xCoord, yCoord+1.5, zCoord, aDirtStack); - worldObj.spawnEntityInWorld(entity); - } - } - } - } - - - /** - * Return the amount of fluid for this entity type - * @param aEntity - * @return - */ - public abstract <V> int onPostTick(V aEntity); - - public abstract <V> boolean addDrop(V aPooMaker); - - public abstract Fluid fluidToProvide(); - - public abstract ItemStack itemToSpawnInWorldIfTankIsFull(); - - - - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java deleted file mode 100644 index 8ba43bb197..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java +++ /dev/null @@ -1,480 +0,0 @@ -package gtPlusPlus.core.tileentities.machines; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import gregtech.api.enums.ItemList; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.container.Container_ModularityTable; -import gtPlusPlus.core.inventories.modulartable.InventoryModularMain; -import gtPlusPlus.core.inventories.modulartable.InventoryModularOutput; -import gtPlusPlus.core.item.bauble.ModularBauble; -import gtPlusPlus.core.tileentities.base.TileEntityBase; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils.BT; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils.Modifiers; - -public class TileEntityModularityTable extends TileEntityBase implements ISidedInventory{ - - public InventoryModularMain inventoryGrid; - public InventoryModularOutput inventoryOutputs; - public InventoryModularOutput mTempRecipeStorage; - private Container_ModularityTable container; - private String customName; - private int mRecipeTimeRemaining = -1; - - public TileEntityModularityTable() { - super(16); - this.inventoryGrid = new InventoryModularMain(); - this.inventoryOutputs = new InventoryModularOutput(); - this.mTempRecipeStorage = new InventoryModularOutput(); - this.canUpdate(); - generateAllValidUpgrades(); - } - - public void setContainer(Container_ModularityTable container_ModularityTable) { - this.container = container_ModularityTable; - } - - public Container_ModularityTable getContainer() { - return this.container; - } - - public int getRecipeTime(){ - return this.mRecipeTimeRemaining; - } - - @Override - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { - if (!nbt.hasKey(tag)) { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound nbt) { - super.writeToNBT(nbt); - nbt.setInteger("mRecipeTime", this.mRecipeTimeRemaining); - this.inventoryOutputs.writeToNBT(this.getTag(nbt, "ContentsOutput")); - this.inventoryGrid.writeToNBT(this.getTag(nbt, "ContentsGrid")); - this.mTempRecipeStorage.writeToNBT(this.getTag(nbt, "ContentsRecipeTemp")); - if (this.hasCustomInventoryName()) { - nbt.setString("CustomName", this.getCustomName()); - } - } - - @Override - public void readFromNBT(final NBTTagCompound nbt) { - super.readFromNBT(nbt); - this.mRecipeTimeRemaining = nbt.getInteger("mRecipeTime"); - this.inventoryOutputs.readFromNBT(nbt.getCompoundTag("ContentsOutput")); - this.inventoryGrid.readFromNBT(nbt.getCompoundTag("ContentsGrid")); - this.mTempRecipeStorage.readFromNBT(nbt.getCompoundTag("ContentsRecipeTemp")); - if (nbt.hasKey("CustomName", 8)) { - this.setCustomName(nbt.getString("CustomName")); - } - } - - protected ItemStack mOutputStack; //Upgraded Bauble - protected ItemStack mInputstackA; //Bauble - protected ItemStack mInputstackB; //Upgrade - - public ItemStack getPendingOutputItem(){ - this.mRecipeTimeRemaining--; - return this.mOutputStack; - } - - public ItemStack[] getCurrentInputItems(){ - if (this.mRecipeTimeRemaining < 0){ - return null; - } - else { - return new ItemStack[]{this.mInputstackA, this.mInputstackB}; - } - } - - public boolean setInputStacks(ItemStack tBauble, ItemStack tUpgrade){ - if (tBauble != null){ - this.mInputstackA = tBauble; - } - else { - this.mInputstackA = null; - } - if (tUpgrade != null){ - this.mInputstackB = tBauble; - } - else { - this.mInputstackB = null; - } - if (this.mInputstackA != null && this.mInputstackB != null){ - return true; - } - return false; - } - - public boolean setOutputStack(ItemStack mNewBauble){ - if (mNewBauble != null){ - this.mOutputStack = mNewBauble; - return true; - } - else { - this.mOutputStack = null; - return false; - } - } - - public boolean clearRecipeData(){ - this.mInputstackA = null; - this.mInputstackB = null; - this.mOutputStack = null; - return true; - } - - @Override - public boolean canUpdate() { - return true; - } - - public static Map<ItemStack, Pair<Modifiers, Integer>> mValidUpgradeList = new HashMap<ItemStack, Pair<Modifiers, Integer>>(); - public static Map<ItemStack, BT> mValidUpgradeListFormChange = new HashMap<ItemStack, BT>(); - - private static boolean generateAllValidUpgrades() { - - // Form Change - generateUpgradeFormData(ItemList.Sensor_MV.get(1), BT.TYPE_RING); - generateUpgradeFormData(ItemList.Electric_Piston_MV.get(1), BT.TYPE_BELT); - generateUpgradeFormData(ItemList.Emitter_MV.get(1), BT.TYPE_AMULET); - - // Damage Boost - generateUpgradeData(ItemList.Electric_Motor_LV.get(1), Modifiers.BOOST_DAMAGE, 1); - generateUpgradeData(ItemList.Electric_Motor_MV.get(1), Modifiers.BOOST_DAMAGE, 2); - generateUpgradeData(ItemList.Electric_Motor_HV.get(1), Modifiers.BOOST_DAMAGE, 3); - generateUpgradeData(ItemList.Electric_Motor_EV.get(1), Modifiers.BOOST_DAMAGE, 4); - generateUpgradeData(ItemList.Electric_Motor_IV.get(1), Modifiers.BOOST_DAMAGE, 5); - - // Defence Boost - generateUpgradeData(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateAluminium", 1), Modifiers.BOOST_DEF, 1); - generateUpgradeData(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateStainlessSteel", 1), Modifiers.BOOST_DEF, 2); - generateUpgradeData(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateTungsten", 1), Modifiers.BOOST_DEF, 3); - generateUpgradeData(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateTungstenSteel", 1), Modifiers.BOOST_DEF, 4); - generateUpgradeData(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateNaquadah", 1), Modifiers.BOOST_DEF, 5); - - // Hp Boost - generateUpgradeData(ItemUtils.simpleMetaStack(Items.golden_apple, 0, 1), Modifiers.BOOST_HP, 1); - generateUpgradeData(ItemUtils.simpleMetaStack(Items.golden_apple, 1, 1), Modifiers.BOOST_HP, 2); - generateUpgradeData(ItemUtils.simpleMetaStack(Items.nether_star, 0, 1), Modifiers.BOOST_HP, 3); - generateUpgradeData(ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32725", 32725, 1), Modifiers.BOOST_HP, - 4); - generateUpgradeData(ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:32726", 32726, 1), Modifiers.BOOST_HP, - 5); - - return true; - } - - public static boolean generateUpgradeData(ItemStack tStack, Modifiers tMod, int tLevel) { - Pair<Modifiers, Integer> tTemp = new Pair<Modifiers, Integer>(tMod, tLevel); - if (mValidUpgradeList.put(tStack, tTemp) != null) { - return true; - } - return false; - } - - public static boolean generateUpgradeFormData(ItemStack tStack, BT tMod) { - if (mValidUpgradeListFormChange.put(tStack, tMod) != null) { - return true; - } - return false; - } - - public static boolean addUpgrade(ItemStack tStack, ItemStack tBauble) { - - try { - Iterator<Entry<ItemStack, BT>> it = mValidUpgradeListFormChange.entrySet().iterator(); - while (it.hasNext()) { - Entry<ItemStack, BT> pair = it.next(); - if (pair.getKey().getItem() == tStack.getItem() - && pair.getKey().getItemDamage() == tStack.getItemDamage()) { - ModularArmourUtils.setBaubleType(tBauble, pair.getValue()); - tBauble.setItemDamage(ModularArmourUtils.getBaubleTypeID(tBauble)); - return true; - } - } - } catch (Throwable t) { - - } - try { - Iterator<Entry<ItemStack, Pair<Modifiers, Integer>>> it2 = mValidUpgradeList.entrySet().iterator(); - while (it2.hasNext()) { - Entry<ItemStack, Pair<Modifiers, Integer>> pair = it2.next(); - if (pair.getKey().getItem() == tStack.getItem() - && pair.getKey().getItemDamage() == tStack.getItemDamage()) { - Pair<Modifiers, Integer> newPair = pair.getValue(); - ModularArmourUtils.setModifierLevel(tBauble, newPair); - return true; - } - } - } catch (Throwable t) { - - } - return false; - } - - @Override - public int getSizeInventory() { - return 11; - } - - @Override - public ItemStack getStackInSlot(int slot) { - if (slot >= this.inventoryGrid.getSizeInventory()){ - return this.inventoryOutputs.getStackInSlot(slot-9); - } - else if (slot < this.inventoryGrid.getSizeInventory()){ - return this.inventoryGrid.getStackInSlot(slot); - } - else { - return null; - } - } - - @Override - public ItemStack decrStackSize(int slot, int count) { - if (slot < this.inventoryGrid.getSizeInventory()){ - return this.inventoryGrid.decrStackSize(slot, count); - } - else if (slot >= this.inventoryGrid.getSizeInventory()){ - return this.inventoryOutputs.decrStackSize(slot-9, count); - } - else { - return null; - } - } - - @Override - public ItemStack getStackInSlotOnClosing(int slot) { - return this.getStackInSlot(slot); - } - - @Override - public void setInventorySlotContents(int slot, ItemStack stack) { - if (slot >= this.inventoryGrid.getSizeInventory()){ - this.inventoryOutputs.setInventorySlotContents(slot-9, stack); - } - else if (slot < this.inventoryGrid.getSizeInventory()){ - this.inventoryGrid.setInventorySlotContents(slot, stack); - } - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) { - return true; - } - - @Override - public void openInventory() { - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.inventoryGrid.openInventory(); - this.inventoryOutputs.openInventory(); - } - - @Override - public void closeInventory() { - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.inventoryGrid.openInventory(); - this.inventoryOutputs.openInventory(); - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) { - if (slot >= this.inventoryGrid.getSizeInventory()){ - return this.inventoryOutputs.isItemValidForSlot(slot-9, itemstack); - } - else if (slot < this.inventoryGrid.getSizeInventory()){ - return this.inventoryGrid.isItemValidForSlot(slot, itemstack); - } - else { - return false; - } - } - - @Override - public int[] getAccessibleSlotsFromSide(int side) { - int[] accessibleSides = new int[this.getSizeInventory()]; - for (int r=0; r<this.getSizeInventory(); r++){ - accessibleSides[r]=r; - } - return accessibleSides; - - } - - @Override - public boolean canInsertItem(int slot, ItemStack item, int side) { - Logger.INFO("Slot:"+slot+" | side? "+side); - - /*if (side == 1){ - return this.inventoryOutputs.isItemValidForSlot(slot-9, item); - } */ - if (slot >= 9){ - return this.inventoryOutputs.isItemValidForSlot(slot-9, item); - } - else { - return this.inventoryGrid.isItemValidForSlot(slot, item); - } - } - - @Override - public boolean canExtractItem(int slot, ItemStack item, int side) { - Logger.INFO("Slot:"+slot+" | side? "+side); - if (slot == 11 || slot <= 8){ - return true; - } - return false; - } - - @Override - public String getCustomName() { - return this.customName; - } - - @Override - public void setCustomName(String customName) { - this.customName = customName; - } - - @Override - public String getInventoryName() { - return this.hasCustomInventoryName() ? this.customName : "container.fishtrap"; - } - - @Override - public boolean hasCustomInventoryName() { - return this.customName != null && !this.customName.equals(""); - } - - @Override - public boolean onPreTick(long aTick) { - //Check for active recipe - if (this.mRecipeTimeRemaining > -1 || (this.mTempRecipeStorage != null) && (this.mTempRecipeStorage.getRecipeTime() > -1)){ - if ((this.mTempRecipeStorage != null) && this.mTempRecipeStorage.getRecipeTime() > -1){ - if (this.mRecipeTimeRemaining < this.mTempRecipeStorage.getRecipeTime()){ - this.mRecipeTimeRemaining = this.mTempRecipeStorage.getRecipeTime(); - this.markDirty(); - } - } - if (this.mInputstackA != null && this.mInputstackB != null && this.mOutputStack != null){ - this.mTempRecipeStorage.setInventorySlotContents(0, this.mInputstackA); - this.mTempRecipeStorage.setInventorySlotContents(1, this.mInputstackB); - this.mTempRecipeStorage.setInventorySlotContents(2, this.mOutputStack); - this.mTempRecipeStorage.setRecipeTime(this.mRecipeTimeRemaining); - this.markDirty(); - } - } - return true; - } - - @Override - public boolean onPostTick(long aTick) { - if (mRecipeTimeRemaining == 0){ - this.inventoryOutputs.setInventorySlotContents(2, this.getPendingOutputItem()); - clearRecipeData(); - this.mTempRecipeStorage.setRecipeTime(this.mRecipeTimeRemaining); - this.markDirty(); - } - else if (mRecipeTimeRemaining > 0){ - mRecipeTimeRemaining--; - this.mTempRecipeStorage.setRecipeTime(this.mRecipeTimeRemaining); - } - return true; - } - - @Override - public boolean processRecipe() { - boolean removeInputA = false; - boolean removeInputB = false; - // Data stick - ItemStack tBauble = this.inventoryOutputs.getStackInSlot(0); - ItemStack tUpgrade = this.inventoryOutputs.getStackInSlot(1); - if (tBauble != null && tUpgrade != null && this.container != null) { - if (tBauble.getItem() instanceof ModularBauble && this.mRecipeTimeRemaining == -1) { - if (tUpgrade != null && tBauble != null) { - removeInputA = true; - this.setInputStacks(tBauble, tUpgrade); - try { - removeInputB = addUpgrade(tUpgrade, tBauble); - if (!removeInputB) { - } - } catch (Throwable t) { - } - if (removeInputA && removeInputB) { - if (this.setOutputStack(tBauble)){ - if (this.inventoryOutputs.getStackInSlot(1).stackSize > 1) { - ItemStack mTempStack = this.inventoryOutputs.getStackInSlot(1); - mTempStack.stackSize--; - this.inventoryOutputs.setInventorySlotContents(1, mTempStack); - } else { - this.inventoryOutputs.setInventorySlotContents(1, null); - } - this.inventoryOutputs.setInventorySlotContents(0, null); - this.mRecipeTimeRemaining = 80; - this.markDirty(); - return true; - } - } - } - } - } - return false; - } - - public static boolean isValidModularPiece(final ItemStack itemstack){ - if (itemstack.getItem() instanceof ModularBauble){ - return true; - } - return false; - } - - public static boolean isValidUpgrade(final ItemStack itemstack) { - boolean isValid = false; - if (itemstack != null){ - Iterator<Entry<ItemStack, BT>> it = mValidUpgradeListFormChange.entrySet().iterator(); - while (it.hasNext()) { - Entry<ItemStack, BT> pair = it.next(); - if (pair.getKey().getItem() == itemstack.getItem() - && pair.getKey().getItemDamage() == itemstack.getItemDamage()){ - isValid = true; - } - } - Iterator<Entry<ItemStack, Pair<Modifiers, Integer>>> it2 = mValidUpgradeList.entrySet().iterator(); - while (it2.hasNext()) { - Entry<ItemStack, Pair<Modifiers, Integer>> pair = it2.next(); - if (pair.getKey().getItem() == itemstack.getItem() - && pair.getKey().getItemDamage() == itemstack.getItemDamage()){ - isValid = true; - } - } - } - return isValid; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java deleted file mode 100644 index 012c9f4ff5..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java +++ /dev/null @@ -1,506 +0,0 @@ -package gtPlusPlus.core.tileentities.machines; - -import java.util.ArrayList; -import java.util.List; - -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.BTF_FluidTank; -import gtPlusPlus.core.inventories.InventoryPestKiller; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.MISC_MATERIALS; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.entity.Entity; -import net.minecraft.entity.passive.EntityBat; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.DamageSource; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidEvent; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTank; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; -import net.minecraftforge.oredict.OreDictionary; - -public class TileEntityPestKiller extends TileEntity implements ISidedInventory, IFluidHandler { - - private final int mBaseTickRate = 20 * 30; - private final InventoryPestKiller mInventory; - private final FluidTank mTank; - private int mChunkX; - private int mChunkZ; - private boolean mSet = false; - - private int mTickCounter = 0; - private int mUpdateTick = 0; - private boolean mNeedsUpdate = false; - private String mCustomName; - - private static final AutoMap<Class<?>> mEntityMap = new AutoMap<Class<?>>(); - - static { - mEntityMap.put(EntityBat.class); - if (LoadedMods.Forestry) { - mEntityMap.put(ReflectionUtils.getClass("forestry.lepidopterology.entities.EntityButterfly")); - } - } - - public TileEntityPestKiller() { - this.mInventory = new InventoryPestKiller(); - mTank = new BTF_FluidTank(2000); - } - - public InventoryPestKiller getInventory() { - return this.mInventory; - } - - public FluidTank getTank() { - return mTank; - } - - private final void setup() { - World w = this.worldObj; - if (w != null) { - Chunk c = w.getChunkFromBlockCoords(this.xCoord, this.zCoord); - if (c != null) { - mChunkX = c.xPosition; - mChunkZ = c.zPosition; - mSet = true; - } - } - } - - @SuppressWarnings("rawtypes") - public boolean tryKillPests() { - int min = 0; - int max = 0; - switch (getTier()) { - case 1: - min = -2; - max = 3; - break; - case 2: - min = -4; - max = 5; - break; - default: - // code block - } - int aChunkCount = 0; - AutoMap<Entity> entities = new AutoMap<Entity>(); - if (min != 0 && max != 0) { - for (int x = min; x < max; x++) { - for (int z = min; z < max; z++) { - Chunk c = getChunkFromOffsetIfLoaded(x, z); - if (c != null) { - if (c.hasEntities) { - aChunkCount++; - List[] lists = c.entityLists; - for (List o : lists) { - for (Object e : o) { - if (e instanceof Entity) { - for (Class<?> C : mEntityMap) { - if (e.getClass().equals(C) || C.isAssignableFrom(e.getClass())) { - entities.put((Entity) e); - } - } - } - } - } - } - } - } - } - } else { - Chunk c = getChunkFromOffsetIfLoaded(0, 0); - if (c != null) { - if (c.hasEntities) { - List[] lists = c.entityLists; - for (List o : lists) { - for (Object e : o) { - if (e instanceof Entity) { - for (Class<?> C : mEntityMap) { - if (e.getClass().equals(C) || C.isAssignableFrom(e.getClass())) { - entities.put((Entity) e); - } - } - } - } - } - } - } - } - boolean killed = false; - if (!entities.isEmpty()) { - for (Entity e : entities) { - if (e != null) { - if (e.isEntityAlive()) { - if (this.mTank.getFluidAmount() >= 1 || getTier() == 0) { - if (getTier() > 0) { - int aChanceToUse = MathUtils.randInt(1, (100 * getTier())); - if (aChanceToUse == 1) { - this.mTank.drain(1, true); - } - } - e.performHurtAnimation(); - EntityUtils.doDamage(e, DamageSource.generic, Short.MAX_VALUE); - e.setDead(); - killed = true; - } - } - } - } - } - updateTileEntity(); - return killed; - } - - public Chunk getChunkFromOffsetIfLoaded(int x, int y) { - Chunk c = this.worldObj.getChunkFromChunkCoords(mChunkX + x, mChunkZ + y); - if (c.isChunkLoaded) { - return c; - } - return null; - } - - public int getTier() { - if (this.mTank != null) { - FluidStack f = mTank.getFluid(); - if (f != null) { - if (f.isFluidEqual(FluidUtils.getWildcardFluidStack("formaldehyde", 1))) { - return 1; - } else if (f.isFluidEqual(MISC_MATERIALS.HYDROGEN_CYANIDE.getFluidStack(1))) { - return 2; - } - } - } - return 0; - } - - @Override - public void updateEntity() { - if (worldObj.isRemote) { - return; - } - if (!mSet) { - setup(); - } - this.mTickCounter++; - if (this.mTank != null) { - if (this.hasFluidSpace()) { - handleInventory(); - } - } - if (this.mTickCounter % this.mBaseTickRate == 0) { - tryKillPests(); - } - updateTick(); - } - - public boolean anyPlayerInRange() { - return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null; - } - - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { - if (!nbt.hasKey(tag)) { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound nbt) { - mTank.writeToNBT(nbt); - super.writeToNBT(nbt); - // Utils.LOG_MACHINE_INFO("Trying to write NBT data to TE."); - final NBTTagCompound chestData = new NBTTagCompound(); - this.mInventory.writeToNBT(chestData); - nbt.setTag("ContentsChest", chestData); - if (this.hasCustomInventoryName()) { - nbt.setString("CustomName", this.getCustomName()); - } - } - - @Override - public void readFromNBT(final NBTTagCompound nbt) { - mTank.readFromNBT(nbt); - super.readFromNBT(nbt); - // Utils.LOG_MACHINE_INFO("Trying to read NBT data from TE."); - this.mInventory.readFromNBT(nbt.getCompoundTag("ContentsChest")); - if (nbt.hasKey("CustomName", 8)) { - this.setCustomName(nbt.getString("CustomName")); - } - } - - @Override - public int getSizeInventory() { - return this.getInventory().getSizeInventory(); - } - - @Override - public ItemStack getStackInSlot(final int slot) { - return this.getInventory().getStackInSlot(slot); - } - - @Override - public ItemStack decrStackSize(final int slot, final int count) { - return this.getInventory().decrStackSize(slot, count); - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) { - return this.getInventory().getStackInSlotOnClosing(slot); - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) { - this.getInventory().setInventorySlotContents(slot, stack); - } - - @Override - public int getInventoryStackLimit() { - return this.getInventory().getInventoryStackLimit(); - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) { - return this.getInventory().isUseableByPlayer(entityplayer); - } - - @Override - public void openInventory() { - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.getInventory().openInventory(); - } - - @Override - public void closeInventory() { - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.getInventory().closeInventory(); - } - - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - return this.getInventory().isItemValidForSlot(slot, itemstack); - } - - @Override - public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { - final int[] accessibleSides = new int[this.getSizeInventory()]; - for (int r = 0; r < this.getInventory().getSizeInventory(); r++) { - accessibleSides[r] = r; - } - return accessibleSides; - - } - - @Override - public boolean canInsertItem(final int aSlot, final ItemStack aStack, final int p_102007_3_) { - if (this.getInventory().getInventory()[0] == null) { - return true; - } else if (GT_Utility.areStacksEqual(aStack, this.getInventory().getInventory()[0])) { - if (this.getInventory().getInventory()[0].stackSize < 64) { - int diff = 64 - this.getInventory().getInventory()[0].stackSize; - if (aStack.stackSize <= diff) { - return true; - } - } - } - return false; - } - - @Override - public boolean canExtractItem(final int aSlot, final ItemStack aStack, final int p_102008_3_) { - if (this.getInventory().getInventory()[1] == null) { - return false; - } else { - return true; - } - } - - public String getCustomName() { - return this.mCustomName; - } - - public void setCustomName(final String customName) { - this.mCustomName = customName; - } - - @Override - public String getInventoryName() { - return this.hasCustomInventoryName() ? this.mCustomName : "container.pestkiller"; - } - - @Override - public boolean hasCustomInventoryName() { - return (this.mCustomName != null) && !this.mCustomName.equals(""); - } - - @Override - public final int fill(ForgeDirection from, FluidStack resource, boolean doFill) { - updateTileEntity(); - return this.mTank.fill(resource, doFill); - } - - @Override - public final FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { - updateTileEntity(); - return this.mTank.drain(resource.amount, doDrain); - } - - @Override - public final FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { - FluidStack fluid = this.mTank.getFluid(); - // return this.tank.drain(maxDrain, doDrain); - if (fluid == null) { - return null; - } - - int drained = maxDrain; - if (fluid.amount < drained) { - drained = fluid.amount; - } - - FluidStack stack = new FluidStack(fluid, drained); - if (doDrain) { - fluid.amount -= drained; - if (fluid.amount <= 0) { - fluid = null; - } - - if (this != null) { - FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluid, this.getWorldObj(), this.xCoord, - this.yCoord, this.zCoord, this.mTank, 0)); - } - } - updateTileEntity(); - return stack; - } - - @Override - public boolean canFill(ForgeDirection from, Fluid fluid) { - return mTank.getFluid() == null || mTank.getFluid().getFluid().equals(fluid); - } - - @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) { - return false; - } - - @Override - public final FluidTankInfo[] getTankInfo(ForgeDirection from) { - return new FluidTankInfo[] { this.mTank.getInfo() }; - } - - @Override - public final Packet getDescriptionPacket() { - NBTTagCompound tag = new NBTTagCompound(); - writeToNBT(tag); - return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tag); - } - - @Override - public final void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { - NBTTagCompound tag = pkt.func_148857_g(); - readFromNBT(tag); - } - - - public boolean hasFluidSpace() { - if (this.mTank.getFluidAmount() <= 1000) { - return true; - } - return false; - } - - public boolean drainCell() { - boolean didFill = false; - ItemStack aInput = this.getStackInSlot(0); - if (aInput == null) { - return false; - } - aInput = aInput.copy(); - if (aInput != null && (this.getStackInSlot(1) == null || this.getStackInSlot(1).stackSize < 64)) { - ArrayList<ItemStack> t1Cells = OreDictionary.getOres("cellFormaldehyde"); - ArrayList<ItemStack> t2Cells = OreDictionary.getOres("cellHydrogenCyanide"); - didFill = addFluid(t1Cells, aInput, FluidUtils.getWildcardFluidStack("formaldehyde", 1000)); - if (!didFill) { - didFill = addFluid(t2Cells, aInput, MISC_MATERIALS.HYDROGEN_CYANIDE.getFluidStack(1000)); - } - } - - return didFill; - } - - public boolean handleInventory() { - if (this.getInventory() != null && drainCell()) { - this.decrStackSize(0, 1); - if (this.getStackInSlot(1) == null) { - this.setInventorySlotContents(1, CI.emptyCells(1)); - } else { - this.getStackInSlot(1).stackSize++; - } - this.updateTileEntity(); - return true; - } else { - return false; - } - } - - public boolean addFluid(ArrayList<ItemStack> inputs, ItemStack aInput, FluidStack aFluidForInput) { - for (ItemStack a : inputs) { - if (GT_Utility.areStacksEqual(a, aInput)) { - if (mTank.getFluid() == null || mTank.getFluid() - .isFluidEqual(aFluidForInput)) { - boolean didFill = fill(ForgeDirection.UNKNOWN, aFluidForInput, true) > 0; - return didFill; - } - } else { - continue; - } - } - return false; - } - - public void updateTileEntity() { - this.getInventory().markDirty(); - this.markDirty(); - this.mNeedsUpdate = true; - } - - private final void updateTick() { - if (mNeedsUpdate) { - if (mUpdateTick == 0) { - mUpdateTick = 4; // every 4 ticks it will send an update - } else { - --mUpdateTick; - if (mUpdateTick == 0) { - markDirty(); - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - mNeedsUpdate = false; - } - } - } - } - - - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPooCollector.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPooCollector.java deleted file mode 100644 index 25348a31f8..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPooCollector.java +++ /dev/null @@ -1,147 +0,0 @@ -package gtPlusPlus.core.tileentities.machines; - -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.item.chemistry.AgriculturalChem; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.passive.EntityAnimal; -import net.minecraft.entity.passive.EntityChicken; -import net.minecraft.entity.passive.EntityCow; -import net.minecraft.entity.passive.EntityHorse; -import net.minecraft.entity.passive.EntityMooshroom; -import net.minecraft.entity.passive.EntitySheep; -import net.minecraft.entity.passive.IAnimals; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; - -public class TileEntityPooCollector extends TileEntityBaseFluidCollector { - - public TileEntityPooCollector() { - super(9, 8000); - } - - - @Override - public boolean canFill(ForgeDirection from, Fluid fluid) { - return false; - } - - @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) { - return true; - } - - public void onPreLogicTick() { - - } - - public <V> boolean addDrop(V aPooMaker) { - int aChance = MathUtils.randInt(0, 50000); - if (aChance > 0) { - ItemStack aPoop; - if (aChance<= 100) { - aPoop = ItemUtils.getItemStackOfAmountFromOreDict("dustManureByproducts", 1); - } - else if (aChance <= 500) { - aPoop = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallManureByproducts", 1); - } - else if (aChance <= 1250) { - aPoop = ItemUtils.getItemStackOfAmountFromOreDict("dustTinyManureByproducts", 1); - } - else { - return false; - } - if (!ItemUtils.checkForInvalidItems(aPoop)) { - return false; - } - - //Add poop to world - //Logger.INFO("Adding animal waste for "+aPooMaker.getCommandSenderName()); - - //Add to inventory if not full, else espawn in world - if (!this.mInventory.addItemStack(aPoop)) { - EntityItem entity = new EntityItem(worldObj, xCoord, yCoord+1.5, zCoord, aPoop); - worldObj.spawnEntityInWorld(entity); - } - - } - - - return false; - } - - private static AutoMap<Class> aEntityToDrain = new AutoMap<Class>(); - - @Override - public AutoMap<Class> aThingsToLookFor() { - if (aEntityToDrain.isEmpty()) { - aEntityToDrain.add(EntityAnimal.class); - aEntityToDrain.add(IAnimals.class); - } - return aEntityToDrain; - } - - @Override - public <V> int onPostTick(V aPooMaker) { - if (this.tank.getFluidAmount() < this.tank.getCapacity()) { - int aPooAmount = 0; - // Vanilla Animals - if (aPooMaker instanceof EntityChicken) { - aPooAmount = MathUtils.randInt(1, 40); - } - else if (aPooMaker instanceof EntityHorse) { - aPooAmount = MathUtils.randInt(20, 40); - } - else if (aPooMaker instanceof EntityCow) { - aPooAmount = MathUtils.randInt(18, 45); - } - else if (aPooMaker instanceof EntityMooshroom) { - aPooAmount = 17; - } - else if (aPooMaker instanceof EntitySheep) { - aPooAmount = MathUtils.randInt(8, 30); - } - - else { - if (aPooMaker instanceof EntityAnimal || aPooMaker instanceof IAnimals) { - aPooAmount = MathUtils.randInt(5, 35); - } - else { - aPooAmount = MathUtils.randInt(1, 10); - } - } - aPooAmount = Math.max((Math.min(this.tank.getCapacity()-this.tank.getFluidAmount(), aPooAmount)/10), 1); - return aPooAmount; - } - else { - return 0; - } - } - - @Override - public Fluid fluidToProvide() { - return AgriculturalChem.PoopJuice; - } - - @Override - public ItemStack itemToSpawnInWorldIfTankIsFull() { - int a = MathUtils.randInt(0, 100); - ItemStack aItem = null; - if (a <= 30) { - aItem = ItemUtils.getSimpleStack(AgriculturalChem.dustDirt); - } - else if (a <= 40) { - aItem = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallManureByproducts", 1); - } - else if (a <= 55) { - aItem = ItemUtils.getItemStackOfAmountFromOreDict("dustTinyManureByproducts", 1); - } - return aItem; - } - - - - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java deleted file mode 100644 index 8c87baf6a9..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java +++ /dev/null @@ -1,288 +0,0 @@ -package gtPlusPlus.core.tileentities.machines; - -import java.util.List; -import java.util.Vector; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; - -import gregtech.api.enums.ItemList; -import gregtech.common.items.GT_MetaGenerated_Item_01; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.container.Container_ProjectTable; -import gtPlusPlus.core.inventories.projecttable.InventoryProjectMain; -import gtPlusPlus.core.inventories.projecttable.InventoryProjectOutput; -import gtPlusPlus.core.item.bauble.ModularBauble; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils.BT; -import gtPlusPlus.core.util.minecraft.ModularArmourUtils.Modifiers; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechItems; -import ic2.api.network.INetworkDataProvider; -import ic2.api.network.INetworkUpdateListener; -import ic2.api.tile.IWrenchable; -import ic2.core.IC2; - -public class TileEntityProjectTable extends TileEntity implements INetworkDataProvider, INetworkUpdateListener, IWrenchable{ - - public InventoryProjectMain inventoryGrid; - public InventoryProjectOutput inventoryOutputs; - - /** The crafting matrix inventory (3x3). */ - public InventoryCrafting craftMatrix; - public IInventory craftResult; - private Container_ProjectTable container; - - public TileEntityProjectTable(){ - this.inventoryGrid = new InventoryProjectMain();//number of slots - without product slot - this.inventoryOutputs = new InventoryProjectOutput();//number of slots - without product slot - this.canUpdate(); - } - - public void setContainer(Container_ProjectTable container){ - this.container = container; - } - - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag){ - if(!nbt.hasKey(tag)) - { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound nbt){ - super.writeToNBT(nbt); - nbt.setShort("facing", this.facing); - this.inventoryGrid.writeToNBT(this.getTag(nbt, "ContentsGrid")); - this.inventoryOutputs.writeToNBT(this.getTag(nbt, "ContentsOutput")); - - } - - @Override - public void readFromNBT(final NBTTagCompound nbt){ - super.readFromNBT(nbt); - this.prevFacing = (this.facing = nbt.getShort("facing")); - this.inventoryGrid.readFromNBT(nbt.getCompoundTag("ContentsGrid")); - this.inventoryOutputs.readFromNBT(nbt.getCompoundTag("ContentsOutput")); - } - - @Override - public List<String> getNetworkedFields(){ - final List<String> ret = new Vector(2); - ret.add("facing"); - return ret; - } - - - @Override - public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final int side){ - return false; - } - - private short facing = 0; - public short prevFacing = 0; - - @Override - public void setFacing(final short facing1){ - this.facing = facing1; - if (this.prevFacing != facing1) { - IC2.network.get().updateTileEntityField(this, "facing"); - } - this.prevFacing = facing1; - } - - @Override - public short getFacing(){ - return this.facing; - } - - - @Override - public boolean wrenchCanRemove(final EntityPlayer entityPlayer){ - return true; - } - - @Override - public float getWrenchDropRate(){ - return 1.0F; - } - - @Override - public ItemStack getWrenchDrop(final EntityPlayer entityPlayer){ - return new ItemStack(this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord), 1, this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord)); - } - - @Override - public void onNetworkUpdate(final String field) { - this.prevFacing = this.facing; - - } - - @Override - public void updateEntity() { - if (!this.worldObj.isRemote){ - //Data stick - ItemStack dataStick = this.inventoryOutputs.getStackInSlot(0); - if (dataStick != null && this.container != null && container.getOutputContent() != null){ - if ((dataStick.getItem() instanceof GT_MetaGenerated_Item_01 && dataStick.getItemDamage() == 32708) - || (dataStick == ItemList.Tool_DataStick.get(1)) - || (dataStick == GregtechItemList.Old_Tool_DataStick.get(1)) - || (dataStick.getItem() instanceof MetaGeneratedGregtechItems && dataStick.getItemDamage() == 32208)){ - - Logger.INFO("Found Data Stick and valid container."); - - - ItemStack outputComponent = container.getOutputContent(); - ItemStack[] craftInputComponent = container.getInputComponents(); - - - ItemStack newStick = NBTUtils.writeItemsToNBT(dataStick, new ItemStack[]{outputComponent}, "Output"); - newStick = NBTUtils.writeItemsToNBT(newStick, craftInputComponent); - NBTUtils.setBookTitle(newStick, "Encrypted Project Data"); - NBTUtils.setBoolean(newStick, "mEncrypted", true); - int slotm=0; - Logger.WARNING("Uploading to Data Stick."); - for (ItemStack is : NBTUtils.readItemsFromNBT(newStick)){ - if (is != null){ - Logger.WARNING("Uploaded "+is.getDisplayName()+" into memory slot "+slotm+"."); - } - else { - Logger.WARNING("Left memory slot "+slotm+" blank."); - } - slotm++; - } - Logger.WARNING("Encrypting Data Stick."); - this.inventoryOutputs.setInventorySlotContents(1, newStick); - this.inventoryOutputs.setInventorySlotContents(0, null); - } - } - - //Utils.LOG_INFO("Doing thing 1"); - if (dataStick != null) - if (dataStick.getItem() instanceof ModularBauble){ - Logger.INFO("Doing thing 2"); - ItemStack tBauble = dataStick; - dataStick = null; - this.inventoryOutputs.setInventorySlotContents(0, dataStick); - if (this.inventoryGrid != null){ - Logger.INFO("Doing things"); - ItemStack[] tStack = container.getInputComponents(); - if (tStack != null){ - //Utils.LOG_INFO(""+tStack.length); - if (tBauble != null){ - for (int i=0;i<tStack.length;i++){ - - ItemStack testStack; - if ((testStack = container.inventoryGrid.getStackInSlot(i)) != null){ - Logger.INFO("FOUND: "+testStack.getDisplayName()); - } - - if (tStack[i] != null){ - Logger.INFO("found "+tStack[i].getDisplayName()); - try { - if (tStack[i].getItem() == Items.feather){ - ModularArmourUtils.setBaubleType(tBauble, BT.TYPE_BELT); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - this.inventoryGrid.setInventorySlotContents(i, null); - } - if (tStack[i].getItem() == Items.bed){ - ModularArmourUtils.setBaubleType(tBauble, BT.TYPE_RING); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - this.inventoryGrid.setInventorySlotContents(i, null); - } - if (tStack[i].getItem() == Items.boat){ - ModularArmourUtils.setBaubleType(tBauble, BT.TYPE_AMULET); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - this.inventoryGrid.setInventorySlotContents(i, null); - } - - if (tStack[i].getItem() == Items.egg){ - ModularArmourUtils.setModifierLevel(tBauble, Modifiers.BOOST_HOLY, ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_HOLY)+1); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - this.inventoryGrid.setInventorySlotContents(i, null); - } - - if (tStack[i].getItem() == Items.baked_potato){ - ModularArmourUtils.setModifierLevel(tBauble, Modifiers.BOOST_DEF, ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_DEF)+1); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - this.inventoryGrid.setInventorySlotContents(i, null); - } - - if (tStack[i].getItem() == Items.cooked_beef){ - ModularArmourUtils.setModifierLevel(tBauble, Modifiers.BOOST_HP, ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_HP)+1); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - this.inventoryGrid.setInventorySlotContents(i, null); - } - - if (tStack[i] == ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:17019", 17019, 1)){ - ModularArmourUtils.setModifierLevel(tBauble, Modifiers.BOOST_DEF, ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_DEF)+1); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - } - if (tStack[i] == ItemList.Electric_Motor_LV.get(1)){ - ModularArmourUtils.setModifierLevel(tBauble, Modifiers.BOOST_DAMAGE, ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_DAMAGE)+1); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - } - else if (tStack[i] == ItemList.Electric_Motor_MV.get(1)){ - ModularArmourUtils.setModifierLevel(tBauble, Modifiers.BOOST_DAMAGE, ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_DAMAGE)+2); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - } - else if (tStack[i] == ItemList.Electric_Motor_HV.get(1)){ - ModularArmourUtils.setModifierLevel(tBauble, Modifiers.BOOST_DAMAGE, ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_DAMAGE)+3); - Logger.INFO("buffed Modular bauble"); - tStack[i] = null; - container.inventoryGrid.setInventorySlotContents(i, null); - } - } - catch (Throwable t){ - - } - } - } - Logger.INFO("set new Modular bauble"); - this.inventoryOutputs.setInventorySlotContents(1, tBauble); - } - } - } - } - } - super.updateEntity(); - } - - @Override - public boolean canUpdate() { - return true; - } - - - - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java deleted file mode 100644 index a220997c84..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java +++ /dev/null @@ -1,739 +0,0 @@ -package gtPlusPlus.core.tileentities.machines; - -import java.util.List; - -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.handler.GuiHandler; -import gtPlusPlus.core.inventories.Inventory_RoundRobinator; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.sys.KeyboardUtils; -import net.minecraft.block.Block; -import net.minecraft.block.BlockChest; -import net.minecraft.command.IEntitySelector; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.tileentity.IHopper; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.Facing; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; - -public class TileEntityRoundRobinator extends TileEntity implements ISidedInventory, IHopper { - - private int tickCount = 0; - private final Inventory_RoundRobinator inventoryContents; - private String customName; - public int locationX; - public int locationY; - public int locationZ; - private int aData = 1111; - private int aTier = 1; - private int aTickRate = 100; - - public TileEntityRoundRobinator() { - this.inventoryContents = new Inventory_RoundRobinator(); - this.setTileLocation(); - } - - public boolean setTileLocation() { - if (this.hasWorldObj()) { - if (!this.getWorldObj().isRemote) { - this.locationX = this.xCoord; - this.locationY = this.yCoord; - this.locationZ = this.zCoord; - this.aTier = this.getWorldObj().getBlockMetadata(locationX, locationY, locationZ) + 1; - return true; - } - } - return false; - } - - //Rename to hasCircuitToConfigure - public final boolean hasInventoryContents() { - for (ItemStack i : this.aHopperInventory) { - if (i == null) { - continue; - } - else { - return true; - } - } - return false; - } - - public Inventory_RoundRobinator getInventory() { - return this.inventoryContents; - } - - public int getTier() { - return this.aTier; - } - - public int getTickRate() { - return this.aTickRate; - } - - @Override - public void updateEntity() { - try{ - // TODO - if (this.worldObj != null && !this.worldObj.isRemote){ - setTileLocation(); - aTickRate = (60-(aTier*10)); - if (this.getTier() == 1) { - // 20 s - aTickRate = 400; - } - else if (this.getTier() == 2) { - // 5 - aTickRate = 100; - } - else if (this.getTier() == 3) { - // 1 - aTickRate = 20; - } - else if (this.getTier() == 4) { - // 1/5 - aTickRate = 10; - } - else if (this.getTier() == 5) { - // 1/20 - aTickRate = 1; - } - else { - aTickRate = 999999; - } - - if (tickCount % getTickRate() == 0) { - if (hasInventoryContents()) { - Logger.WARNING("Trying to move items. "+aTickRate); - this.tryProcessItems(); - } - } - this.tickCount++; - } - } - catch (final Throwable t){ - t.printStackTrace(); - } - } - - public boolean anyPlayerInRange() { - return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null; - } - - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { - if (!nbt.hasKey(tag)) { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound nbt) { - super.writeToNBT(nbt); - if (this.hasCustomInventoryName()) { - nbt.setString("CustomName", this.getCustomName()); - } - nbt.setInteger("aCurrentMode", aData); - this.writeToNBT2(nbt); - } - - @Override - public void readFromNBT(final NBTTagCompound nbt) { - super.readFromNBT(nbt); - if (nbt.hasKey("CustomName", 8)) { - this.setCustomName(nbt.getString("CustomName")); - } - aData = nbt.getInteger("aCurrentMode"); - this.readFromNBT2(nbt); - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) { - return this.getInventory().isUseableByPlayer(entityplayer); - } - - @Override - public void openInventory() { - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - //this.getInventory().openInventory(); - } - - @Override - public void closeInventory() { - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - //this.getInventory().closeInventory(); - } - - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - return true; - } - - @Override - public int[] getAccessibleSlotsFromSide(final int aSide) { - return new int[] {0, 1, 2, 3, 4}; - } - - @Override - public boolean canInsertItem(final int aSlot, final ItemStack aStack, final int aSide) { - return aSide < 2; - } - - @Override - public boolean canExtractItem(final int aSlot, final ItemStack aStack, final int aSide) { - return false; - } - - public String getCustomName() { - return this.customName; - } - - public void setCustomName(final String customName) { - this.customName = customName; - } - - @Override - public String getInventoryName() { - return this.hasCustomInventoryName() ? this.customName : "container.roundrobinator"; - } - - @Override - public boolean hasCustomInventoryName() { - return (this.customName != null) && !this.customName.equals(""); - } - - @Override - public Packet getDescriptionPacket() { - final NBTTagCompound tag = new NBTTagCompound(); - this.writeToNBT(tag); - return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tag); - } - - @Override - public void onDataPacket(final NetworkManager net, final S35PacketUpdateTileEntity pkt) { - final NBTTagCompound tag = pkt.func_148857_g(); - this.readFromNBT(tag); - } - - - public boolean onRightClick(byte side, EntityPlayer player, int x, int y, int z) { - if (player != null && player.getHeldItem() == null) { - if (!player.isSneaking() && !KeyboardUtils.isShiftKeyDown()) { - player.openGui(GTplusplus.instance, GuiHandler.GUI16, player.getEntityWorld(), x, y, z); - } - else { - String InventoryContents = ItemUtils.getArrayStackNames(this.aHopperInventory); - PlayerUtils.messagePlayer(player, "Contents: "+InventoryContents+" | "+getDataString()); - } - return true; - } - else { - return false; - } - } - - public boolean onScrewdriverRightClick(byte side, EntityPlayer player, int x, int y, int z) { - try { - if (side < 2) { - // Top/Bottom - } - else { - if (toggleSide(side)) { - PlayerUtils.messagePlayer(player, "Enabling side "+side+"."); - } - else { - PlayerUtils.messagePlayer(player, "Disabling side "+side+"."); - } - PlayerUtils.messagePlayer(player, "Mode String: "+aData+""); - } - return true; - } - catch (Throwable t) { - t.printStackTrace(); - return false; - } - } - - public int getDataString() { - return aData; - } - - public boolean[] getActiveSides() { - this.markDirty(); - String s = String.valueOf(aData); - if (s == null || s.length() != 4) { - s = "1111"; - } - boolean[] aActiveSides = new boolean[4]; - for (int i=0;i<4;i++) { - char ch = s.charAt(i); - if (ch == '1') { - aActiveSides[i] = true; - } - else { - aActiveSides[i] = false; - } - } - return aActiveSides; - } - - /** - * Toggle active state of side - * @param aSide - Forge Direction / Side - * @return - True if the side is now Active, false if now disabled. - */ - public boolean toggleSide(int aSide) { - setSideActive(!getSideActive(aSide), aSide); - return getSideActive(aSide); - } - - - public void setSideActive(boolean aActive, int aSide) { - try { - if (aSide < 2) { - } - else { - if (aData < 1111) { - aData = 1111; - } - else if (aData > 2222) { - aData = 2222; - } - String s = String.valueOf(aData); - StringBuilder aDataString = new StringBuilder(s); - int aIndex = aSide - 2; - if (aActive) { - aDataString.setCharAt(aIndex, '1'); - } - else { - aDataString.setCharAt(aIndex, '2'); - } - aData = Integer.valueOf(aDataString.toString()); - this.markDirty(); - } - } - catch (Throwable t) { - t.printStackTrace(); - } - } - - public boolean getSideActive(int aSide) { - this.markDirty(); - try { - if (aSide < 2) { - return false; - } - else { - if (aData < 1111) { - aData = 1111; - } - else if (aData > 2222) { - aData = 2222; - } - String s = String.valueOf(aData); - int aIndex = aSide - 2; - char ch = s.charAt(aIndex); - if (ch == '1') { - return true; - } - else { - return false; - } - - } - } - catch (Throwable t) { - t.printStackTrace(); - return false; - } - } - - @Override - public double getXPos() { - return this.locationX; - } - - @Override - public double getYPos() { - return this.locationY; - } - - @Override - public double getZPos() { - return this.locationZ; - } - - - - - - - - - // TODO - - - - /* - * Hopper Code - */ - - - private ItemStack[] aHopperInventory = new ItemStack[5]; - - public int getSizeInventory() { - return this.aHopperInventory.length; - } - - public ItemStack getStackInSlot(int aSlot) { - return this.aHopperInventory[aSlot]; - } - - /** - * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a - * new stack. - */ - public ItemStack decrStackSize(int aSlot, int aMinimumSizeOfExistingStack) - { - if (this.aHopperInventory[aSlot] != null) - { - ItemStack itemstack; - - if (this.aHopperInventory[aSlot].stackSize <= aMinimumSizeOfExistingStack) - { - itemstack = this.aHopperInventory[aSlot]; - this.aHopperInventory[aSlot] = null; - return itemstack; - } - else - { - itemstack = this.aHopperInventory[aSlot].splitStack(aMinimumSizeOfExistingStack); - - if (this.aHopperInventory[aSlot].stackSize == 0) - { - this.aHopperInventory[aSlot] = null; - } - - return itemstack; - } - } - else - { - return null; - } - } - - /** - * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - - * like when you close a workbench GUI. - */ - public ItemStack getStackInSlotOnClosing(int aSlot) - { - if (this.aHopperInventory[aSlot] != null) - { - ItemStack itemstack = this.aHopperInventory[aSlot]; - this.aHopperInventory[aSlot] = null; - return itemstack; - } - else - { - return null; - } - } - - /** - * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). - */ - public void setInventorySlotContents(int aSlot, ItemStack aStack) - { - this.aHopperInventory[aSlot] = aStack; - - if (aStack != null && aStack.stackSize > this.getInventoryStackLimit()) - { - aStack.stackSize = this.getInventoryStackLimit(); - } - } - - public boolean tryProcessItems() { - if (this.worldObj != null && !this.worldObj.isRemote) { - boolean didSomething = false; - if (!this.isEmpty()) { - Logger.WARNING("Has Items, Trying to push to all active directions."); - didSomething = this.tryPushItemsIntoNeighbours(); - } - if (didSomething) { - this.markDirty(); - return true; - } - } - return false; - } - - /** - * Is Empty - * @return - */ - private boolean isEmpty() { - ItemStack[] aitemstack = this.aHopperInventory; - int i = aitemstack.length; - - for (int j = 0; j < i; ++j) { - ItemStack itemstack = aitemstack[j]; - - if (itemstack != null) { - return false; - } - } - - return true; - } - - private boolean tryPushItemsIntoNeighbours() { - - boolean aDidPush = false; - - for (int u = 2; u < 6; u++) { - if (!this.getSideActive(u)) { - Logger.WARNING("Not pushing on side "+u); - continue; - } - - Logger.WARNING("Pushing on side "+u); - IInventory iinventory = this.getInventoryFromFacing(u); - - if (iinventory == null) { - Logger.WARNING("No inventory found."); - continue; - } - else { - - int i = Facing.oppositeSide[u]; - Logger.WARNING("Using Opposite direction: "+i); - - if (this.isInventoryFull(iinventory, i)) { - Logger.WARNING("Target is full, skipping."); - continue; - } - else { - Logger.WARNING("Target has space, let's move a single item."); - for (int j = 0; j < this.getSizeInventory(); ++j) { - if (this.getStackInSlot(j) != null) { - ItemStack itemstack = this.getStackInSlot(j).copy(); - ItemStack itemstack1 = setStackInNeighbour(iinventory, this.decrStackSize(j, 1), i); - if (itemstack1 == null || itemstack1.stackSize == 0) { - iinventory.markDirty(); - aDidPush = true; - continue; - } - this.setInventorySlotContents(j, itemstack); - } - } - } - } - } - - return aDidPush; - } - - private boolean isInventoryFull(IInventory aInv, int aSide) { - if (aInv instanceof ISidedInventory && aSide > -1) { - ISidedInventory isidedinventory = (ISidedInventory)aInv; - int[] aint = isidedinventory.getAccessibleSlotsFromSide(aSide); - - for (int l = 0; l < aint.length; ++l) - { - ItemStack itemstack1 = isidedinventory.getStackInSlot(aint[l]); - - if (itemstack1 == null || itemstack1.stackSize != itemstack1.getMaxStackSize()) - { - return false; - } - } - } - else { - int j = aInv.getSizeInventory(); - - for (int k = 0; k < j; ++k) - { - ItemStack itemstack = aInv.getStackInSlot(k); - - if (itemstack == null || itemstack.stackSize != itemstack.getMaxStackSize()) - { - return false; - } - } - } - return true; - } - - public static ItemStack setStackInNeighbour(IInventory aNeighbour, ItemStack aStack, int aSide) { - if (aNeighbour instanceof ISidedInventory && aSide > -1) - { - ISidedInventory isidedinventory = (ISidedInventory)aNeighbour; - int[] aint = isidedinventory.getAccessibleSlotsFromSide(aSide); - - for (int l = 0; l < aint.length && aStack != null && aStack.stackSize > 0; ++l) - { - aStack = tryMoveStack(aNeighbour, aStack, aint[l], aSide); - } - } - else - { - int j = aNeighbour.getSizeInventory(); - - for (int k = 0; k < j && aStack != null && aStack.stackSize > 0; ++k) - { - aStack = tryMoveStack(aNeighbour, aStack, k, aSide); - } - } - - if (aStack != null && aStack.stackSize == 0) - { - aStack = null; - } - - return aStack; - } - - private static boolean canInsertItemIntoNeighbour(IInventory aNeighbour, ItemStack aStack, int aSlot, int aSide) { - return !aNeighbour.isItemValidForSlot(aSlot, aStack) ? false : !(aNeighbour instanceof ISidedInventory) || ((ISidedInventory)aNeighbour).canInsertItem(aSlot, aStack, aSide); - } - - private static ItemStack tryMoveStack(IInventory aNeighbour, ItemStack aStack, int aSlot, int aSide) { - ItemStack itemstack1 = aNeighbour.getStackInSlot(aSlot); - if (canInsertItemIntoNeighbour(aNeighbour, aStack, aSlot, aSide)) { - boolean aDidSomething = false; - if (itemstack1 == null) { - //Forge: BUGFIX: Again, make things respect max stack sizes. - int max = Math.min(aStack.getMaxStackSize(), aNeighbour.getInventoryStackLimit()); - if (max >= aStack.stackSize) { - aNeighbour.setInventorySlotContents(aSlot, aStack); - aStack = null; - } - else { - aNeighbour.setInventorySlotContents(aSlot, aStack.splitStack(max)); - } - aDidSomething = true; - } - else if (areItemStacksEqual(itemstack1, aStack)) { - //Forge: BUGFIX: Again, make things respect max stack sizes. - int max = Math.min(aStack.getMaxStackSize(), aNeighbour.getInventoryStackLimit()); - if (max > itemstack1.stackSize) { - int l = Math.min(aStack.stackSize, max - itemstack1.stackSize); - aStack.stackSize -= l; - itemstack1.stackSize += l; - aDidSomething = l > 0; - } - } - if (aDidSomething){ - aNeighbour.markDirty(); - } - } - return aStack; - } - - private IInventory getInventoryFromFacing(int aSide) - { - int i = aSide; - return tryFindInvetoryAtXYZ(this.getWorldObj(), (double)(this.xCoord + Facing.offsetsXForSide[i]), (double)(this.yCoord + Facing.offsetsYForSide[i]), (double)(this.zCoord + Facing.offsetsZForSide[i])); - } - - public static IInventory tryFindInvetoryAtXYZ(World aWorld, double aX, double aY, double aZ) - { - IInventory iinventory = null; - int sX = MathHelper.floor_double(aX); - int sY = MathHelper.floor_double(aY); - int sZ = MathHelper.floor_double(aZ); - TileEntity tileentity = aWorld.getTileEntity(sX, sY, sZ); - - if (tileentity != null && tileentity instanceof IInventory) - { - iinventory = (IInventory)tileentity; - - if (iinventory instanceof TileEntityChest) - { - Block block = aWorld.getBlock(sX, sY, sZ); - - if (block instanceof BlockChest) - { - iinventory = ((BlockChest)block).func_149951_m(aWorld, sX, sY, sZ); - } - } - } - - if (iinventory == null) - { - List list = aWorld.getEntitiesWithinAABBExcludingEntity((Entity)null, AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1.0D, aY + 1.0D, aZ + 1.0D), IEntitySelector.selectInventories); - - if (list != null && list.size() > 0) - { - iinventory = (IInventory)list.get(aWorld.rand.nextInt(list.size())); - } - } - - return iinventory; - } - - private static boolean areItemStacksEqual(ItemStack aStack, ItemStack aStack2) { - return aStack.getItem() != aStack2.getItem() ? false : (aStack.getItemDamage() != aStack2.getItemDamage() ? false : (aStack.stackSize > aStack.getMaxStackSize() ? false : ItemStack.areItemStackTagsEqual(aStack, aStack2))); - } - - public void readFromNBT2(NBTTagCompound p_145839_1_) { - super.readFromNBT(p_145839_1_); - NBTTagList nbttaglist = p_145839_1_.getTagList("Items", 10); - this.aHopperInventory = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < nbttaglist.tagCount(); ++i) { - NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); - byte b0 = nbttagcompound1.getByte("Slot"); - if (b0 >= 0 && b0 < this.aHopperInventory.length) { - this.aHopperInventory[b0] = ItemStack.loadItemStackFromNBT( - nbttagcompound1 - ); - } - } - } - - public void writeToNBT2(NBTTagCompound aNBT) { - super.writeToNBT(aNBT); - NBTTagList nbttaglist = new NBTTagList(); - for (int i = 0; i < this.aHopperInventory.length; ++i) { - if (this.aHopperInventory[i] != null) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setByte("Slot", (byte) i); - this.aHopperInventory[i].writeToNBT(nbttagcompound1); - nbttaglist.appendTag(nbttagcompound1); - } - } - aNBT.setTag("Items", nbttaglist); - } - - - - - - - -} diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityTradeTable.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityTradeTable.java deleted file mode 100644 index ad7ec3d0b3..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityTradeTable.java +++ /dev/null @@ -1,133 +0,0 @@ -package gtPlusPlus.core.tileentities.machines; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import gtPlusPlus.core.container.Container_TradeTable; -import gtPlusPlus.core.inventories.tradetable.InventoryTradeMain; -import gtPlusPlus.core.inventories.tradetable.InventoryTradeOutput; -import gtPlusPlus.core.tileentities.base.TileEntityBase; -import gtPlusPlus.core.util.minecraft.NBTUtils; - -public class TileEntityTradeTable extends TileEntityBase { - - public InventoryTradeMain inventoryGrid; - public InventoryTradeOutput inventoryOutputs; - - private Container_TradeTable container; - - public TileEntityTradeTable(){ - super(2); - this.inventoryGrid = new InventoryTradeMain();//number of slots - without product slot - this.inventoryOutputs = new InventoryTradeOutput();//number of slots - without product slot - } - - public void setContainer(Container_TradeTable container_TradeTable){ - this.container = container_TradeTable; - } - - @Override - public void writeToNBT(final NBTTagCompound nbt){ - super.writeToNBT(nbt); - this.inventoryGrid.writeToNBT(this.getTag(nbt, "ContentsGrid")); - this.inventoryOutputs.writeToNBT(this.getTag(nbt, "ContentsOutput")); - - } - - @Override - public void readFromNBT(final NBTTagCompound nbt){ - this.inventoryGrid.readFromNBT(nbt); - this.inventoryOutputs.readFromNBT(nbt); - super.readFromNBT(nbt); - } - - @Override - public void updateEntity() { - if (!this.worldObj.isRemote){ - ItemStack slot0; - try{ - - slot0 = this.inventoryOutputs.getStackInSlot(0); - if (slot0 != null && slot0.hasTagCompound()){ - NBTUtils.tryIterateNBTData(slot0); - this.inventoryOutputs.setInventorySlotContents(0, null); - this.inventoryOutputs.setInventorySlotContents(1, slot0); - } - - } - catch (Throwable t){ - t.printStackTrace(); - this.inventoryOutputs.setInventorySlotContents(0, null); - } - - } - super.updateEntity(); - } - - @Override - public int getSizeInventory() { - return 0; - } - - @Override - public ItemStack getStackInSlot(int p_70301_1_) { - return null; - } - - @Override - public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) { - return null; - } - - @Override - public ItemStack getStackInSlotOnClosing(int p_70304_1_) { - return null; - } - - @Override - public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) { - - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { - return true; - } - - @Override - public void openInventory() { - - } - - @Override - public void closeInventory() { - - } - - @Override - public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { - return false; - } - - @Override - public int[] getAccessibleSlotsFromSide(int p_94128_1_) { - return new int[] {}; - } - - @Override - public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) { - return false; - } - - @Override - public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) { - return false; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java deleted file mode 100644 index a2db2326a9..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java +++ /dev/null @@ -1,172 +0,0 @@ -package gtPlusPlus.core.tileentities.machines; - -import java.util.List; -import java.util.Vector; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.InventoryCraftResult; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.tileentity.TileEntity; - -import gtPlusPlus.core.inventories.InventoryWorkbenchChest; -import gtPlusPlus.core.inventories.InventoryWorkbenchHoloSlots; -import gtPlusPlus.core.inventories.InventoryWorkbenchTools; -import ic2.api.network.INetworkDataProvider; -import ic2.api.network.INetworkUpdateListener; -import ic2.api.tile.IWrenchable; -import ic2.core.IC2; - -public class TileEntityWorkbench extends TileEntity implements INetworkDataProvider, INetworkUpdateListener, IWrenchable{ - - //Credit to NovaViper in http://www.minecraftforge.net/forum/index.php?topic=26439.0 - Helped me restructure my Inventory system and now the crafting matrix works better. - - public InventoryWorkbenchChest inventoryChest; - public InventoryWorkbenchTools inventoryTool; - public InventoryWorkbenchHoloSlots inventoryHolo; - //public InventoryWorkbenchHoloCrafting inventoryCrafting; - - public IInventory inventoryCraftResult = new InventoryCraftResult(); - - public TileEntityWorkbench(){ - this.inventoryTool = new InventoryWorkbenchTools();//number of slots - without product slot - this.inventoryChest = new InventoryWorkbenchChest();//number of slots - without product slot - this.inventoryHolo = new InventoryWorkbenchHoloSlots(); - //this.inventoryCrafting = new InventoryWorkbenchHoloCrafting(); - this.canUpdate(); - } - - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) - { - if(!nbt.hasKey(tag)) - { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound nbt) - { - super.writeToNBT(nbt); - - nbt.setShort("facing", this.facing); - - this.inventoryChest.writeToNBT(this.getTag(nbt, "ContentsChest")); - this.inventoryTool.writeToNBT(this.getTag(nbt, "ContentsTools")); - //inventoryCrafting.writeToNBT(getTag(nbt, "ContentsCrafting")); - this.inventoryHolo.writeToNBT(this.getTag(nbt, "ContentsHolo")); - - // Write Crafting Matrix to NBT - final NBTTagList craftingTag = new NBTTagList(); - /*for (int currentIndex = 0; currentIndex < this.inventoryCrafting.getSizeInventory(); ++currentIndex) { - if (this.inventoryCrafting.getStackInSlot(currentIndex) != null) { - final NBTTagCompound tagCompound = new NBTTagCompound(); - tagCompound.setByte("Slot", (byte) currentIndex); - this.inventoryCrafting.getStackInSlot(currentIndex).writeToNBT(tagCompound); - craftingTag.appendTag(tagCompound); - } - }*/ - - nbt.setTag("CraftingMatrix", craftingTag); - // Write craftingResult to NBT - if (this.inventoryCraftResult.getStackInSlot(0) != null) { - nbt.setTag("CraftingResult", this.inventoryCraftResult.getStackInSlot(0).writeToNBT(new NBTTagCompound())); - } - - } - - @Override - public void readFromNBT(final NBTTagCompound nbt) - { - super.readFromNBT(nbt); - - this.prevFacing = (this.facing = nbt.getShort("facing")); - - this.inventoryChest.readFromNBT(nbt.getCompoundTag("ContentsChest")); - this.inventoryTool.readFromNBT(nbt.getCompoundTag("ContentsTools")); - //inventoryCrafting.readFromNBT(nbt.getCompoundTag("ContentsCrafting")); - this.inventoryHolo.readFromNBT(nbt.getCompoundTag("ContentsHolo")); - - // Read in the Crafting Matrix from NBT - final NBTTagList craftingTag = nbt.getTagList("CraftingMatrix", 10); - /*this.inventoryCrafting = new InventoryWorkbenchHoloCrafting(); //TODO: magic number - for (int i = 0; i < craftingTag.tagCount(); ++i) { - final NBTTagCompound tagCompound = craftingTag.getCompoundTagAt(i); - final byte slot = tagCompound.getByte("Slot"); - if ((slot >= 0) && (slot < this.inventoryCrafting.getSizeInventory())) { - this.inventoryCrafting.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tagCompound)); - } - }*/ - - - // Read craftingResult from NBT - final NBTTagCompound tagCraftResult = nbt.getCompoundTag("CraftingResult"); - this.inventoryCraftResult.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(tagCraftResult)); - - } - - @Override - public List<String> getNetworkedFields(){ - final List<String> ret = new Vector(2); - ret.add("facing"); - return ret; - } - - - @Override - public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final int side) - { - return false; - } - - private short facing = 0; - public short prevFacing = 0; - - @Override - public void setFacing(final short facing1) - { - this.facing = facing1; - if (this.prevFacing != facing1) { - IC2.network.get().updateTileEntityField(this, "facing"); - } - this.prevFacing = facing1; - } - - @Override - public short getFacing() - { - return this.facing; - } - - - @Override - public boolean wrenchCanRemove(final EntityPlayer entityPlayer) - { - return true; - } - - @Override - public float getWrenchDropRate() - { - return 1.0F; - } - - @Override - public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) - { - return new ItemStack(this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord), 1, this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord)); - } - - @Override - public void onNetworkUpdate(final String field) { - - this.prevFacing = this.facing; - - } - - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java deleted file mode 100644 index 264323388f..0000000000 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java +++ /dev/null @@ -1,245 +0,0 @@ -package gtPlusPlus.core.tileentities.machines; - -import java.util.List; -import java.util.Vector; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.InventoryCraftResult; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.tileentity.TileEntity; - -import gtPlusPlus.core.inventories.*; -import ic2.api.energy.event.EnergyTileLoadEvent; -import ic2.api.energy.event.EnergyTileUnloadEvent; -import ic2.api.energy.tile.IEnergySink; -import ic2.api.network.INetworkDataProvider; -import ic2.api.network.INetworkUpdateListener; -import ic2.api.tile.IWrenchable; -import ic2.core.IC2; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.util.ForgeDirection; - -public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySink, INetworkDataProvider, INetworkUpdateListener, IWrenchable{ - - //Credit to NovaViper in http://www.minecraftforge.net/forum/index.php?topic=26439.0 - Helped me restructure my Inventory system and now the crafting matrix works better. - - public InventoryWorkbenchChest inventoryChest; - public InventoryWorkbenchToolsElectric inventoryTool; - public InventoryWorkbenchHoloSlots inventoryHolo; - public InventoryWorkbenchHoloCrafting inventoryCrafting; - - public IInventory inventoryCraftResult = new InventoryCraftResult(); - - //Wrench Code - private short facing = 0; - public short prevFacing = 0; - - //E-Net Code - public double energy = 0.0D; - public int maxEnergy; - private boolean addedToEnergyNet = false; - private int tier; - private float guiChargeLevel; - - - public TileEntityWorkbenchAdvanced(final int maxenergy, final int tier1){ - this.inventoryTool = new InventoryWorkbenchToolsElectric();//number of slots - without product slot - this.inventoryChest = new InventoryWorkbenchChest();//number of slots - without product slot - this.inventoryHolo = new InventoryWorkbenchHoloSlots(); - this.inventoryCrafting = new InventoryWorkbenchHoloCrafting(); - this.canUpdate(); - - //Electric Stats - this.maxEnergy = maxenergy; - this.tier = tier1; - - } - - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) - { - if(!nbt.hasKey(tag)) - { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound nbt) - { - super.writeToNBT(nbt); - nbt.setDouble("energy", this.energy); - nbt.setShort("facing", this.facing); - - this.inventoryChest.writeToNBT(this.getTag(nbt, "ContentsChest")); - this.inventoryTool.writeToNBT(this.getTag(nbt, "ContentsTools")); - //inventoryCrafting.writeToNBT(getTag(nbt, "ContentsCrafting")); - this.inventoryHolo.writeToNBT(this.getTag(nbt, "ContentsHolo")); - - // Write Crafting Matrix to NBT - final NBTTagList craftingTag = new NBTTagList(); - for (int currentIndex = 0; currentIndex < this.inventoryCrafting.getSizeInventory(); ++currentIndex) { - if (this.inventoryCrafting.getStackInSlot(currentIndex) != null) { - final NBTTagCompound tagCompound = new NBTTagCompound(); - tagCompound.setByte("Slot", (byte) currentIndex); - this.inventoryCrafting.getStackInSlot(currentIndex).writeToNBT(tagCompound); - craftingTag.appendTag(tagCompound); - } - } - - nbt.setTag("CraftingMatrix", craftingTag); - // Write craftingResult to NBT - if (this.inventoryCraftResult.getStackInSlot(0) != null) { - nbt.setTag("CraftingResult", this.inventoryCraftResult.getStackInSlot(0).writeToNBT(new NBTTagCompound())); - } - - } - - @Override - public void readFromNBT(final NBTTagCompound nbt) - { - super.readFromNBT(nbt); - this.energy = nbt.getDouble("energy"); - - this.prevFacing = (this.facing = nbt.getShort("facing")); - - this.inventoryChest.readFromNBT(nbt.getCompoundTag("ContentsChest")); - this.inventoryTool.readFromNBT(nbt.getCompoundTag("ContentsTools")); - //inventoryCrafting.readFromNBT(nbt.getCompoundTag("ContentsCrafting")); - this.inventoryHolo.readFromNBT(nbt.getCompoundTag("ContentsHolo")); - - // Read in the Crafting Matrix from NBT - final NBTTagList craftingTag = nbt.getTagList("CraftingMatrix", 10); - this.inventoryCrafting = new InventoryWorkbenchHoloCrafting(); //TODO: magic number - for (int i = 0; i < craftingTag.tagCount(); ++i) { - final NBTTagCompound tagCompound = craftingTag.getCompoundTagAt(i); - final byte slot = tagCompound.getByte("Slot"); - if ((slot >= 0) && (slot < this.inventoryCrafting.getSizeInventory())) { - this.inventoryCrafting.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tagCompound)); - } - } - - - // Read craftingResult from NBT - final NBTTagCompound tagCraftResult = nbt.getCompoundTag("CraftingResult"); - this.inventoryCraftResult.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(tagCraftResult)); - - } - - @Override - public boolean acceptsEnergyFrom(final TileEntity emitter, final ForgeDirection direction) - { - return true; - } - - @Override - public double getDemandedEnergy() - { - return this.maxEnergy - this.energy; - } - - @Override - public int getSinkTier() - { - return this.tier; - } - - @Override - public double injectEnergy(final ForgeDirection directionFrom, final double amount, final double voltage) - { - if (this.energy >= this.maxEnergy) { - return amount; - } - this.energy += amount; - return 0.0D; - } - - public final float getChargeLevel() - { - return this.guiChargeLevel; - } - - public void setTier(final int tier1) - { - if (this.tier == tier1) { - return; - } - final boolean addedToENet = this.addedToEnergyNet; - if (addedToENet) - { - MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); - this.addedToEnergyNet = false; - } - this.tier = tier1; - - for (int i=0; i<this.inventoryTool.getSizeInventory(); i++){ - //this.inventoryTool..setTier(tier1); TODO - } - - if (addedToENet) - { - MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); - this.addedToEnergyNet = true; - } - } - - @Override - public List<String> getNetworkedFields(){ - final List<String> ret = new Vector(2); - ret.add("facing"); - return ret; - } - - - @Override - public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final int side) - { - return false; - } - - @Override - public void setFacing(final short facing1) - { - this.facing = facing1; - if (this.prevFacing != facing1) { - IC2.network.get().updateTileEntityField(this, "facing"); - } - this.prevFacing = facing1; - } - - @Override - public short getFacing() - { - return this.facing; - } - - - @Override - public boolean wrenchCanRemove(final EntityPlayer entityPlayer) - { - return true; - } - - @Override - public float getWrenchDropRate() - { - return 1.0F; - } - - @Override - public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) - { - return new ItemStack(this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord), 1, this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord)); - } - - @Override - public void onNetworkUpdate(final String field) { - - this.prevFacing = this.facing; - - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java deleted file mode 100644 index 81b23e0b1c..0000000000 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ /dev/null @@ -1,946 +0,0 @@ -package gtPlusPlus.core.util; - -import java.awt.Color; -import java.awt.Graphics; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.ObjectOutput; -import java.io.ObjectOutputStream; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.security.SecureRandom; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Timer; -import java.util.TimerTask; - -import javax.xml.bind.DatatypeConverter; - -import org.apache.commons.lang3.EnumUtils; - -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.registry.EntityRegistry; -import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration; -import gregtech.GT_Mod; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.TC_Aspects; -import gregtech.api.enums.TC_Aspects.TC_AspectStack; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.core.util.sys.SystemUtils; -import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner; -import ic2.core.Ic2Items; -import ic2.core.init.InternalName; -import ic2.core.item.resources.ItemCell; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.item.Item.ToolMaterial; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.nbt.NBTTagString; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.util.EnumHelper; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; - -public class Utils { - - public static final int WILDCARD_VALUE = Short.MAX_VALUE; - - public static final boolean isServer() { - return FMLCommonHandler.instance().getEffectiveSide().isServer(); - } - - public static final boolean isClient() { - return FMLCommonHandler.instance().getEffectiveSide().isClient(); - } - - static class ShortTimerTask extends TimerTask { - @Override - public void run() { - Logger.WARNING("Timer expired."); - } - } - - public static TC_AspectStack getTcAspectStack(final TC_Aspects aspect, final long size) { - return getTcAspectStack(aspect.name(), (int) size); - } - - public static TC_AspectStack getTcAspectStack(final String aspect, final long size) { - return getTcAspectStack(aspect, (int) size); - } - - public static TC_AspectStack getTcAspectStack(final TC_Aspects aspect, final int size) { - return getTcAspectStack(aspect.name(), size); - } - - public static TC_AspectStack getTcAspectStack(final String aspect, final int size) { - - TC_AspectStack returnValue = null; - - if (aspect.toUpperCase().equals("COGNITIO")) { - // Adds in Compat for older GT Versions which Misspell aspects. - try { - if (EnumUtils.isValidEnum(TC_Aspects.class, "COGNITIO")) { - Logger.WARNING("TC Aspect found - " + aspect); - returnValue = new TC_AspectStack(TC_Aspects.valueOf("COGNITIO"), size); - } else { - Logger.INFO("Fallback TC Aspect found - " + aspect - + " - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); - returnValue = new TC_AspectStack(TC_Aspects.valueOf("COGNITO"), size); - } - } catch (final NoSuchFieldError r) { - Logger.INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); - } - } else if (aspect.toUpperCase().equals("EXANIMUS")) { - // Adds in Compat for older GT Versions which Misspell aspects. - try { - if (EnumUtils.isValidEnum(TC_Aspects.class, "EXANIMUS")) { - Logger.WARNING("TC Aspect found - " + aspect); - returnValue = new TC_AspectStack(TC_Aspects.valueOf("EXANIMUS"), size); - } else { - Logger.INFO("Fallback TC Aspect found - " + aspect - + " - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); - returnValue = new TC_AspectStack(TC_Aspects.valueOf("EXAMINIS"), size); - } - } catch (final NoSuchFieldError r) { - Logger.INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); - } - - } else if (aspect.toUpperCase().equals("PRAECANTATIO")) { - // Adds in Compat for older GT Versions which Misspell aspects. - try { - if (EnumUtils.isValidEnum(TC_Aspects.class, "PRAECANTATIO")) { - Logger.WARNING("TC Aspect found - " + aspect); - returnValue = new TC_AspectStack(TC_Aspects.valueOf("PRAECANTATIO"), size); - } else { - Logger.INFO("Fallback TC Aspect found - " + aspect - + " - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); - returnValue = new TC_AspectStack(TC_Aspects.valueOf("PRAECANTIO"), size); - } - } catch (final NoSuchFieldError r) { - Logger.INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); - } - } else { - Logger.WARNING("TC Aspect found - " + aspect); - returnValue = new TC_AspectStack(TC_Aspects.valueOf(aspect), size); - } - - return returnValue; - } - - public static boolean containsMatch(final boolean strict, final ItemStack[] inputs, final ItemStack... targets) { - for (final ItemStack input : inputs) { - for (final ItemStack target : targets) { - if (itemMatches(target, input, strict)) { - return true; - } - } - } - return false; - } - - public static boolean itemMatches(final ItemStack target, final ItemStack input, final boolean strict) { - if ((input == null) || (target == null)) { - return false; - } - return ((target.getItem() == input.getItem()) && (((target.getItemDamage() == WILDCARD_VALUE) && !strict) - || (target.getItemDamage() == input.getItemDamage()))); - } - - //Register an event to both busses. - public static void registerEvent(Object o){ - MinecraftForge.EVENT_BUS.register(o); - FMLCommonHandler.instance().bus().register(o); - } - - public static void paintBox(final Graphics g, final int MinA, final int MinB, final int MaxA, final int MaxB) { - g.drawRect(MinA, MinB, MaxA, MaxB); - } - - // Send a message to all players on the server - public static void sendServerMessage(final String translationKey) { - sendServerMessage(new ChatComponentText(translationKey)); - } - - // Send a message to all players on the server - public static void sendServerMessage(final IChatComponent chatComponent) { - MinecraftServer.getServer().getConfigurationManager().sendChatMsg(chatComponent); - } - - /** - * Returns if that Liquid is IC2Steam. - */ - public static boolean isIC2Steam(final FluidStack aFluid) { - if (aFluid == null) { - return false; - } - return aFluid.isFluidEqual(getIC2Steam(1)); - } - - /** - * Returns a Liquid Stack with given amount of IC2Steam. - */ - public static FluidStack getIC2Steam(final long aAmount) { - return FluidRegistry.getFluidStack("ic2steam", (int) aAmount); - } - - /* - * public static void recipeBuilderBlock(ItemStack slot_1, ItemStack slot_2, - * ItemStack slot_3, ItemStack slot_4, ItemStack slot_5, ItemStack slot_6, - * ItemStack slot_7, ItemStack slot_8, ItemStack slot_9, Block resultBlock){ - * GameRegistry.addRecipe(new ItemStack(resultBlock), new Object[] {"ABC", - * "DEF", "GHI", 'A',slot_1,'B',slot_2,'C',slot_3, - * 'D',slot_4,'E',slot_5,'F',slot_6, 'G',slot_7,'H',slot_8,'I',slot_9 }); } - */ - - public static String checkCorrectMiningToolForBlock(final Block currentBlock, final World currentWorld) { - String correctTool = ""; - if (!currentWorld.isRemote) { - try { - correctTool = currentBlock.getHarvestTool(0); - Logger.WARNING(correctTool); - - } catch (final NullPointerException e) { - - } - } - - return correctTool; - } - - /** - * - * @param colourStr - * e.g. "#FFFFFF" - * @return String - formatted "rgb(0,0,0)" - */ - public static String hex2RgbFormatted(final String hexString) { - final Color c = new Color(Integer.valueOf(hexString.substring(1, 3), 16), - Integer.valueOf(hexString.substring(3, 5), 16), Integer.valueOf(hexString.substring(5, 7), 16)); - - final StringBuffer sb = new StringBuffer(); - sb.append("rgb("); - sb.append(c.getRed()); - sb.append(","); - sb.append(c.getGreen()); - sb.append(","); - sb.append(c.getBlue()); - sb.append(")"); - return sb.toString(); - } - - /** - * - * @param colourStr - * e.g. "#FFFFFF" - * @return - */ - public static Color hex2Rgb(final String colorStr) { - return new Color(Integer.valueOf(colorStr.substring(1, 3), 16), Integer.valueOf(colorStr.substring(3, 5), 16), - Integer.valueOf(colorStr.substring(5, 7), 16)); - } - - /** - * - * @param colourInt - * e.g. 0XFFFFFF - * @return Colour - */ - public static Color hex2Rgb(final int colourInt) { - return Color.decode(String.valueOf(colourInt)); - } - - /** - * - * @param colourInt - * e.g. 0XFFFFFF - * @return short[] - */ - public static short[] hex2RgbShort(final int colourInt) { - final Color rgb = Color.decode(String.valueOf(colourInt)); - final short[] rgba = { (short) rgb.getRed(), (short) rgb.getGreen(), (short) rgb.getBlue(), - (short) rgb.getAlpha() }; - return rgba; - } - - public static Timer ShortTimer(final int seconds) { - Timer timer; - timer = new Timer(); - timer.schedule(new ShortTimerTask(), seconds * 1000); - return timer; - } - - public static String byteToHex(final byte b) { - final int i = b & 0xFF; - return Integer.toHexString(i); - } - - public static Object[] convertListToArray(final List<Object> sourceList) { - final Object[] targetArray = sourceList.toArray(new Object[sourceList.size()]); - return targetArray; - } - - public static List<Object> convertArrayToFixedSizeList(final Object[] sourceArray) { - final List<Object> targetList = Arrays.asList(sourceArray); - return targetList; - } - - public static List<Object> convertArrayToList(final Object[] sourceArray) { - final List<Object> targetList = new ArrayList<>(Arrays.asList(sourceArray)); - return targetList; - } - - public static List<Object> convertArrayListToList(final ArrayList<Object> sourceArray) { - final List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray)); - return targetList; - } - - public static void spawnCustomParticle(final Entity entity) { - GTplusplus.proxy.generateMysteriousParticles(entity); - } - - public static void spawnFX(final World world, final int x, final int y, final int z, final String particleName, - Object particleName2) { - if (!world.isRemote) { - if ((particleName2 == null) || particleName2.equals("")) { - particleName2 = particleName; - } - final int l = MathUtils.randInt(0, 4); - final double d0 = x + 0.5F; - final double d1 = y + 0.7F; - final double d2 = z + 0.5F; - final double d3 = 0.2199999988079071D; - final double d4 = 0.27000001072883606D; - - if (l == 1) { - world.spawnParticle(particleName, d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D); - } else if (l == 2) { - world.spawnParticle((String) particleName2, d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D); - } else if (l == 3) { - world.spawnParticle(particleName, d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D); - } else if (l == 4) { - world.spawnParticle((String) particleName2, d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D); - } else { - world.spawnParticle(particleName, d0, d1, d2, 0.0D, 0.0D, 0.0D); - if (particleName2 != null) { - world.spawnParticle((String) particleName2, d0, d1, d2, 0.0D, 0.0D, 0.0D); - } - } - } - } - - public static int rgbtoHexValue(final int r, final int g, final int b) { - if ((r > 255) || (g > 255) || (b > 255) || (r < 0) || (g < 0) || (b < 0)) { - return 0; - } - final Color c = new Color(r, g, b); - String temp = Integer.toHexString(c.getRGB() & 0xFFFFFF).toUpperCase(); - temp = Utils.appenedHexNotationToString(String.valueOf(temp)); - Logger.WARNING("Made " + temp + " - Hopefully it's not a mess."); - Logger.WARNING("It will decode into " + Integer.decode(temp) + "."); - return Integer.decode(temp); - } - - /* - * http://javadevnotes.com/java-left-pad-string-with-zeros-examples - */ - public static String padWithZerosLefts(final String originalString, final int length) { - final StringBuilder sb = new StringBuilder(); - while ((sb.length() + originalString.length()) < length) { - sb.append('0'); - } - sb.append(originalString); - final String paddedString = sb.toString(); - return paddedString; - } - - public static String padWithZerosRight(final int value, final int length) { - String originalString = String.valueOf(value); - final StringBuilder sb = new StringBuilder(); - while ((sb.length() + originalString.length()) < length) { - sb.append('0'); - } - //sb.append(originalString); - if (sb.length() > 0) - originalString = (originalString + sb.toString()); - final String paddedString = sb.toString(); - return originalString; - } - - /* - * Original Code by Chandana Napagoda - - * https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator. - * html - */ - public static Map<Integer, String> hexColourGenerator(final int colorCount) { - final int maxColorValue = 16777215; - // this is decimal value of the "FFFFFF" - final int devidedvalue = maxColorValue / colorCount; - int countValue = 0; - final HashMap<Integer, String> hexColorMap = new HashMap<>(); - for (int a = 0; (a < colorCount) && (maxColorValue >= countValue); a++) { - if (a != 0) { - countValue += devidedvalue; - hexColorMap.put(a, Integer.toHexString(0x10000 | countValue).substring(1).toUpperCase()); - } else { - hexColorMap.put(a, Integer.toHexString(0x10000 | countValue).substring(1).toUpperCase()); - } - } - return hexColorMap; - } - - /* - * Original Code by Chandana Napagoda - - * https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator. - * html - */ - public static Map<Integer, String> hexColourGeneratorRandom(final int colorCount) { - final HashMap<Integer, String> hexColorMap = new HashMap<>(); - for (int a = 0; a < colorCount; a++) { - String code = "" + (int) (Math.random() * 256); - code = code + code + code; - final int i = Integer.parseInt(code); - hexColorMap.put(a, Integer.toHexString(0x1000000 | i).substring(1).toUpperCase()); - Logger.WARNING("" + Integer.toHexString(0x1000000 | i).substring(1).toUpperCase()); - } - return hexColorMap; - } - - public static String appenedHexNotationToString(final Object hexAsStringOrInt) { - final String hexChar = "0x"; - String result; - if (hexAsStringOrInt.getClass() == String.class) { - - if (((String) hexAsStringOrInt).length() != 6) { - final String temp = padWithZerosLefts((String) hexAsStringOrInt, 6); - result = temp; - } - result = hexChar + hexAsStringOrInt; - return result; - } else if (hexAsStringOrInt.getClass() == Integer.class || hexAsStringOrInt.getClass() == int.class) { - String aa = String.valueOf(hexAsStringOrInt); - if (aa.length() != 6) { - final String temp = padWithZerosLefts(aa, 6); - result = temp; - } - else { - result = hexChar + String.valueOf(hexAsStringOrInt); - } - return result; - } else { - return null; - } - } - - public static Integer appenedHexNotationToInteger(final int hexAsStringOrInt) { - final String hexChar = "0x"; - String result; - Logger.WARNING(String.valueOf(hexAsStringOrInt)); - result = hexChar + String.valueOf(hexAsStringOrInt); - return Integer.getInteger(result); - } - - public static boolean doesEntryExistAlreadyInOreDictionary(final String OreDictName) { - if (OreDictionary.getOres(OreDictName).size() != 0) { - return true; - } - return false; - } - - public static boolean invertBoolean(final boolean booleans) { - if (booleans == true) { - return false; - } - return true; - } - - public static File getMcDir() { - if (Utils.isClient()) { - if (Minecraft.getMinecraft() != null) { - return Minecraft.getMinecraft().mcDataDir; - } - } - return new File("."); - } - - private static short cellID = 15; - - public static ItemStack createInternalNameAndFluidCell(final String s) { - Logger.WARNING("1"); - final InternalName yourName = EnumHelper.addEnum(InternalName.class, s, new Class[0], new Object[0]); - Logger.WARNING("2 " + yourName.name()); - final ItemCell item = (ItemCell) Ic2Items.cell.getItem(); - Logger.WARNING("3 " + item.getUnlocalizedName()); - try { - Logger.WARNING("4"); - final Class<? extends ItemCell> clz = item.getClass(); - Logger.WARNING("5 " + clz.getSimpleName()); - final Method methode = clz.getDeclaredMethod("addCell", int.class, InternalName.class, Block[].class); - Logger.WARNING("6 " + methode.getName()); - methode.setAccessible(true); - Logger.WARNING("7 " + methode.isAccessible()); - final ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]); - Logger.WARNING("Successfully created " + temp.getDisplayName() + "s."); - FluidContainerRegistry.registerFluidContainer(FluidUtils.getFluidStack(s.toLowerCase(), 1000), temp.copy(), - Ic2Items.cell.copy()); - ItemUtils.addItemToOreDictionary(temp.copy(), "cell" + s); - return temp; - } catch (final Exception e) { - e.printStackTrace(); - } - return null; - } - - public static ItemStack createInternalNameAndFluidCellNoOreDict(final String s) { - Logger.WARNING("1"); - final InternalName yourName = EnumHelper.addEnum(InternalName.class, s, new Class[0], new Object[0]); - Logger.WARNING("2 " + yourName.name()); - final ItemCell item = (ItemCell) Ic2Items.cell.getItem(); - Logger.WARNING("3 " + item.getUnlocalizedName()); - try { - Logger.WARNING("4"); - final Class<? extends ItemCell> clz = item.getClass(); - Logger.WARNING("5 " + clz.getSimpleName()); - final Method methode = clz.getDeclaredMethod("addCell", int.class, InternalName.class, Block[].class); - Logger.WARNING("6 " + methode.getName()); - methode.setAccessible(true); - Logger.WARNING("7 " + methode.isAccessible()); - final ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]); - Logger.WARNING("Successfully created " + temp.getDisplayName() + "s."); - FluidContainerRegistry.registerFluidContainer(FluidUtils.getFluidStack(s.toLowerCase(), 1000), temp.copy(), - Ic2Items.cell.copy()); - // ItemUtils.addItemToOreDictionary(temp.copy(), "cell"+s); - return temp; - } catch (final Exception e) { - e.printStackTrace(); - } - return null; - } - - public static String sanitizeString(final String input, final char[] aDontRemove) { - - String output; - AutoMap<String> aToRemoveMap = new AutoMap<String>(); - - aToRemoveMap.put(" "); - aToRemoveMap.put("-"); - aToRemoveMap.put("_"); - aToRemoveMap.put("~"); - aToRemoveMap.put("?"); - aToRemoveMap.put("!"); - aToRemoveMap.put("@"); - aToRemoveMap.put("#"); - aToRemoveMap.put("$"); - aToRemoveMap.put("%"); - aToRemoveMap.put("^"); - aToRemoveMap.put("&"); - aToRemoveMap.put("*"); - aToRemoveMap.put("("); - aToRemoveMap.put(")"); - aToRemoveMap.put("{"); - aToRemoveMap.put("}"); - aToRemoveMap.put("["); - aToRemoveMap.put("]"); - aToRemoveMap.put(" "); - - for (String s : aToRemoveMap) { - for (char e : aDontRemove) { - if (s.charAt(0) == e) { - aToRemoveMap.remove("s"); - } - } - } - output = input; - for (String A : aToRemoveMap) { - output = output.replace(A, ""); - } - return output; - - } - - public static String sanitizeString(final String input) { - String temp; - String output; - - temp = input.replace(" ", ""); - temp = temp.replace("-", ""); - temp = temp.replace("_", ""); - temp = temp.replace("?", ""); - temp = temp.replace("!", ""); - temp = temp.replace("@", ""); - temp = temp.replace("#", ""); - temp = temp.replace("(", ""); - temp = temp.replace(")", ""); - temp = temp.replace("{", ""); - temp = temp.replace("}", ""); - temp = temp.replace("[", ""); - temp = temp.replace("]", ""); - temp = temp.replace(" ", ""); - output = temp; - return output; - - } - - public static String sanitizeStringKeepBrackets(final String input) { - String temp; - String output; - - temp = input.replace(" ", ""); - temp = temp.replace("-", ""); - temp = temp.replace("_", ""); - temp = temp.replace("?", ""); - temp = temp.replace("!", ""); - temp = temp.replace("@", ""); - temp = temp.replace("#", ""); - temp = temp.replace(" ", ""); - output = temp; - return output; - - } - - public static String[] parseVersion(final String version) { - return parseVersion(version, "//."); - } - - public static String[] parseVersion(final String version, final String delimiter) { - final String[] versionArray = version.split(delimiter); - return versionArray; - } - - public static Versioning compareModVersion(final String currentVersion, final String expectedVersion) { - return compareModVersion(currentVersion, expectedVersion, "//."); - } - - public static Versioning compareModVersion(final String currentVersion, final String expectedVersion, - final String delimiter) { - final String[] a = parseVersion(currentVersion, delimiter); - final String[] b = parseVersion(expectedVersion, delimiter); - final int[] c = new int[a.length]; - final int[] d = new int[b.length]; - for (int r = 0; r < a.length; r++) { - c[r] = Integer.parseInt(a[r]); - } - for (int r = 0; r < b.length; r++) { - d[r] = Integer.parseInt(b[r]); - } - final Versioning[] e = new Versioning[MathUtils.returnLargestNumber(c.length, d.length)]; - for (int r = 0; r < e.length; r++) { - - if (c[r] > d[r]) { - e[r] = Versioning.NEWER; - } else if (c[r] < d[r]) { - e[r] = Versioning.OLDER; - } else if (c[r] == d[r]) { - e[r] = Versioning.EQUAL; - } - } - - for (int r = 0; r < e.length; r++) { - if (e[0] == Versioning.NEWER) { - return Versioning.NEWER; - } else if (e[0] == Versioning.OLDER) { - return Versioning.OLDER; - } else { - if (e[r] == Versioning.OLDER) { - - } - - return Versioning.NEWER; - } - } - - return null; - } - - public static ToolMaterial generateToolMaterialFromGT(final Materials gtMaterial) { - final String name = Utils.sanitizeString(gtMaterial.mDefaultLocalName); - final int harvestLevel = gtMaterial.mToolQuality; - final int durability = gtMaterial.mDurability; - final float damage = gtMaterial.mToolQuality; - final int efficiency = (int) gtMaterial.mToolSpeed; - final int enchantability = gtMaterial.mEnchantmentToolsLevel; - final ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, - enchantability); - return temp; - - } - - public static ToolMaterial generateToolMaterial(final Material material) { - final String name = material.getLocalizedName(); - final int harvestLevel = material.vHarvestLevel; - final int durability = (int) material.vDurability; - final float damage = material.vToolQuality; - final int efficiency = material.vToolQuality; - // int enchantability = material.mEnchantmentToolsLevel; - Logger.INFO("ToolMaterial stats for " + material.getLocalizedName() + " | harvestLevel:" + harvestLevel - + " | durability:" + durability + " | toolQuality:" + damage + " | toolSpeed:" + damage); - final ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, 0); - return temp; - - } - - public static enum Versioning { - EQUAL(0), NEWER(1), OLDER(-1); - private final int versioningInfo; - - private Versioning(final int versionStatus) { - this.versioningInfo = versionStatus; - } - - public int getTexture() { - return this.versioningInfo; - } - } - - - public static ItemStack getWrittenBook(final ItemStack aBook, final int aID, final String aMapping, final String aTitle, final String aAuthor, - final String[] aPages) { - if (GT_Utility.isStringInvalid(aMapping)) { - return null; - } - ItemStack rStack = CORE.sBookList.get(aMapping); - if (rStack != null) { - return GT_Utility.copyAmount(1L, new Object[] { rStack }); - } - if ((GT_Utility.isStringInvalid(aTitle)) || (GT_Utility.isStringInvalid(aAuthor)) || (aPages.length <= 0)) { - return null; - } - final int vMeta = aID; - rStack = (aBook == null ? new ItemStack(ModItems.itemCustomBook, 1, vMeta) : aBook); - final NBTTagCompound tNBT = new NBTTagCompound(); - tNBT.setString("title", GT_LanguageManager.addStringLocalization( - new StringBuilder().append("Book.").append(aTitle).append(".Name").toString(), aTitle)); - tNBT.setString("author", aAuthor); - final NBTTagList tNBTList = new NBTTagList(); - for (byte i = 0; i < aPages.length; i = (byte) (i + 1)) { - aPages[i] = GT_LanguageManager - .addStringLocalization(new StringBuilder().append("Book.").append(aTitle).append(".Page") - .append((i < 10) ? new StringBuilder().append("0").append(i).toString() : Byte.valueOf(i)) - .toString(), aPages[i]); - if (i < 48) { - if (aPages[i].length() < 256) { - tNBTList.appendTag(new NBTTagString(aPages[i])); - } - else { - Logger.INFO("WARNING: String for written Book too long! -> "+aPages[i]); - GT_Log.err.println(new StringBuilder().append("WARNING: String for written Book too long! -> ") - .append(aPages[i]).toString()); - } - } else { - Logger.INFO("WARNING: Too much Pages for written Book! -> "+aTitle); - GT_Log.err.println(new StringBuilder().append("WARNING: Too much Pages for written Book! -> ") - .append(aTitle).toString()); - break; - } - } - tNBTList.appendTag(new NBTTagString(new StringBuilder().append("Credits to ").append(aAuthor) - .append(" for writing this Book. This was Book Nr. ").append(aID) - .append(" at its creation. Gotta get 'em all!").toString())); - tNBT.setTag("pages", tNBTList); - rStack.setTagCompound(tNBT); - GT_Log.out.println(new StringBuilder().append("GT++_Mod: Added Book to Book++ List - Mapping: '") - .append(aMapping).append("' - Name: '").append(aTitle).append("' - Author: '").append(aAuthor) - .append("'").toString()); - NBTUtils.createIntegerTagCompound(rStack, "stats", "mMeta", vMeta); - CORE.sBookList.put(aMapping, rStack); - Logger.INFO("Creating book: " + aTitle + " by " + aAuthor + ". Using Meta " + vMeta + "."); - return GT_Utility.copy(new Object[] { rStack }); - } - - @SuppressWarnings({ "unused", "unchecked" }) - public static Pair<Integer, Integer> getGregtechVersion(){ - Pair<Integer, Integer> version; - if (GT_Mod.VERSION == 509){ - Class<GT_Mod> clazz; - try { - - if (LoadedMods.BeyondRealityCore) { - //Safely assume it's Beyond Reality running .28-pre (If it's not, tough shit really?) - return new Pair<Integer, Integer>(9, 28); - } - - clazz = (Class<GT_Mod>) ReflectionUtils.getClass("gregtech.GT_Mod"); - Field mSubversion = ReflectionUtils.getField(clazz, "SUBVERSION"); - if (mSubversion != null){ - int mSub = 0; - mSub = mSubversion.getInt(clazz); - if (mSub != 0){ - version = new Pair<Integer, Integer>(9, mSub); - return version; - } - } - } - catch (Throwable t){ - - } - } - //5.08.33 - else if (GT_Mod.VERSION == 508){ - version = new Pair<Integer, Integer>(8, 33); - return version; - - } - //5.07.07 - else if (GT_Mod.VERSION == 507){ - version = new Pair<Integer, Integer>(7, 7); - return version; - - } - //Returb Bad Value - version = new Pair<Integer, Integer>(0, 0); - return version; - } - - public static int getGregtechVersionAsInt(){ - Pair<Integer, Integer> ver = getGregtechVersion(); - return 50000+(ver.getKey()*100)+(ver.getValue()); - } - - public static String getGregtechVersionAsString(){ - Pair<Integer, Integer> ver = getGregtechVersion(); - return "5."+ver.getKey()+"."+ver.getValue(); - } - - public static int getGregtechSubVersion(){ - Pair<Integer, Integer> ver = getGregtechVersion(); - return ver.getValue(); - } - - public static SecureRandom generateSecureRandom(){ - SecureRandom secRan; - String secRanType; - - if (SystemUtils.isWindows()){ - secRanType = "Windows-PRNG"; - } - else { - secRanType = "NativePRNG"; - } - try { - secRan = SecureRandom.getInstance(secRanType); - // Default constructor would have returned insecure SHA1PRNG algorithm, so make an explicit call. - byte[] b = new byte[64] ; - secRan.nextBytes(b); - return secRan; - } - catch (NoSuchAlgorithmException e) { - return null; - } - } - - - public static String calculateChecksumMD5(Object bytes) { - byte[] result = new byte[] {}; - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutput out = null; - try { - out = new ObjectOutputStream(bos); - out.writeObject(bytes); - out.flush(); - result = bos.toByteArray(); - } - catch (IOException e) { - } finally { - try { - bos.close(); - } - catch (IOException e) {} - } - return calculateChecksumMD5(result); - } - - public static String calculateChecksumMD5(byte[] bytes) { - MessageDigest md; - try { - md = MessageDigest.getInstance("MD5"); - md.update(bytes); - byte[] digest = md.digest(); - String myHash = DatatypeConverter.printHexBinary(digest).toUpperCase(); - return myHash; - } - catch (NoSuchAlgorithmException e) { - return null; - } - } - - public static boolean createNewMobSpawner(int aID, Entity aEntity) { - if (aEntity instanceof Entity) { - Class c = aEntity.getClass(); - return createNewMobSpawner(aID, c); - } - return false; - } - - public static boolean createNewMobSpawner(int aID, Class aEntity) { - Logger.INFO("[Spawn] Generating new spawner for entity with class ("+aEntity.getSimpleName()+")."); - if (TileEntityGenericSpawner.registerNewMobSpawner(aID, (Class<Entity>) aEntity)) { - EntityRegistration x = EntityRegistry.instance().lookupModSpawn((Class<? extends Entity>) aEntity, true); - if (x != null) { - Logger.INFO("[Spawn] Registration for "+x.getEntityName()+" successful"); - return true; - } - else { - Logger.INFO("[Spawn] Registration for "+aEntity.getSimpleName()+" successful"); - return true; - } - } - Logger.INFO("[Spawn] Mob Spawner creation for "+aEntity.getName()+" failed"); - return false; - } - - public static long getMillisSince(long aStartTime, long aCurrentTime) { - return (aCurrentTime - aStartTime); - } - - public static long getSecondsFromMillis(long aMillis) { - return (aMillis/1000); - } - - public static long getTicksFromSeconds(long aSeconds) { - return (aSeconds*20); - } - - public static byte getTier(long l) { - byte i = -1; - do { - ++i; - if (i >= GT_Values.V.length) { - return i; - } - } while (l > GT_Values.V[i]); - i = (byte) MathUtils.getValueWithinRange(i, 0, 15); - return i; - } - -} diff --git a/src/Java/gtPlusPlus/core/util/data/AES.java b/src/Java/gtPlusPlus/core/util/data/AES.java deleted file mode 100644 index 1183cdd8e7..0000000000 --- a/src/Java/gtPlusPlus/core/util/data/AES.java +++ /dev/null @@ -1 +0,0 @@ -\u0070\u0061\u0063\u006b\u0061\u0067\u0065\u0020\u0067\u0074\u0050\u006c\u0075\u0073\u0050\u006c\u0075\u0073\u002e\u0063\u006f\u0072\u0065\u002e\u0075\u0074\u0069\u006c\u002e\u0064\u0061\u0074\u0061\u003b\u000d\u000a\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061\u002e\u0069\u006f\u002e\u0055\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u003b\u000d\u000a\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061\u002e\u006d\u0061\u0074\u0068\u002e\u0042\u0069\u0067\u0049\u006e\u0074\u0065\u0067\u0065\u0072\u003b\u000d\u000a\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061\u002e\u006e\u0069\u006f\u002e\u0063\u0068\u0061\u0072\u0073\u0065\u0074\u002e\u0053\u0074\u0061\u006e\u0064\u0061\u0072\u0064\u0043\u0068\u0061\u0072\u0073\u0065\u0074\u0073\u003b\u000d\u000a\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061\u002e\u0073\u0065\u0063\u0075\u0072\u0069\u0074\u0079\u002e\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u003b\u000d\u000a\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061\u002e\u0073\u0065\u0063\u0075\u0072\u0069\u0074\u0079\u002e\u004e\u006f\u0053\u0075\u0063\u0068\u0041\u006c\u0067\u006f\u0072\u0069\u0074\u0068\u006d\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u003b\u000d\u000a\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061\u002e\u0075\u0074\u0069\u006c\u002e\u0041\u0072\u0072\u0061\u0079\u0073\u003b\u000d\u000a\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061\u002e\u0075\u0074\u0069\u006c\u002e\u0042\u0061\u0073\u0065\u0036\u0034\u003b\u000d\u000a\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061\u0078\u002e\u0063\u0072\u0079\u0070\u0074\u006f\u002e\u0043\u0069\u0070\u0068\u0065\u0072\u003b\u000d\u000a\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061\u0078\u002e\u0063\u0072\u0079\u0070\u0074\u006f\u002e\u0073\u0070\u0065\u0063\u002e\u0053\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0053\u0070\u0065\u0063\u003b\u000d\u000a\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0063\u006c\u0061\u0073\u0073\u0020\u0041\u0045\u0053\u0020\u007b\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0073\u0065\u0063\u0072\u0065\u0074\u003b\u003b\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0053\u0070\u0065\u0063\u0020\u0073\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u003b\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u006b\u0065\u0079\u003b\u0009\u000d\u000a\u0009\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0041\u0045\u0053\u0028\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0074\u0068\u0069\u0073\u0028\u0022\u0044\u0061\u0072\u006b\u006e\u0065\u0073\u0073\u0020\u0049\u006e\u0020\u0054\u0068\u0065\u0069\u0072\u0020\u0048\u0065\u0061\u0072\u0074\u0073\u0022\u0029\u003b\u0009\u0009\u000d\u000a\u0009\u007d\u0009\u000d\u000a\u0009\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0041\u0045\u0053\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0061\u0053\u0065\u0063\u0072\u0065\u0074\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0073\u0065\u0063\u0072\u0065\u0074\u0020\u003d\u0020\u0061\u0053\u0065\u0063\u0072\u0065\u0074\u003b\u000d\u000a\u0009\u0009\u006b\u0065\u0079\u0020\u003d\u0020\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0067\u0065\u0074\u0048\u0061\u0073\u0068\u0065\u0064\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0073\u0065\u0063\u0072\u0065\u0074\u0029\u0029\u003b\u000d\u000a\u0009\u0009\u0073\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0020\u003d\u0020\u0067\u0065\u006e\u0065\u0072\u0061\u0074\u0065\u004b\u0065\u0079\u0028\u006b\u0065\u0079\u0029\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0073\u0074\u0061\u0074\u0069\u0063\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0067\u0065\u0074\u0048\u0061\u0073\u0068\u0065\u0064\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0061\u0053\u0074\u0072\u0069\u006e\u0067\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0074\u006f\u0048\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0067\u0065\u0074\u0053\u0048\u0041\u0028\u0061\u0053\u0074\u0072\u0069\u006e\u0067\u0029\u0029\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0073\u0074\u0061\u0074\u0069\u0063\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u0067\u0065\u0074\u0053\u0048\u0041\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0069\u006e\u0070\u0075\u0074\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u0020\u006d\u0064\u003b\u000d\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u006d\u0064\u0020\u003d\u0020\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0022\u0053\u0048\u0041\u002d\u0032\u0035\u0036\u0022\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006d\u0064\u002e\u0064\u0069\u0067\u0065\u0073\u0074\u0028\u0069\u006e\u0070\u0075\u0074\u002e\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0053\u0074\u0061\u006e\u0064\u0061\u0072\u0064\u0043\u0068\u0061\u0072\u0073\u0065\u0074\u0073\u002e\u0055\u0054\u0046\u005f\u0038\u0029\u0029\u003b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u004e\u006f\u0053\u0075\u0063\u0068\u0041\u006c\u0067\u006f\u0072\u0069\u0074\u0068\u006d\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0065\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u0065\u0077\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u007b\u007d\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0073\u0074\u0061\u0074\u0069\u0063\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0074\u006f\u0048\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u0068\u0061\u0073\u0068\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0042\u0069\u0067\u0049\u006e\u0074\u0065\u0067\u0065\u0072\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0042\u0069\u0067\u0049\u006e\u0074\u0065\u0067\u0065\u0072\u0028\u0031\u002c\u0020\u0068\u0061\u0073\u0068\u0029\u003b\u000d\u000a\u0009\u0009\u0053\u0074\u0072\u0069\u006e\u0067\u0042\u0075\u0069\u006c\u0064\u0065\u0072\u0020\u0068\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0042\u0075\u0069\u006c\u0064\u0065\u0072\u0028\u006e\u0075\u006d\u0062\u0065\u0072\u002e\u0074\u006f\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0031\u0036\u0029\u0029\u003b\u000d\u000a\u0009\u0009\u0077\u0068\u0069\u006c\u0065\u0020\u0028\u0068\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u002e\u006c\u0065\u006e\u0067\u0074\u0068\u0028\u0029\u0020\u003c\u0020\u0033\u0032\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0068\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u002e\u0069\u006e\u0073\u0065\u0072\u0074\u0028\u0030\u002c\u0020\u0027\u0030\u0027\u0029\u003b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0068\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u002e\u0074\u006f\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0029\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0061\u004b\u0065\u0079\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u0061\u004b\u0065\u0079\u0044\u0061\u0074\u0061\u003b\u000d\u000a\u0009\u0009\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u0020\u0073\u0068\u0061\u003b\u000d\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0073\u0068\u0061\u0020\u003d\u0020\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0022\u0053\u0048\u0041\u002d\u0032\u0035\u0036\u0022\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0073\u0068\u0061\u002e\u0064\u0069\u0067\u0065\u0073\u0074\u0028\u0061\u004b\u0065\u0079\u002e\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0053\u0074\u0061\u006e\u0064\u0061\u0072\u0064\u0043\u0068\u0061\u0072\u0073\u0065\u0074\u0073\u002e\u0055\u0054\u0046\u005f\u0038\u0029\u0029\u003b\u0020\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u004e\u006f\u0053\u0075\u0063\u0068\u0041\u006c\u0067\u006f\u0072\u0069\u0074\u0068\u006d\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0031\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0065\u0031\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0009\u0061\u004b\u0065\u0079\u0044\u0061\u0074\u0061\u0020\u003d\u0020\u0061\u004b\u0065\u0079\u002e\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0022\u0055\u0054\u0046\u002d\u0038\u0022\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0009\u0073\u0068\u0061\u0020\u003d\u0020\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0022\u0053\u0048\u0041\u002d\u0031\u0022\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0009\u0061\u004b\u0065\u0079\u0044\u0061\u0074\u0061\u0020\u003d\u0020\u0073\u0068\u0061\u002e\u0064\u0069\u0067\u0065\u0073\u0074\u0028\u006b\u0065\u0079\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0009\u0061\u004b\u0065\u0079\u0044\u0061\u0074\u0061\u0020\u003d\u0020\u0041\u0072\u0072\u0061\u0079\u0073\u002e\u0063\u006f\u0070\u0079\u004f\u0066\u0028\u006b\u0065\u0079\u002c\u0020\u0031\u0036\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0061\u004b\u0065\u0079\u0044\u0061\u0074\u0061\u003b\u000d\u000a\u0009\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0009\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u004e\u006f\u0053\u0075\u0063\u0068\u0041\u006c\u0067\u006f\u0072\u0069\u0074\u0068\u006d\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0009\u0065\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0009\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0055\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0009\u0065\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u007d\u0009\u0009\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u0065\u0077\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u007b\u007d\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0053\u0070\u0065\u0063\u0020\u0067\u0065\u006e\u0065\u0072\u0061\u0074\u0065\u004b\u0065\u0079\u0028\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u0061\u004b\u0065\u0079\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u0065\u0077\u0020\u0053\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0053\u0070\u0065\u0063\u0028\u0061\u004b\u0065\u0079\u002c\u0020\u0022\u0041\u0045\u0053\u0022\u0029\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u0009\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0065\u006e\u0063\u006f\u0064\u0065\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0073\u0074\u0072\u0054\u006f\u0045\u006e\u0063\u0072\u0079\u0070\u0074\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0043\u0069\u0070\u0068\u0065\u0072\u0020\u0063\u0069\u0070\u0068\u0065\u0072\u0020\u003d\u0020\u0043\u0069\u0070\u0068\u0065\u0072\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0022\u0041\u0045\u0053\u002f\u0045\u0043\u0042\u002f\u0050\u004b\u0043\u0053\u0035\u0050\u0061\u0064\u0064\u0069\u006e\u0067\u0022\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0063\u0069\u0070\u0068\u0065\u0072\u002e\u0069\u006e\u0069\u0074\u0028\u0043\u0069\u0070\u0068\u0065\u0072\u002e\u0045\u004e\u0043\u0052\u0059\u0050\u0054\u005f\u004d\u004f\u0044\u0045\u002c\u0020\u0073\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0042\u0061\u0073\u0065\u0036\u0034\u002e\u0067\u0065\u0074\u0045\u006e\u0063\u006f\u0064\u0065\u0072\u0028\u0029\u002e\u0065\u006e\u0063\u006f\u0064\u0065\u0054\u006f\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0063\u0069\u0070\u0068\u0065\u0072\u002e\u0064\u006f\u0046\u0069\u006e\u0061\u006c\u0028\u0073\u0074\u0072\u0054\u006f\u0045\u006e\u0063\u0072\u0079\u0070\u0074\u002e\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0022\u0055\u0054\u0046\u002d\u0038\u0022\u0029\u0029\u0029\u003b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0053\u0079\u0073\u0074\u0065\u006d\u002e\u006f\u0075\u0074\u002e\u0070\u0072\u0069\u006e\u0074\u006c\u006e\u0028\u0022\u0045\u0072\u0072\u006f\u0072\u0020\u0077\u0068\u0069\u006c\u0065\u0020\u0065\u006e\u0063\u0072\u0079\u0070\u0074\u0069\u006e\u0067\u003a\u0020\u0022\u0020\u002b\u0020\u0065\u002e\u0074\u006f\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0029\u0029\u003b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u0075\u006c\u006c\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u0009\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0064\u0065\u0063\u006f\u0064\u0065\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0073\u0074\u0072\u0054\u006f\u0044\u0065\u0063\u0072\u0079\u0070\u0074\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0043\u0069\u0070\u0068\u0065\u0072\u0020\u0063\u0069\u0070\u0068\u0065\u0072\u0020\u003d\u0020\u0043\u0069\u0070\u0068\u0065\u0072\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0022\u0041\u0045\u0053\u002f\u0045\u0043\u0042\u002f\u0050\u004b\u0043\u0053\u0035\u0050\u0041\u0044\u0044\u0049\u004e\u0047\u0022\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0063\u0069\u0070\u0068\u0065\u0072\u002e\u0069\u006e\u0069\u0074\u0028\u0043\u0069\u0070\u0068\u0065\u0072\u002e\u0044\u0045\u0043\u0052\u0059\u0050\u0054\u005f\u004d\u004f\u0044\u0045\u002c\u0020\u0073\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u0065\u0077\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0063\u0069\u0070\u0068\u0065\u0072\u002e\u0064\u006f\u0046\u0069\u006e\u0061\u006c\u0028\u0042\u0061\u0073\u0065\u0036\u0034\u002e\u0067\u0065\u0074\u0044\u0065\u0063\u006f\u0064\u0065\u0072\u0028\u0029\u002e\u0064\u0065\u0063\u006f\u0064\u0065\u0028\u0073\u0074\u0072\u0054\u006f\u0044\u0065\u0063\u0072\u0079\u0070\u0074\u0029\u0029\u0029\u003b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u0075\u006c\u006c\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u007d
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java b/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java deleted file mode 100644 index 62f703f5f5..0000000000 --- a/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java +++ /dev/null @@ -1,121 +0,0 @@ -package gtPlusPlus.core.util.data; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -public class ArrayUtils { - - public static <V> V[] expandArray(final V[] someArray, final V newValueToAdd) { - V[] series = someArray; - series = addElement(series, newValueToAdd); - return series; - } - - private static <V> V[] addElement(V[] series, final V newValueToAdd) { - series = Arrays.copyOf(series, series.length + 1); - series[series.length - 1] = newValueToAdd; - return series; - } - - public static <V> V[] insertElementAtIndex(V[] aArray, int aIndex, V aObjectToInsert) { - V[] newArray = Arrays.copyOf(aArray, aArray.length + 1); - for (int i=0;i<aIndex;i++) { - newArray[i] = aArray[i]; - } - newArray[aIndex] = aObjectToInsert; - for (int i=(aIndex+1);i<newArray.length;i++) { - newArray[i] = aArray[i-1]; - } - return newArray; - } - - /*public static <V> Object getMostCommonElement(List<V> list) { - Optional r = list.stream().map(V::getTextureSet).collect(Collectors.groupingBy(Function.identity(), Collectors.counting())).entrySet().stream().max(Map.Entry.comparingByValue()).map(Map.Entry::getKey); - return r.get(); - }*/ - - - public static Object[] removeNulls(final Object[] v) { - List<Object> list = new ArrayList<Object>(Arrays.asList(v)); - list.removeAll(Collections.singleton((Object)null)); - return list.toArray(new Object[list.size()]); - } - - public static ItemStack[] removeNulls(final ItemStack[] v) { - List<ItemStack> list = new ArrayList<ItemStack>(Arrays.asList(v)); - list.removeAll(Collections.singleton((ItemStack)null)); - return list.toArray(new ItemStack[list.size()]); - } - - @SuppressWarnings("unchecked") - public static <T> Set<T> combineSetData(Set<T> S, Set<T> J) { - Set<T> mData = new HashSet<T>(); - T[] array1 = (T[]) S.toArray(); - Collections.addAll(mData, array1); - T[] array2 = (T[]) J.toArray(); - Collections.addAll(mData, array2); - return mData; - } - - public static <A> AutoMap<A> mergeTwoMaps(AutoMap<A> a, AutoMap<A> b) { - AutoMap<A> c = new AutoMap<A>(); - for (A g : a.values()) { - c.put(g); - } - for (A g : b.values()) { - c.put(g); - } - return c; - } - - public static <T> T[][] rotateArrayClockwise(T[][] mat) { - Logger.INFO("Rotating Array 90' Clockwise"); - try { - final int M = mat.length; - final int N = mat[0].length; - Logger.INFO("Dimension X: "+M); - Logger.INFO("Dimension Z: "+N); - @SuppressWarnings("unchecked") - T[][] ret = (T[][]) new Object[N][M]; - for (int r = 0; r < M; r++) { - for (int c = 0; c < N; c++) { - ret[c][M-1-r] = mat[r][c]; - } - } - Logger.INFO("Returning Rotated Array"); - return ret; - } - catch (Throwable t) { - t.printStackTrace(); - return null; - } - } - - public static String toString(Object[] aArray, String string) { - return org.apache.commons.lang3.ArrayUtils.toString(aArray, string); - } - - public static String toString(Object[] aArray) { - return org.apache.commons.lang3.ArrayUtils.toString(aArray); - } - - public static <T> Object[] getArrayFromArrayList(ArrayList<T> aArrayList) { - Object[] aGenericArray = new Object[aArrayList.size()]; - int aIndex = 0; - for (T object : aArrayList) { - aGenericArray[aIndex++] = object; - } - return aGenericArray; - } - -} - diff --git a/src/Java/gtPlusPlus/core/util/data/EnumUtils.java b/src/Java/gtPlusPlus/core/util/data/EnumUtils.java deleted file mode 100644 index edcc071b54..0000000000 --- a/src/Java/gtPlusPlus/core/util/data/EnumUtils.java +++ /dev/null @@ -1,51 +0,0 @@ -package gtPlusPlus.core.util.data; - -import com.google.common.base.Enums; -import com.google.common.base.Optional; - -public class EnumUtils { - - /** - * Returns the value of an Enum if it exists. - * If value is not found, case-insensitive search will occur. - * If value still not found, an IllegalArgumentException is thrown. - **/ - public static <T extends Enum<T>> T getValue(Class<T> enumeration, String name) { - Optional<T> j = Enums.getIfPresent(enumeration, name); - T VALUE; - if (j == null || !j.isPresent()) { - VALUE = valueOfIgnoreCase(enumeration, name); - } - else { - VALUE = j.get(); - } - return VALUE; - } - - /** - * Finds the value of the given enumeration by name, case-insensitive. - * Throws an IllegalArgumentException if no match is found. - **/ - private static <T extends Enum<T>> T valueOfIgnoreCase(Class<T> enumeration, String name) { - - for (T enumValue : enumeration.getEnumConstants()) { - if (enumValue.name().equalsIgnoreCase(name)) { - return enumValue; - } - } - - throw new IllegalArgumentException(String.format( - "There is no value with name '%s' in Enum %s", - name, enumeration.getName() - )); - } - - public static Object getValue(Class class1, String materialName, boolean bool) { - if (Enum.class.isInstance(class1)){ - return getValue(class1, materialName); - } - return null; - } - - -} diff --git a/src/Java/gtPlusPlus/core/util/data/FileUtils.java b/src/Java/gtPlusPlus/core/util/data/FileUtils.java deleted file mode 100644 index bec5e0eeff..0000000000 --- a/src/Java/gtPlusPlus/core/util/data/FileUtils.java +++ /dev/null @@ -1,118 +0,0 @@ -package gtPlusPlus.core.util.data; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.StandardOpenOption; -import java.util.ArrayList; -import java.util.List; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.Utils; - -public class FileUtils { - - private static final Charset utf8 = StandardCharsets.UTF_8; - - public static boolean doesFileExist(File f) { - if (f != null && f.exists() && !f.isDirectory()) { - return true; - } - return false; - } - - public static File createFile(String path, String filename, String extension) { - File file = new File(Utils.getMcDir(), path + filename + extension); - return createFile(file); - } - - public static File createFile(File aFile) { - boolean blnCreated = false; - Logger.INFO("Trying to use path "+aFile.getPath()); - try { - Logger.INFO("Trying to use path "+aFile.getCanonicalPath()); - Logger.INFO("Trying to use absolute path "+aFile.getAbsolutePath()); - blnCreated = aFile.createNewFile(); - } catch (IOException ioe) { - Logger.INFO("Error while creating a new empty file :" + ioe); - return null; - } - return blnCreated ? aFile : null; - } - - public static File getFile(String filename, String extension) { - return getFile("", filename, extension); - } - - public static File getFile(String path, String filename, String extension) { - if (path == null || path.length() <= 0) { - path = ""; - } - else { - path = path + "/"; - } - if (filename == null || filename.length() <= 0) { - return null; - } - if (extension == null || extension.length() <= 0) { - extension = ".txt"; - } - else { - extension = "." + extension; - } - File file = new File(Utils.getMcDir(), path + filename + extension); - boolean doesExist = doesFileExist(file); - - if (doesExist) { - Logger.INFO("Found File: " + file.getAbsolutePath()); - return file; - } else { - Logger.INFO("Creating file, as it was not found."); - return createFile(path, filename, extension); - } - } - - public static boolean appendListToFile(File file, List<String> content) { - try { - long oldSize; - long newSize; - if (doesFileExist(file)) { - Path p = Paths.get(file.getPath()); - if (p != null && Files.isWritable(p)) { - oldSize = Files.size(p); - try { - Files.write(p, content, utf8, StandardOpenOption.APPEND); - } catch (IOException e) { - e.printStackTrace(); - } - newSize = Files.size(p); - return newSize > oldSize; - } - } - } catch (IOException e) { - } - return false; - } - - /** - * Reads the contents of a file line by line to a List of Strings using the default encoding for the VM. - * The file is always closed. - * - * @param file the file to read, must not be {@code null} - * @return the list of Strings representing each line in the file, never {@code null} - * @throws IOException in case of an I/O error - * @since 1.3 - */ - public static List<String> readLines(File file) { - try { - return org.apache.commons.io.FileUtils.readLines(file, utf8); - } - catch (IOException e) { - return new ArrayList<String>(); - } - } -} diff --git a/src/Java/gtPlusPlus/core/util/data/LocaleUtils.java b/src/Java/gtPlusPlus/core/util/data/LocaleUtils.java deleted file mode 100644 index d1a35a661b..0000000000 --- a/src/Java/gtPlusPlus/core/util/data/LocaleUtils.java +++ /dev/null @@ -1,90 +0,0 @@ -package gtPlusPlus.core.util.data; - -import java.io.*; - -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.ModContainer; -import cpw.mods.fml.common.registry.GameData; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class LocaleUtils { - - public static boolean generateFakeLocaleFile() { - for (ModContainer modcontainer : Loader.instance().getModList()){ - if (modcontainer.getModId().toLowerCase().equals("miscutils")) { - String S = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; - writeToFile(S); - dumpItemsAndBlocksForModContainer(modcontainer); - } - } - return true; - } - - public static boolean dumpItemsAndBlocksForModContainer(ModContainer mod) { - writeToFile("Dumping Items from "+mod.getModId()+"."); - for (Object C : GameData.getItemRegistry()) { - - try { - - if (C != null) { - if (C instanceof Item) { - Item R = (Item) C; - ItemStack IS = ItemUtils.getSimpleStack(R); - String modid = ItemUtils.getModId(IS); - if (modid.equals("miscutils") || modid.equals("ToxicEverglades")) { - String S = "["+modid+"] "+IS.getUnlocalizedName()+".name="; - writeToFile(S); - } - } - } - - } - catch (Throwable T) {} - - } - writeToFile("Dumping Blocks from "+mod.getModId()+"."); - for (Object B : GameData.getBlockRegistry()) { - - try { - - if (B != null) { - if (B instanceof Block) { - Block R = (Block) B; - ItemStack IS = ItemUtils.getSimpleStack(R); - String modid = ItemUtils.getModId(IS); - if (modid.equals("miscutils") || modid.equals("ToxicEverglades")) { - String S = "["+modid+"] "+IS.getUnlocalizedName()+".name="; - writeToFile(S); - } - } - } - - } - catch (Throwable T) {} - - } - - - return true; - } - - public static void writeToFile(String S) { - try { - File F = new File(Utils.getMcDir(), "config/GTplusplus/en_US.lang"); - BufferedWriter writer; - writer = new BufferedWriter(new FileWriter(F, true)); - writer.write(S); - writer.newLine(); - writer.close(); - } - catch (IOException e) {} - } - - -} diff --git a/src/Java/gtPlusPlus/core/util/data/LoggingUtils.java b/src/Java/gtPlusPlus/core/util/data/LoggingUtils.java deleted file mode 100644 index 8415ab32fe..0000000000 --- a/src/Java/gtPlusPlus/core/util/data/LoggingUtils.java +++ /dev/null @@ -1,49 +0,0 @@ -package gtPlusPlus.core.util.data; - -import java.io.*; -import java.util.Date; - -public class LoggingUtils { - - public static void profileLog(final Object o) { - try { - String content; - final File file = new File("GregtechTimingsTC.txt"); - // if file doesnt exists, then create it - if (!file.exists()) { - file.createNewFile(); - final FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); - final BufferedWriter bw = new BufferedWriter(fw); - bw.write("============================================================"); - bw.write(System.lineSeparator()); - bw.close(); - } - if (o instanceof String) { - content = (String) o; - } else { - content = o.toString(); - } - final FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); - final BufferedWriter bw = new BufferedWriter(fw); - bw.write(content); - bw.write(System.lineSeparator()); - bw.close(); - System.out.println("Data Logged."); - - } catch (final IOException e) { - System.out.println("Data logging failed."); - } - } - - public static boolean logCurrentSystemTime(final String message) { - final Date date = new Date(System.currentTimeMillis()); - try { - profileLog(message + " | " + date.toString()); - return true; - } catch (final Throwable r) { - return false; - } - - } - -} diff --git a/src/Java/gtPlusPlus/core/util/data/StringUtils.java b/src/Java/gtPlusPlus/core/util/data/StringUtils.java deleted file mode 100644 index 2372d04c15..0000000000 --- a/src/Java/gtPlusPlus/core/util/data/StringUtils.java +++ /dev/null @@ -1,219 +0,0 @@ -package gtPlusPlus.core.util.data; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.util.Utils; - -public class StringUtils { - - public static String superscript(String str) { - str = str.replaceAll("0", "\u2070"); - str = str.replaceAll("1", "\u00B9"); - str = str.replaceAll("2", "\u00B2"); - str = str.replaceAll("3", "\u00B3"); - str = str.replaceAll("4", "\u2074"); - str = str.replaceAll("5", "\u2075"); - str = str.replaceAll("6", "\u2076"); - str = str.replaceAll("7", "\u2077"); - str = str.replaceAll("8", "\u2078"); - str = str.replaceAll("9", "\u2079"); - return str; - } - - public static String subscript(String str) { - str = str.replaceAll("0", "\u2080"); - str = str.replaceAll("1", "\u2081"); - str = str.replaceAll("2", "\u2082"); - str = str.replaceAll("3", "\u2083"); - str = str.replaceAll("4", "\u2084"); - str = str.replaceAll("5", "\u2085"); - str = str.replaceAll("6", "\u2086"); - str = str.replaceAll("7", "\u2087"); - str = str.replaceAll("8", "\u2088"); - str = str.replaceAll("9", "\u2089"); - return str; - } - - public static boolean containsSuperOrSubScript(final String s){ - if (s.contains(StringUtils.superscript("0"))) { - return true; - } - else if (s.contains(StringUtils.superscript("1"))) { - return true; - } - else if (s.contains(StringUtils.superscript("2"))) { - return true; - } - else if (s.contains(StringUtils.superscript("3"))) { - return true; - } - else if (s.contains(StringUtils.superscript("4"))) { - return true; - } - else if (s.contains(StringUtils.superscript("5"))) { - return true; - } - else if (s.contains(StringUtils.superscript("6"))) { - return true; - } - else if (s.contains(StringUtils.superscript("7"))) { - return true; - } - else if (s.contains(StringUtils.superscript("8"))) { - return true; - } - else if (s.contains(StringUtils.superscript("9"))) { - return true; - } - if (s.contains(StringUtils.subscript("0"))) { - return true; - } - else if (s.contains(StringUtils.subscript("1"))) { - return true; - } - else if (s.contains(StringUtils.subscript("2"))) { - return true; - } - else if (s.contains(StringUtils.subscript("3"))) { - return true; - } - else if (s.contains(StringUtils.subscript("4"))) { - return true; - } - else if (s.contains(StringUtils.subscript("5"))) { - return true; - } - else if (s.contains(StringUtils.subscript("6"))) { - return true; - } - else if (s.contains(StringUtils.subscript("7"))) { - return true; - } - else if (s.contains(StringUtils.subscript("8"))) { - return true; - } - else if (s.contains(StringUtils.subscript("9"))) { - return true; - } - return false; - } - - //Can call this Enum for formatting. - public static enum TextUtils { - blue('1'), green('2'), teal('3'), maroon('4'), purple('5'), orange('6'), lightGray('7'), darkGray('8'), lightBlue( - '9'), black('0'), lime('a'), aqua('b'), red('c'), pink('d'), yellow('e'), white('f'); - - private char colourValue; - private TextUtils(final char value) { - this.colourValue = value; - } - public String colour() { - return getFormatter() + this.colourValue; - } - private String getFormatter() { - return "\u00A7"; // Returns §. - } - } - - public static String firstLetterCaps(String data) { - String firstLetter = data.substring(0,1).toUpperCase(); - String restLetters = data.substring(1).toLowerCase(); - return firstLetter + restLetters; - } - - public static <V> String getDataStringFromArray(V[] parameterTypes) { - if (parameterTypes == null || parameterTypes.length == 0) { - return "empty/null"; - } - else { - String aData = ""; - for (V y : parameterTypes) { - if (y != null) { - aData += ", "+y.toString(); - } - } - return aData; - } - } - - - - /** - * Is this a special regex character for delimination? (.$|()[]{}^?*+\\) - * @param aChar - The char to test - * @return - Is this a special character? - */ - public static boolean isSpecialCharacter(char aChar) { - if (aChar == '"' || aChar == '.' || aChar == '$' || aChar == '|' || aChar == '(' || aChar == ')' || aChar == '[' - || aChar == ']' || aChar == '{' || aChar == '}' || aChar == '^' || aChar == '?' || aChar == '*' - || aChar == '+' || aChar == '\\') { - return true; - } - return false; - } - - public static boolean isEscaped(String aString) { - return aString.substring(0, 1).equals("\\"); - } - - public static String splitAndUppercase(String aInput, String aDelim) { - - if (!isEscaped(aDelim)) { - boolean isSpecial = false; - for (int o=0;o<aInput.length();o++) { - if (isSpecialCharacter(aInput.charAt(o))) { - isSpecial = true; - } - } - if (isSpecial) { - aDelim = "\\"+aDelim; - } - } - - - Logger.INFO("Splitting "+aInput); - String[] aSplit = aInput.split(aDelim); - Logger.INFO("Split into "+aSplit == null ? ""+0 : aSplit.length+" parts."); - if (aSplit == null || aSplit.length == 0) { - return aInput; - } - else { - AutoMap<String> aTemp = new AutoMap<String>(); - for (String s : aSplit) { - Logger.INFO("Found: "+s); - s = s.replace(".", ""); - s = Utils.sanitizeString(s); - s = firstLetterCaps(s); - Logger.INFO("Formatted & Captilized: "+s); - aTemp.put(s); - } - Logger.INFO("Rebuilding"); - String aReturn = ""; - for (String s : aTemp) { - aReturn += s; - Logger.INFO("Step: "+aReturn); - } - return aReturn; - } - } - - public static int characterCount(String aString, char aChar) { - return characterCount(aString, ""+aChar); - } - - public static int characterCount(String aString, String aChar) { - int aLength = aString.length(); - int aFound = 0; - if (aLength == 0 || !aString.contains(aChar)) { - return 0; - } - else { - for (int index = 0; index < aLength; index++) { - if (aString.substring(index, index+1).equals(aChar)) { - aFound++; - } - } - return aFound; - } - } -} diff --git a/src/Java/gtPlusPlus/core/util/data/UUIDUtils.java b/src/Java/gtPlusPlus/core/util/data/UUIDUtils.java deleted file mode 100644 index d6b32314b1..0000000000 --- a/src/Java/gtPlusPlus/core/util/data/UUIDUtils.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.core.util.data; - -import java.nio.ByteBuffer; -import java.util.UUID; - -public class UUIDUtils { - - //UUID Methods below created by https://gist.github.com/jeffjohnson9046 - //https://gist.github.com/jeffjohnson9046/c663dd22bbe6bb0b3f5e - - public static byte[] getBytesFromUUID(UUID uuid) { - ByteBuffer bb = ByteBuffer.wrap(new byte[16]); - bb.putLong(uuid.getMostSignificantBits()); - bb.putLong(uuid.getLeastSignificantBits()); - return bb.array(); - } - - public static UUID getUUIDFromBytes(byte[] bytes) { - ByteBuffer byteBuffer = ByteBuffer.wrap(bytes); - Long high = byteBuffer.getLong(); - Long low = byteBuffer.getLong(); - return new UUID(high, low); - } - -} diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java deleted file mode 100644 index f8fc15c778..0000000000 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java +++ /dev/null @@ -1,37 +0,0 @@ -package gtPlusPlus.core.util.debug; - -import gtPlusPlus.preloader.CORE_Preloader; - -public class DEBUG_INIT { - - public static void registerBlocks(){ - //Debug Loading - if (CORE_Preloader.DEBUG_MODE){ - - } - } - - public static void registerItems(){ - /*ModItems.itemDebugShapeSpawner = new DEBUG_ITEM_ShapeSpawner("itemDebugShapeSpawner", AddToCreativeTab.tabMisc, 1, 500); - GameRegistry.registerItem(ModItems.itemDebugShapeSpawner, "itemDebugShapeSpawner"); - ModItems.itemBedLocator_Base = new BedLocator_Base("itemBedLocator_Base"); - GameRegistry.registerItem(ModItems.itemBedLocator_Base, "itemBedLocator_Base"); - ModItems.itemBaseItemWithCharge = new BaseItemWithCharge("itemBaseItemWithCharge", 0, 1000); - GameRegistry.registerItem(ModItems.itemBaseItemWithCharge, "itemBaseItemWithCharge");*/ - } - - public static void registerTEs(){ - - } - - public static void registerMisc(){ - - - - } - - public static void registerHandlers(){ - //MinecraftForge.EVENT_BUS.register(new DEBUG_ScreenOverlay()); - } - -} diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java deleted file mode 100644 index d1e65afe3e..0000000000 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java +++ /dev/null @@ -1,58 +0,0 @@ -package gtPlusPlus.core.util.debug; - -import static net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK; - -import java.util.List; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.BaseItemGeneric; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; - -public class DEBUG_ITEM_ShapeSpawner extends BaseItemGeneric{ - - public DEBUG_ITEM_ShapeSpawner(String s, CreativeTabs c, int stackSize, int maxDmg) { - super(s, c, stackSize, maxDmg); - s = "itemDebugShapeSpawner"; - c = AddToCreativeTab.tabMisc; - stackSize = 1; - maxDmg = 500; - } - - @Override - public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player){ - - if (!world.isRemote){ - Logger.INFO("Constructing the shape for the "+"VACUUM FREEZER"); - final Thread thread = new Thread(new DEBUG_TimerThread(world, player)); - thread.start(); - } - return stack; - } - - - - @SubscribeEvent - public void playerInteractEventHandler(final PlayerInteractEvent event) - { - if (event.isCanceled() || event.world.isRemote || (event.action != RIGHT_CLICK_BLOCK)) { - return; - } - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(EnumChatFormatting.GOLD+"For Testing Gregtech Shapes!"); - super.addInformation(stack, aPlayer, list, bool); - } - -} diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java deleted file mode 100644 index 2e46b171f9..0000000000 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java +++ /dev/null @@ -1,918 +0,0 @@ -package gtPlusPlus.core.util.debug; - -import static gregtech.api.enums.GT_Values.V; - -import java.util.ArrayList; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.gui.GT_Container_MultiMachine; -import gregtech.api.gui.GT_GUIContainer_MultiMachine; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.*; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; -import gregtech.api.util.GT_Utility; -import gregtech.common.items.GT_MetaGenerated_Tool_01; - -import net.minecraftforge.fluids.FluidStack; - -public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { - - public static boolean disableMaintenance; - public boolean mMachine = false, mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, mSolderingTool = false, mCrowbar = false, mRunningOnLoad = false; - public int mPollution = 0, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mEfficiencyIncrease = 0, mUpdate = 0, mStartUpCheck = 100, mRuntime = 0, mEfficiency = 0; - public ItemStack[] mOutputItems = null; - public FluidStack[] mOutputFluids = null; - public ArrayList<GT_MetaTileEntity_Hatch_Input> mInputHatches = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_Output> mOutputHatches = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_InputBus> mInputBusses = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_OutputBus> mOutputBusses = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_Dynamo> mDynamoHatches = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_Muffler> mMufflerHatches = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_Energy> mEnergyHatches = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_Maintenance> mMaintenanceHatches = new ArrayList<>(); - - public DEBUG_MULTIBLOCK_ShapeSpawner(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional, 2); - DEBUG_MULTIBLOCK_ShapeSpawner.disableMaintenance = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); - } - - public DEBUG_MULTIBLOCK_ShapeSpawner(final String aName) { - super(aName, 2); - DEBUG_MULTIBLOCK_ShapeSpawner.disableMaintenance = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); - } - - public static boolean isValidMetaTileEntity(final MetaTileEntity aMetaTileEntity) { - return (aMetaTileEntity.getBaseMetaTileEntity() != null) && (aMetaTileEntity.getBaseMetaTileEntity().getMetaTileEntity() == aMetaTileEntity) && !aMetaTileEntity.getBaseMetaTileEntity().isDead(); - } - - @Override - public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aCoverID) { - return aSide != this.getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isFacingValid(final byte aFacing) { - return true; - } - - @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(final int aIndex) { - return aIndex > 0; - } - - @Override - public int getProgresstime() { - return this.mProgresstime; - } - - @Override - public int maxProgresstime() { - return this.mMaxProgresstime; - } - - @Override - public int increaseProgress(final int aProgress) { - return aProgress; - } - - @Override - public void saveNBTData(final NBTTagCompound aNBT) { - aNBT.setInteger("mEUt", this.mEUt); - aNBT.setInteger("mProgresstime", this.mProgresstime); - aNBT.setInteger("mMaxProgresstime", this.mMaxProgresstime); - aNBT.setInteger("mEfficiencyIncrease", this.mEfficiencyIncrease); - aNBT.setInteger("mEfficiency", this.mEfficiency); - aNBT.setInteger("mPollution", this.mPollution); - aNBT.setInteger("mRuntime", this.mRuntime); - - if (this.mOutputItems != null) { - for (int i = 0; i < this.mOutputItems.length; i++) { - if (this.mOutputItems[i] != null) { - final NBTTagCompound tNBT = new NBTTagCompound(); - this.mOutputItems[i].writeToNBT(tNBT); - aNBT.setTag("mOutputItem" + i, tNBT); - } - } - } - if (this.mOutputFluids != null) { - for (int i = 0; i < this.mOutputFluids.length; i++) { - if (this.mOutputFluids[i] != null) { - final NBTTagCompound tNBT = new NBTTagCompound(); - this.mOutputFluids[i].writeToNBT(tNBT); - aNBT.setTag("mOutputFluids" + i, tNBT); - } - } - } - - aNBT.setBoolean("mWrench", this.mWrench); - aNBT.setBoolean("mScrewdriver", this.mScrewdriver); - aNBT.setBoolean("mSoftHammer", this.mSoftHammer); - aNBT.setBoolean("mHardHammer", this.mHardHammer); - aNBT.setBoolean("mSolderingTool", this.mSolderingTool); - aNBT.setBoolean("mCrowbar", this.mCrowbar); - } - - @Override - public void loadNBTData(final NBTTagCompound aNBT) { - this.mEUt = aNBT.getInteger("mEUt"); - this.mProgresstime = aNBT.getInteger("mProgresstime"); - this.mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); - if (this.mMaxProgresstime > 0) { - this.mRunningOnLoad = true; - } - this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease"); - this.mEfficiency = aNBT.getInteger("mEfficiency"); - this.mPollution = aNBT.getInteger("mPollution"); - this.mRuntime = aNBT.getInteger("mRuntime"); - this.mOutputItems = new ItemStack[this.getAmountOfOutputs()]; - for (int i = 0; i < this.mOutputItems.length; i++) { - this.mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); - } - this.mOutputFluids = new FluidStack[this.getAmountOfOutputs()]; - for (int i = 0; i < this.mOutputFluids.length; i++) { - this.mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i); - } - this.mWrench = aNBT.getBoolean("mWrench"); - this.mScrewdriver = aNBT.getBoolean("mScrewdriver"); - this.mSoftHammer = aNBT.getBoolean("mSoftHammer"); - this.mHardHammer = aNBT.getBoolean("mHardHammer"); - this.mSolderingTool = aNBT.getBoolean("mSolderingTool"); - this.mCrowbar = aNBT.getBoolean("mCrowbar"); - } - - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - - @Override - public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); - } - - @Override - public byte getTileEntityBaseType() { - return 2; - } - - @Override - public void onMachineBlockUpdate() { - this.mUpdate = 50; - } - - @Override - public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - if (this.mEfficiency < 0) { - this.mEfficiency = 0; - } - if ((--this.mUpdate == 0) || (--this.mStartUpCheck == 0)) { - this.mInputHatches.clear(); - this.mInputBusses.clear(); - this.mOutputHatches.clear(); - this.mOutputBusses.clear(); - this.mDynamoHatches.clear(); - this.mEnergyHatches.clear(); - this.mMufflerHatches.clear(); - this.mMaintenanceHatches.clear(); - this.mMachine = this.checkMachine(aBaseMetaTileEntity, this.mInventory[1]); - } - if (this.mStartUpCheck < 0) { - if (this.mMachine) { - for (final GT_MetaTileEntity_Hatch_Maintenance tHatch : this.mMaintenanceHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (!DEBUG_MULTIBLOCK_ShapeSpawner.disableMaintenance) { - if (tHatch.mWrench) { - this.mWrench = true; - } - if (tHatch.mScrewdriver) { - this.mScrewdriver = true; - } - if (tHatch.mSoftHammer) { - this.mSoftHammer = true; - } - if (tHatch.mHardHammer) { - this.mHardHammer = true; - } - if (tHatch.mSolderingTool) { - this.mSolderingTool = true; - } - if (tHatch.mCrowbar) { - this.mCrowbar = true; - } - } else { - this.mWrench = true; - this.mScrewdriver = true; - this.mSoftHammer = true; - this.mHardHammer = true; - this.mSolderingTool = true; - this.mCrowbar = true; - } - - tHatch.mWrench = false; - tHatch.mScrewdriver = false; - tHatch.mSoftHammer = false; - tHatch.mHardHammer = false; - tHatch.mSolderingTool = false; - tHatch.mCrowbar = false; - } - } - if (this.getRepairStatus() > 0) { - if ((this.mMaxProgresstime > 0) && this.doRandomMaintenanceDamage()) { - if (this.onRunningTick(this.mInventory[1])) { - if (!this.polluteEnvironment(this.getPollutionPerTick(this.mInventory[1]))) { - this.stopMachine(); - } - if ((this.mMaxProgresstime > 0) && (++this.mProgresstime >= this.mMaxProgresstime)) { - if (this.mOutputItems != null) { - for (final ItemStack tStack : this.mOutputItems) { - if (tStack != null) { - try { - GT_Mod.achievements.issueAchivementHatch(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), tStack); - } catch (final Exception e) { - } - this.addOutput(tStack); - } - } - } - if ((this.mOutputFluids != null) && (this.mOutputFluids.length == 1)) { - for (final FluidStack tStack : this.mOutputFluids) { - if (tStack != null) { - this.addOutput(tStack); - } - } - } else if ((this.mOutputFluids != null) && (this.mOutputFluids.length > 1)) { - this.addFluidOutputs(this.mOutputFluids); - } - this.mEfficiency = Math.max(0, Math.min(this.mEfficiency + this.mEfficiencyIncrease, this.getMaxEfficiency(this.mInventory[1]) - ((this.getIdealStatus() - this.getRepairStatus()) * 1000))); - this.mOutputItems = null; - this.mProgresstime = 0; - this.mMaxProgresstime = 0; - this.mEfficiencyIncrease = 0; - if (aBaseMetaTileEntity.isAllowedToWork()) { - this.checkRecipe(this.mInventory[1]); - } - if ((this.mOutputFluids != null) && (this.mOutputFluids.length > 0)) { - if (this.mOutputFluids.length > 1) { - GT_Mod.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "oilplant"); - } - } - } - } - } else { - if (((aTick % 100) == 0) || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { - - if (aBaseMetaTileEntity.isAllowedToWork()) { - this.checkRecipe(this.mInventory[1]); - } - if (this.mMaxProgresstime <= 0) { - this.mEfficiency = Math.max(0, this.mEfficiency - 1000); - } - } - } - } else { - this.stopMachine(); - } - } else { - this.stopMachine(); - } - } - aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (this.mWrench ? 0 : 1) | (this.mScrewdriver ? 0 : 2) | (this.mSoftHammer ? 0 : 4) | (this.mHardHammer ? 0 : 8) | (this.mSolderingTool ? 0 : 16) | (this.mCrowbar ? 0 : 32) | (this.mMachine ? 0 : 64)); - aBaseMetaTileEntity.setActive(this.mMaxProgresstime > 0); - } - } - - public boolean polluteEnvironment(final int aPollutionLevel) { - this.mPollution += aPollutionLevel; - for (final GT_MetaTileEntity_Hatch_Muffler tHatch : this.mMufflerHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (this.mPollution >= 10000) { - if (tHatch.polluteEnvironment()) { - this.mPollution -= 10000; - } - } else { - break; - } - } - } - return this.mPollution < 10000; - } - - /** - * Called every tick the Machine runs - */ - public boolean onRunningTick(final ItemStack aStack) { - if (this.mEUt > 0) { - this.addEnergyOutput(((long) this.mEUt * this.mEfficiency) / 10000); - return true; - } - if (this.mEUt < 0) { - if (!this.drainEnergyInput(((long) -this.mEUt * 10000) / Math.max(1000, this.mEfficiency))) { - this.stopMachine(); - return false; - } - } - return true; - } - - /** - * Checks if this is a Correct Machine Part for this kind of Machine (Turbine Rotor for example) - */ - public abstract boolean isCorrectMachinePart(ItemStack aStack); - - /** - * Checks the Recipe - */ - public abstract boolean checkRecipe(ItemStack aStack); - - /** - * Checks the Machine. You have to assign the MetaTileEntities for the Hatches here. - */ - public abstract boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack); - - /** - * Gets the maximum Efficiency that spare Part can get (0 - 10000) - */ - public abstract int getMaxEfficiency(ItemStack aStack); - - /** - * Gets the pollution this Device outputs to a Muffler per tick (10000 = one Pullution Block) - */ - public abstract int getPollutionPerTick(ItemStack aStack); - - /** - * Gets the damage to the ItemStack, usually 0 or 1. - */ - public abstract int getDamageToComponent(ItemStack aStack); - - /** - * Gets the Amount of possibly outputted Items for loading the Output Stack Array from NBT. - * This should be the largest Amount that can ever happen legitimately. - */ - public abstract int getAmountOfOutputs(); - - /** - * If it explodes when the Component has to be replaced. - */ - public abstract boolean explodesOnComponentBreak(ItemStack aStack); - - public void stopMachine() { - this.mOutputItems = null; - this.mEUt = 0; - this.mEfficiency = 0; - this.mProgresstime = 0; - this.mMaxProgresstime = 0; - this.mEfficiencyIncrease = 0; - this.getBaseMetaTileEntity().disableWorking(); - } - - public int getRepairStatus() { - return (this.mWrench ? 1 : 0) + (this.mScrewdriver ? 1 : 0) + (this.mSoftHammer ? 1 : 0) + (this.mHardHammer ? 1 : 0) + (this.mSolderingTool ? 1 : 0) + (this.mCrowbar ? 1 : 0); - } - - public int getIdealStatus() { - return 6; - } - - public boolean doRandomMaintenanceDamage() { - if (!this.isCorrectMachinePart(this.mInventory[1]) || (this.getRepairStatus() == 0)) { - this.stopMachine(); - return false; - } - if (this.mRuntime++ > 1000) { - this.mRuntime = 0; - if (this.getBaseMetaTileEntity().getRandomNumber(6000) == 0) { - switch (this.getBaseMetaTileEntity().getRandomNumber(6)) { - case 0: - this.mWrench = false; - break; - case 1: - this.mScrewdriver = false; - break; - case 2: - this.mSoftHammer = false; - break; - case 3: - this.mHardHammer = false; - break; - case 4: - this.mSolderingTool = false; - break; - case 5: - this.mCrowbar = false; - break; - } - } - if ((this.mInventory[1] != null) && (this.getBaseMetaTileEntity().getRandomNumber(2) == 0) && !this.mInventory[1].getUnlocalizedName().startsWith("gt.blockmachines.basicmachine.")) { - if (this.mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) { - final NBTTagCompound tNBT = this.mInventory[1].getTagCompound(); - if (tNBT != null) { - NBTTagCompound tNBT2 = tNBT.getCompoundTag("GT.CraftingComponents"); - if (!tNBT.getBoolean("mDis")) { - tNBT2 = new NBTTagCompound(); - final Materials tMaterial = GT_MetaGenerated_Tool.getPrimaryMaterial(this.mInventory[1]); - final ItemStack tTurbine = GT_OreDictUnificator.get(OrePrefixes.turbineBlade, tMaterial, 1); - final int i = this.mInventory[1].getItemDamage(); - if (i == 170) { - ItemStack tStack = GT_Utility.copyAmount(1, tTurbine); - tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); - tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Magnalium, 1); - tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); - } else if (i == 172) { - ItemStack tStack = GT_Utility.copyAmount(1, tTurbine); - tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.7", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.8", tStack.writeToNBT(new NBTTagCompound())); - tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Titanium, 1); - tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); - } else if (i == 174) { - ItemStack tStack = GT_Utility.copyAmount(2, tTurbine); - tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); - tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.TungstenSteel, 1); - tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); - } else if (i == 176) { - ItemStack tStack = GT_Utility.copyAmount(2, tTurbine); - tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.7", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.8", tStack.writeToNBT(new NBTTagCompound())); - tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Americium, 1); - tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); - } - tNBT.setTag("GT.CraftingComponents", tNBT2); - tNBT.setBoolean("mDis", true); - this.mInventory[1].setTagCompound(tNBT); - - } - } - - ((GT_MetaGenerated_Tool) this.mInventory[1].getItem()).doDamage(this.mInventory[1], (long) Math.min(this.mEUt / 5, Math.pow(this.mEUt, 0.7))); - if (this.mInventory[1].stackSize == 0) { - this.mInventory[1] = null; - } - } - } - } - return true; - } - - public void explodeMultiblock() { - this.mInventory[1] = null; - for (final MetaTileEntity tTileEntity : this.mInputBusses) { - tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - } - for (final MetaTileEntity tTileEntity : this.mOutputBusses) { - tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - } - for (final MetaTileEntity tTileEntity : this.mInputHatches) { - tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - } - for (final MetaTileEntity tTileEntity : this.mOutputHatches) { - tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - } - for (final MetaTileEntity tTileEntity : this.mDynamoHatches) { - tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - } - for (final MetaTileEntity tTileEntity : this.mMufflerHatches) { - tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - } - for (final MetaTileEntity tTileEntity : this.mEnergyHatches) { - tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - } - for (final MetaTileEntity tTileEntity : this.mMaintenanceHatches) { - tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - } - this.getBaseMetaTileEntity().doExplosion(V[8]); - } - - public boolean addEnergyOutput(final long aEU) { - if (aEU <= 0) { - return true; - } - for (final GT_MetaTileEntity_Hatch_Dynamo tHatch : this.mDynamoHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(aEU, false)) { - return true; - } - } - } - return false; - } - - public long getMaxInputVoltage() { - long rVoltage = 0; - for (final GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches) { - if (isValidMetaTileEntity(tHatch)) { - rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); - } - } - return rVoltage; - } - - public boolean drainEnergyInput(final long aEU) { - if (aEU <= 0) { - return true; - } - for (final GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false)) { - return true; - } - } - } - return false; - } - - public boolean addOutput(final FluidStack aLiquid) { - if (aLiquid == null) { - return false; - } - final FluidStack tLiquid = aLiquid.copy(); - for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { - if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) { - final int tAmount = tHatch.fill(tLiquid, false); - if (tAmount >= tLiquid.amount) { - return tHatch.fill(tLiquid, true) >= tLiquid.amount; - } else if (tAmount > 0) { - tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true); - } - } - } - return false; - } - - private void addFluidOutputs(final FluidStack[] mOutputFluids2) { - for (int i = 0; i < mOutputFluids2.length; i++) { - if ((this.mOutputHatches.size() > i) && (this.mOutputHatches.get(i) != null) && (mOutputFluids2[i] != null) && isValidMetaTileEntity(this.mOutputHatches.get(i))) { - this.mOutputHatches.get(i).fill(mOutputFluids2[i], true); - } - } - - } - - public boolean depleteInput(final FluidStack aLiquid) { - if (aLiquid == null) { - return false; - } - for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { - tHatch.mRecipeMap = this.getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - FluidStack tLiquid = tHatch.getFluid(); - if ((tLiquid != null) && tLiquid.isFluidEqual(aLiquid)) { - tLiquid = tHatch.drain(aLiquid.amount, false); - if ((tLiquid != null) && (tLiquid.amount >= aLiquid.amount)) { - tLiquid = tHatch.drain(aLiquid.amount, true); - return (tLiquid != null) && (tLiquid.amount >= aLiquid.amount); - } - } - } - } - return false; - } - - public boolean addOutput(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) { - return false; - } - aStack = GT_Utility.copy(aStack); - // FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); - // if (aLiquid == null) { - for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) { - if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getSizeInventory() - 1; i >= 0; i--) { - if (tHatch.getBaseMetaTileEntity().addStackToSlot(i, aStack)) { - return true; - } - } - } - } - for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { - if (isValidMetaTileEntity(tHatch) && tHatch.outputsItems()) { - if (tHatch.getBaseMetaTileEntity().addStackToSlot(1, aStack)) { - return true; - } - } - } - // }else { - // for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { - // if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid)?tHatch.outputsSteam():tHatch.outputsLiquids()) { - // int tAmount = tHatch.fill(aLiquid, false); - // if (tAmount >= aLiquid.amount) { - // return tHatch.fill(aLiquid, true) >= aLiquid.amount; - // } - // } - // } - // } - return false; - } - - public boolean depleteInput(final ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) { - return false; - } - final FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); - if (aLiquid != null) { - return this.depleteInput(aLiquid); - } - for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { - tHatch.mRecipeMap = this.getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(0))) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { - tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); - return true; - } - } - } - } - for (final GT_MetaTileEntity_Hatch_InputBus tHatch : this.mInputBusses) { - tHatch.mRecipeMap = this.getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(i))) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { - tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); - return true; - } - } - } - } - } - return false; - } - - public ArrayList<ItemStack> getStoredOutputs() { - final ArrayList<ItemStack> rList = new ArrayList<>(); - for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { - if (isValidMetaTileEntity(tHatch)) { - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(1)); - } - } - for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) { - if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); - } - } - } - return rList; - } - - public ArrayList<FluidStack> getStoredFluids() { - final ArrayList<FluidStack> rList = new ArrayList<>(); - for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { - tHatch.mRecipeMap = this.getRecipeMap(); - if (isValidMetaTileEntity(tHatch) && (tHatch.getFillableStack() != null)) { - rList.add(tHatch.getFillableStack()); - } - } - return rList; - } - - public ArrayList<ItemStack> getStoredInputs() { - final ArrayList<ItemStack> rList = new ArrayList<>(); - for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { - tHatch.mRecipeMap = this.getRecipeMap(); - if (isValidMetaTileEntity(tHatch) && (tHatch.getBaseMetaTileEntity().getStackInSlot(0) != null)) { - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(0)); - } - } - for (final GT_MetaTileEntity_Hatch_InputBus tHatch : this.mInputBusses) { - tHatch.mRecipeMap = this.getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null) { - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); - } - } - } - } - return rList; - } - - public GT_Recipe_Map getRecipeMap() { - return null; - } - - public void updateSlots() { - for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { - if (isValidMetaTileEntity(tHatch)) { - tHatch.updateSlots(); - } - } - for (final GT_MetaTileEntity_Hatch_InputBus tHatch : this.mInputBusses) { - if (isValidMetaTileEntity(tHatch)) { - tHatch.updateSlots(); - } - } - } - - public boolean addToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { - return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { - return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { - return this.mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { - return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { - return this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { - return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { - return this.mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); - } - return false; - } - - public boolean addMaintenanceToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); - } - return false; - } - - public boolean addEnergyInputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); - } - return false; - } - - public boolean addDynamoToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); - } - return false; - } - - public boolean addMufflerToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return this.mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); - } - return false; - } - - public boolean addInputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = this.getRecipeMap(); - return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = this.getRecipeMap(); - return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); - } - return false; - } - - public boolean addOutputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return this.mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); - } - return false; - } - - @Override - public String[] getInfoData() { - return new String[]{"Progress:", (this.mProgresstime / 20) + "secs", (this.mMaxProgresstime / 20) + "secs", "Efficiency:", (this.mEfficiency / 100.0F) + "%", "Problems:", "" + (this.getIdealStatus() - this.getRepairStatus())}; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { - return false; - } -} diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java deleted file mode 100644 index 1c6a8e9278..0000000000 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java +++ /dev/null @@ -1,47 +0,0 @@ -package gtPlusPlus.core.util.debug; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.item.Item; - -import net.minecraftforge.client.event.RenderGameOverlayEvent; - -public class DEBUG_ScreenOverlay extends Gui { - - int width, height; - Minecraft mc = Minecraft.getMinecraft(); - - @SubscribeEvent - public void eventHandler(final RenderGameOverlayEvent.Text event) - { - - //if (mc.thePlayer.getHeldItem().equals(ModItems.itemStaballoyPickaxe)){ - final ScaledResolution res = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight); - final FontRenderer fontRender = this.mc.fontRenderer; - this.width = res.getScaledWidth(); - this.height = res.getScaledHeight(); - Minecraft.getMinecraft().entityRenderer.setupOverlayRendering(); - final String str = "Words"; - Item heldItem = null; - - try{heldItem = this.mc.thePlayer.getHeldItem().getItem(); - - if (heldItem != null){ - /*if (heldItem instanceof StaballoyPickaxe){ - - int dmg =((StaballoyPickaxe) heldItem).getDamage(((StaballoyPickaxe) heldItem).thisPickaxe); - - ((StaballoyPickaxe) heldItem).checkFacing(((StaballoyPickaxe) heldItem).localWorld); - str = "DAMAGE: "+ dmg +" | FACING: "+((StaballoyPickaxe) heldItem).FACING+" | FACING_HORIZONTAL: "+((StaballoyPickaxe) heldItem).FACING_HORIZONTAL+" | LOOKING DIRECTION: "+((StaballoyPickaxe) heldItem).lookingDirection; - - drawString(fontRender, str, (this.width - fontRender.getStringWidth(str)) / 2, this.height / 10, 0xFFAA00); - }*/ - } - }catch(final NullPointerException e){} - - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java deleted file mode 100644 index 50d12871cb..0000000000 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java +++ /dev/null @@ -1,64 +0,0 @@ -package gtPlusPlus.core.util.debug; - -import java.util.concurrent.TimeUnit; - -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import net.minecraftforge.common.util.ForgeDirection; - -public class DEBUG_TimerThread implements Runnable { - - private final World world; - private final EntityPlayer player; - - - public DEBUG_TimerThread(final World WORLD, final EntityPlayer PLAYER) { - this.world = WORLD; - this.player = PLAYER; - } - - @Override - public void run(){ - int xDir = ForgeDirection.getOrientation(this.player.getPlayerCoordinates().posX).offsetX; - int zDir = ForgeDirection.getOrientation(this.player.getPlayerCoordinates().posZ).offsetZ; - - final int stepX = Minecraft.getMinecraft().objectMouseOver.blockX; - final int stepY = Minecraft.getMinecraft().objectMouseOver.blockY; - final int stepZ = Minecraft.getMinecraft().objectMouseOver.blockZ; - Logger.INFO("Clicked on a Block @ "+"[X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"+" with xDir:"+xDir+" zDir:"+zDir); - this.world.setBlock(stepX, stepY, stepZ, Blocks.bedrock,0,3); - Logger.INFO("Makng it Bedrock for future investment."); - //for (int i = -1; i <= 1; i++) { - //stepX = stepX+i; - for (int i = stepX-1; i <= (stepX+1); i++){ - for (int j = stepZ-1; j <= (stepZ+1); j++){ - for (int h = stepY-1; h <= (stepY+1); h++){ - - xDir = ForgeDirection.getOrientation(this.player.getPlayerCoordinates().posX).offsetX; - zDir = ForgeDirection.getOrientation(this.player.getPlayerCoordinates().posZ).offsetZ; - - //for (int j = -1; j <= 1; j++) { - //stepZ = stepZ+j; - //for (int h = -1; h <= 1; h++) { - //stepY = stepY+h; - Logger.INFO("Placing Block @ "+"[X:"+i+"][Y:"+h+"][Z:"+j+"]"+" with xDir:"+xDir+" zDir:"+zDir); - if ((h != 0) || ((((xDir + i) != 0) || ((zDir + j) != 0)) && ((i != 0) || (j != 0)))) { - this.world.setBlock(i, h, j, Blocks.stone,0,3); - } - else { - Logger.INFO("Not even sure what this is for, but I got here."); - } - try { - TimeUnit.MILLISECONDS.sleep(500); - } catch (final InterruptedException e1) { - e1.printStackTrace(); - } - } - } - } - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java b/src/Java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java deleted file mode 100644 index 7cb1054d53..0000000000 --- a/src/Java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java +++ /dev/null @@ -1,343 +0,0 @@ -package gtPlusPlus.core.util.debug; - -import java.nio.ByteBuffer; - -import org.lwjgl.BufferUtils; -import org.lwjgl.opengl.GL11; - - -/** - * User: The Grey Ghost - * Date: 9/02/14 - */ -public class UtilityGL11Debug -{ - public class GLproperty - { - public GLproperty(final int init_gLconstant, final String init_name, final String init_description, final String init_category, final String init_fetchCommand) { - this.gLconstant = init_gLconstant; - this.name = init_name; - this.description = init_description; - this.category = init_category; - this.fetchCommand = init_fetchCommand; - } - - public int gLconstant; - public String name; - public String description; - public String category; - public String fetchCommand; - } - - public static UtilityGL11Debug instance = new UtilityGL11Debug(); - - public GLproperty[] propertyList = - - { - new GLproperty(GL11.GL_CURRENT_COLOR, "GL_CURRENT_COLOR", "Current color", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_INDEX, "GL_CURRENT_INDEX", "Current color index", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_TEXTURE_COORDS, "GL_CURRENT_TEXTURE_COORDS", "Current texture coordinates", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_NORMAL, "GL_CURRENT_NORMAL", "Current normal", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_RASTER_POSITION, "GL_CURRENT_RASTER_POSITION", "Current raster position", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_RASTER_DISTANCE, "GL_CURRENT_RASTER_DISTANCE", "Current raster distance", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_RASTER_COLOR, "GL_CURRENT_RASTER_COLOR", "Color associated with raster position", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_RASTER_INDEX, "GL_CURRENT_RASTER_INDEX", "Color index associated with raster position", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_RASTER_TEXTURE_COORDS, "GL_CURRENT_RASTER_TEXTURE_COORDS", "Texture coordinates associated with raster position", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_RASTER_POSITION_VALID, "GL_CURRENT_RASTER_POSITION_VALID", "Raster position valid bit", "current", "glGetBooleanv()"), - new GLproperty(GL11.GL_EDGE_FLAG, "GL_EDGE_FLAG", "Edge flag", "current", "glGetBooleanv()"), - new GLproperty(GL11.GL_VERTEX_ARRAY, "GL_VERTEX_ARRAY", "Vertex array enable", "vertex-array", "glIsEnabled()"), - new GLproperty(GL11.GL_VERTEX_ARRAY_SIZE, "GL_VERTEX_ARRAY_SIZE", "Coordinates per vertex", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_VERTEX_ARRAY_TYPE, "GL_VERTEX_ARRAY_TYPE", "Type of vertex coordinates", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_VERTEX_ARRAY_STRIDE, "GL_VERTEX_ARRAY_STRIDE", "Stride between vertices", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_VERTEX_ARRAY_POINTER, "GL_VERTEX_ARRAY_POINTER", "Pointer to the vertex array", "vertex-array", "glGetPointerv()"), - new GLproperty(GL11.GL_NORMAL_ARRAY, "GL_NORMAL_ARRAY", "Normal array enable", "vertex-array", "glIsEnabled()"), - new GLproperty(GL11.GL_NORMAL_ARRAY_TYPE, "GL_NORMAL_ARRAY_TYPE", "Type of normal coordinates", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_NORMAL_ARRAY_STRIDE, "GL_NORMAL_ARRAY_STRIDE", "Stride between normals", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_NORMAL_ARRAY_POINTER, "GL_NORMAL_ARRAY_POINTER", "Pointer to the normal array", "vertex-array", "glGetPointerv()"), - new GLproperty(GL11.GL_COLOR_ARRAY, "GL_COLOR_ARRAY", "RGBA color array enable", "vertex-array", "glIsEnabled()"), - new GLproperty(GL11.GL_COLOR_ARRAY_SIZE, "GL_COLOR_ARRAY_SIZE", "Colors per vertex", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_COLOR_ARRAY_TYPE, "GL_COLOR_ARRAY_TYPE", "Type of color components", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_COLOR_ARRAY_STRIDE, "GL_COLOR_ARRAY_STRIDE", "Stride between colors", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_COLOR_ARRAY_POINTER, "GL_COLOR_ARRAY_POINTER", "Pointer to the color array", "vertex-array", "glGetPointerv()"), - new GLproperty(GL11.GL_INDEX_ARRAY, "GL_INDEX_ARRAY", "Color-index array enable", "vertex-array", "glIsEnabled()"), - new GLproperty(GL11.GL_INDEX_ARRAY_TYPE, "GL_INDEX_ARRAY_TYPE", "Type of color indices", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_INDEX_ARRAY_STRIDE, "GL_INDEX_ARRAY_STRIDE", "Stride between color indices", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_INDEX_ARRAY_POINTER, "GL_INDEX_ARRAY_POINTER", "Pointer to the index array", "vertex-array", "glGetPointerv()"), - new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY, "GL_TEXTURE_COORD_ARRAY", "Texture coordinate array enable", "vertex-array", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_SIZE, "GL_TEXTURE_COORD_ARRAY_SIZE", "Texture coordinates per element", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_TYPE, "GL_TEXTURE_COORD_ARRAY_TYPE", "Type of texture coordinates", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_STRIDE, "GL_TEXTURE_COORD_ARRAY_STRIDE", "Stride between texture coordinates", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_POINTER, "GL_TEXTURE_COORD_ARRAY_POINTER", "Pointer to the texture coordinate array", "vertex-array", "glGetPointerv()"), - new GLproperty(GL11.GL_EDGE_FLAG_ARRAY, "GL_EDGE_FLAG_ARRAY", "Edge flag array enable", "vertex-array", "glIsEnabled()"), - new GLproperty(GL11.GL_EDGE_FLAG_ARRAY_STRIDE, "GL_EDGE_FLAG_ARRAY_STRIDE", "Stride between edge flags", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_EDGE_FLAG_ARRAY_POINTER, "GL_EDGE_FLAG_ARRAY_POINTER", "Pointer to the edge flag array", "vertex-array", "glGetPointerv()"), - new GLproperty(GL11.GL_MODELVIEW_MATRIX, "GL_MODELVIEW_MATRIX", "Modelview matrix stack", "matrix", "glGetFloatv()"), - new GLproperty(GL11.GL_PROJECTION_MATRIX, "GL_PROJECTION_MATRIX", "Projection matrix stack", "matrix", "glGetFloatv()"), - new GLproperty(GL11.GL_TEXTURE_MATRIX, "GL_TEXTURE_MATRIX", "Texture matrix stack", "matrix", "glGetFloatv()"), - new GLproperty(GL11.GL_VIEWPORT, "GL_VIEWPORT", "Viewport origin and extent", "viewport", "glGetIntegerv()"), - new GLproperty(GL11.GL_DEPTH_RANGE, "GL_DEPTH_RANGE", "Depth range near and far", "viewport", "glGetFloatv()"), - new GLproperty(GL11.GL_MODELVIEW_STACK_DEPTH, "GL_MODELVIEW_STACK_DEPTH", "Modelview matrix stack pointer", "matrix", "glGetIntegerv()"), - new GLproperty(GL11.GL_PROJECTION_STACK_DEPTH, "GL_PROJECTION_STACK_DEPTH", "Projection matrix stack pointer", "matrix", "glGetIntegerv()"), - new GLproperty(GL11.GL_TEXTURE_STACK_DEPTH, "GL_TEXTURE_STACK_DEPTH", "Texture matrix stack pointer", "matrix", "glGetIntegerv()"), - new GLproperty(GL11.GL_MATRIX_MODE, "GL_MATRIX_MODE", "Current matrix mode", "transform", "glGetIntegerv()"), - new GLproperty(GL11.GL_NORMALIZE, "GL_NORMALIZE", "Current normal normalization on/off", "transform/ enable", "glIsEnabled()"), - new GLproperty(GL11.GL_FOG_COLOR, "GL_FOG_COLOR", "Fog color", "fog", "glGetFloatv()"), - new GLproperty(GL11.GL_FOG_INDEX, "GL_FOG_INDEX", "Fog index", "fog", "glGetFloatv()"), - new GLproperty(GL11.GL_FOG_DENSITY, "GL_FOG_DENSITY", "Exponential fog density", "fog", "glGetFloatv()"), - new GLproperty(GL11.GL_FOG_START, "GL_FOG_START", "Linear fog start", "fog", "glGetFloatv()"), - new GLproperty(GL11.GL_FOG_END, "GL_FOG_END", "Linear fog end", "fog", "glGetFloatv()"), - new GLproperty(GL11.GL_FOG_MODE, "GL_FOG_MODE", "Fog mode", "fog", "glGetIntegerv()"), - new GLproperty(GL11.GL_FOG, "GL_FOG", "True if fog enabled", "fog/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_SHADE_MODEL, "GL_SHADE_MODEL", "glShadeModel() setting", "lighting", "glGetIntegerv()"), - new GLproperty(GL11.GL_LIGHTING, "GL_LIGHTING", "True if lighting is enabled", "lighting/e nable", "glIsEnabled()"), - new GLproperty(GL11.GL_COLOR_MATERIAL, "GL_COLOR_MATERIAL", "True if color tracking is enabled", "lighting", "glIsEnabled()"), - new GLproperty(GL11.GL_COLOR_MATERIAL_PARAMETER, "GL_COLOR_MATERIAL_PARAMETER", "Material properties tracking current color", "lighting", "glGetIntegerv()"), - new GLproperty(GL11.GL_COLOR_MATERIAL_FACE, "GL_COLOR_MATERIAL_FACE", "Face(s) affected by color tracking", "lighting", "glGetIntegerv()"), - new GLproperty(GL11.GL_AMBIENT, "GL_AMBIENT", "Ambient material color", "lighting", "glGetMaterialfv()"), - new GLproperty(GL11.GL_DIFFUSE, "GL_DIFFUSE", "Diffuse material color", "lighting", "glGetMaterialfv()"), - new GLproperty(GL11.GL_SPECULAR, "GL_SPECULAR", "Specular material color", "lighting", "glGetMaterialfv()"), - new GLproperty(GL11.GL_EMISSION, "GL_EMISSION", "Emissive material color", "lighting", "glGetMaterialfv()"), - new GLproperty(GL11.GL_SHININESS, "GL_SHININESS", "Specular exponent of material", "lighting", "glGetMaterialfv()"), - new GLproperty(GL11.GL_LIGHT_MODEL_AMBIENT, "GL_LIGHT_MODEL_AMBIENT", "Ambient scene color", "lighting", "glGetFloatv()"), - new GLproperty(GL11.GL_LIGHT_MODEL_LOCAL_VIEWER, "GL_LIGHT_MODEL_LOCAL_VIEWER", "Viewer is local", "lighting", "glGetBooleanv()"), - new GLproperty(GL11.GL_LIGHT_MODEL_TWO_SIDE, "GL_LIGHT_MODEL_TWO_SIDE", "Use two-sided lighting", "lighting", "glGetBooleanv()"), - new GLproperty(GL11.GL_AMBIENT, "GL_AMBIENT", "Ambient intensity of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_DIFFUSE, "GL_DIFFUSE", "Diffuse intensity of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_SPECULAR, "GL_SPECULAR", "Specular intensity of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_POSITION, "GL_POSITION", "Position of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_CONSTANT_ATTENUATION, "GL_CONSTANT_ATTENUATION", "Constant attenuation factor", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_LINEAR_ATTENUATION, "GL_LINEAR_ATTENUATION", "Linear attenuation factor", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_QUADRATIC_ATTENUATION, "GL_QUADRATIC_ATTENUATION", "Quadratic attenuation factor", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_SPOT_DIRECTION, "GL_SPOT_DIRECTION", "Spotlight direction of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_SPOT_EXPONENT, "GL_SPOT_EXPONENT", "Spotlight exponent of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_SPOT_CUTOFF, "GL_SPOT_CUTOFF", "Spotlight angle of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_LIGHT0, "GL_LIGHT0", "True if light 0 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT1, "GL_LIGHT1", "True if light 1 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT2, "GL_LIGHT2", "True if light 2 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT3, "GL_LIGHT3", "True if light 3 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT4, "GL_LIGHT4", "True if light 4 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT5, "GL_LIGHT5", "True if light 5 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT6, "GL_LIGHT6", "True if light 6 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT7, "GL_LIGHT7", "True if light 7 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_COLOR_INDEXES, "GL_COLOR_INDEXES", "ca, cd, and cs for color-index lighting", "lighting/e nable", "glGetMaterialfv()"), - new GLproperty(GL11.GL_POINT_SIZE, "GL_POINT_SIZE", "Point size", "point", "glGetFloatv()"), - new GLproperty(GL11.GL_POINT_SMOOTH, "GL_POINT_SMOOTH", "Point antialiasing on", "point/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LINE_WIDTH, "GL_LINE_WIDTH", "Line width", "line", "glGetFloatv()"), - new GLproperty(GL11.GL_LINE_SMOOTH, "GL_LINE_SMOOTH", "Line antialiasing on", "line/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LINE_STIPPLE_PATTERN, "GL_LINE_STIPPLE_PATTERN", "Line stipple", "line", "glGetIntegerv()"), - new GLproperty(GL11.GL_LINE_STIPPLE_REPEAT, "GL_LINE_STIPPLE_REPEAT", "Line stipple repeat", "line", "glGetIntegerv()"), - new GLproperty(GL11.GL_LINE_STIPPLE, "GL_LINE_STIPPLE", "Line stipple enable", "line/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_CULL_FACE, "GL_CULL_FACE", "Polygon culling enabled", "polygon/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_CULL_FACE_MODE, "GL_CULL_FACE_MODE", "Cull front-/back-facing polygons", "polygon", "glGetIntegerv()"), - new GLproperty(GL11.GL_FRONT_FACE, "GL_FRONT_FACE", "Polygon front-face CW/CCW indicator", "polygon", "glGetIntegerv()"), - new GLproperty(GL11.GL_POLYGON_SMOOTH, "GL_POLYGON_SMOOTH", "Polygon antialiasing on", "polygon/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_POLYGON_MODE, "GL_POLYGON_MODE", "Polygon rasterization mode (front and back)", "polygon", "glGetIntegerv()"), - new GLproperty(GL11.GL_POLYGON_OFFSET_FACTOR, "GL_POLYGON_OFFSET_FACTOR", "Polygon offset factor", "polygon", "glGetFloatv()"), - new GLproperty(GL11.GL_POLYGON_OFFSET_POINT, "GL_POLYGON_OFFSET_POINT", "Polygon offset enable for GL_POINT mode rasterization", "polygon/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_POLYGON_OFFSET_LINE, "GL_POLYGON_OFFSET_LINE", "Polygon offset enable for GL_LINE mode rasterization", "polygon/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_POLYGON_OFFSET_FILL, "GL_POLYGON_OFFSET_FILL", "Polygon offset enable for GL_FILL mode rasterization", "polygon/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_POLYGON_STIPPLE, "GL_POLYGON_STIPPLE", "Polygon stipple enable", "polygon/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_1D, "GL_TEXTURE_1D", "True if 1-D texturing enabled ", "texture/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_2D, "GL_TEXTURE_2D", "True if 2-D texturing enabled ", "texture/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_BINDING_1D, "GL_TEXTURE_BINDING_1D", "Texture object bound to GL_TEXTURE_1D", "texture", "glGetIntegerv()"), - new GLproperty(GL11.GL_TEXTURE_BINDING_2D, "GL_TEXTURE_BINDING_2D", "Texture object bound to GL_TEXTURE_2D", "texture", "glGetIntegerv()"), - new GLproperty(GL11.GL_TEXTURE, "GL_TEXTURE", "x-D texture image at level of detail i", "UNUSED", "glGetTexImage()"), - new GLproperty(GL11.GL_TEXTURE_WIDTH, "GL_TEXTURE_WIDTH", "x-D texture image i's width", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_HEIGHT, "GL_TEXTURE_HEIGHT", "x-D texture image i's height", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_BORDER, "GL_TEXTURE_BORDER", "x-D texture image i's border width", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_RED_SIZE, "GL_TEXTURE_RED_SIZE", "x-D texture image i's red resolution", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_GREEN_SIZE, "GL_TEXTURE_GREEN_SIZE", "x-D texture image i's green resolution", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_BLUE_SIZE, "GL_TEXTURE_BLUE_SIZE", "x-D texture image i's blue resolution", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_ALPHA_SIZE, "GL_TEXTURE_ALPHA_SIZE", "x-D texture image i's alpha resolution", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_LUMINANCE_SIZE, "GL_TEXTURE_LUMINANCE_SIZE", "x-D texture image i's luminance resolution", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_INTENSITY_SIZE, "GL_TEXTURE_INTENSITY_SIZE", "x-D texture image i's intensity resolution", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_BORDER_COLOR, "GL_TEXTURE_BORDER_COLOR", "Texture border color", "texture", "glGetTexParameter*()"), - new GLproperty(GL11.GL_TEXTURE_MIN_FILTER, "GL_TEXTURE_MIN_FILTER", "Texture minification function", "texture", "glGetTexParameter*()"), - new GLproperty(GL11.GL_TEXTURE_MAG_FILTER, "GL_TEXTURE_MAG_FILTER", "Texture magnification function", "texture", "glGetTexParameter*()"), - new GLproperty(GL11.GL_TEXTURE_WRAP_S, "GL_TEXTURE_WRAP_S", "Texture wrap mode (x is S or T)", "texture", "glGetTexParameter*()"), - new GLproperty(GL11.GL_TEXTURE_WRAP_T, "GL_TEXTURE_WRAP_T", "Texture wrap mode (x is S or T)", "texture", "glGetTexParameter*()"), - new GLproperty(GL11.GL_TEXTURE_PRIORITY, "GL_TEXTURE_PRIORITY", "Texture object priority", "texture", "glGetTexParameter*()"), - new GLproperty(GL11.GL_TEXTURE_ENV_MODE, "GL_TEXTURE_ENV_MODE", "Texture application function", "texture", "glGetTexEnviv()"), - new GLproperty(GL11.GL_TEXTURE_ENV_COLOR, "GL_TEXTURE_ENV_COLOR", "Texture environment color", "texture", "glGetTexEnvfv()"), - new GLproperty(GL11.GL_TEXTURE_GEN_S, "GL_TEXTURE_GEN_S", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_GEN_T, "GL_TEXTURE_GEN_T", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_GEN_R, "GL_TEXTURE_GEN_R", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_GEN_Q, "GL_TEXTURE_GEN_Q", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_EYE_PLANE, "GL_EYE_PLANE", "Texgen plane equation coefficients", "texture", "glGetTexGenfv()"), - new GLproperty(GL11.GL_OBJECT_PLANE, "GL_OBJECT_PLANE", "Texgen object linear coefficients", "texture", "glGetTexGenfv()"), - new GLproperty(GL11.GL_TEXTURE_GEN_MODE, "GL_TEXTURE_GEN_MODE", "Function used for texgen", "texture", "glGetTexGeniv()"), - new GLproperty(GL11.GL_SCISSOR_TEST, "GL_SCISSOR_TEST", "Scissoring enabled", "scissor/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_SCISSOR_BOX, "GL_SCISSOR_BOX", "Scissor box", "scissor", "glGetIntegerv()"), - new GLproperty(GL11.GL_ALPHA_TEST, "GL_ALPHA_TEST", "Alpha test enabled", "color-buffer/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_ALPHA_TEST_FUNC, "GL_ALPHA_TEST_FUNC", "Alpha test function", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_ALPHA_TEST_REF, "GL_ALPHA_TEST_REF", "Alpha test reference value", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_TEST, "GL_STENCIL_TEST", "Stenciling enabled", "stencil-buffer/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_STENCIL_FUNC, "GL_STENCIL_FUNC", "Stencil function", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_VALUE_MASK, "GL_STENCIL_VALUE_MASK", "Stencil mask", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_REF, "GL_STENCIL_REF", "Stencil reference value", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_FAIL, "GL_STENCIL_FAIL", "Stencil fail action", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_PASS_DEPTH_FAIL, "GL_STENCIL_PASS_DEPTH_FAIL", "Stencil depth buffer fail action", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_PASS_DEPTH_PASS, "GL_STENCIL_PASS_DEPTH_PASS", "Stencil depth buffer pass action", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_DEPTH_TEST, "GL_DEPTH_TEST", "Depth buffer enabled", "depth-buffer/ena ble", "glIsEnabled()"), - new GLproperty(GL11.GL_DEPTH_FUNC, "GL_DEPTH_FUNC", "Depth buffer test function", "depth-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_BLEND, "GL_BLEND", "Blending enabled", "color-buffer/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_BLEND_SRC, "GL_BLEND_SRC", "Blending source function", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_BLEND_DST, "GL_BLEND_DST", "Blending destination function", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_DITHER, "GL_DITHER", "Dithering enabled", "color-buffer/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_INDEX_LOGIC_OP, "GL_INDEX_LOGIC_OP", "Color index logical operation enabled", "color-buffer/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_COLOR_LOGIC_OP, "GL_COLOR_LOGIC_OP", "RGBA color logical operation enabled", "color-buffer/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LOGIC_OP_MODE, "GL_LOGIC_OP_MODE", "Logical operation function", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_DRAW_BUFFER, "GL_DRAW_BUFFER", "Buffers selected for drawing", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_INDEX_WRITEMASK, "GL_INDEX_WRITEMASK", "Color-index writemask", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_COLOR_WRITEMASK, "GL_COLOR_WRITEMASK", "Color write enables; R, G, B, or A", "color-buffer", "glGetBooleanv()"), - new GLproperty(GL11.GL_DEPTH_WRITEMASK, "GL_DEPTH_WRITEMASK", "Depth buffer enabled for writing", "depth-buffer", "glGetBooleanv()"), - new GLproperty(GL11.GL_STENCIL_WRITEMASK, "GL_STENCIL_WRITEMASK", "Stencil-buffer writemask", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_COLOR_CLEAR_VALUE, "GL_COLOR_CLEAR_VALUE", "Color-buffer clear value (RGBA mode)", "color-buffer", "glGetFloatv()"), - new GLproperty(GL11.GL_INDEX_CLEAR_VALUE, "GL_INDEX_CLEAR_VALUE", "Color-buffer clear value (color-index mode)", "color-buffer", "glGetFloatv()"), - new GLproperty(GL11.GL_DEPTH_CLEAR_VALUE, "GL_DEPTH_CLEAR_VALUE", "Depth-buffer clear value", "depth-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_CLEAR_VALUE, "GL_STENCIL_CLEAR_VALUE", "Stencil-buffer clear value", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_ACCUM_CLEAR_VALUE, "GL_ACCUM_CLEAR_VALUE", "Accumulation-buffer clear value", "accum-buffer", "glGetFloatv()"), - new GLproperty(GL11.GL_UNPACK_SWAP_BYTES, "GL_UNPACK_SWAP_BYTES", "Value of GL_UNPACK_SWAP_BYTES", "pixel-store", "glGetBooleanv()"), - new GLproperty(GL11.GL_UNPACK_LSB_FIRST, "GL_UNPACK_LSB_FIRST", "Value of GL_UNPACK_LSB_FIRST", "pixel-store", "glGetBooleanv()"), - new GLproperty(GL11.GL_UNPACK_ROW_LENGTH, "GL_UNPACK_ROW_LENGTH", "Value of GL_UNPACK_ROW_LENGTH", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_UNPACK_SKIP_ROWS, "GL_UNPACK_SKIP_ROWS", "Value of GL_UNPACK_SKIP_ROWS", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_UNPACK_SKIP_PIXELS, "GL_UNPACK_SKIP_PIXELS", "Value of GL_UNPACK_SKIP_PIXELS", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_UNPACK_ALIGNMENT, "GL_UNPACK_ALIGNMENT", "Value of GL_UNPACK_ALIGNMENT", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_PACK_SWAP_BYTES, "GL_PACK_SWAP_BYTES", "Value of GL_PACK_SWAP_BYTES", "pixel-store", "glGetBooleanv()"), - new GLproperty(GL11.GL_PACK_LSB_FIRST, "GL_PACK_LSB_FIRST", "Value of GL_PACK_LSB_FIRST", "pixel-store", "glGetBooleanv()"), - new GLproperty(GL11.GL_PACK_ROW_LENGTH, "GL_PACK_ROW_LENGTH", "Value of GL_PACK_ROW_LENGTH", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_PACK_SKIP_ROWS, "GL_PACK_SKIP_ROWS", "Value of GL_PACK_SKIP_ROWS", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_PACK_SKIP_PIXELS, "GL_PACK_SKIP_PIXELS", "Value of GL_PACK_SKIP_PIXELS", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_PACK_ALIGNMENT, "GL_PACK_ALIGNMENT", "Value of GL_PACK_ALIGNMENT", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAP_COLOR, "GL_MAP_COLOR", "True if colors are mapped", "pixel", "glGetBooleanv()"), - new GLproperty(GL11.GL_MAP_STENCIL, "GL_MAP_STENCIL", "True if stencil values are mapped", "pixel", "glGetBooleanv()"), - new GLproperty(GL11.GL_INDEX_SHIFT, "GL_INDEX_SHIFT", "Value of GL_INDEX_SHIFT", "pixel", "glGetIntegerv()"), - new GLproperty(GL11.GL_INDEX_OFFSET, "GL_INDEX_OFFSET", "Value of GL_INDEX_OFFSET", "pixel", "glGetIntegerv()"), - new GLproperty(GL11.GL_ZOOM_X, "GL_ZOOM_X", "x zoom factor", "pixel", "glGetFloatv()"), - new GLproperty(GL11.GL_ZOOM_Y, "GL_ZOOM_Y", "y zoom factor", "pixel", "glGetFloatv()"), - new GLproperty(GL11.GL_READ_BUFFER, "GL_READ_BUFFER", "Read source buffer", "pixel", "glGetIntegerv()"), - new GLproperty(GL11.GL_ORDER, "GL_ORDER", "1D map order", "capability", "glGetMapiv()"), - new GLproperty(GL11.GL_ORDER, "GL_ORDER", "2D map orders", "capability", "glGetMapiv()"), - new GLproperty(GL11.GL_COEFF, "GL_COEFF", "1D control points", "capability", "glGetMapfv()"), - new GLproperty(GL11.GL_COEFF, "GL_COEFF", "2D control points", "capability", "glGetMapfv()"), - new GLproperty(GL11.GL_DOMAIN, "GL_DOMAIN", "1D domain endpoints", "capability", "glGetMapfv()"), - new GLproperty(GL11.GL_DOMAIN, "GL_DOMAIN", "2D domain endpoints", "capability", "glGetMapfv()"), - new GLproperty(GL11.GL_MAP1_GRID_DOMAIN, "GL_MAP1_GRID_DOMAIN", "1D grid endpoints", "eval", "glGetFloatv()"), - new GLproperty(GL11.GL_MAP2_GRID_DOMAIN, "GL_MAP2_GRID_DOMAIN", "2D grid endpoints", "eval", "glGetFloatv()"), - new GLproperty(GL11.GL_MAP1_GRID_SEGMENTS, "GL_MAP1_GRID_SEGMENTS", "1D grid divisions", "eval", "glGetFloatv()"), - new GLproperty(GL11.GL_MAP2_GRID_SEGMENTS, "GL_MAP2_GRID_SEGMENTS", "2D grid divisions", "eval", "glGetFloatv()"), - new GLproperty(GL11.GL_AUTO_NORMAL, "GL_AUTO_NORMAL", "True if automatic normal generation enabled", "eval", "glIsEnabled()"), - new GLproperty(GL11.GL_PERSPECTIVE_CORRECTION_HINT, "GL_PERSPECTIVE_CORRECTION_HINT", "Perspective correction hint", "hint", "glGetIntegerv()"), - new GLproperty(GL11.GL_POINT_SMOOTH_HINT, "GL_POINT_SMOOTH_HINT", "Point smooth hint", "hint", "glGetIntegerv()"), - new GLproperty(GL11.GL_LINE_SMOOTH_HINT, "GL_LINE_SMOOTH_HINT", "Line smooth hint", "hint", "glGetIntegerv()"), - new GLproperty(GL11.GL_POLYGON_SMOOTH_HINT, "GL_POLYGON_SMOOTH_HINT", "Polygon smooth hint", "hint", "glGetIntegerv()"), - new GLproperty(GL11.GL_FOG_HINT, "GL_FOG_HINT", "Fog hint", "hint", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_LIGHTS, "GL_MAX_LIGHTS", "Maximum number of lights", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_CLIP_PLANES, "GL_MAX_CLIP_PLANES", "Maximum number of user clipping planes", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_MODELVIEW_STACK_DEPTH, "GL_MAX_MODELVIEW_STACK_DEPTH", "Maximum modelview-matrix stack depth", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_PROJECTION_STACK_DEPTH, "GL_MAX_PROJECTION_STACK_DEPTH", "Maximum projection-matrix stack depth", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_TEXTURE_STACK_DEPTH, "GL_MAX_TEXTURE_STACK_DEPTH", "Maximum depth of texture matrix stack", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_SUBPIXEL_BITS, "GL_SUBPIXEL_BITS", "Number of bits of subpixel precision in x and y", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_TEXTURE_SIZE, "GL_MAX_TEXTURE_SIZE", "See discussion in Texture Proxy in Chapter 9", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_PIXEL_MAP_TABLE, "GL_MAX_PIXEL_MAP_TABLE", "Maximum size of a glPixelMap() translation table", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_NAME_STACK_DEPTH, "GL_MAX_NAME_STACK_DEPTH", "Maximum selection-name stack depth", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_LIST_NESTING, "GL_MAX_LIST_NESTING", "Maximum display-list call nesting", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_EVAL_ORDER, "GL_MAX_EVAL_ORDER", "Maximum evaluator polynomial order", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_VIEWPORT_DIMS, "GL_MAX_VIEWPORT_DIMS", "Maximum viewport dimensions", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_ATTRIB_STACK_DEPTH, "GL_MAX_ATTRIB_STACK_DEPTH", "Maximum depth of the attribute stack", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", "Maximum depth of the client attribute stack", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_AUX_BUFFERS, "GL_AUX_BUFFERS", "Number of auxiliary buffers", "capability", "glGetBooleanv()"), - new GLproperty(GL11.GL_RGBA_MODE, "GL_RGBA_MODE", "True if color buffers store RGBA", "capability", "glGetBooleanv()"), - new GLproperty(GL11.GL_INDEX_MODE, "GL_INDEX_MODE", "True if color buffers store indices", "capability", "glGetBooleanv()"), - new GLproperty(GL11.GL_DOUBLEBUFFER, "GL_DOUBLEBUFFER", "True if front and back buffers exist", "capability", "glGetBooleanv()"), - new GLproperty(GL11.GL_STEREO, "GL_STEREO", "True if left and right buffers exist", "capability", "glGetBooleanv()"), - new GLproperty(GL11.GL_POINT_SIZE_RANGE, "GL_POINT_SIZE_RANGE", "Range (low to high) of antialiased point sizes", "capability", "glGetFloatv()"), - new GLproperty(GL11.GL_POINT_SIZE_GRANULARITY, "GL_POINT_SIZE_GRANULARITY", "Antialiased point-size granularity", "capability", "glGetFloatv()"), - new GLproperty(GL11.GL_LINE_WIDTH_RANGE, "GL_LINE_WIDTH_RANGE", "Range (low to high) of antialiased line widths", "capability", "glGetFloatv()"), - new GLproperty(GL11.GL_LINE_WIDTH_GRANULARITY, "GL_LINE_WIDTH_GRANULARITY", "Antialiased line-width granularity", "capability", "glGetFloatv()"), - new GLproperty(GL11.GL_RED_BITS, "GL_RED_BITS", "Number of bits per red component in color buffers", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_GREEN_BITS, "GL_GREEN_BITS", "Number of bits per green component in color buffers", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_BLUE_BITS, "GL_BLUE_BITS", "Number of bits per blue component in color buffers", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_ALPHA_BITS, "GL_ALPHA_BITS", "Number of bits per alpha component in color buffers", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_INDEX_BITS, "GL_INDEX_BITS", "Number of bits per index in color buffers", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_DEPTH_BITS, "GL_DEPTH_BITS", "Number of depth-buffer bitplanes", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_BITS, "GL_STENCIL_BITS", "Number of stencil bitplanes", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_ACCUM_RED_BITS, "GL_ACCUM_RED_BITS", "Number of bits per red component in the accumulation buffer", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_ACCUM_GREEN_BITS, "GL_ACCUM_GREEN_BITS", "Number of bits per green component in the accumulation buffer", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_ACCUM_BLUE_BITS, "GL_ACCUM_BLUE_BITS", "Number of bits per blue component in the accumulation buffer", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_ACCUM_ALPHA_BITS, "GL_ACCUM_ALPHA_BITS", "Number of bits per alpha component in the accumulation buffer", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_LIST_BASE, "GL_LIST_BASE", "Setting of glListBase()", "list", "glGetIntegerv()"), - new GLproperty(GL11.GL_LIST_INDEX, "GL_LIST_INDEX", "Number of display list under construction; 0 if none", "current", "glGetIntegerv()"), - new GLproperty(GL11.GL_LIST_MODE, "GL_LIST_MODE", "Mode of display list under construction; undefined if none", "current", "glGetIntegerv()"), - new GLproperty(GL11.GL_ATTRIB_STACK_DEPTH, "GL_ATTRIB_STACK_DEPTH", "Attribute stack pointer", "current", "glGetIntegerv()"), - new GLproperty(GL11.GL_CLIENT_ATTRIB_STACK_DEPTH, "GL_CLIENT_ATTRIB_STACK_DEPTH", "Client attribute stack pointer", "current", "glGetIntegerv()"), - new GLproperty(GL11.GL_NAME_STACK_DEPTH, "GL_NAME_STACK_DEPTH", "Name stack depth", "current", "glGetIntegerv()"), - new GLproperty(GL11.GL_RENDER_MODE, "GL_RENDER_MODE", "glRenderMode() setting", "current", "glGetIntegerv()"), - new GLproperty(GL11.GL_SELECTION_BUFFER_POINTER, "GL_SELECTION_BUFFER_POINTER", "Pointer to selection buffer", "select", "glGetPointerv()"), - new GLproperty(GL11.GL_SELECTION_BUFFER_SIZE, "GL_SELECTION_BUFFER_SIZE", "Size of selection buffer", "select", "glGetIntegerv()"), - new GLproperty(GL11.GL_FEEDBACK_BUFFER_POINTER, "GL_FEEDBACK_BUFFER_POINTER", "Pointer to feedback buffer", "feedback", "glGetPointerv()"), - new GLproperty(GL11.GL_FEEDBACK_BUFFER_SIZE, "GL_FEEDBACK_BUFFER_SIZE", "Size of feedback buffer", "feedback", "glGetIntegerv()"), - new GLproperty(GL11.GL_FEEDBACK_BUFFER_TYPE, "GL_FEEDBACK_BUFFER_TYPE", "Type of feedback buffer", "feedback", "glGetIntegerv()"), - }; - - public static void dumpOpenGLstate() - { - } - - public static void dumpAllIsEnabled() //Call This - { - for (int i = 0; i < instance.propertyList.length; ++i) - - { - if (instance.propertyList[i].fetchCommand == "glIsEnabled()") - - { - System.out.print(instance.propertyList[i].name + ":"); - System.out.print(GL11.glIsEnabled(instance.propertyList[i].gLconstant)); - System.out.println(" (" + instance.propertyList[i].description + ")"); - } - } - } - - public static void dumpAllType(final String type) - - { - for (int i = 0; i < instance.propertyList.length; ++i) - - { - if (instance.propertyList[i].category.equals(type)) - - { - System.out.print(instance.propertyList[i].name + ":"); - System.out.println(getPropertyAsString(i)); - System.out.println(" (" + instance.propertyList[i].description + ")"); - } - } - } - - private static String getPropertyAsString(final int propertyListIndex) - { - final int gLconstant = instance.propertyList[propertyListIndex].gLconstant; - if (instance.propertyList[propertyListIndex].fetchCommand.equals("glIsEnabled()")) { - return "" + GL11.glIsEnabled(gLconstant); - } - - if (instance.propertyList[propertyListIndex].fetchCommand == "glGetBooleanv()") - - { - final ByteBuffer params = BufferUtils.createByteBuffer(16); - - GL11.glGetBoolean(gLconstant, params); - String out = ""; - for (int i = 0; i < params.capacity(); ++i) - - { - out += (i == 0 ? "" : ", ") + params.get(i); - } - return out; - } - - return ""; - } -} - diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java deleted file mode 100644 index 7573e0d51c..0000000000 --- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java +++ /dev/null @@ -1,787 +0,0 @@ -package gtPlusPlus.core.util.math; - -import java.text.NumberFormat; -import java.util.Map; -import java.util.Random; - -import gregtech.api.enums.GT_Values; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; - -public class MathUtils { - - final static Random rand = CORE.RANDOM; - - /** Formats a number with group separator and at most 2 fraction digits. */ - private static final NumberFormat sNumberFormat = NumberFormat.getInstance(); - - static { - sNumberFormat.setMaximumFractionDigits(2); - } - - /** - * Returns a psuedo-random number between min and max, inclusive. - * The difference between min and max can be at most - * Integer.MAX_VALUE - 1. - * - * @param min Minimim value - * @param max Maximim value. Must be greater than min. - * @return Integer between min and max, inclusive. - * @see java.util.Random#nextInt(int) - */ - public static int randInt(final int min, final int max) { - // nextInt is normally exclusive of the top value, - // so add 1 to make it inclusive - return rand.nextInt((max - min) + 1) + min; - } - - public static double getChanceOfXOverYRuns(final double x, final double y){ - return (1-Math.pow((1-x), y)); - } - - - /** - * Returns a psuedo-random number between min and max, inclusive. - * The difference between min and max can be at most - * Long.MAX_VALUE - 1. - * - * @param min Minimim value - * @param max Maximim value. Must be greater than min. - * @return Long between min and max, inclusive. - * @see java.util.Random#nextLong(long) - */ - public static long randLong(final long min, final long max) { - // nextInt is normally exclusive of the top value, - // so add 1 to make it inclusive - return MathUtils.nextLong(rand,(max - min) + 1) + min; - } - private static long nextLong(final Random rng, final long n) { - // error checking and 2^x checking removed for simplicity. - long bits, val; - do { - bits = (rng.nextLong() << 1) >>> 1; - val = bits % n; - } while (((bits-val)+(n-1)) < 0L); - return val; - } - - - /** - * Returns a psuedo-random number between min and max, inclusive. - * The difference between min and max can be at most - * Double.MAX_VALUE - 1. - * - * @param min Minimim value - * @param max Maximim value. Must be greater than min. - * @return Double between min and max, inclusive. - * @see java.util.Random#nextDouble(double) - */ - public static double randDouble(final double min, final double max) { - // nextInt is normally exclusive of the top value, - // so add 1 to make it inclusive - return MathUtils.nextDouble(rand,(max - min) + 1) + min; - } - - private static double nextDouble(final Random rng, final double n) { - // error checking and 2^x checking removed for simplicity. - double bits, val; - do { - bits = (rng.nextLong() << 1) >>> 1; - val = bits % n; - } while (((bits-val)+(n-1)) < 0L); - return val; - } - - /** - * Returns a psuedo-random number between min and max, inclusive. - * The difference between min and max can be at most - * Float.MAX_VALUE - 1. - * - * @param min Minimim value - * @param max Maximim value. Must be greater than min. - * @return Float between min and max, inclusive. - * @see java.util.Random#nextFloat(float) - */ - public static float randFloat(final float min, final float max) { - // nextInt is normally exclusive of the top value, - // so add 1 to make it inclusive - return MathUtils.nextFloat(rand,(max - min) + 1) + min; - } - - private static float nextFloat(final Random rng, final float n) { - // error checking and 2^x checking removed for simplicity. - float bits, val; - do { - bits = (rng.nextLong() << 1) >>> 1; - val = bits % n; - } while (((bits-val)+(n-1)) < 0L); - return val; - } - - - /** - * Returns a percentage. - * The returned number is the % of X in Y. - * Supports Doubles. - * - * @param current Current value. - * @param max Maximim value. Must be greater than min. - * @return double between min and max, inclusive. - */ - public static double findPercentage(final double current, final double max){ - return Math.round(((current / max) * 100) * 100.00) / 100.00; - } - - public static int findPercentageOfInt(long input, float percentage){ - return (int)(input*(percentage/100.0f)); - } - - - //Smooth Rounding Function - /** - * Returns a double. - * The returned number is d rounded to the nearest d.01. - * Supports Doubles. - * - * @param current Current value. - * @return double Rounded value. - */ - public static double decimalRounding(final double d) { - return Math.round(d * 2) / 2.0; - } - - - //Smooth Rounding Function (Nearest 5) - /** - * Returns a double. - * The returned number is d rounded to the nearest d.5. - * Supports Doubles. - * - * @param current Current value. - * @return double Rounded value. - */ - public static double decimalRoundingToWholes(final double d) { - return 5*(Math.round(d/5)); - } - - //Smooth Rounding Function - /** - * Returns a integer. - * The returned number is d rounded to the nearest flat integer. - * Supports Doubles as input. - * - * @param current Current value. - * @return integer Rounded value. - */ - public static int roundToClosestInt(final double d) { - return (int) (Math.round(d * 2) / 2.0); - } - - public static int roundToClosestMultiple(final double number, final int multiple) { - int result = multiple; - if ((number % multiple) == 0) { - return (int) number; - } - // If not already multiple of given number - if ((number % multiple) != 0) { - final int division = (int) ((number / multiple) + 1); - result = division * multiple; - } - return result; - } - - - //Smooth Rounding Function - /** - * Returns a long. - * The returned number is d rounded to the nearest flat long. - * Supports Doubles as input. - * - * @param current Current value. - * @return long Rounded value. - */ - public static long roundToClosestLong(final double d) { - return (long) (Math.round(d * 2) / 2.0); - } - - - /** - * Returns a boolean. - * The returned boolean is wether or not X evenly fits in to Y. - * Supports ints. - * - * @param x Value A. - * @param y Value B. Must be greater than min. - * @return boolean Whether or not it divides evenly. - */ - public static boolean divideXintoY(final int x, final int y){ - if ((x % y) == 0) - { - return true; - } - return false; - } - - - /** - * Returns a boolean. - * The returned boolean is based on the odd/eveness of the input. - * Supports ints. - * - * @param x Value A. - * @return boolean Whether or not it divides evenly. - */ - public static boolean isNumberEven(final long x){ - if ((x % 2) == 0) - { - return true; - } - return false; - } - - - - /** - * Returns an int. - * The returned number is the value on i + 273.15F. - * Supports ints. - * - * @param i Temp in Celcius. - * @return int The celcius temp returned as Kelvin, rounded to the readest whole. - */ - public static float celsiusToKelvin(final int i){ - final double f = i + 273.15F; - return (int)decimalRoundingToWholes(f); - } - - - /** - * Returns a hexInteger. - * The returned number is the hex value of the input. - * Supports ints. - * - * @param input Current value. - * @return hexInteger. - */ - public static int getHexNumberFromInt(final int input){ - final String result = Integer.toHexString(input); - final int resultINT = Integer.getInteger(result); - return resultINT; - } - - - /** - * Returns a hexInteger. - * The returned value is between min and max. - * Supports ints. - * - * @param min Minimum value. - * @param max Maximium value. Must be greater than min. - * @return hexInteger between min and max, inclusive. - */ - public static int generateRandomHexValue(final int min, final int max){ - return getHexNumberFromInt(randInt(min, max)); - } - - - /** - * Returns a random hex value. - * The returned value is between 000000-ffffff. - * - * @return hexInteger between min and max, inclusive. - */ - public static int generateSingularRandomHexValue(){ - String temp; - final int randomInt = randInt(1, 5); - final Map<Integer, String> colours = Utils.hexColourGeneratorRandom(5); - - if ((colours.get(randomInt) != null) && (colours.size() > 0)){ - temp = colours.get(randomInt); - } - else { - temp = "0F0F0F"; - } - - Logger.WARNING("Operating with "+temp); - temp = Utils.appenedHexNotationToString(String.valueOf(temp)); - Logger.WARNING("Made "+temp+" - Hopefully it's not a mess."); - Logger.WARNING("It will decode into "+Integer.decode(temp)+"."); - return Integer.decode(temp); - } - - public static long[] simplifyNumbersToSmallestForm(final long[] inputArray){ - final long GCD = gcd(inputArray); - final long[] outputArray = new long[inputArray.length]; - for (int i=0;i<inputArray.length;i++){ - if (GCD != 0) { - outputArray[i] = (inputArray[i]/GCD); - } else { - outputArray[i] = inputArray[i]; - } - } - if (outputArray.length > 0) { - return outputArray; - } - return new long[] {}; - } - - private static long gcd(long a, long b){ - while (b > 0) - { - final long temp = b; - b = a % b; // % is remainder - a = temp; - } - return a; - } - - private static long gcd(final long[] input){ - long result = input[0]; - for(int i = 1; i < input.length; i++) { - result = gcd(result, input[i]); - } - return result; - } - - final public static int getRgbAsHex(final short[] RGBA){ - final int returnValue = Utils.rgbtoHexValue(RGBA[0], RGBA[1], RGBA[2]); - return (returnValue == 0) ? 0 : returnValue; - } - - - public final static int returnLargestNumber(final int a, final int b){ - if (a > b){ - return a; - } - else if (a == b){ - return a; - } - else { - return b; - } - } - - public static byte safeByte(long number){ - return number>Byte.MAX_VALUE ? Byte.MAX_VALUE :(byte)number; - } - - public static short safeShort(long number){ - return number>Short.MAX_VALUE ? Short.MAX_VALUE :(short)number; - } - - public static int safeInt(long number, int margin){ - return number>Integer.MAX_VALUE-margin ? Integer.MAX_VALUE-margin :(int)number; - } - - public static int safeInt(long number){ - return number>GT_Values.V[GT_Values.V.length-1] ? safeInt(GT_Values.V[GT_Values.V.length-1],1) : number<Integer.MIN_VALUE ? Integer.MIN_VALUE : (int)number; - } - - public static int getRandomFromArray(int[] mValues) { - int[] mLargeChanceArray = new int[(mValues.length-1)*1000]; - int mValueSelection; - for (int g = 0; g < mLargeChanceArray.length; g++) { - mValueSelection = randInt(0, mValues.length-1); - mLargeChanceArray[g] = mValues[mValueSelection]; - } - return mLargeChanceArray[randInt(0, mLargeChanceArray.length-1)]; - - } - - - /* - * Averages - */ - - public static byte getByteAverage(AutoMap<Byte> aDataSet) { - byte[] aNewSet = new byte[aDataSet.size()]; - for (int u=0;u<aDataSet.size();u++) { - byte b = getSafeByte(aDataSet.get(u)); - aNewSet[u] = b; - } - return getByteAverage(aNewSet); - } - - public static short getShortAverage(AutoMap<Short> aDataSet) { - short[] aNewSet = new short[aDataSet.size()]; - for (int u=0;u<aDataSet.size();u++) { - short b = getSafeShort(aDataSet.get(u)); - aNewSet[u] = b; - } - return getShortAverage(aNewSet); - } - - public static int getIntAverage(AutoMap<Integer> aDataSet) { - int[] aNewSet = new int[aDataSet.size()]; - for (int u=0;u<aDataSet.size();u++) { - int b = getSafeInt(aDataSet.get(u)); - aNewSet[u] = b; - } - return getIntAverage(aNewSet); - } - - public static float getFloatAverage(AutoMap<Float> aDataSet) { - float[] aNewSet = new float[aDataSet.size()]; - for (int u=0;u<aDataSet.size();u++) { - float b = getSafeFloat(aDataSet.get(u)); - aNewSet[u] = b; - } - return getFloatAverage(aNewSet); - } - - public static long getLongAverage(AutoMap<Long> aDataSet) { - long[] aNewSet = new long[aDataSet.size()]; - for (int u=0;u<aDataSet.size();u++) { - long b = getSafeLong(aDataSet.get(u)); - aNewSet[u] = b; - } - return getLongAverage(aNewSet); - } - - public static double getDoubleAverage(AutoMap<Double> aDataSet) { - double[] aNewSet = new double[aDataSet.size()]; - for (int u=0;u<aDataSet.size();u++) { - double b = getSafeDouble(aDataSet.get(u)); - aNewSet[u] = b; - } - return getDoubleAverage(aNewSet); - } - - - - public static byte getByteAverage(byte[] aDataSet) { - if (aDataSet.length <= 0) { - return 0; - } - int divisor = aDataSet.length; - byte total = 0; - for (byte i : aDataSet) { - total += i; - } - byte result = safeByte(total/divisor); - return result; - } - - public static short getShortAverage(short[] aDataSet) { - if (aDataSet.length <= 0) { - return 0; - } - int divisor = aDataSet.length; - Logger.WARNING("Calculating Average Short. Divisor: "+divisor); - short total = 0; - for (short i : aDataSet) { - Logger.WARNING("Adding "+i); - total += i; - } - short result = safeShort((total/divisor)); - Logger.WARNING("Average: "+result); - return result; - } - public static int getIntAverage(int[] aDataSet) { - if (aDataSet.length <= 0) { - return 0; - } - int divisor = aDataSet.length; - int total = 0; - for (int i : aDataSet) { - total += i; - } - int result = safeInt(total/divisor); - return result; - } - public static float getFloatAverage(float[] aDataSet) { - if (aDataSet.length <= 0) { - return 0; - } - int divisor = aDataSet.length; - float total = 0; - for (float i : aDataSet) { - total += i; - } - float result = (total/divisor); - return result; - } - public static long getLongAverage(long[] aDataSet) { - if (aDataSet.length <= 0) { - return 0; - } - int divisor = aDataSet.length; - long total = 0; - for (long i : aDataSet) { - total += i; - } - long result = (total/divisor); - return result; - } - public static double getDoubleAverage(double[] aDataSet) { - if (aDataSet.length <= 0) { - return 0; - } - int divisor = aDataSet.length; - double total = 0; - for (double i : aDataSet) { - total += i; - } - double result = (total/divisor); - return result; - } - - public static int howManyPlaces(int aValueForGen) { - if (aValueForGen < 0) { - aValueForGen = makeNegative(aValueForGen); - } - String a = String.valueOf(aValueForGen); - return a.length(); - } - - /** - * Inverts the value, making Positives into Negatives and vice versa. - * @param aPositive - An int value, either positive or negative. - * @return - Inverted int Value. - */ - public static int makeNegative(int aPositive) { - if (aPositive > 0) { - return -aPositive; - } - else if (aPositive < 0) { - return +aPositive; - } - else { - return 0; - } - } - - public static <V> V safeCast(Object aNumberType) { - long a1; - double a2; - a1 = Long.parseLong(aNumberType.toString()); - a2 = Double.parseDouble(aNumberType.toString()); - - if ((aNumberType.getClass() == byte.class) || (aNumberType instanceof Byte)){ - if (a1 >= Byte.MIN_VALUE && a1 <= Byte.MAX_VALUE) { - String s = ""+a1; - Byte s1 = Byte.valueOf(s); - return (V) s1; - } - } - else if ((aNumberType.getClass() == short.class) || (aNumberType instanceof Short)){ - if (a1 >= Short.MIN_VALUE && a1 <= Short.MAX_VALUE) { - String s = ""+a1; - Short s1 = Short.valueOf(s); - return (V) s1; - - } - } - else if ((aNumberType.getClass() == int.class) || (aNumberType instanceof Integer)){ - if (a1 >= Integer.MIN_VALUE && a1 <= Integer.MAX_VALUE) { - String s = ""+a1; - Integer s1 = Integer.valueOf(s); - return (V) s1; - - } - } - else if ((aNumberType.getClass() == long.class) || (aNumberType instanceof Long)){ - if (a1 >= Long.MIN_VALUE && a1 <= Long.MAX_VALUE) { - String s = ""+a1; - Long s1 = Long.valueOf(s); - return (V) s1; - } - } - else if ((aNumberType.getClass() == float.class) || (aNumberType instanceof Float)){ - if (a2 >= Float.MIN_VALUE && a2 <= Float.MAX_VALUE) { - String s = ""+a1; - Float s1 = Float.valueOf(s); - return (V) s1; - - } - } - else if ((aNumberType.getClass() == double.class) || (aNumberType instanceof Double)){ - if (a2 >= Double.MIN_VALUE && a2 <= Double.MAX_VALUE) { - String s = ""+a1; - Double s1 = Double.valueOf(s); - return (V) s1; - - } - } - - Integer o = 0; - return (V) o; - - } - - public static byte getSafeByte(Byte b) { - Byte a = safeCast(b); - return a.byteValue(); - } - - public static short getSafeShort(Short b) { - Short a = safeCast(b); - return a.shortValue(); - } - - public static int getSafeInt(Integer b) { - Integer a = safeCast(b); - return a.intValue(); - } - - public static long getSafeLong(Long b) { - Long a = safeCast(b); - return a.longValue(); - } - - public static float getSafeFloat(Float b) { - Float a = safeCast(b); - return a.floatValue(); - } - - public static double getSafeDouble(Double b) { - Double a = safeCast(b); - return a.doubleValue(); - } - - - public static long safeCast_IntToLong(int o) { - long i = o; - return i; - } - - public static int safeCast_LongToInt(long o) { - if (o > Integer.MAX_VALUE) { - return Integer.MAX_VALUE; - } - else { - int i = (int) o; - return i; - } - } - - public static short safeCast_IntToShort(int o) { - if (o > Short.MAX_VALUE) { - return Short.MAX_VALUE; - } - else { - short i = (short) o; - return i; - } - } - - public static int safeCast_ShortToInt(short o) { - int i = (int) o; - return i; - } - - public static byte safeCast_ShortToByte(short o) { - if (o > Byte.MAX_VALUE) { - return Byte.MAX_VALUE; - } - else { - byte i = (byte) o; - return i; - } - } - - public static short safeCast_ByteToshort(byte o) { - short i = (short) o; - return i; - } - - /** - * Balances a number within a range. - * @param aInput - The number to balance - * @param aMin - The minimum bounds - * @param aMax - The maximum bounds - * @return - An Integer which will be between the bounds, or a boundary value. - */ - public static int balance(int aInput, int aMin, int aMax) { - return Math.max(Math.min(aInput, aMax), aMin); - } - - /** - * Balances a number within a range. - * @param aInput - The number to balance - * @param aMin - The minimum bounds - * @param aMax - The maximum bounds - * @return - A Number which will be between the bounds, or a boundary value. - */ - public static Number balance(Number aInput, Number aMin, Number aMax) { - return max(min(aInput, aMax), aMin); - } - - /** - * Balances a number within a range. - * @param aInput - The number to balance - * @param aMin - The minimum bounds - * @param aMax - The maximum bounds - * @return - An Integer which will be between the bounds, or a boundary value. - */ - public static int balanceInt(Number aInput, Number aMin, Number aMax) { - return MathUtils.safeCast_LongToInt((long) balance(max(min(aInput, aMax), aMin), Integer.MIN_VALUE, Integer.MAX_VALUE)); - } - - /** - * Balances a number within a range. - * @param aInput - The number to balance - * @param aMin - The minimum bounds - * @param aMax - The maximum bounds - * @return - A Long which will be between the bounds, or a boundary value. - */ - public static long balanceLong(Number aInput, Number aMin, Number aMax) { - return (long) balance(max(min(aInput, aMax), aMin), Long.MIN_VALUE, Long.MAX_VALUE); - } - - public static int getValueWithinRange(int i, int aMin, int aMax) { - int aAmount = Math.max(Math.min(i, aMax), aMin); - return aAmount; - } - - public static Pair<Integer, Integer> splitLongIntoIntegers(long aLong){ - int aIntMaxInLong = (int) Math.min(Integer.MAX_VALUE, Math.floor(aLong/Integer.MAX_VALUE)); - int aRemainder = (int) (aLong - (aIntMaxInLong * Integer.MAX_VALUE)); - return new Pair<Integer, Integer>(aIntMaxInLong, aRemainder); - } - - - - - /** - * Returns the smaller of two {@code Number}s. That is, - * the result the argument closer to the value of - * {@link Long#MIN_VALUE}. If the arguments have the same - * value, the result is that same value. - * - * @param a an argument. - * @param b another argument. - * @return the smaller of {@code a} and {@code b}. - */ - public static Number min(Number a, Number b) { - return (a.longValue() <= b.longValue()) ? a : b; - } - - /** - * Returns the greater of two {@code Number}s. That is, the - * result is the argument closer to the value of - * {@link Long#MAX_VALUE}. If the arguments have the same value, - * the result is that same value. - * - * @param a an argument. - * @param b another argument. - * @return the larger of {@code a} and {@code b}. - */ - public static Number max(Number a, Number b) { - return (a.longValue() >= b.longValue()) ? a : b; - } - - public static String formatNumbers(long aNumber) { - return sNumberFormat.format(aNumber); - } - - public static String formatNumbers(double aNumber) { - return sNumberFormat.format(aNumber); - } - - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ClientUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ClientUtils.java deleted file mode 100644 index 806f83d830..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/ClientUtils.java +++ /dev/null @@ -1,18 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.relauncher.Side; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; - -public class ClientUtils { - - static { - if (FMLCommonHandler.instance().getSide() == Side.SERVER) { - Logger.ERROR("Something tried to access the ClientUtils class from the Server Side."); - Logger.ERROR("Soft crashing to prevent data corruption."); - CORE.crash(); - } - } - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/EnchantingUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/EnchantingUtils.java deleted file mode 100644 index 2f273d5f7f..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/EnchantingUtils.java +++ /dev/null @@ -1,102 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import gtPlusPlus.api.objects.Logger; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -public class EnchantingUtils { - - - public static final int XP_PER_BOTTLE = 8; - public static final int RATIO = 20; - public static final int LIQUID_PER_XP_BOTTLE = 160; - public static final double RATIO_MOB_ESSENCE_TO_LIQUID_XP = 13.32; - - public static int liquidToXpRatio(final int liquid) { - return liquid / RATIO; - } - - public static int xpToLiquidRatio(final int xp) { - return xp * RATIO; - } - - public static FluidStack getEssenceFromLiquidXp(final int xpAmount){ - if (xpAmount <= 0){ - return null; - } - return getMobEssence((int) (xpAmount*RATIO_MOB_ESSENCE_TO_LIQUID_XP)); - } - - public static FluidStack getLiquidXpFromEssence(final int essenceAmount){ - if (essenceAmount <= 0){ - return null; - } - return getLiquidXP((int) (essenceAmount/RATIO_MOB_ESSENCE_TO_LIQUID_XP)); - } - - public static int getLiquidForLevel(final int level) { - final int xp = getExperienceForLevel(level); - return xpToLiquidRatio(xp); - } - - public static int getLevelForLiquid(final int liquid) { - final int xp = liquidToXpRatio(liquid); - return getLevelForExperience(xp); - } - - public static int getExperienceForLevel(final int level) { - if (level == 0) { - return 0; - } - if ((level > 0) && (level < 16)) { - return level * 17; - } - if ((level > 15) && (level < 31)) { - return (int) (((1.5 * Math.pow(level, 2.0)) - (29.5 * level)) + 360.0); - } - return (int) (((3.5 * Math.pow(level, 2.0)) - (151.5 * level)) + 2220.0); - } - - public static int getXpToNextLevel(final int level) { - final int levelXP = getLevelForExperience(level); - final int nextXP = getExperienceForLevel(level + 1); - return nextXP - levelXP; - } - - public static int getLevelForExperience(final int experience) { - int i; - for (i = 0; getExperienceForLevel(i) <= experience; ++i) { - } - return i - 1; - } - - - - - - - - //Xp Fluids - public static FluidStack getMobEssence(final int amount){ - Logger.WARNING("Trying to get a fluid stack of Mob Essence."); - try { - return FluidRegistry.getFluidStack("mobessence", amount).copy(); - } - catch (final Throwable e){ - return null; - } - - } - - public static FluidStack getLiquidXP(final int amount){ - Logger.WARNING("Trying to get a fluid stack of Liquid XP."); - try { - return FluidRegistry.getFluidStack("xpjuice", amount).copy(); - } - catch (final Throwable e){ - return null; - } - - } - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/EnergyUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/EnergyUtils.java deleted file mode 100644 index 8b02ea9c7c..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/EnergyUtils.java +++ /dev/null @@ -1,134 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import gregtech.api.util.GT_ModHandler; -import ic2.api.item.IElectricItem; -import ic2.api.item.IElectricItemManager; -import ic2.api.item.ISpecialElectricItem; -import net.minecraft.item.ItemRedstone; -import net.minecraft.item.ItemStack; - -public class EnergyUtils { - - public static class EU { - - public static boolean isElectricItem(ItemStack aStack) { - if (aStack == null || aStack.getItem() == null || aStack.getItem() instanceof ItemRedstone) { - return false; - } - if (aStack.getItem() instanceof ISpecialElectricItem) { - return true; - } - else if (aStack.getItem() instanceof IElectricItem) { - return true; - } - else if (aStack.getItem() instanceof IElectricItemManager) { - return true; - } - else { - return GT_ModHandler.isElectricItem(aStack); - } - } - - public static boolean isChargerItem(ItemStack aStack) { - return GT_ModHandler.isChargerItem(aStack); - } - - public static boolean charge(ItemStack aStack, int aEnergyToInsert, int aTier) { - return 0 != GT_ModHandler.chargeElectricItem(aStack, aEnergyToInsert, aTier, true, false); - } - - public static boolean discharge(ItemStack aStack, int aEnergyToDrain, int aTier) { - if (isElectricItem(aStack)) { - int tTier = ((IElectricItem) aStack.getItem()).getTier(aStack); - int aDischargeValue = GT_ModHandler.dischargeElectricItem(aStack, aEnergyToDrain, tTier, true, false, false); - //Logger.INFO("Trying to drain "+aDischargeValue); - return aDischargeValue > 0; - } - else { - return false; - } - } - - public static long getMaxStorage(ItemStack aStack) { - if (isElectricItem(aStack)) { - if (aStack.getItem() instanceof ISpecialElectricItem) { - ISpecialElectricItem bStack = (ISpecialElectricItem) aStack.getItem(); - return (long) bStack.getMaxCharge(aStack); - } - if (aStack.getItem() instanceof IElectricItem) { - IElectricItem bStack = (IElectricItem) aStack.getItem(); - return (long) bStack.getMaxCharge(aStack); - } - if (aStack.getItem() instanceof IElectricItemManager) { - IElectricItemManager bStack = (IElectricItemManager) aStack.getItem(); - return (long) bStack.getCharge(aStack); - } - } - else { - return 0; - } - return 0; - } - - public static long getCharge(ItemStack aStack) { - if (isElectricItem(aStack)) { - if (aStack.getItem() instanceof ISpecialElectricItem) { - ISpecialElectricItem bStack = (ISpecialElectricItem) aStack.getItem(); - return (long) bStack.getManager(aStack).getCharge(aStack); - } - if (aStack.getItem() instanceof IElectricItemManager) { - IElectricItemManager bStack = (IElectricItemManager) aStack.getItem(); - return (long) bStack.getCharge(aStack); - } - } - else { - return 0; - } - return 0; - } - - public static boolean hasCharge(ItemStack aStack) { - if (isElectricItem(aStack)) { - if (aStack.getItem() instanceof ISpecialElectricItem) { - ISpecialElectricItem bStack = (ISpecialElectricItem) aStack.getItem(); - return bStack.canProvideEnergy(aStack); - } - if (aStack.getItem() instanceof IElectricItem) { - IElectricItem bStack = (IElectricItem) aStack.getItem(); - return bStack.canProvideEnergy(aStack); - } - if (aStack.getItem() instanceof IElectricItemManager) { - IElectricItemManager bStack = (IElectricItemManager) aStack.getItem(); - return bStack.getCharge(aStack) > 0; - } - } - else { - return false; - } - return false; - } - - public static int getTier(ItemStack aStack) { - if (isElectricItem(aStack)) { - if (aStack.getItem() instanceof ISpecialElectricItem) { - ISpecialElectricItem bStack = (ISpecialElectricItem) aStack.getItem(); - return bStack.getTier(aStack); - } - if (aStack.getItem() instanceof IElectricItem) { - IElectricItem bStack = (IElectricItem) aStack.getItem(); - return bStack.getTier(aStack); - } - } - else { - return 0; - } - return 0; - } - - } - - public static class RF { - - } - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java deleted file mode 100644 index fda7b0b738..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java +++ /dev/null @@ -1,290 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.List; -import java.util.Map; - -import cpw.mods.fml.common.registry.EntityRegistry; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.AABB; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.handler.events.EntityDeathHandler; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import ic2.core.IC2Potion; -import ic2.core.item.armor.ItemArmorHazmat; -import net.minecraft.block.Block; -import net.minecraft.entity.*; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; - -public class EntityUtils { - - public static void setEntityOnFire(final Entity aEntity, final int length){ - if (!isEntityImmuneToFire(aEntity)) { - aEntity.setFire(length); - } - } - - public static boolean isEntityOnFire(final Entity aEntity) { - Field aIsOnFire = ReflectionUtils.getField(Entity.class, "fire"); - if (aIsOnFire != null) { - int aFireTime = (int) ReflectionUtils.getFieldValue(aIsOnFire, aEntity); - return aFireTime > 0; - } - return false; - } - - public static boolean isEntityImmuneToFire(Entity aEntity) { - return aEntity.isImmuneToFire(); - } - - public static int getFacingDirection(final Entity entity){ - final int d = MathHelper.floor_double((entity.rotationYaw * 4.0F) / 360 + 0.50) & 3; - return d; - } - - @Deprecated - public static Block findBlockUnderEntityNonBoundingBox(final Entity parEntity){ - final int blockX = MathHelper.floor_double(parEntity.posX); - final int blockY = MathHelper.floor_double(parEntity.posY-0.2D - parEntity.yOffset); - final int blockZ = MathHelper.floor_double(parEntity.posZ); - return parEntity.worldObj.getBlock(blockX, blockY, blockZ); - } - - public static Block findBlockUnderEntity(final Entity parEntity){ - final int blockX = MathHelper.floor_double(parEntity.posX); - final int blockY = MathHelper.floor_double(parEntity.boundingBox.minY)-1; - final int blockZ = MathHelper.floor_double(parEntity.posZ); - return parEntity.worldObj.getBlock(blockX, blockY, blockZ); - } - - public static BlockPos findBlockPosUnderEntity(final Entity parEntity){ - final int blockX = MathHelper.floor_double(parEntity.posX); - final int blockY = MathHelper.floor_double(parEntity.boundingBox.minY)-1; - final int blockZ = MathHelper.floor_double(parEntity.posZ); - return new BlockPos(blockX, blockY, blockZ, parEntity.worldObj); - } - - public static BlockPos findBlockPosOfEntity(final Entity parEntity){ - final int blockX = MathHelper.floor_double(parEntity.posX); - final int blockY = MathHelper.floor_double(parEntity.boundingBox.minY); - final int blockZ = MathHelper.floor_double(parEntity.posZ); - return new BlockPos(blockX, blockY, blockZ, parEntity.worldObj); - } - - //TODO - public static void registerEntityToBiomeSpawns(final Class<EntityLiving> classy, final EnumCreatureType EntityType, final BiomeGenBase baseBiomeGen){ - EntityRegistry.addSpawn(classy, 6, 1, 5, EntityType, baseBiomeGen); //change the values to vary the spawn rarity, biome, etc. - } - - public static boolean applyRadiationDamageToEntity(final int stackSize, final int radiationLevel, final World world, final Entity entityHolding){ - if (!world.isRemote){ - if ((radiationLevel > 0) && (entityHolding instanceof EntityLivingBase)) { - final EntityLivingBase entityLiving = (EntityLivingBase) entityHolding; - if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){ - if (!ItemArmorHazmat.hasCompleteHazmat(entityLiving) && !GT_Utility.isWearingFullRadioHazmat(entityLiving)) { - int duration; - if (entityLiving.getActivePotionEffect(IC2Potion.radiation) != null){ - //Utils.LOG_INFO("t"); - duration = (radiationLevel*5)+entityLiving.getActivePotionEffect(IC2Potion.radiation).getDuration(); - } - else { - //Utils.LOG_INFO("f"); - duration = radiationLevel*30; - } - //IC2Potion.radiation.applyTo(entityLiving, duration, damage * 15); - applyRadioactivity(entityLiving, radiationLevel, stackSize); - } - } - } - return true; - } - return false; - } - - public static boolean isWearingFullFrostHazmat(EntityLivingBase aEntity) { - for (byte i = 1; i < 5; i++) - if (!HazmatUtils.providesProtetion_Frost(aEntity.getEquipmentInSlot(i))) { - return false; - } - return true; - } - - public static boolean isWearingFullHeatHazmat(EntityLivingBase aEntity) { - for (byte i = 1; i < 5; i++) - if (!HazmatUtils.providesProtetion_Fire(aEntity.getEquipmentInSlot(i))) { - return false; - } - return true; - } - - public static boolean isWearingFullBioHazmat(EntityLivingBase aEntity) { - for (byte i = 1; i < 5; i++) - if (!HazmatUtils.providesProtetion_Biohazard(aEntity.getEquipmentInSlot(i))) { - return false; - } - return true; - } - - public static boolean isWearingFullRadioHazmat(EntityLivingBase aEntity) { - for (byte i = 1; i < 5; i++) - if (!HazmatUtils.providesProtetion_Radiation(aEntity.getEquipmentInSlot(i))) { - return false; - } - return true; - } - - public static boolean isWearingFullElectroHazmat(EntityLivingBase aEntity) { - for (byte i = 1; i < 5; i++) - if (!HazmatUtils.providesProtetion_Electricity(aEntity.getEquipmentInSlot(i))) { - return false; - } - return true; - } - - public static boolean isWearingFullGasHazmat(EntityLivingBase aEntity) { - for (byte i = 1; i < 5; i++) - if (!HazmatUtils.providesProtetion_Gas(aEntity.getEquipmentInSlot(i))) { - return false; - } - return true; - } - - public static boolean applyRadioactivity(EntityLivingBase aEntity, int aLevel, int aAmountOfItems) { - if (aLevel > 0 && aEntity != null && aEntity.getCreatureAttribute() != EnumCreatureAttribute.UNDEAD && aEntity.getCreatureAttribute() != EnumCreatureAttribute.ARTHROPOD && !ItemArmorHazmat.hasCompleteHazmat(aEntity)) { - PotionEffect tEffect = null; - aEntity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, aLevel * 140 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.moveSlowdown)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, aLevel * 150 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.digSlowdown)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect(Potion.confusion.id, aLevel * 130 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.confusion)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect(Potion.weakness.id, aLevel * 150 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.weakness)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect(Potion.hunger.id, aLevel * 130 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.hunger)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect(IC2Potion.radiation.id, aLevel * 180 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.potionTypes[24])) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7))); - return true; - } - return false; - } - - public static boolean applyHeatDamageToEntity(final int heatLevel, final World world, final Entity entityHolding){ - if (!world.isRemote){ - if ((heatLevel > 0) && (entityHolding instanceof EntityLivingBase)) { - final EntityLivingBase entityLiving = (EntityLivingBase) entityHolding; - if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){ - if (!GT_Utility.isWearingFullHeatHazmat(entityLiving)) { - return GT_Utility.applyHeatDamage(entityLiving, heatLevel); - } - } - } - } - return false; - } - - - /** - * Static Version of the method used in {@code doFireDamage(entity, int)} to save memory. - */ - private volatile static Method dealFireDamage = null; - - /** - * Reflective Call to do Fire Damage to an entity (Does not set entity on fire though) - */ - public synchronized static boolean doFireDamage(Entity entity, int amount){ - if (dealFireDamage == null){ - dealFireDamage = ReflectionUtils.getMethod(Entity.class, "dealFireDamage", int.class); - } - else { - try { - dealFireDamage.invoke(entity, amount); - } - catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {} - } - return false; - } - - public static void doDamage(Entity entity, DamageSource dmg, int i) { - entity.attackEntityFrom(dmg, i); - } - - public static boolean isTileEntityRegistered(Class aTileClass, String aTileName) { - Field aRegistry = ReflectionUtils.getField(ReflectionUtils.getClass("net.minecraft.tileentity.TileEntity"), "nameToClassMap"); - Field aRegistry2 = ReflectionUtils.getField(ReflectionUtils.getClass("net.minecraft.tileentity.TileEntity"), "classToNameMap"); - try { - Object o = aRegistry.get(null); - if (o != null) { - Map nameToClassMap = (Map) o; - if (!nameToClassMap.containsKey(aTileName)) { - o = aRegistry2.get(null); - if (o != null) { - Map classToNameMap = (Map) o; - if (!classToNameMap.containsKey(aTileClass)) { - return false; - } - else { - return true; - } - } - } - else { - return true; - } - } - } catch (IllegalArgumentException | IllegalAccessException e) { - e.printStackTrace(); - } - return false; - } - - public static double getDistance(Entity p1, Entity p2) { - return Math.sqrt( Math.pow(p1.posX - p2.posX, 2) + Math.pow(p1.posY - p2.posY, 2) + Math.pow(p1.posZ - p2.posZ, 2)); - } - - public static AutoMap<Entity> getEntitiesWithinBoundingBoxExcluding(Entity aExclusion, AABB aBoundingBox){ - if (aExclusion == null) { - return new AutoMap<Entity>(); - } - else { - List<Entity> aEntities = aBoundingBox.world().getEntitiesWithinAABBExcludingEntity(aExclusion, aBoundingBox.get()); - return new AutoMap<Entity>(aEntities); - } - } - - public static AutoMap<Entity> getEntitiesWithinBoundingBox(Class aEntityType, AABB aBoundingBox){ - if (aEntityType == null) { - return new AutoMap<Entity>(); - } - else { - List<Entity> aEntities = aBoundingBox.world().getEntitiesWithinAABB(aEntityType, aBoundingBox.get()); - return new AutoMap<Entity>(aEntities); - } - } - - /** - * Provides the ability to provide custom drops upon the death of EntityLivingBase objects. Simplified function with static Max drop size of 1. - * @param aMobClass - The Base Class you want to drop this item. - * @param aStack - The ItemStack, stack size is not respected. - * @param aChance - Chance out of 10000, where 100 is 1%. (1 = 0.01% - this is ok) - */ - public static void registerDropsForMob(Class aMobClass, ItemStack aStack, int aChance) { - registerDropsForMob(aMobClass, aStack, 1, aChance); - } - - /** - * Provides the ability to provide custom drops upon the death of EntityLivingBase objects. - * @param aMobClass - The Base Class you want to drop this item. - * @param aStack - The ItemStack, stack size is not respected. - * @param aMaxAmount - The maximum size of the ItemStack which drops. - * @param aChance - Chance out of 10000, where 100 is 1%. (1 = 0.01% - this is ok) - */ - public static void registerDropsForMob(Class aMobClass, ItemStack aStack, int aMaxAmount, int aChance) { - EntityDeathHandler.registerDropsForMob(aMobClass, aStack, aMaxAmount, aChance); - } - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java deleted file mode 100644 index 73fa919731..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java +++ /dev/null @@ -1,668 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import java.util.HashMap; - -import gregtech.api.enums.Dyes; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.util.GT_LanguageManager; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.minecraft.FluidGT6; -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.item.base.cell.BaseItemPlasmaCell; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialStack; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidContainerItem; - -public class FluidUtils { - - private static HashMap<String, Fluid> sFluidCache = new HashMap<String, Fluid>(); - - public static FluidStack getWater(final int amount){ - return FluidUtils.getFluidStack("water", amount); - } - - public static FluidStack getDistilledWater(final int amount){ - return FluidUtils.getFluidStack("ic2distilledwater", amount); - } - - public static FluidStack getHotWater(final int amount) { - return FluidUtils.getFluidStack("ic2hotwater", amount); - } - - public static FluidStack getLava(final int amount){ - return FluidUtils.getFluidStack("lava", amount); - } - - public static FluidStack getPahoehoeLava(final int amount){ - return FluidUtils.getFluidStack("ic2pahoehoelava", amount); - } - - public static FluidStack getMilk(final int amount){ - return FluidUtils.getFluidStack("milk", amount); - } - - public static FluidStack getColdCoolant(final int amount){ - return FluidUtils.getFluidStack("ic2coolant", amount); - } - - public static FluidStack getHotCoolant(final int amount){ - return FluidUtils.getFluidStack("ic2hotcoolant", amount); - } - - public static FluidStack getSteam(final int amount){ - return FluidUtils.getFluidStack("steam", amount); - } - - public static FluidStack getIC2Steam(final int amount){ - return FluidUtils.getFluidStack("ic2steam", amount); - } - - public static FluidStack getSuperHeatedSteam(final int amount){ - return FluidUtils.getFluidStack("ic2superheatedsteam", amount); - } - - @Deprecated - /** - * Do not use - Gives third tier steam - Not implemented - * @param amount - * @return - */ - public static FluidStack getHyperSteam(final int amount){ - return FluidUtils.getFluidStack("water", amount); - } - - public static FluidStack getUUA(final int amount){ - return FluidUtils.getFluidStack("uuamplifier", amount); - } - - public static FluidStack getUUM(final int amount){ - return FluidUtils.getFluidStack("ic2uumatter", amount); - } - - public static FluidStack getHydrofluoricAcid(int amount) { - return FluidUtils.getFluidStack("hydrofluoricacid", amount); - } - - public static Fluid sGregtechHydrofluoricAcid = null; - - public static FluidStack getHydrofluoricAcidGT(int amount) { - if (sGregtechHydrofluoricAcid == null) { - FluidStack aGTHF = FluidUtils.getFluidStack("hydrofluoricacid_gt5u", 1); - sGregtechHydrofluoricAcid = aGTHF != null ? aGTHF.getFluid() : getHydrofluoricAcid(1).getFluid(); - } - return FluidUtils.getFluidStack(sGregtechHydrofluoricAcid, amount); - } - - public static boolean doesHydrofluoricAcidGtExist() { - if (sGregtechHydrofluoricAcid == null) { - getHydrofluoricAcidGT(1); - } - return sGregtechHydrofluoricAcid != null && sGregtechHydrofluoricAcid != getHydrofluoricAcid(1).getFluid(); - } - - private static FluidStack createFluidStack(Fluid aFluid, int aAmount) { - if (aFluid != null) { - return new FluidStack(aFluid, aAmount); - } - return null; - } - - public static FluidStack getFluidStack(final String aFluidName, final int aAmount){ - Fluid aFluid = sFluidCache.get(aFluidName); - if (aFluid != null) { - return createFluidStack(aFluid, aAmount); - } - else { - Fluid aLookupFluid = FluidRegistry.getFluid(aFluidName); - if (aLookupFluid != null) { - sFluidCache.put(aFluidName, aLookupFluid); - return createFluidStack(aLookupFluid, aAmount); - } - } - return null; - } - - public static FluidStack getFluidStack(final FluidStack aFluidStack, final int aAmount) { - if (aFluidStack == null) { - return null; - } - return new FluidStack(aFluidStack, aAmount); - } - - public static FluidStack getFluidStack(final Fluid aFluid, final int aAmount) { - if (aFluid == null) { - return null; - } - return new FluidStack(aFluid, aAmount); - } - - public static FluidStack[] getFluidStackArray(final String fluidName, final int amount){ - Logger.WARNING("Trying to get a fluid stack of "+fluidName); - try { - final FluidStack[] singleFluid = {getFluidStack(fluidName, amount)}; - return singleFluid; - } - catch (final Throwable e){ - return null; - } - - } - - public static FluidStack[] getFluidStackArray(final FluidStack fluidName, final int amount){ - Logger.WARNING("Trying to get a fluid stack of "+fluidName); - try { - final FluidStack[] singleFluid = {getFluidStack(fluidName, amount)}; - return singleFluid; - } - catch (final Throwable e){ - return null; - } - - } - - public static Fluid addGtFluid(final String aName, final String aLocalized, final GT_Materials aMaterial, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { - return addGtFluid(aName, aLocalized, aMaterial, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount, true); - } - - - public static Fluid addGtFluid(final String aName, final String aLocalized, final GT_Materials aMaterial, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount, final boolean aGenerateCell) { - Fluid g = addGTFluid(aName, "fluid.autogenerated", aLocalized, aMaterial != null ? aMaterial.mRGBa : new short[]{255, 255, 255, 0}, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount, aGenerateCell); - if (g != null) { - if (aMaterial != null) { - switch (aState) { - case 1: { - aMaterial.mFluid = (g); - break; - } - case 2: { - aMaterial.mGas = (g); - break; - } - case 3: { - aMaterial.mPlasma = (g); - break; - } - } - } - return g; - } - return null; - } - - public static Fluid addGTFluid(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount, final boolean aGenerateCell) { - return addGTFluid("molten."+aName, "fluid.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount, aGenerateCell); - } - - public static Fluid addGTFluidNonMolten(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount, final boolean aGenerateCell) { - return addGTFluid("fluid."+aName, "fluid.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount, aGenerateCell); - } - - public static Fluid addGTFluidNoPrefix(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount, final boolean aGenerateCell) { - return addGTFluid(aName, "fluid.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount, aGenerateCell); - } - //Gass - public static Fluid addGtGas(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount, final boolean aGenerateCell) { - return addGTFluid(aName, "fluid.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount, aGenerateCell); - } - - public static Fluid addGTPlasma(final Material aMaterial) { - if (aMaterial.getLocalizedName().toLowerCase().contains("clay") || (aMaterial.getComposites().size()>1) || aMaterial.getLocalizedName().toLowerCase().contains("wrought")){ - return null; - } - Logger.INFO("Generating a "+aMaterial.getLocalizedName()+" Plasma Cell"); - if (aMaterial.vComponentCount != 1){ - Logger.INFO("Compound made from: "); - for (final MaterialStack x : aMaterial.getComposites()){ - Logger.INFO(x.getStackMaterial().getLocalizedName()); - } - Logger.INFO("Material is a composite, not generating plasma."); - return null; - } - - ItemStack temp = null; - //Generate a Cell if we need to - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellPlasma"+aMaterial.getUnlocalizedName(), 1) == null){ - new BaseItemPlasmaCell(aMaterial); - temp = aMaterial.getPlasmaCell(1); - } - else { - temp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellPlasma"+aMaterial.getUnlocalizedName(), 1); - } - if (temp != null){ - return addGTFluid( - "plasma." + Utils.sanitizeString(aMaterial.getLocalizedName().toLowerCase()), - "plasma.autogenerated", - aMaterial.getLocalizedName() + " Plasma", - aMaterial.getRGBA(), - 3, - 10000, - temp, - ItemUtils.getEmptyCell(), - 1000, - false); - } - return null; - } - - public static Fluid addGTFluid(String aName, final String aTexture, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount, final boolean aGenerateFilledCell) { - - String aNameOriginal = aName; - Logger.INFO("Generating Fluid for "+aName); - - aName = Utils.sanitizeString(aName.toLowerCase()); - - String aLocalName = (aLocalized == null) ? aName : aLocalized; - - Fluid rFluid; - Fluid gFluid = FluidRegistry.getFluid(aName); - FluidStack aCheck = FluidUtils.getWildcardFluidStack(aName.toLowerCase(), 1000); - boolean register = false; - if (aCheck != null) { - rFluid = aCheck.getFluid(); - } - else if (gFluid != null) { - rFluid = gFluid; - } - else { - rFluid = new FluidGT6(aName, aTexture, (aRGBa != null) ? aRGBa : Dyes._NULL.getRGBA()); - register = true; - - } - - if (register) { - GT_LanguageManager.addStringLocalization(rFluid.getUnlocalizedName(), aLocalName); - if (FluidRegistry.registerFluid(rFluid)) { - switch (aState) { - case 0: { - rFluid.setGaseous(false); - rFluid.setViscosity(10000); - break; - } - case 1: - case 4: { - rFluid.setGaseous(false); - rFluid.setViscosity(1000); - break; - } - case 2: { - rFluid.setGaseous(true); - rFluid.setDensity(-100); - rFluid.setViscosity(200); - break; - } - case 3: { - rFluid.setGaseous(true); - rFluid.setDensity(-10000); - rFluid.setViscosity(10); - rFluid.setLuminosity(15); - break; - } - } - } - } - - - String aNameNonMolten = aLocalName.contains("Molten") ? aLocalName.replace("Molten", "") : aLocalName; - - if (aFullContainer == null) { - ItemStack oreStack = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+aLocalName, 1); - aFullContainer = oreStack; - if (aFullContainer == null) { - oreStack = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+aNameOriginal, 1); - aFullContainer = oreStack; - if (aFullContainer == null) { - oreStack = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+aNameNonMolten, 1); - aFullContainer = oreStack; - if (aFullContainer != null) { - Logger.INFO("Found cell for "+aNameNonMolten); - } - } - else { - Logger.INFO("Found cell for "+aNameOriginal); - } - } - else { - Logger.INFO("Found cell for "+aLocalName); - } - } - - Item tempCell = null; - //Generate a Cell if we need to - if (aGenerateFilledCell && aFullContainer == null) { - String aMatName = aNameOriginal; - if (aMatName.contains("molten.")) { - aMatName = aMatName.replace("molten.", ""); - aMatName = aMatName.substring(0, 1).toUpperCase() + aMatName.substring(1); - } - if (aMatName.contains("fluid.")) { - aMatName = aMatName.replace("fluid.", ""); - aMatName = aMatName.substring(0, 1).toUpperCase() + aMatName.substring(1); - } - Logger.INFO("Generating cell for "+aMatName+", "+aLocalName); - tempCell = new BaseItemComponent(aMatName, aLocalName, aRGBa); - aFullContainer = ItemUtils.getSimpleStack(tempCell); - } - - if ((rFluid.getTemperature() == new Fluid("test").getTemperature()) || (rFluid.getTemperature() <= 0)) { - rFluid.setTemperature((int) (aTemperatureK)); - } - if ((aFullContainer != null) && (aEmptyContainer != null) && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) { - CORE.RA.addFluidCannerRecipe(CI.emptyCells(1), aFullContainer, new FluidStack(rFluid, aFluidAmount)); - } - else { - //Utils.LOG_INFO("Failed creating recipes to fill/empty cells of "+aName+"."); - } - return rFluid; - } - - public static boolean valid(final Object aStack) { - return (aStack != null) && (aStack instanceof ItemStack) && (((ItemStack)aStack).getItem() != null) && (((ItemStack)aStack).stackSize >= 0); - } - - public static boolean invalid(final Object aStack) { - return (aStack == null) || !(aStack instanceof ItemStack) || (((ItemStack)aStack).getItem() == null) || (((ItemStack)aStack).stackSize < 0); - } - - public static boolean equal(final ItemStack aStack1, final ItemStack aStack2) { - return equal(aStack1, aStack2, false); - } - - public static boolean equal(final ItemStack aStack1, final ItemStack aStack2, final boolean aIgnoreNBT) { - return (aStack1 != null) && (aStack2 != null) && equal_(aStack1, aStack2, aIgnoreNBT); - } - - public static boolean equal_(final ItemStack aStack1, final ItemStack aStack2, final boolean aIgnoreNBT) { - return (aStack1.getItem() == aStack2.getItem()) && (aIgnoreNBT || ((aStack1.getTagCompound() == null == (aStack2.getTagCompound() == null)) && ((aStack1.getTagCompound() == null) || aStack1.getTagCompound().equals(aStack2.getTagCompound())))) && ((meta(aStack1) == meta(aStack2)) || (meta(aStack1) == 32767) || (meta(aStack2) == 32767)); - } - - public static ItemStack copy(final Object... aStacks) { - for (final Object tStack : aStacks) { - if (valid(tStack)) { - return ((ItemStack)tStack).copy(); - } - } - return null; - } - - public static ItemStack copyMeta(final long aMetaData, final Object... aStacks) { - final ItemStack rStack = copy(aStacks); - if (invalid(rStack)) { - return null; - } - return meta(rStack, aMetaData); - } - - public static short meta(final ItemStack aStack) { - return (short)Items.feather.getDamage(aStack); - } - - public static ItemStack meta(final ItemStack aStack, final long aMeta) { - Items.feather.setDamage(aStack, (short)aMeta); - return aStack; - } - - public static ItemStack amount(final long aAmount, final Object... aStacks) { - final ItemStack rStack = copy(aStacks); - if (invalid(rStack)) { - return null; - } - rStack.stackSize = (int)aAmount; - return rStack; - } - - public static ItemStack container(final ItemStack aStack, final boolean aCheckIFluidContainerItems) { - if (invalid(aStack)) { - return null; - } - if (aStack.getItem().hasContainerItem(aStack)) { - return aStack.getItem().getContainerItem(aStack); - } - if (equal(aStack, ItemUtils.getEmptyCell(), true)) { - return null; - } - if (aCheckIFluidContainerItems && (aStack.getItem() instanceof IFluidContainerItem) && (((IFluidContainerItem)aStack.getItem()).getCapacity(aStack) > 0)) { - final ItemStack tStack = amount(1L, aStack); - ((IFluidContainerItem)aStack.getItem()).drain(tStack, Integer.MAX_VALUE, true); - if (!equal(aStack, tStack)) { - return tStack; - } - return null; - } - if (equal(aStack, ItemList.IC2_ForgeHammer.get(1)) || equal(aStack, ItemList.IC2_WireCutter.get(1))) { - return copyMeta(meta(aStack) + 1, aStack); - } - return null; - } - - public static ItemStack container(final ItemStack aStack, final boolean aCheckIFluidContainerItems, final int aStacksize) { - return amount(aStacksize, container(aStack, aCheckIFluidContainerItems)); - } - - public final static Fluid generateFluid(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA, boolean aGenerateCell){ - FluidStack aFStack = (FluidUtils.getFluidStack("molten"+"."+unlocalizedName.toLowerCase(), 1)); - if (aFStack == null){ - Logger.WARNING("Generating our own fluid."); -/* ItemStack cell = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1); - if (cell == null){ - final Item temp = new BaseItemComponent(unlocalizedName, localizedName, RGBA); - cell = ItemUtils.getSimpleStack(temp); - }*/ - final Fluid gtFluid = FluidUtils.addGTFluid( - unlocalizedName, - "Molten "+localizedName, - RGBA, - 4, - MeltingPoint, - null, - ItemUtils.getEmptyCell(), - 1000, - aGenerateCell); - - return gtFluid; - } - else { - Logger.INFO("FLUID GENERATION FAILED FOR "+localizedName+", ALREADY EXISTS"); - return aFStack.getFluid(); - } - } - - public final static Fluid generateFluidNonMolten(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA, final boolean aGenerateCell){ - return generateFluidNonMolten(unlocalizedName, localizedName, MeltingPoint, RGBA, null, null, 0, aGenerateCell); - } - - - public final static Fluid generateFluidNonMolten(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA, final ItemStack dustStack, final ItemStack dustStack2){ - return generateFluidNonMolten(unlocalizedName, localizedName, MeltingPoint, RGBA, dustStack, dustStack2, 144, true); - } - - public final static Fluid generateFluidNonMolten(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA, final ItemStack dustStack, final ItemStack dustStack2, final boolean aGenerateCell){ - return generateFluidNonMolten(unlocalizedName, localizedName, MeltingPoint, RGBA, dustStack, dustStack2, 144, aGenerateCell); - } - - public final static Fluid generateFluidNonMolten(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA, ItemStack dustStack, final ItemStack dustStack2, final int amountPerItem, final boolean aGenerateCell){ - if (dustStack == null){ - dustStack = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust"+Utils.sanitizeString(localizedName), 1); - } - FluidStack aFStack = (FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1)); - if (aFStack == null){ - Logger.WARNING("Generating our own fluid."); - - final Fluid gtFluid = FluidUtils.addGTFluidNonMolten( - unlocalizedName, - localizedName, - RGBA, - 4, - MeltingPoint, - null, - ItemUtils.getEmptyCell(), - 1000, - aGenerateCell); - - if (dustStack != null){ - CORE.RA.addFluidExtractionRecipe( - dustStack, //Input 2 - FluidUtils.getFluidStack(gtFluid, amountPerItem), //Fluid Output - 1*20, //Duration - 16 //Eu Tick - ); - } - if (dustStack2 != null){ - CORE.RA.addFluidExtractionRecipe( - dustStack2, //Input 2 - FluidUtils.getFluidStack(gtFluid, amountPerItem), //Fluid Output - 1*20, //Duration - 16 //Eu Tick - ); - } - - return gtFluid; - } - else { - Logger.INFO("FLUID GENERATION FAILED FOR "+localizedName+", ALREADY EXISTS"); - return aFStack.getFluid(); - } - } - - public final static Fluid generateFluidNoPrefix(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA){ - return generateFluidNoPrefix(unlocalizedName, localizedName, MeltingPoint, RGBA, true); - } - - public final static Fluid generateFluidNoPrefix(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA, final boolean aGenerateCell){ - Fluid gtFluid; - if (FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1) == null){ - Logger.WARNING("Generating our own fluid."); - gtFluid = FluidUtils.addGTFluidNoPrefix( - unlocalizedName, - localizedName, - RGBA, - 4, - MeltingPoint, - null, - ItemUtils.getEmptyCell(), - 1000, - aGenerateCell); - } - else { - gtFluid = FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1).getFluid(); - } - //Generate a Cell if we need to -// if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){ -// new BaseItemCell(unlocalizedName, localizedName, RGBA, gtFluid); -// } - return gtFluid; - } - - public final static Fluid generateGas(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA, final boolean aGenerateCell){ - Fluid gtFluid; - if (FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1) == null){ - Logger.WARNING("Generating our own gas."); - gtFluid = FluidUtils.addGtGas( - unlocalizedName, - localizedName, - RGBA, - 3, - MeltingPoint, - null, - ItemUtils.getEmptyCell(), - 1000, - aGenerateCell); - } - else { - gtFluid = FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1).getFluid(); - } - //Generate a Cell if we need to -/* if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){ - new BaseItemCell(unlocalizedName, localizedName, RGBA, gtFluid); - }*/ - return gtFluid; - } - - - - - public static FluidStack getMobEssence(final int amount){ - return EnchantingUtils.getMobEssence(amount); - } - - public static FluidStack getLiquidXP(final int amount){ - return EnchantingUtils.getLiquidXP(amount); - } - - public static boolean doesFluidExist(String aFluidName) { - FluidStack aFStack1 = (FluidUtils.getFluidStack("molten"+"."+aFluidName.toLowerCase(), 1)); - FluidStack aFStack2 = (FluidUtils.getFluidStack("fluid"+"."+aFluidName.toLowerCase(), 1)); - FluidStack aFStack3 = (FluidUtils.getFluidStack(aFluidName.toLowerCase(), 1)); - FluidStack aFStack4 = (FluidUtils.getFluidStack(aFluidName, 1)); - FluidStack aFStack5 = (FluidUtils.getFluidStack("liquid_"+aFluidName.toLowerCase(), 1)); - FluidStack aFStack6 = (FluidUtils.getFluidStack("liquid"+"."+aFluidName.toLowerCase(), 1)); - return aFStack1 != null || aFStack2 != null || aFStack3 != null || aFStack4 != null || aFStack5 != null || aFStack6 != null; - } - - public static FluidStack getWildcardFluidStack(String aFluidName, int amount) { - FluidStack aFStack1 = (FluidUtils.getFluidStack(aFluidName, amount)); - FluidStack aFStack2 = (FluidUtils.getFluidStack(aFluidName.toLowerCase(), amount)); - FluidStack aFStack3 = (FluidUtils.getFluidStack("molten"+"."+aFluidName.toLowerCase(), amount)); - FluidStack aFStack4 = (FluidUtils.getFluidStack("fluid"+"."+aFluidName.toLowerCase(), amount)); - FluidStack aFStack5 = (FluidUtils.getFluidStack("liquid_"+aFluidName.toLowerCase(), amount)); - FluidStack aFStack6 = (FluidUtils.getFluidStack("liquid"+"."+aFluidName.toLowerCase(), amount)); - if (aFStack1 != null) { - return aFStack1; - } - if (aFStack2 != null) { - return aFStack2; - } - if (aFStack3 != null) { - return aFStack3; - } - if (aFStack4 != null) { - return aFStack4; - } - if (aFStack5 != null) { - return aFStack5; - } - if (aFStack6 != null) { - return aFStack6; - } - return null; - } - - public static FluidStack getWildcardFluidStack(Materials aMaterial, int amount) { - FluidStack aFStack1 = aMaterial.getFluid(amount); - FluidStack aFStack2 = aMaterial.getGas(amount); - FluidStack aFStack3 = aMaterial.getMolten(amount); - FluidStack aFStack4 = aMaterial.getSolid(amount); - if (aFStack1 != null) { - return aFStack1; - } - else if (aFStack2 != null) { - return aFStack2; - } - else if (aFStack3 != null) { - return aFStack3; - } - else if (aFStack4 != null) { - return aFStack4; - } - else { - return null; - } - } - - public static FluidStack getAir(int aAmount) { - return FluidUtils.getFluidStack("air", aAmount); - } - - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/FoodUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/FoodUtils.java deleted file mode 100644 index 9f5d4f36ca..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/FoodUtils.java +++ /dev/null @@ -1,60 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.init.Items; -import net.minecraft.item.EnumAction; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemFood; -import net.minecraft.item.ItemStack; - -public class FoodUtils { - - public static final Class IEdibleClass; - - static { - IEdibleClass = ReflectionUtils.getClass("squeek.applecore.api.food.IEdible"); - } - - public static boolean isFood(ItemStack food) { - - if (food == null) { - return false; - } - - Item item = food.getItem(); - - if(item == null) { - return false; - } - - EnumAction action = item.getItemUseAction(food); - - if(item instanceof ItemBlock || action == EnumAction.eat || action == EnumAction.drink) { - if(getUnmodifiedFoodValues(food) > 0) { - return true; - } - } - - return false; - } - - private static int getUnmodifiedFoodValues(ItemStack stack) { - - if (stack == null) { - return 0; - } - - Item item = stack.getItem(); - - if(item == null) { - return 0; - } - - if(IEdibleClass.isInstance(item) || item instanceof ItemFood || item == Items.cake) { - return 1; - } - - return 0; - } -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java deleted file mode 100644 index b322036ef7..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java +++ /dev/null @@ -1,604 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import static gregtech.api.GregTech_API.*; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.HashMap; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gregtech.api.objects.GT_HashSet; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.GTplusplus.INIT_PHASE; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import ic2.core.Ic2Items; -import ic2.core.item.armor.ItemArmorHazmat; -import ic2.core.item.armor.ItemArmorNanoSuit; -import ic2.core.item.armor.ItemArmorQuantumSuit; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; - -public class HazmatUtils { - - public static final GT_HashSet<GT_ItemStack> sHazmatList = new GT_HashSet<GT_ItemStack>(); - - private static final HashMap<String, AutoMap<String>> mToolTips = new HashMap<String, AutoMap<String>>(); - - private static boolean mInit = false; - private static HazmatUtils mInstance; - - @SuppressWarnings("rawtypes") - public static void init() { - if (mInit) { - return; - } - //doInit(); Disabled, hazmat moved to gt5u - } - public static void doInit() { - - mInstance = new HazmatUtils(); - - sHazmatList.add(ItemUtils.getSimpleStack(Ic2Items.hazmatHelmet, 1)); - sHazmatList.add(ItemUtils.getSimpleStack(Ic2Items.hazmatChestplate, 1)); - sHazmatList.add(ItemUtils.getSimpleStack(Ic2Items.hazmatLeggings, 1)); - sHazmatList.add(ItemUtils.getSimpleStack(Ic2Items.hazmatBoots, 1)); - - // Make Nano a hazmat suit - // Make Quantum a hazmat suit - - - if (LoadedMods.IndustrialCraft2 || LoadedMods.IndustrialCraft2Classic) { - AutoMap<ItemStack> aVanillaIC2Armour = new AutoMap<ItemStack>(); - aVanillaIC2Armour.add(ItemUtils.getSimpleStack(Ic2Items.nanoHelmet, 1)); - aVanillaIC2Armour.add(ItemUtils.getSimpleStack(Ic2Items.nanoBodyarmor, 1)); - aVanillaIC2Armour.add(ItemUtils.getSimpleStack(Ic2Items.nanoLeggings, 1)); - aVanillaIC2Armour.add(ItemUtils.getSimpleStack(Ic2Items.nanoBoots, 1)); - aVanillaIC2Armour.add(ItemUtils.getSimpleStack(Ic2Items.quantumHelmet, 1)); - aVanillaIC2Armour.add(ItemUtils.getSimpleStack(Ic2Items.quantumBodyarmor, 1)); - aVanillaIC2Armour.add(ItemUtils.getSimpleStack(Ic2Items.quantumLeggings, 1)); - aVanillaIC2Armour.add(ItemUtils.getSimpleStack(Ic2Items.quantumBoots, 1)); - for (ItemStack aItem : aVanillaIC2Armour) { - addProtection(aItem); - } - Logger.INFO("[Hazmat] Registered IC2 Items as hazmat gear."); - } - - if (LoadedMods.isModLoaded("EMT")) { - AutoMap<Field> aItemFields = new AutoMap<Field>(); - Class aItemsEMT = ReflectionUtils.getClass("emt.init.EMTItems"); - aItemFields.add(ReflectionUtils.getField(aItemsEMT, "nanoThaumicHelmet")); - aItemFields.add(ReflectionUtils.getField(aItemsEMT, "nanoWing")); - aItemFields.add(ReflectionUtils.getField(aItemsEMT, "nanoBootsTraveller")); - aItemFields.add(ReflectionUtils.getField(aItemsEMT, "quantumThaumicHelmet")); - aItemFields.add(ReflectionUtils.getField(aItemsEMT, "quantumWing")); - aItemFields.add(ReflectionUtils.getField(aItemsEMT, "quantumArmor")); - aItemFields.add(ReflectionUtils.getField(aItemsEMT, "quantumBootsTraveller")); - AutoMap<ItemStack> aEMT = new AutoMap<ItemStack>(); - for (Field aItemField : aItemFields) { - Item aItemObject = null; - if (aItemField != null) { - try { - aItemObject = (Item) aItemField.get(null); - } - catch (Exception t) { - t.printStackTrace(); - } - } - if (aItemObject != null) { - aEMT.add(ItemUtils.getSimpleStack(aItemObject)); - } - else { - Logger.INFO("[Hazmat] Could not get "+aItemField.getName()+" from "+aItemsEMT.getName()); - } - } - Logger.INFO("[Hazmat] Registering "+aEMT.size()+" EMT Items as hazmat gear."); - for (ItemStack aItem : aEMT) { - addProtection(aItem); - } - Logger.INFO("[Hazmat] Registered EMT Items as hazmat gear."); - } - - if (LoadedMods.isModLoaded("DraconicEvolution")) { - AutoMap<Field> aItemFields = new AutoMap<Field>(); - Class aItemsDE = ReflectionUtils.getClass("com.brandon3055.draconicevolution.ModItems"); - - aItemFields.add(ReflectionUtils.getField(aItemsDE, "draconicHelm")); - aItemFields.add(ReflectionUtils.getField(aItemsDE, "draconicChest")); - aItemFields.add(ReflectionUtils.getField(aItemsDE, "draconicLeggs")); - aItemFields.add(ReflectionUtils.getField(aItemsDE, "draconicBoots")); - aItemFields.add(ReflectionUtils.getField(aItemsDE, "wyvernHelm")); - aItemFields.add(ReflectionUtils.getField(aItemsDE, "wyvernChest")); - aItemFields.add(ReflectionUtils.getField(aItemsDE, "wyvernLeggs")); - aItemFields.add(ReflectionUtils.getField(aItemsDE, "wyvernBoots")); - AutoMap<ItemStack> aItemMap = new AutoMap<ItemStack>(); - for (Field aItemField : aItemFields) { - Item aItemObject = null; - if (aItemField != null) { - try { - aItemObject = (Item) aItemField.get(null); - } - catch (Exception t) { - t.printStackTrace(); - } - } - if (aItemObject != null) { - aItemMap.add(ItemUtils.getSimpleStack(aItemObject)); - } - else { - Logger.INFO("[Hazmat] Could not get "+aItemField.getName()+" from "+aItemsDE.getName()); - } - } - Logger.INFO("[Hazmat] Registering "+aItemMap.size()+" Draconic Evolution Items as hazmat gear."); - for (ItemStack aItem : aItemMap) { - addProtection(aItem); - } - Logger.INFO("[Hazmat] Registered Draconic Evolution Items as hazmat gear."); - } - - if (LoadedMods.isModLoaded("TaintedMagic")) { - AutoMap<Field> aItemFields = new AutoMap<Field>(); - Class aItemsTaintedMagic = ReflectionUtils.getClass("taintedmagic.common.registry.ItemRegistry"); - - aItemFields.add(ReflectionUtils.getField(aItemsTaintedMagic, "ItemShadowFortressHelmet")); - aItemFields.add(ReflectionUtils.getField(aItemsTaintedMagic, "ItemShadowFortressChestplate")); - aItemFields.add(ReflectionUtils.getField(aItemsTaintedMagic, "ItemShadowFortressLeggings")); - aItemFields.add(ReflectionUtils.getField(aItemsTaintedMagic, "ItemVoidwalkerBoots")); - AutoMap<ItemStack> aItemMap = new AutoMap<ItemStack>(); - for (Field aItemField : aItemFields) { - Item aItemObject = null; - if (aItemField != null) { - try { - aItemObject = (Item) aItemField.get(null); - } - catch (Exception t) { - t.printStackTrace(); - } - } - if (aItemObject != null) { - aItemMap.add(ItemUtils.getSimpleStack(aItemObject)); - } - else { - Logger.INFO("[Hazmat] Could not get "+aItemField.getName()+" from "+aItemsTaintedMagic.getName()); - } - } - Logger.INFO("[Hazmat] Registering "+aItemMap.size()+" Tainted Magic Items as hazmat gear."); - for (ItemStack aItem : aItemMap) { - addProtection(aItem); - } - Logger.INFO("[Hazmat] Registered Tainted Magic Items as hazmat gear."); - } - - if (LoadedMods.isModLoaded("WitchingGadgets")) { - AutoMap<Field> aItemFields = new AutoMap<Field>(); - Class aItemsTaintedMagic = ReflectionUtils.getClass("witchinggadgets.common.WGContent"); - - aItemFields.add(ReflectionUtils.getField(aItemsTaintedMagic, "ItemPrimordialHelm")); - aItemFields.add(ReflectionUtils.getField(aItemsTaintedMagic, "ItemPrimordialChest")); - aItemFields.add(ReflectionUtils.getField(aItemsTaintedMagic, "ItemPrimordialLegs")); - aItemFields.add(ReflectionUtils.getField(aItemsTaintedMagic, "ItemPrimordialBoots")); - AutoMap<ItemStack> aItemMap = new AutoMap<ItemStack>(); - for (Field aItemField : aItemFields) { - Item aItemObject = null; - if (aItemField != null) { - try { - aItemObject = (Item) aItemField.get(null); - } - catch (Exception t) { - t.printStackTrace(); - } - } - if (aItemObject != null) { - aItemMap.add(ItemUtils.getSimpleStack(aItemObject)); - } - else { - Logger.INFO("[Hazmat] Could not get "+aItemField.getName()+" from "+aItemsTaintedMagic.getName()); - } - } - Logger.INFO("[Hazmat] Registering "+aItemMap.size()+" Witching Gadgets Items as hazmat gear."); - for (ItemStack aItem : aItemMap) { - addProtection(aItem); - } - Logger.INFO("[Hazmat] Registered Witching Gadgets Items as hazmat gear."); - } - - if (LoadedMods.isModLoaded("ThaumicTinkerer")) { - /* - AutoMap<Item> aItems = new AutoMap<Item>(); - Class aMainTT = ReflectionUtils.getClass("thaumic.tinkerer.common.ThaumicTinkerer"); - Class aItemRegistryTT = ReflectionUtils.getClass("thaumic.tinkerer.common.registry.TTRegistry"); - Field aRegistryInstance = ReflectionUtils.getField(aMainTT, "registry"); - Object aRegistry = ReflectionUtils.getFieldValue(aRegistryInstance); - Method aFuckingStupidMethodHandlingMethod = ReflectionUtils.getMethod(aItemRegistryTT, "getFirstItemFromClass", new Class[] {Class.class}); - Item aIchorHelm = (Item) ReflectionUtils.invokeNonBool(aRegistry, aFuckingStupidMethodHandlingMethod, new Object[] {ReflectionUtils.getClass("thaumic.tinkerer.common.item.kami.armor.ItemGemHelm")}); - Item aIchorChest = (Item) ReflectionUtils.invokeNonBool(aRegistry, aFuckingStupidMethodHandlingMethod, new Object[] {ReflectionUtils.getClass("thaumic.tinkerer.common.item.kami.armor.ItemGemChest")}); - Item aIchorLegs = (Item) ReflectionUtils.invokeNonBool(aRegistry, aFuckingStupidMethodHandlingMethod, new Object[] {ReflectionUtils.getClass("thaumic.tinkerer.common.item.kami.armor.ItemGemLegs")}); - Item aIchorBoots = (Item) ReflectionUtils.invokeNonBool(aRegistry, aFuckingStupidMethodHandlingMethod, new Object[] {ReflectionUtils.getClass("thaumic.tinkerer.common.item.kami.armor.ItemGemBoots")}); - aItems.add(aIchorHelm); - aItems.add(aIchorChest); - aItems.add(aIchorLegs); - aItems.add(aIchorBoots); - AutoMap<ItemStack> aItemMap = new AutoMap<ItemStack>(); - int aIndex = 0; - for (Item aItem : aItems) { - Item aItemObject = null; - if (aItem != null) { - aItemMap.add(ItemUtils.getSimpleStack(aItemObject)); - } - else { - Logger.INFO("[Hazmat] Could not get item "+aIndex+" from "+aItemRegistryTT.getName()); - } - aIndex++; - } - Logger.INFO("[Hazmat] Registering "+aItemMap.size()+" Thaumic Tinkerer Items as hazmat gear."); - for (ItemStack aItem : aItemMap) { - addProtection(aItem); - } - Logger.INFO("[Hazmat] Registered Thaumic Tinkerer Items as hazmat gear."); - */ - Logger.INFO("[Hazmat] Did not register Thaumic Tinkerer Items as hazmat gear."); - } - - if (LoadedMods.isModLoaded("GraviSuite")) { - AutoMap<Field> aItemFields = new AutoMap<Field>(); - Class aItemsGravisuite = ReflectionUtils.getClass("gravisuite.GraviSuite"); - aItemFields.add(ReflectionUtils.getField(aItemsGravisuite, "advNanoChestPlate")); - aItemFields.add(ReflectionUtils.getField(aItemsGravisuite, "graviChestPlate")); - AutoMap<ItemStack> aGravisuite = new AutoMap<ItemStack>(); - for (Field aItemField : aItemFields) { - Item aItemObject = (Item) ReflectionUtils.getFieldValue(aItemField); - if (aItemObject != null) { - aGravisuite.add(ItemUtils.getSimpleStack(aItemObject)); - } - } - Logger.INFO("[Hazmat] Registering "+aGravisuite.size()+" Gravisuit Items as hazmat gear."); - for (ItemStack aItem : aGravisuite) { - addProtection(aItem); - } - Logger.INFO("[Hazmat] Registered Gravisuit Items as hazmat gear."); - } - - if (LoadedMods.isModLoaded("AdvancedSolarPanel")) { - AutoMap<Field> aItemFields = new AutoMap<Field>(); - Class aItemsEMT = ReflectionUtils.getClass("advsolar.common.AdvancedSolarPanel"); - aItemFields.add(ReflectionUtils.getField(aItemsEMT, "advancedSolarHelmet")); - aItemFields.add(ReflectionUtils.getField(aItemsEMT, "hybridSolarHelmet")); - aItemFields.add(ReflectionUtils.getField(aItemsEMT, "ultimateSolarHelmet")); - AutoMap<ItemStack> aASP = new AutoMap<ItemStack>(); - for (Field aItemField : aItemFields) { - Item aItemObject = (Item) ReflectionUtils.getFieldValue(aItemField); - if (aItemObject != null) { - aASP.add(ItemUtils.getSimpleStack(aItemObject)); - } - } - Logger.INFO("[Hazmat] Registering "+aASP.size()+" Adv. Solar Items as hazmat gear."); - for (ItemStack aItem : aASP) { - addProtection(aItem); - } - Logger.INFO("[Hazmat] Registered Adv. Solar Items as hazmat gear."); - } - - Utils.registerEvent(mInstance); - Logger.INFO("[Hazmat] Registered Tooltip handler for hazmat gear."); - mInit = true; - - } - - private final static String mToolTipText = "Provides protection from:"; - - @SubscribeEvent - public void onItemTooltip(ItemTooltipEvent event) { - //Logger.INFO("Ticking Hazmat handler"); - if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) { - - if (event.itemStack == null || isVanillaHazmatPiece(event.itemStack)) { - //Logger.INFO("[Hazmat] Invalid Itemstack or vanilla hazmat"); - return; - } else { - ItemStack aStackTemp = event.itemStack; - GT_ItemStack aStack = new GT_ItemStack(aStackTemp); - if (isNanoArmourPiece(aStackTemp) || isQuantumArmourPiece(aStackTemp)) { - event.toolTip.add(EnumChatFormatting.DARK_PURPLE+"Provides full hazmat protection."); - } - else { - //Logger.INFO("[Hazmat] Finding Tooltip Data"); - String[] aTooltips = getTooltips(aStack); - if (aTooltips == null || aTooltips.length == 0) { - //Logger.INFO("[Hazmat] No Info!"); - return; - } else { - //Logger.INFO("[Hazmat] Found Tooltips!"); - if (providesProtection(aStackTemp)) { - event.toolTip.add(EnumChatFormatting.LIGHT_PURPLE+"Provides full hazmat protection."); - } else { - event.toolTip.add(mToolTipText); - for (String r : aTooltips) { - event.toolTip.add(" - " + r); - } - } - } - } - } - } - } - - /** - * Static function to replace - * {@link #ic2.core.item.armor.ItemArmorHazmat.hasCompleteHazmat(EntityLivingBase)}. - * Because IC2 doesn't let us register things ourself, anything registered via - * GT/GT++ will return true. - * - * @param living - Entity Wearing Armour - * @return - Does {@link EntityLivingBase} have a full hazmat suit on? - */ - public static boolean hasCompleteHazmat(EntityLivingBase living) { - // Entity is Null, cannot have Hazmat. - if (living == null || living.isDead) { - return false; - } else { - - // Map All Player Armour slots - AutoMap<ItemStack> aEquipment = new AutoMap<ItemStack>(); - for (int i = 1; i < 5; ++i) { - ItemStack stack = living.getEquipmentInSlot(i); - - // Item is Null, cannot have full suit - if (stack == null) { - return false; - } else { - aEquipment.put(stack); - } - } - - // Compare Equipment to all items mapped for full hazmat. - for (ItemStack aSlotStack : aEquipment) { - if (!isHazmatPiece(aSlotStack)) { - //Logger.INFO("Found item which is not hazmat. "+ItemUtils.getItemName(aSlotStack)); - return false; - } - } - - // We are in some kind of full hazmat, huzzah! - //Logger.INFO("Has full hazmat."); - return true; - } - } - - /** - * Is this item vanilla IC2 hazmat? - * - * @param aArmour - The Armour to provide protection. - * @return - */ - public static boolean isVanillaHazmatPiece(ItemStack aArmour) { - return aArmour != null ? aArmour.getItem() instanceof ItemArmorHazmat : false; - } - - /** - * Is this item vanilla IC2 Nanosuit? - * - * @param aArmour - The Armour to provide protection. - * @return - */ - public static boolean isNanoArmourPiece(ItemStack aArmour) { - return aArmour != null ? aArmour.getItem() instanceof ItemArmorNanoSuit : false; - } - - /** - * Is this item vanilla IC2 Quantum? - * - * @param aArmour - The Armour to provide protection. - * @return - */ - public static boolean isQuantumArmourPiece(ItemStack aArmour) { - return aArmour != null ? aArmour.getItem() instanceof ItemArmorQuantumSuit : false; - } - - /** - * Is this item a registered piece of full hazmat? (Provides all 6 protections) - * - * @param aStack - The Armour to provide protection. - * @return - */ - public static boolean isHazmatPiece(ItemStack aStack) { - return isVanillaHazmatPiece(aStack) || providesProtection(aStack); - } - - /** - * Registers the {@link ItemStack} to all types of protection. Provides full - * hazmat protection. Frost, Fire, Bio, Gas, Radioaton & Electricity. - * - * @param aStack - The Armour to provide protection. - * @return - Did we register this ItemStack properly? - */ - public static boolean addProtection(ItemStack aVanStack) { - if (!ItemUtils.checkForInvalidItems(aVanStack)) { - Logger.INFO("=================Bad Hazmat Addition======================"); - Logger.INFO("Called from: "+ReflectionUtils.getMethodName(0)); - Logger.INFO(ReflectionUtils.getMethodName(1)); - Logger.INFO(ReflectionUtils.getMethodName(2)); - Logger.INFO(ReflectionUtils.getMethodName(3)); - Logger.INFO(ReflectionUtils.getMethodName(4)); - Logger.INFO(ReflectionUtils.getMethodName(5)); - Logger.INFO(ReflectionUtils.getMethodName(6)); - Logger.INFO("=========================================================="); - return false; - } - Logger.INFO("[Hazmat] Registering " + ItemUtils.getItemName(aVanStack) + " for full Hazmat protection."); - GT_ItemStack aStack = getGtStackFromVanilla(aVanStack); - AutoMap<Boolean> aAdded = new AutoMap<Boolean>(); - aAdded.put(addProtection_Frost(aStack)); - aAdded.put(addProtection_Fire(aStack)); - aAdded.put(addProtection_Biohazard(aStack)); - aAdded.put(addProtection_Gas(aStack)); - aAdded.put(addProtection_Radiation(aStack)); - aAdded.put(addProtection_Electricty(aStack)); - for (boolean b : aAdded) { - if (!b) { - return false; - } - } - Logger.INFO("[Hazmat] Protection added for all 6 damage types, registering to master Hazmat list."); - sHazmatList.add(aStack); - return true; - } - - public static boolean addProtection_Frost(GT_ItemStack aStack) { - registerTooltip(aStack, EnumChatFormatting.AQUA + "Frost"); - return addProtection_Generic(sFrostHazmatList, aStack); - } - - public static boolean addProtection_Fire(GT_ItemStack aStack) { - registerTooltip(aStack, EnumChatFormatting.DARK_RED + "Heat"); - return addProtection_Generic(sHeatHazmatList, aStack); - } - - public static boolean addProtection_Biohazard(GT_ItemStack aStack) { - registerTooltip(aStack, EnumChatFormatting.GREEN + "Biohazards"); - return addProtection_Generic(sBioHazmatList, aStack); - } - - public static boolean addProtection_Gas(GT_ItemStack aStack) { - registerTooltip(aStack, EnumChatFormatting.WHITE + "Gas"); - return addProtection_Generic(sGasHazmatList, aStack); - } - - public static boolean addProtection_Radiation(GT_ItemStack aStack) { - registerTooltip(aStack, EnumChatFormatting.DARK_GREEN + "Radiation"); - return addProtection_Generic(sRadioHazmatList, aStack); - } - - public static boolean addProtection_Electricty(GT_ItemStack aStack) { - registerTooltip(aStack, EnumChatFormatting.YELLOW + "Electricity"); - return addProtection_Generic(sElectroHazmatList, aStack); - } - - private static boolean addProtection_Generic(GT_HashSet<GT_ItemStack> aSet, GT_ItemStack aStack) { - int aMapSize = aSet.size(); - aSet.add(aStack); - return aMapSize < aSet.size(); - } - - /** - * Does this item provide hazmat protection? (Protection against Frost, Heat, - * Bio, Gas, Rads, Elec) An item may return false even if it protects against - * all six damage types. This is because it's not actually registered as hazmat - * correct. - * - * @param aStack - The item to check for protection - * @return - */ - public static boolean providesProtection(ItemStack aStack) { - return providesProtetion_Generic(sHazmatList, aStack); - } - - public static boolean providesProtetion_Frost(ItemStack aStack) { - return providesProtetion_Generic(sFrostHazmatList, aStack); - } - - public static boolean providesProtetion_Fire(ItemStack aStack) { - return providesProtetion_Generic(sHeatHazmatList, aStack); - } - - public static boolean providesProtetion_Biohazard(ItemStack aStack) { - return providesProtetion_Generic(sBioHazmatList, aStack); - } - - public static boolean providesProtetion_Gas(ItemStack aStack) { - return providesProtetion_Generic(sGasHazmatList, aStack); - } - - public static boolean providesProtetion_Radiation(ItemStack aStack) { - return providesProtetion_Generic(sRadioHazmatList, aStack); - } - - public static boolean providesProtetion_Electricity(ItemStack aStack) { - return providesProtetion_Generic(sElectroHazmatList, aStack); - } - - private static boolean providesProtetion_Generic(GT_HashSet<GT_ItemStack> aSet, ItemStack aStack) { - if (isVanillaHazmatPiece(aStack)) { - return true; - } - for (GT_ItemStack o : aSet) { - if (o != null && o.mItem != null && aStack != null && aStack.getItem() != null) { - if (GT_Utility.areStacksEqual(o.toStack(), aStack, true)) { - return true; - } - if (o.isStackEqual(aStack)){ - return true; - } - if (o.mItem == aStack.getItem() && EnergyUtils.EU.isElectricItem(aStack)) { - return true; - } - } - } - return false; - } - - private static String[] getTooltips(GT_ItemStack aStack) { - String aKey = convertGtItemstackToStringDataIgnoreDamage(aStack); - AutoMap<String> aTempTooltipData = mToolTips.get(aKey); - if (aTempTooltipData == null || aTempTooltipData.isEmpty()) { - //Logger.INFO("[Hazmat] Item was not mapped for TTs - "+aKey); - return new String[] {}; - } else { - //Logger.INFO("[Hazmat] Item was mapped for TTs"); - //Collections.sort(aTempTooltipData); - //Logger.INFO("[Hazmat] Sorted TTs"); - - String[] mBuiltOutput = new String[aTempTooltipData.size()]; - int aIndex = 0; - for (String i : aTempTooltipData) { - mBuiltOutput[aIndex++] = i; - } - - return mBuiltOutput; - } - } - - private static void registerTooltip(GT_ItemStack aStack, String aTooltip) { - String aKey = convertGtItemstackToStringDataIgnoreDamage(aStack); - Logger.INFO("[Hazmat] Mapping " + aTooltip + " for " + aKey); - AutoMap<String> aTempTooltipData = mToolTips.get(aKey); - if (aTempTooltipData == null) { - Logger.INFO("No data mapped yet, creating."); - aTempTooltipData = new AutoMap<String>(); - mToolTips.put(aKey, aTempTooltipData); - } - aTempTooltipData.add(aTooltip); - } - - public static ItemStack getStackFromGtStack(GT_ItemStack aGtStack) { - return ItemUtils.simpleMetaStack(aGtStack.mItem, aGtStack.mMetaData, aGtStack.mStackSize); - } - - public static GT_ItemStack getGtStackFromVanilla(ItemStack aStack) { - return new GT_ItemStack(aStack); - } - - private static String convertGtItemstackToStringData(GT_ItemStack aStack) { - if (aStack == null) { - return "NULL"; - } else { - return aStack.mItem.getUnlocalizedName() + "." + aStack.mMetaData + "." + aStack.mStackSize; - } - } - - private static String convertGtItemstackToStringDataIgnoreDamage(GT_ItemStack aStack) { - if (aStack == null) { - return "NULL"; - } else { - return aStack.mItem.getUnlocalizedName() + "." + aStack.mStackSize; - } - } - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/InventoryUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/InventoryUtils.java deleted file mode 100644 index fe67c88d69..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/InventoryUtils.java +++ /dev/null @@ -1,88 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import java.util.Random; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy_RTG; -import net.minecraft.block.Block; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class InventoryUtils { - - private final static Random mRandom = new Random(); - - public static void dropInventoryItems(World world, int x, int y, int z, Block block) { - TileEntity tileentity = world.getTileEntity(x, y, z); - - if (tileentity != null && tileentity instanceof IInventory && ((IInventory) tileentity).getSizeInventory() > 0) { - - IInventory aTileInv = (IInventory) tileentity; - int aMinSlot = 0; - int aMaxSlot = aTileInv.getSizeInventory()-1; - - for (int i1 = aMinSlot; i1 < aMaxSlot; ++i1) { - ItemStack itemstack = aTileInv.getStackInSlot(i1); - - if (itemstack != null) { - float f = mRandom.nextFloat() * 0.8F + 0.1F; - float f1 = mRandom.nextFloat() * 0.8F + 0.1F; - EntityItem entityitem; - - for (float f2 = mRandom.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; world.spawnEntityInWorld(entityitem)) { - int j1 = mRandom.nextInt(21) + 10; - - if (j1 > itemstack.stackSize) { - j1 = itemstack.stackSize; - } - - itemstack.stackSize -= j1; - entityitem = new EntityItem(world, x + f, y + f1, z + f2, - new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - float f3 = 0.05F; - entityitem.motionX = (float) mRandom.nextGaussian() * f3; - entityitem.motionY = (float) mRandom.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float) mRandom.nextGaussian() * f3; - - if (itemstack.hasTagCompound()) { - entityitem.getEntityItem() - .setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); - } - } - } - } - - world.func_147453_f(x, y, z, block); - } - - } - - public static void sortInventoryItems(MetaTileEntity aTile) { - sortInventoryItems(aTile.getBaseMetaTileEntity()); - } - - public static void sortInventoryItems(IGregTechTileEntity aBaseMetaTileEntity) { - IInventory mInv = aBaseMetaTileEntity.getIInventory(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord()); - AutoMap<ItemStack> aInvContents = new AutoMap<ItemStack>(); - int aSize = mInv.getSizeInventory(); - for (int slot=0; slot<aSize; slot++) { - aInvContents.put(mInv.getStackInSlot(slot)); - } - ItemStack[] mInventory = aInvContents.toArray(); - for (int i = 0; i < mInventory.length; i++) { - for (int j = i + 1; j < mInventory.length; j++) { - if (mInventory[j] != null && (mInventory[i] == null || GT_Utility.areStacksEqual(mInventory[i], mInventory[j]))) { - GT_Utility.moveStackFromSlotAToSlotB(aBaseMetaTileEntity, aBaseMetaTileEntity, j, i, (byte) 64, (byte) 1, (byte) 64, (byte) 1); - } - } - } - } - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java deleted file mode 100644 index e96bd3391b..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ /dev/null @@ -1,1419 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gregtech.common.items.GT_MetaGenerated_Tool_01; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.item.base.BasicSpawnEgg; -import gtPlusPlus.core.item.base.dusts.BaseItemDustUnique; -import gtPlusPlus.core.item.base.dusts.decimal.BaseItemCentidust; -import gtPlusPlus.core.item.base.dusts.decimal.BaseItemDecidust; -import gtPlusPlus.core.item.base.plates.BaseItemPlate_OLD; -import gtPlusPlus.core.item.chemistry.AgriculturalChem; -import gtPlusPlus.core.item.chemistry.GenericChem; -import gtPlusPlus.core.item.chemistry.RocketFuels; -import gtPlusPlus.core.item.tool.staballoy.MultiPickaxeBase; -import gtPlusPlus.core.item.tool.staballoy.MultiSpadeBase; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.preloader.CORE_Preloader; -import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaTool; -import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_DustGeneration; -import net.minecraft.block.Block; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentData; -import net.minecraft.init.Items; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.Item; -import net.minecraft.item.Item.ToolMaterial; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; - -public class ItemUtils { - - public static ItemStack getSimpleStack(final Item x) { - return getSimpleStack(x, 1); - } - - public static ItemStack getSimpleStack(final Block x) { - return simpleMetaStack(Item.getItemFromBlock(x), 0, 1); - } - - - public static ItemStack getSimpleStack(final Block x, int i) { - if (i == 0) { - return getSimpleStack(x, i, 1); - } - - return getSimpleStack(x, 0, i); - } - - public static ItemStack getSimpleStack(final Block x, int meta, int i) { - return simpleMetaStack(Item.getItemFromBlock(x), meta, i); - } - - public static ItemStack getSimpleStack(final Item x, final int i) { - try { - final ItemStack r = new ItemStack(x, i); - return r.copy(); - } catch (final Throwable e) { - return null; - } - } - - public static ItemStack getSimpleStack(final ItemStack x, final int i) { - try { - final ItemStack r = x.copy(); - r.stackSize = i; - return r; - } catch (final Throwable e) { - return null; - } - } - - public static final int WILDCARD_VALUE = Short.MAX_VALUE; - - public static ItemStack getWildcardStack(final Item x) { - final ItemStack y = new ItemStack(x, 1, WILDCARD_VALUE); - return y; - } - - public static ItemStack getWildcardStack(final ItemStack x) { - final ItemStack y = ItemUtils.simpleMetaStack(x, WILDCARD_VALUE, 1); - return y; - } - - public static ItemStack getIC2Cell(final String S) { - final ItemStack moreTemp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell" + S, 1); - - if (moreTemp == null) { - final int cellID = 0; - final ItemStack temp = GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, cellID); - return temp != null ? temp : null; - } - - return moreTemp; - } - - public static ItemStack getIC2Cell(final int meta) { - final ItemStack temp = GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, meta); - return temp != null ? temp : null; - } - - public static ItemStack getEmptyCell() { - return getEmptyCell(1); - } - - public static ItemStack getEmptyCell(int i) { - if (ItemList.Cell_Empty.hasBeenSet()) { - return ItemList.Cell_Empty.get(i); - } - final ItemStack temp = GT_ModHandler.getModItem("IC2", "itemCellEmpty", i, 0); - return temp != null ? temp : null; - } - - public static void getItemForOreDict(final String FQRN, final String oreDictName, final String itemName, - final int meta) { - try { - Item em = null; - final Item em1 = getItemFromFQRN(FQRN); - // Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); - if (em1 != null) { - em = em1; - } - if (em != null) { - - final ItemStack metaStack = new ItemStack(em, 1, meta); - GT_OreDictUnificator.registerOre(oreDictName, metaStack); - - /* - * ItemStack itemStackWithMeta = new ItemStack(em,1,meta); - * GT_OreDictUnificator.registerOre(oreDictName, new - * ItemStack(itemStackWithMeta.getItem())); - */ - } - } catch (final NullPointerException e) { - Logger.ERROR(itemName + " not found. [NULL]"); - } - } - - public static void addItemToOreDictionary(ItemStack stack, final String oreDictName, boolean useWildcardMeta) { - if (useWildcardMeta) { - stack = ItemUtils.getWildcardStack(stack); - } - try { - OreDictionary.registerOre(oreDictName, stack); - } catch (final NullPointerException e) { - Logger.ERROR(ItemUtils.getItemName(stack) + " not registered. [NULL]"); - } - } - - public static void addItemToOreDictionary(final ItemStack stack, final String oreDictName) { - addItemToOreDictionary(stack, oreDictName, false); - } - - public static ItemStack getItemStackWithMeta(final boolean MOD, final String FQRN, final String itemName, - final int meta, final int itemstackSize) { - if (MOD) { - try { - Item em = null; - final Item em1 = getItemFromFQRN(FQRN); - // Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); - if (em1 != null) { - if (null == em) { - em = em1; - } - if (em != null) { - final ItemStack metaStack = new ItemStack(em, itemstackSize, meta); - return metaStack; - } - } - return null; - } catch (final NullPointerException e) { - Logger.ERROR(itemName + " not found. [NULL]"); - return null; - } - } - return null; - } - - public static ItemStack simpleMetaStack(final String FQRN, final int meta, final int itemstackSize) { - try { - Item em = null; - final Item em1 = getItemFromFQRN(FQRN); - // Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); - if (em1 != null) { - if (null == em) { - em = em1; - } - if (em != null) { - final ItemStack metaStack = new ItemStack(em, itemstackSize, meta); - return metaStack; - } - } - return null; - } catch (final NullPointerException e) { - Logger.ERROR(FQRN + " not found. [NULL]"); - return null; - } - } - - public static ItemStack simpleMetaStack(ItemStack simpleStack, int meta, int size) { - return simpleMetaStack(simpleStack.getItem(), meta, size); - } - - public static ItemStack simpleMetaStack(final Item item, int meta, int size) { - if (item == null) { - return null; - } - if (meta < 0 || meta > Short.MAX_VALUE) { - meta = 0; - } - if (size < 0 || size > 64) { - size = 1; - } - //Logger.INFO("Found Metastack: " + item.getUnlocalizedName() + ":" + meta); - //Logger.INFO(""+ReflectionUtils.getMethodName(0)); - //Logger.INFO(""+ReflectionUtils.getMethodName(1)); - //Logger.INFO(""+ReflectionUtils.getMethodName(2)); - //Logger.INFO(""+ReflectionUtils.getMethodName(3)); - //Logger.INFO(""+ReflectionUtils.getMethodName(4)); - final ItemStack metaStack = new ItemStack(item, size, meta); - return metaStack; - } - - public static ItemStack simpleMetaStack(final Block block, final int meta, final int size) { - return simpleMetaStack(Item.getItemFromBlock(block), meta, size); - } - - public static ItemStack getCorrectStacktype(final String fqrn, final int stackSize) { - final String oreDict = "ore:"; - ItemStack temp; - if (fqrn.toLowerCase().contains(oreDict.toLowerCase())) { - final String sanitizedName = fqrn.replace(oreDict, ""); - temp = ItemUtils.getItemStackFromFQRN(sanitizedName, stackSize); - return temp; - } - final String[] fqrnSplit = fqrn.split(":"); - String temp1; - String temp2; - temp1 = fqrnSplit[1]; - if (fqrnSplit.length < 3) { - temp2 = "0"; - } else { - temp2 = fqrnSplit[2]; - } - temp = ItemUtils.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, temp1, Integer.parseInt(temp2), stackSize); - return temp; - } - - public static ItemStack getCorrectStacktype(final Object item_Input, final int stackSize) { - if (item_Input instanceof String) { - return getItemStackOfAmountFromOreDictNoBroken((String) item_Input, stackSize); - } else if (item_Input instanceof ItemStack) { - return (ItemStack) item_Input; - } - return null; - } - - public static Item getItemFromFQRN(final String fqrn) // fqrn = fully qualified resource name - { - final String[] fqrnSplit = fqrn.split(":"); - return GameRegistry.findItem(fqrnSplit[0], fqrnSplit[1]); - } - - public static ItemStack getItemStackFromFQRN(final String fqrn, final int Size) // fqrn = fully qualified resource name - { - Logger.INFO("Trying to split string '"+fqrn+"'."); - final String[] fqrnSplit = fqrn.split(":"); - if (fqrnSplit.length < 2) { - return null; - } - else { - if (fqrnSplit.length == 2) { - Logger.INFO("Mod: "+fqrnSplit[0]+", Item: "+fqrnSplit[1]); - return GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size); - } - else if (fqrnSplit.length == 3 && fqrnSplit[2] != null && fqrnSplit[2].length() > 0) { - Logger.INFO("Mod: "+fqrnSplit[0]+", Item: "+fqrnSplit[1]+", Meta: "+fqrnSplit[2]); - ItemStack aStack = GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size); - int aMeta = Integer.parseInt(fqrnSplit[2]); - if (aStack != null && (aMeta >= 0 && aMeta <= Short.MAX_VALUE)){ - return ItemUtils.simpleMetaStack(aStack, aMeta, Size); - } - else { - Logger.INFO("Could not find instance of Item: "+fqrnSplit[1]); - - } - } - - } - return null; - } - - public static void generateSpawnEgg(final String entityModID, final String parSpawnName, final int colourEgg, - final int colourOverlay) { - final Item itemSpawnEgg = new BasicSpawnEgg(entityModID, parSpawnName, colourEgg, colourOverlay) - .setUnlocalizedName("spawn_egg_" + parSpawnName.toLowerCase()) - .setTextureName(CORE.MODID + ":spawn_egg"); - GameRegistry.registerItem(itemSpawnEgg, "spawnEgg" + parSpawnName); - } - - public static ItemStack[] validItemsForOreDict(final String oredictName) { - final List<?> validNames = MaterialUtils.oreDictValuesForEntry(oredictName); - final ItemStack[] inputs = new ItemStack[validNames.size()]; - for (int i = 0; i < validNames.size(); i++) { - inputs[i] = (ItemStack) validNames.get(i); - } - return inputs; - } - - public static ItemStack getItemStackOfAmountFromOreDict(String oredictName, final int amount) { - String mTemp = oredictName; - - if (oredictName.contains("-") || oredictName.contains("_")) { - mTemp = Utils.sanitizeString(mTemp, new char[] {'-', '_'}); - } - else { - mTemp = Utils.sanitizeString(mTemp); - } - - - - if (oredictName.contains("rod")) { - String s = "stick"+oredictName.substring(3); - oredictName = s; - } - - // Banned Materials and replacements for GT5.8 compat. - - if (oredictName.toLowerCase().contains("ingotclay")) { - return getSimpleStack(Items.clay_ball, amount); - } - - if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { - if (oredictName.toLowerCase().contains("rutile")) { - mTemp = oredictName.replace("Rutile", "Titanium"); - } - if (oredictName.toLowerCase().contains("vanadiumsteel")) { - mTemp = oredictName.replace("VanadiumSteel", "StainlessSteel"); - } - } - final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(mTemp); - if (!oreDictList.isEmpty()) { - final ItemStack returnValue = oreDictList.get(0).copy(); - returnValue.stackSize = amount; - return returnValue; - } - Logger.INFO("Failed to find `" + oredictName + "` in OD."); - return getErrorStack(amount, oredictName+" x"+amount); - //return getItemStackOfAmountFromOreDictNoBroken(mTemp, amount); - } - - public static ItemStack getItemStackOfAmountFromOreDictNoBroken(String oredictName, final int amount) { - if (CORE_Preloader.DEBUG_MODE) { - Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(1)); - Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(2)); - Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(3)); - Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(4)); - Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(5)); - } - - try { - - if (oredictName.contains("-") || oredictName.contains("_")) { - oredictName = Utils.sanitizeString(oredictName, new char[] {'-', '_'}); - } - else { - oredictName = Utils.sanitizeString(oredictName); - } - - // Adds a check to grab dusts using GT methodology if possible. - ItemStack returnValue = null; - if (oredictName.toLowerCase().contains("dust")) { - final String MaterialName = oredictName.toLowerCase().replace("dust", ""); - final Materials m = Materials.get(MaterialName); - if (m != null && m != Materials._NULL) { - returnValue = getGregtechDust(m, amount); - if (checkForInvalidItems(returnValue)) { - return returnValue; - } - } - } - if (returnValue == null) { - returnValue = getItemStackOfAmountFromOreDict(oredictName, amount); - if (ItemUtils.checkForInvalidItems(returnValue)) { - return returnValue.copy(); - } - } - - Logger.RECIPE(oredictName + " was not valid."); - return null; - } catch (final Throwable t) { - return null; - } - } - - public static ItemStack getGregtechDust(final Materials material, final int amount) { - final ItemStack returnValue = GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L); - if (returnValue != null) { - if (ItemUtils.checkForInvalidItems(returnValue)) { - return returnValue.copy(); - } - } - Logger.WARNING(material + " was not valid."); - return null; - } - - // NullFormula - public static Item[] generateSpecialUseDusts(final String unlocalizedName, final String materialName, - final int Colour) { - return generateSpecialUseDusts(unlocalizedName, materialName, "NullFormula", Colour); - } - - public static Item[] generateSpecialUseDusts(final String unlocalizedName, final String materialName, - String mChemForm, final int Colour) { - final Item[] output = { - new BaseItemDustUnique("itemDust" + unlocalizedName, materialName, mChemForm, Colour, "Dust"), - new BaseItemDustUnique("itemDustSmall" + unlocalizedName, materialName, mChemForm, Colour, "Small"), - new BaseItemDustUnique("itemDustTiny" + unlocalizedName, materialName, mChemForm, Colour, "Tiny") }; - - //Generate Shaped/Shapeless Recipes - - final ItemStack normalDust = ItemUtils.getSimpleStack(output[0]); - final ItemStack smallDust = ItemUtils.getSimpleStack(output[1]); - final ItemStack tinyDust = ItemUtils.getSimpleStack(output[2]); - - CORE.RA.addpackagerRecipe(ItemList.Schematic_Dust.get(0), smallDust, tinyDust, normalDust); - - if (ItemUtils.checkForInvalidItems(tinyDust) && ItemUtils.checkForInvalidItems(normalDust)) { - if (RecipeUtils.addShapedRecipe( - tinyDust, tinyDust, tinyDust, - tinyDust, tinyDust, tinyDust, - tinyDust, tinyDust, tinyDust, - normalDust)){ - Logger.WARNING("9 Tiny dust to 1 Dust Recipe: "+materialName+" - Success"); - } - else { - Logger.WARNING("9 Tiny dust to 1 Dust Recipe: "+materialName+" - Failed"); - } - - if (RecipeUtils.addShapedRecipe( - normalDust, null, null, - null, null, null, - null, null, null, - ItemUtils.getSimpleStack(tinyDust, 9))){ - Logger.WARNING("9 Tiny dust from 1 Recipe: "+materialName+" - Success"); - } - else { - Logger.WARNING("9 Tiny dust from 1 Recipe: "+materialName+" - Failed"); - } - } - - if (ItemUtils.checkForInvalidItems(smallDust) && ItemUtils.checkForInvalidItems(normalDust)) { - if (RecipeUtils.addShapedRecipe( - smallDust, smallDust, null, - smallDust, smallDust, null, - null, null, null, - normalDust)){ - Logger.WARNING("4 Small dust to 1 Dust Recipe: "+materialName+" - Success"); - } - else { - Logger.WARNING("4 Small dust to 1 Dust Recipe: "+materialName+" - Failed"); - } - if (RecipeUtils.addShapedRecipe( - null, normalDust, null, - null, null, null, - null, null, null, - ItemUtils.getSimpleStack(smallDust, 4))){ - Logger.WARNING("4 Small dust from 1 Dust Recipe: "+materialName+" - Success"); - } - else { - Logger.WARNING("4 Small dust from 1 Dust Recipe: "+materialName+" - Failed"); - } - } - - return output; - } - - public static Item generateSpecialUsePlate(final String internalName, final String displayName, final short[] rgb, - final int radioactivity) { - return generateSpecialUsePlate(internalName, displayName, Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]), - radioactivity); - } - - public static Item generateSpecialUsePlate(final String internalName, final String displayName, - final String mFormula, final short[] rgb, final int radioactivity) { - return generateSpecialUsePlate(internalName, displayName, mFormula, Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]), - radioactivity); - } - - public static Item generateSpecialUsePlate(final String internalName, final String displayName, final int rgb, - final int radioactivity) { - return new BaseItemPlate_OLD(internalName, displayName, rgb, radioactivity); - } - - public static Item generateSpecialUsePlate(final String internalName, final String displayName, - final String mFormula, final int rgb, final int radioactivity) { - return new BaseItemPlate_OLD(internalName, displayName, mFormula, rgb, radioactivity); - } - - - public static Item[] generateSpecialUseDusts(final Material material, final boolean onlyLargeDust) { - return generateSpecialUseDusts(material, onlyLargeDust, false); - } - - public static Item[] generateSpecialUseDusts(final Material material, final boolean onlyLargeDust, final boolean disableExtraRecipes) { - final String materialName = material.getLocalizedName(); - final String unlocalizedName = Utils.sanitizeString(materialName); - final int Colour = material.getRgbAsHex(); - final String aChemForm = material.vChemicalFormula; - final boolean isChemFormvalid = (aChemForm != null && aChemForm.length() > 0); - Item[] output = null; - if (onlyLargeDust == false) { - output = new Item[] { new BaseItemDustUnique("itemDust" + unlocalizedName, materialName, isChemFormvalid ? aChemForm : "", Colour, "Dust"), - new BaseItemDustUnique("itemDustSmall" + unlocalizedName, materialName, isChemFormvalid ? aChemForm : "", Colour, "Small"), - new BaseItemDustUnique("itemDustTiny" + unlocalizedName, materialName, isChemFormvalid ? aChemForm : "", Colour, "Tiny") }; - } else { - output = new Item[] { new BaseItemDustUnique("itemDust" + unlocalizedName, materialName, Colour, "Dust") }; - } - - new RecipeGen_DustGeneration(material, disableExtraRecipes); - - return output; - } - - public static MultiPickaxeBase generateMultiPick(final boolean GT_Durability, final Materials material) { - final ToolMaterial customMaterial = Utils.generateToolMaterialFromGT(material); - final int enchantLevel = material.mEnchantmentToolsLevel; - final Object enchant = new Pair(material.mEnchantmentTools, enchantLevel); - return generateMultiPick(GT_Durability, customMaterial, material.mDefaultLocalName, material.mDurability, - material.mRGBa, enchant); - } - - public static MultiPickaxeBase generateMultiPick(final Material material) { - final ToolMaterial customMaterial = Utils.generateToolMaterial(material); - return generateMultiPick(true, customMaterial, material.getLocalizedName(), (int) material.vDurability, - material.getRGBA(), null); - } - - public static MultiPickaxeBase generateMultiPick(final boolean GT_Durability, final ToolMaterial customMaterial, - final String name, final int durability, final short[] rgba, final Object enchantment) { - Logger.WARNING("Generating a Multi-Pick out of " + name); - final short[] rgb = rgba; - int dur = customMaterial.getMaxUses(); - Logger.WARNING("Determined durability for " + name + " is " + dur); - if (GT_Durability) { - dur = durability * 100; - Logger.WARNING("Using gregtech durability value, " + name + " is now " + dur + "."); - } else if (dur <= 0) { - dur = durability; - Logger.WARNING("Determined durability too low, " + name + " is now " + dur - + " based on the GT material durability."); - } - if (dur <= 0) { - Logger.WARNING("Still too low, " + name + " will now go unused."); - return null; - } - - Object enchant; - if (enchantment != null) { - if (enchantment instanceof Pair) { - enchant = enchantment; - } - } else { - enchant = null; - } - - final MultiPickaxeBase MP_Redstone = new MultiPickaxeBase(name + " Multipick", (customMaterial), dur, - Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]), enchantment); - - if (MP_Redstone.isValid) { - return MP_Redstone; - } - Logger.WARNING("Pickaxe was not valid."); - return null; - } - - public static MultiSpadeBase generateMultiShovel(final boolean GT_Durability, final Materials material) { - final ToolMaterial customMaterial = Utils.generateToolMaterialFromGT(material); - return generateMultiShovel(GT_Durability, customMaterial, material.mDefaultLocalName, material.mDurability, - material.mRGBa); - } - - public static MultiSpadeBase generateMultiShovel(final Material material) { - final ToolMaterial customMaterial = Utils.generateToolMaterial(material); - return generateMultiShovel(true, customMaterial, material.getLocalizedName(), (int) material.vDurability, - material.getRGBA()); - } - - public static MultiSpadeBase generateMultiShovel(final boolean GT_Durability, final ToolMaterial customMaterial, - final String name, final int durability, final short[] rgba) { - Logger.WARNING("Generating a Multi-Spade out of " + name); - final short[] rgb = rgba; - int dur = customMaterial.getMaxUses(); - Logger.WARNING("Determined durability for " + name + " is " + dur); - if (GT_Durability) { - dur = durability * 100; - Logger.WARNING("Using gregtech durability value, " + name + " is now " + dur + "."); - } else if (dur <= 0) { - dur = durability; - Logger.WARNING("Determined durability too low, " + name + " is now " + dur - + " based on the GT material durability."); - } - if (dur <= 0) { - Logger.WARNING("Still too low, " + name + " will now go unused."); - return null; - } - final MultiSpadeBase MP_Redstone = new MultiSpadeBase(name + " Multispade", (customMaterial), dur, - Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2])); - - if (MP_Redstone.isValid) { - return MP_Redstone; - } - return null; - } - - public static BaseItemDecidust generateDecidust(final Materials material) { - if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null) { - final Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material); - if (placeholder != null) { - generateDecidust(placeholder); - } - } - return null; - } - - public static BaseItemDecidust generateDecidust(final Material material) { - if ((material.getDust(1) != null) && MaterialUtils.hasValidRGBA(material.getRGBA())) { - final BaseItemDecidust Decidust = new BaseItemDecidust(material); - return Decidust; - } - return null; - } - - public static BaseItemCentidust generateCentidust(final Materials material) { - if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null) { - final Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material); - if (placeholder != null) { - generateCentidust(placeholder); - } - } - return null; - } - - public static BaseItemCentidust generateCentidust(final Material material) { - if ((material.getDust(1) != null) && MaterialUtils.hasValidRGBA(material.getRGBA())) { - final BaseItemCentidust Centidust = new BaseItemCentidust(material); - return Centidust; - } - return null; - } - - public static boolean isRadioactive(final String materialName) { - int sRadiation = 0; - if (materialName.toLowerCase().contains("uranium")) { - sRadiation = 2; - } else if (materialName.toLowerCase().contains("plutonium")) { - sRadiation = 4; - } else if (materialName.toLowerCase().contains("thorium")) { - sRadiation = 1; - } - if (sRadiation >= 1) { - return true; - } - return false; - } - - public static int getRadioactivityLevel(final String materialName) { - int sRadiation = 0; - if (materialName.toLowerCase().contains("uranium")) { - sRadiation = 2; - } else if (materialName.toLowerCase().contains("plutonium")) { - sRadiation = 4; - } else if (materialName.toLowerCase().contains("thorium")) { - sRadiation = 1; - } - return sRadiation; - } - - public static String getArrayStackNames(ArrayList<?> aStack) { - Object aType = aStack.get(0); - if (aType instanceof FluidStack) { - FluidStack[] aItems = new FluidStack[aStack.size()]; - for (int i=0;i<aItems.length;i++) { - aItems[i] = (FluidStack) aStack.get(i); - } - return getArrayStackNames(aItems); - } - if (aType instanceof ItemStack) { - ItemStack[] aItems = new ItemStack[aStack.size()]; - for (int i=0;i<aItems.length;i++) { - aItems[i] = (ItemStack) aStack.get(i); - } - return getArrayStackNames(aItems); - } - return ""; - } - - public static String getArrayStackNames(final AutoMap<?> aStack) { - Object aType = aStack.get(0); - if (aType instanceof FluidStack) { - FluidStack[] aItems = new FluidStack[aStack.size()]; - for (int i=0;i<aItems.length;i++) { - aItems[i] = (FluidStack) aStack.get(i); - } - return getArrayStackNames(aItems); - } - if (aType instanceof ItemStack) { - ItemStack[] aItems = new ItemStack[aStack.size()]; - for (int i=0;i<aItems.length;i++) { - aItems[i] = (ItemStack) aStack.get(i); - } - return getArrayStackNames(aItems); - } - return ""; - } - - public static String getArrayStackNames(final FluidStack[] aStack) { - String itemNames = "Fluid Array: "; - for (final FluidStack alph : aStack) { - if (alph != null) { - final String temp = itemNames; - itemNames = temp + ", " + alph.getLocalizedName() + " x" + alph.amount; - } else { - final String temp = itemNames; - itemNames = temp + ", " + "null" + " x" + "0"; - } - } - return itemNames; - } - - public static String getArrayStackNames(final ItemStack[] aStack) { - String itemNames = ""; - int aPos = 0; - for (final ItemStack alph : aStack) { - if (alph == null) { - continue; - } - if (alph != null) { - final String temp = itemNames; - itemNames = temp + (aPos > 0 ? ", " : "") + alph.getDisplayName() + " x" + alph.stackSize; - aPos++; - } - } - return itemNames; - } - - public static String[] getArrayStackNamesAsArray(final ItemStack[] aStack) { - final String[] itemNames = aStack == null ? new String[] {} : new String[aStack.length]; - if (aStack != null){ - Logger.INFO(""+aStack.length); - } - - if (aStack == null || aStack.length < 1) { - return itemNames; - } - - int arpos = 0; - for (final ItemStack alph : aStack) { - if (alph == null) { - continue; - } - try { - itemNames[arpos] = alph.getDisplayName(); - arpos++; - } - catch (Throwable t) { - t.printStackTrace(); - } - } - return itemNames; - - } - - public static String getFluidArrayStackNames(final FluidStack[] aStack) { - String itemNames = "Fluid Array: "; - for (final FluidStack alph : aStack) { - final String temp = itemNames; - itemNames = temp + ", " + alph.getFluid().getName() + " x" + alph.amount; - } - return itemNames; - - } - - public static ItemStack getGregtechCircuit(final int Meta) { - return ItemUtils.getItemStackWithMeta(LoadedMods.Gregtech, "gregtech:gt.integrated_circuit", "Gregtech Circuit", - Meta, 0); - } - - public static ItemStack[] getBlockDrops(final ArrayList<ItemStack> blockDrops) { - if (blockDrops == null) { - return null; - } - if (blockDrops.isEmpty()) { - return null; - } - final ItemStack[] outputs = new ItemStack[blockDrops.size()]; - short forCounter = 0; - for (final ItemStack I : blockDrops) { - outputs[forCounter++] = I; - } - return outputs; - } - - private static Map<Item, String> mModidCache = new HashMap<Item, String>(); - - private static String getModId(final Item item) { - if (mModidCache.containsKey(item)) { - return mModidCache.get(item); - } - String value = ""; - try { - final GameRegistry.UniqueIdentifier id = GameRegistry.findUniqueIdentifierFor(item); - if (id != null) { - final String modname = (id.modId == null ? id.name : id.modId); - value = ((id == null) || id.modId.equals("")) ? "minecraft" : modname; - } - } catch (final Throwable t) { - try { - final UniqueIdentifier t2 = GameRegistry.findUniqueIdentifierFor(Block.getBlockFromItem(item)); - if (t2 != null) { - final String modname = (t2.modId == null ? t2.name : t2.modId); - value = ((t2 == null) || t2.modId.equals("")) ? "minecraft" : modname; - } - } catch (final Throwable t3) { - t3.printStackTrace(); - value = "bad modid"; - } - } - if (!mModidCache.containsKey(item)) { - return mModidCache.put(item, value); - } - return value; - } - - public static String getModId(final ItemStack key) { - return getModId(key.getItem()); - } - - // Take 2 - GT/GT++ Dusts - public static ItemStack getGregtechDust(final String oredictName, final int amount) { - final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); - if (!oreDictList.isEmpty()) { - ItemStack returnvalue; - for (int xrc = 0; xrc < oreDictList.size(); xrc++) { - final String modid = getModId(oreDictList.get(xrc).getItem()); - if (modid != null && (modid.equals("gregtech") || modid.equals(CORE.MODID))) { - returnvalue = oreDictList.get(xrc).copy(); - returnvalue.stackSize = amount; - return returnvalue; - } - } - } - return getNonTinkersDust(oredictName, amount); - } - - // Anything But Tinkers Dust - public static ItemStack getNonTinkersDust(final String oredictName, final int amount) { - final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); - if (!oreDictList.isEmpty()) { - ItemStack returnvalue; - for (int xrc = 0; xrc < oreDictList.size(); xrc++) { - final String modid = getModId(oreDictList.get(xrc).getItem()); - if (modid != null && !modid.equals("tconstruct")) { - returnvalue = oreDictList.get(xrc).copy(); - returnvalue.stackSize = amount; - return returnvalue; - } - } - } - // If only Tinkers dust exists, bow down and just use it. - return getItemStackOfAmountFromOreDictNoBroken(oredictName, amount); - } - - @Deprecated - public static ItemStack getGregtechOreStack(OrePrefixes mPrefix, Materials mMat, int mAmount) { - - ItemStack aTemp = getOrePrefixStack(mPrefix, mMat, mAmount); - if (aTemp != null) { - return aTemp; - } - - String mName = MaterialUtils.getMaterialName(mMat); - - String mItemName = mPrefix.name() + mName; - // Utils.LOG_INFO("[Component Maker] Trying to get "+mItemName+"."); - ItemStack gregstack = ItemUtils.getItemStackOfAmountFromOreDictNoBroken(mItemName, mAmount); - if (gregstack == null) { - // Utils.LOG_INFO("[Component Maker] Failed to get "+mItemName+"."); - return null; - } - // Utils.LOG_INFO("[Component Maker] Found "+mItemName+"."); - return (gregstack); - } - - public static ItemStack getOrePrefixStack(OrePrefixes mPrefix, Material mMat, int mAmount) { - - String mName = Utils.sanitizeString(mMat.getLocalizedName()); - - String mItemName = mPrefix.name() + mName; - ItemStack gregstack = ItemUtils.getItemStackOfAmountFromOreDictNoBroken(mItemName, mAmount); - if (gregstack == null) { - return null; - } - return (gregstack); - } - - public static ItemStack getOrePrefixStack(OrePrefixes mPrefix, Materials mMat, int mAmount) { - if (mPrefix == OrePrefixes.rod) { - mPrefix = OrePrefixes.stick; - } - ItemStack aGtStack = GT_OreDictUnificator.get(mPrefix, mMat, mAmount); - if (aGtStack == null) { - Logger.INFO( - "Failed to find `" + mPrefix + MaterialUtils.getMaterialName(mMat) + "` in OD. [Prefix Search]"); - return getErrorStack(mAmount, (mPrefix.toString()+MaterialUtils.getMaterialName(mMat)+" x"+mAmount)); - } else { - return aGtStack; - } - } - - public static ItemStack getErrorStack(int mAmount) { - return getErrorStack(mAmount, null); - } - - public static ItemStack getErrorStack(int mAmount, String aName) { - ItemStack g = getSimpleStack(ModItems.AAA_Broken, 1); - if (aName != null) { - //NBTUtils.setString(g, "Lore", EnumChatFormatting.RED+aName); - NBTUtils.setBookTitle(g, EnumChatFormatting.RED+aName); - //NBTUtils.setBookTitle(g, EnumChatFormatting.YELLOW+"Maybe Alkalus should know about this"); - } - return g; - } - - public static ItemStack[] getStackOfAllOreDictGroup(String oredictname) { - final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictname); - if (!oreDictList.isEmpty()) { - final ItemStack[] returnValues = new ItemStack[oreDictList.size()]; - for (int i = 0; i < oreDictList.size(); i++) { - if (oreDictList.get(i) != null) { - returnValues[i] = oreDictList.get(i); - } - } - return returnValues.length > 0 ? returnValues : null; - } else { - return null; - } - } - - public static boolean registerFuel(ItemStack aBurnable, int burn) { - return CORE.burnables.add(new Pair<Integer, ItemStack>(burn, aBurnable)); - } - - public static String getLocalizedNameOfBlock(BlockPos pos) { - Block block = pos.world.getBlock(pos.xPos, pos.yPos, pos.zPos); - int metaData = pos.world.getBlockMetadata(pos.xPos, pos.yPos, pos.zPos); - return LangUtils.getLocalizedNameOfBlock(block, metaData); - } - - public static boolean checkForInvalidItems(ItemStack mInput) { - return checkForInvalidItems(new ItemStack[] { mInput }); - } - - public static boolean checkForInvalidItems(ItemStack[] mInput) { - return checkForInvalidItems(mInput, new ItemStack[] {}); - } - - /** - * - * @param mInputs - * @return {@link Boolean} - True if {@link ItemStack}[] only contains valid - * items. - */ - public static boolean checkForInvalidItems(ItemStack[] mInputs, ItemStack[] mOutputs) { - if (mInputs == null || mOutputs == null) { - return false; - } - - if (mInputs.length > 0) { - for (ItemStack stack : mInputs) { - if (stack != null) { - if (stack.getItem() != null) { - if (stack.getItem() == ModItems.AAA_Broken - || stack.getItem().getClass() == ModItems.AAA_Broken.getClass()) { - return false; - } else if (stack.getItem() == ModItems.ZZZ_Empty - || stack.getItem().getClass() == ModItems.ZZZ_Empty.getClass()) { - return false; - } else { - continue; - } - } else { - continue; - } - } else { - return false; - } - } - } - if (mOutputs.length > 0) { - for (ItemStack stack : mOutputs) { - if (stack != null) { - if (stack.getItem() != null) { - if (stack.getItem() == ModItems.AAA_Broken - || stack.getItem().getClass() == ModItems.AAA_Broken.getClass()) { - return false; - } else if (stack.getItem() == ModItems.ZZZ_Empty - || stack.getItem().getClass() == ModItems.ZZZ_Empty.getClass()) { - return false; - } else { - continue; - } - } else { - continue; - } - } else { - return false; - } - } - } - - return true; - } - - - public static IInventory organiseInventory(IInventory aInputInventory) { - ItemStack[] p = new ItemStack[aInputInventory.getSizeInventory()]; - for (int o = 0; o < aInputInventory.getSizeInventory(); o++) { - p[o] = aInputInventory.getStackInSlot(o); - } - //ItemStack[] g = organiseInventory(p); - - IInventory aTemp = aInputInventory; - for (int i = 0; i < p.length; ++i) { - for (int j = i + 1; j < p.length; ++j) { - if (p[j] != null && (p[i] == null - || GT_Utility.areStacksEqual(p[i], p[j]))) { - GT_Utility.moveStackFromSlotAToSlotB(aTemp, aTemp, j, i, (byte) 64, (byte) 1, (byte) 64, (byte) 1); - } - } - } - - /* - for (int o = 0; o < aInputInventory.getSizeInventory(); o++) { - aTemp.setInventorySlotContents(o, g[o]); - }*/ - return aTemp; - } - - - public static ItemStack[] organiseInventory(ItemStack[] aInputs) { - - //Update Slots - int aInvSize = aInputs.length; - ItemStack[] newArray = new ItemStack[aInvSize]; - - - //Try merge stacks - for (int i = 0; i < aInvSize; i++) { - for (int i2 = 0; i2 < aInvSize; i2++) { - if (i != i2) { - ItemStack[] t1 = new ItemStack[] {aInputs[i], aInputs[i2]}; - if (t1[0] == null || t1[1] == null) { - continue; - } - else if (!GT_Utility.areStacksEqual(t1[0], t1[1])) { - continue; - } - //Try Merge - else { - - if (GT_Utility.areStacksEqual(t1[0], t1[1])) { - while ((t1[0].stackSize < 64 && t1[1].stackSize > 0)) { - t1[0].stackSize++; - t1[1].stackSize--; - if (t1[1].stackSize <= 0) { - t1[1] = null; - break; - } - if (t1[0].stackSize == 64) { - break; - } - } - newArray[i] = t1[1]; - newArray[i2] = t1[0]; - } - } - } - } - } - - ItemStack[] newArray2 = new ItemStack[aInvSize]; - - //Move nulls to end - int count2 = 0; - for (int i = 0; i < aInvSize; i++) - if (newArray[i] != null) - newArray2[count2++] = newArray[i]; - while (count2 < aInvSize) - newArray2[count2++] = null; - - return newArray2; - - - } - - public static String getFluidName(FluidStack aFluid) { - return aFluid != null ? aFluid.getFluid().getLocalizedName(aFluid) : "NULL"; - } - - public static String getFluidName(Fluid aFluid) { - return aFluid != null ? aFluid.getLocalizedName() : "NULL"; - } - - public static String getItemName(ItemStack aStack) { - if (aStack == null) { - return "ERROR - Empty Stack"; - } - String aDisplay = null; - try { - aDisplay = ("" + StatCollector - .translateToLocal(aStack.getItem().getUnlocalizedNameInefficiently(aStack) + ".name")) - .trim(); - if (aStack.hasTagCompound()) { - if (aStack.stackTagCompound != null && aStack.stackTagCompound.hasKey("display", 10)) { - NBTTagCompound nbttagcompound = aStack.stackTagCompound.getCompoundTag("display"); - - if (nbttagcompound.hasKey("Name", 8)) { - aDisplay = nbttagcompound.getString("Name"); - } - } - } - } catch (Throwable t) { - - } - if (aDisplay == null || aDisplay.length() <= 0) { - aDisplay = aStack.getUnlocalizedName() + ":" + aStack.getItemDamage(); - } else { - aDisplay += " | Meta: " + aStack.getItemDamage(); - } - return aDisplay; - } - - public static String getUnlocalizedItemName(ItemStack aStack) { - if (aStack == null) { - return "ERROR.Empty.Stack"; - } - String aDisplay = null; - try { - aDisplay = (aStack.getUnlocalizedName()).trim(); - } - catch (Throwable t) { - aDisplay = aStack.getItem().getUnlocalizedName(); - } - if (aDisplay == null || aDisplay.length() <= 0) { - aDisplay = aStack.getItem().getUnlocalizedNameInefficiently(aStack); - } - return aDisplay; - } - - public static boolean isItemGregtechTool(ItemStack aStack) { - if (aStack == null) { - return false; - } - final Item mItem = aStack.getItem(); - final Item aSkookum = ItemUtils.getItemFromFQRN("miscutils:gt.plusplus.metatool.01"); - final Class aSkookClass = aSkookum.getClass(); - if (aSkookClass.isInstance(mItem) || mItem instanceof GT_MetaGenerated_Tool_01 || mItem instanceof MetaGeneratedGregtechTools || mItem instanceof Gregtech_MetaTool || mItem == aSkookum) { - return true; - } - return false; - } - - public static boolean isToolWrench(ItemStack aWrench) { - if (isItemGregtechTool(aWrench) && (aWrench.getItemDamage() == 16 || aWrench.getItemDamage() == 120 || aWrench.getItemDamage() == 122 || aWrench.getItemDamage() == 124 || aWrench.getItemDamage() == 7734)) { - return true; - } - return false; - } - - public static boolean isToolMallet(ItemStack aMallet) { - if (isItemGregtechTool(aMallet) && (aMallet.getItemDamage() == 14)) { - return true; - } - return false; - } - - public static boolean isToolScrewdriver(ItemStack aScrewdriver) { - if (isItemGregtechTool(aScrewdriver) && (aScrewdriver.getItemDamage() == 22 || aScrewdriver.getItemDamage() == 150)) { - return true; - } - return false; - } - - public static boolean isToolCrowbar(ItemStack aCrowbar) { - if (isItemGregtechTool(aCrowbar) && (aCrowbar.getItemDamage() == 20)) { - return true; - } - return false; - } - - public static boolean isToolWirecutters(ItemStack aWirecutters) { - if (isItemGregtechTool(aWirecutters) && (aWirecutters.getItemDamage() == 26)) { - return true; - } - return false; - } - - public static boolean isToolHammer(ItemStack aHammer) { - if (isItemGregtechTool(aHammer) && (aHammer.getItemDamage() == 12 || aHammer.getItemDamage() == 7734)) { - return true; - } - return false; - } - - public static boolean isToolSolderingIron(ItemStack aSoldering) { - if (isItemGregtechTool(aSoldering) && (aSoldering.getItemDamage() == 160)) { - return true; - } - return false; - } - - public static ItemStack[] cleanItemStackArray(ItemStack[] input) { - int aArraySize = input.length; - ItemStack[] aOutput = new ItemStack[aArraySize]; - AutoMap<ItemStack> aCleanedItems = new AutoMap<ItemStack>(); - for (ItemStack checkStack : input) { - if (ItemUtils.checkForInvalidItems(checkStack)) { - aCleanedItems.put(checkStack); - } - } - for (int i=0;i<aArraySize;i++) { - ItemStack aMappedStack = aCleanedItems.get(i); - if (aMappedStack != null){ - aOutput[i] = aMappedStack; - } - } - return aOutput; - } - - public static ItemStack getEnchantedBook(Enchantment aEnch, int aLevel) { - return enchantItem(new ItemStack(Items.enchanted_book), aEnch, aLevel); - } - - public static ItemStack enchantItem(ItemStack aStack, Enchantment aEnch, int aLevel) { - Items.enchanted_book.addEnchantment(aStack, new EnchantmentData(aEnch, aLevel)); - return aStack; - } - - public static boolean doesOreDictHaveEntryFor(String string) { - return OreDictUtils.containsValidEntries(string); - } - - public static void hideItemFromNEI(ItemStack aItemToHide) { - codechicken.nei.api.API.hideItem(aItemToHide); - } - - public static ItemStack getNullStack() { - return GT_Values.NI; - } - - public static ItemStack depleteStack(ItemStack aStack) { - return depleteStack(aStack, 1); - } - - public static ItemStack depleteStack(ItemStack aStack, int aAmount) { - final int cap = aStack.stackSize; - if (cap >= 1 && cap >= aAmount) { - ItemStack aDepStack = aStack.copy(); - aDepStack.stackSize = (MathUtils.balance((aDepStack.stackSize - 1), 0, 64)); - if (aDepStack.stackSize > 0) { - return aDepStack; - } - } - return getNullStack(); - } - - public static boolean isControlCircuit(ItemStack aStack) { - if (aStack != null) { - Item aItem = aStack.getItem(); - if (aItem == CI.getNumberedBioCircuit(0).getItem() || aItem == CI.getNumberedCircuit(0).getItem() || aItem == CI.getNumberedAdvancedCircuit(0).getItem()) { - return true; - } - } - return false; - } - - public static boolean isCatalyst(ItemStack aStack) { - if (GT_Utility.areStacksEqual(aStack, RocketFuels.Formaldehyde_Catalyst_Stack, true)) { - return true; - } - if (GT_Utility.areStacksEqual(aStack, GenericChem.mBlueCatalyst, true)) { - return true; - } - if (GT_Utility.areStacksEqual(aStack, GenericChem.mBrownCatalyst, true)) { - return true; - } - if (GT_Utility.areStacksEqual(aStack, GenericChem.mOrangeCatalyst, true)) { - return true; - } - if (GT_Utility.areStacksEqual(aStack, GenericChem.mPurpleCatalyst, true)) { - return true; - } - if (GT_Utility.areStacksEqual(aStack, GenericChem.mRedCatalyst, true)) { - return true; - } - if (GT_Utility.areStacksEqual(aStack, GenericChem.mYellowCatalyst, true)) { - return true; - } - if (GT_Utility.areStacksEqual(aStack, GenericChem.mPinkCatalyst, true)) { - return true; - } - if (GT_Utility.areStacksEqual(aStack, AgriculturalChem.mGreenCatalyst, true)) { - return true; - } - return false; - } - - public static boolean isMillingBall(ItemStack aStack) { - if (GT_Utility.areStacksEqual(aStack, GenericChem.mMillingBallAlumina, true)) { - return true; - } - if (GT_Utility.areStacksEqual(aStack, GenericChem.mMillingBallSoapstone, true)) { - return true; - } - return false; - } - - public static String getLocalizedNameOfBlock(Block aBlock, int aMeta) { - return LangUtils.getLocalizedNameOfBlock(aBlock, aMeta); - } - - - - public static boolean doesItemListEntryExist(String string) { - ItemList[] aListValues = ItemList.class.getEnumConstants(); - for (ItemList aItem : aListValues) { - if (aItem != null) { - if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) { - return true; - } - } - } - return false; - } - - public static ItemList getValueOfItemList(String string, ItemList aOther) { - ItemList[] aListValues = ItemList.class.getEnumConstants(); - for (ItemList aItem : aListValues) { - if (aItem != null) { - if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) { - return aItem; - } - } - } - Logger.INFO("Tried to obtain '"+string+"' from the GT ItemList, however it does not exist."); - if (aOther != null) { - Logger.INFO("Using fallback option instead - "+aOther.name()); - } - return aOther; - } - - public static ItemStack getValueOfItemList(String string, int aAmount, ItemList aOther) { - return getValueOfItemList(string, aOther).get(aAmount); - } - - public static ItemStack getValueOfItemList(String string, int aAmount, ItemStack aOther) { - ItemList[] aListValues = ItemList.class.getEnumConstants(); - for (ItemList aItem : aListValues) { - if (aItem != null) { - if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) { - return aItem.get(aAmount); - } - } - } - Logger.INFO("Tried to obtain '"+string+"' from the GT ItemList, however it does not exist."); - if (aOther != null) { - Logger.INFO("Using fallback option instead - "+ItemUtils.getItemName(aOther)); - } - return aOther; - } - - public static boolean areItemsEqual(ItemStack aStack1, ItemStack aStack2) { - return areItemsEqual(aStack1, aStack2, true); - } - - public static boolean areItemsEqual(ItemStack aStack1, ItemStack aStack2, boolean aIgnoreNBT) { - return GT_Utility.areStacksEqual(aStack1, aStack2, aIgnoreNBT); - } - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java deleted file mode 100644 index 0b24e962af..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java +++ /dev/null @@ -1,150 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - -import cpw.mods.fml.common.registry.LanguageRegistry; -import gregtech.api.util.GT_LanguageManager; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.StatCollector; - -public class LangUtils { - - - public static boolean rewriteEntryForLanguageRegistry(String aKey, String aNewValue){ - return rewriteEntryForLanguageRegistry("en_US", aKey, aNewValue); - } - - @SuppressWarnings("unchecked") - public static boolean rewriteEntryForLanguageRegistry(String aLang, String aKey, String aNewValue){ - LanguageRegistry aInstance = LanguageRegistry.instance(); - Field aModLanguageData = ReflectionUtils.getField(LanguageRegistry.class, "modLanguageData"); - if (aModLanguageData != null){ - Map<String,Properties> aProps = new HashMap<String, Properties>(); - Object aInstanceProps; - try { - aInstanceProps = aModLanguageData.get(aInstance); - if (aInstanceProps != null){ - aProps = (Map<String, Properties>) aInstanceProps; - Properties aLangProps = aProps.get(aLang); - if (aLangProps != null){ - if (aLangProps.containsKey(aKey)) { - aLangProps.remove(aKey); - aLangProps.put(aKey, aNewValue); - } - else { - aLangProps.put(aKey, aNewValue); - } - aProps.remove(aLang); - aProps.put(aLang, aLangProps); - ReflectionUtils.setField(aInstance, aModLanguageData, aProps); - } - } - } - catch (IllegalArgumentException | IllegalAccessException e) { - - } - } - return false; - } - - public static String trans(String aNr, String aEnglish) { - return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_GTPP_" + aNr, aEnglish, false); - } - - - - /** - * Quick Block Name Lookup that is friendly to servers and locale. - */ - private static final Map<String, String> mLocaleCache = new HashMap<String, String>(); - - public static String getLocalizedNameOfBlock(Block aBlock, int aMeta) { - if (aBlock != null) { - return getLocalizedNameOfItemStack(ItemUtils.simpleMetaStack(aBlock, aMeta, 1)); - } - return "Bad Block Name"; - } - - public static String getLocalizedNameOfItem(Item aItem, int aMeta) { - if (aItem != null) { - return getLocalizedNameOfItemStack(ItemUtils.simpleMetaStack(aItem, aMeta, 1)); - } - return "Bad Item Name"; - } - - public static String getLocalizedNameOfItemStack(ItemStack aStack) { - String aUnlocalized; - if (aStack != null) { - aUnlocalized = ItemUtils.getUnlocalizedItemName(aStack)+"."+aStack.getItemDamage()+".name"; - if (aUnlocalized == null || aUnlocalized.length() <= 0) { - return "Bad Locale Data"; - } - String mCacheKey = aUnlocalized; - if (mLocaleCache.containsKey(mCacheKey)) { - // Recache the key if it's invalid. - if (mLocaleCache.get(mCacheKey).toLowerCase().contains(".name") || mLocaleCache.get(mCacheKey).toLowerCase().contains("|")) { - mLocaleCache.remove(mCacheKey); - String mNew; - try { - mNew = ("" + StatCollector - .translateToLocal(aStack.getItem().getUnlocalizedNameInefficiently(aStack) + ".name")) - .trim(); - if (aStack.hasTagCompound()) { - if (aStack.stackTagCompound != null && aStack.stackTagCompound.hasKey("display", 10)) { - NBTTagCompound nbttagcompound = aStack.stackTagCompound.getCompoundTag("display"); - - if (nbttagcompound.hasKey("Name", 8)) { - mNew = nbttagcompound.getString("Name"); - } - } - } - } catch (Throwable t) { - mNew = "ERROR - Empty Stack"; - } - Logger.INFO("Re-caching "+mNew+" into locale cache. Key: "+mCacheKey); - mLocaleCache.put(mCacheKey, mNew); - } - Logger.INFO("Returning Cached Value. Key: "+mCacheKey); - return mLocaleCache.get(mCacheKey); - } - else { - String unlocalizedName = aStack.getItem().getUnlocalizedName(aStack); - Logger.INFO("Cached New Value. UnlocalName: "+unlocalizedName); - String blockName = StatCollector.translateToLocal(unlocalizedName + ".name"); - Logger.INFO("Cached New Value. TranslatedName: "+unlocalizedName); - if (blockName.toLowerCase().contains(".name") || blockName.toLowerCase().contains("|")) { - try { - blockName = ("" + StatCollector - .translateToLocal(aStack.getItem().getUnlocalizedNameInefficiently(aStack) + ".name")) - .trim(); - if (aStack.hasTagCompound()) { - if (aStack.stackTagCompound != null && aStack.stackTagCompound.hasKey("display", 10)) { - NBTTagCompound nbttagcompound = aStack.stackTagCompound.getCompoundTag("display"); - if (nbttagcompound.hasKey("Name", 8)) { - blockName = nbttagcompound.getString("Name"); - } - } - } - } catch (Throwable t) { - blockName = "ERROR - Empty Stack"; - } - } - mLocaleCache.put(mCacheKey, blockName); - Logger.INFO("Cached New Value. Key: "+mCacheKey); - return blockName; - } - - } - return "Bad ItemStack Name"; - } - - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java deleted file mode 100644 index 0323bf0161..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java +++ /dev/null @@ -1,523 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import gregtech.api.enums.Dyes; -import gregtech.api.enums.Element; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.TextureSet; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.TypeCounter; -import gtPlusPlus.core.client.CustomTextureSet.TextureSets; -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.item.base.BaseItemComponent.ComponentTypes; -import gtPlusPlus.core.item.base.plates.BaseItemPlateHeavy; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialStack; -import gtPlusPlus.core.material.state.MaterialState; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.data.EnumUtils; -import gtPlusPlus.core.util.data.StringUtils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -public class MaterialUtils { - - public static short firstID = 791; - - @SuppressWarnings({ "rawtypes", "unused" }) - private static Class[][] commonTypes = -{{Materials.class, int.class, TextureSet.class, float.class, int.class, - int.class, int.class, int.class, int.class, int.class, int.class, - String.class, int.class, int.class, int.class, int.class, boolean.class, - boolean.class, int.class, int.class, int.class, Dyes.class, int.class, - List.class , List.class}}; - - public static List<?> oreDictValuesForEntry(final String oredictName){ - List<?> oredictItemNames; - if(OreDictionary.doesOreNameExist(oredictName)){ - final List<ItemStack> oredictItems = OreDictionary.getOres(oredictName); - oredictItemNames = oredictItems; - return oredictItemNames; - } - return null; - } - - private static Map<String, Material> mGeneratedMaterialMap = new HashMap(); - - public static Material generateMaterialFromGtENUM(final Materials material){ - return generateMaterialFromGtENUM(material, null, null); - } - - public static Material generateMaterialFromGtENUM(final Materials material, TextureSet aCustomTextures){ - return generateMaterialFromGtENUM(material, null, aCustomTextures); - } - - public static Material generateMaterialFromGtENUM(final Materials material, short[] customRGB){ - return generateMaterialFromGtENUM(material, customRGB, null); - } - - public static Material generateMaterialFromGtENUM(final Materials material, short[] customRGB, TextureSet aCustomTextures){ - String aMaterialKey = getMaterialName(material).toLowerCase(); - if (mGeneratedMaterialMap.containsKey(aMaterialKey)) { - return mGeneratedMaterialMap.get(aMaterialKey); - } - - try { - @SuppressWarnings("deprecation") - String name = material.name(); - final short[] rgba = (customRGB == null ? material.mRGBa : customRGB); - final int melting = material.mMeltingPoint; - final int boiling = material.mBlastFurnaceTemp; - final long protons = material.getProtons(); - final long neutrons = material.getNeutrons(); - final boolean blastFurnace = material.mBlastFurnaceRequired; - Integer radioactivity = 0; - if (material.isRadioactive()){ - ItemStack aDustStack = ItemUtils.getOrePrefixStack(OrePrefixes.dust, material, 1); - radioactivity = aDustStack != null ? GT_Utility.getRadioactivityLevel(aDustStack) : 0; - if (radioactivity == 0) { - long aProtons = material.getProtons(); - radioactivity = (int) Math.min(Math.max((aProtons / 30), 1), 9); - } - } - Logger.MATERIALS("[Debug] Calculated Radiation level to be "+radioactivity.intValue()+"."); - TextureSet iconSet = null; - if (aCustomTextures == null) { - if (material.isRadioactive()) { - iconSet = TextureSets.NUCLEAR.get(); - } - else { - iconSet = material.mIconSet; - } - } - else { - iconSet = aCustomTextures; - } - if (iconSet == null || iconSet.mSetName.toLowerCase().contains("fluid")) { - iconSet = TextureSet.SET_METALLIC; - } - Logger.MATERIALS("[Debug] Calculated Texture Set to be "+iconSet.mSetName+"."); - - - final int durability = material.mDurability; - boolean mGenerateCell = false; - boolean mGenerateFluid = true; - MaterialState materialState; - String chemicalFormula = StringUtils.subscript(Utils.sanitizeString(material.mChemicalFormula)); - final Element element = material.mElement; - - - //Weird Blacklist of Bad Chemical Strings - if (material.mElement == Element.Pb || material.mElement == Element.Na || material.mElement == Element.Ar){ - chemicalFormula = StringUtils.subscript(Utils.sanitizeString(material.mElement.name())); - } - - //Determine default state - Logger.MATERIALS("[Debug] Setting State of GT generated material. "+material.mDefaultLocalName); - if (material.getMolten(1) != null || material.getSolid(1) != null){ - materialState = MaterialState.SOLID; - Logger.MATERIALS("[Debug] Molten or Solid was not null."); - if (material.getMolten(1) == null && material.getSolid(1) != null){ - Logger.MATERIALS("[Debug] Molten is Null, Solid is not. Enabling cell generation."); - mGenerateCell = true; - } - else if (material.getMolten(1) != null && material.getSolid(1) == null){ - Logger.MATERIALS("[Debug] Molten is not Null, Solid is null. Not enabling cell generation."); - //mGenerateCell = true; - } - Logger.MATERIALS("[Debug] State set as solid."); - } - else if (material.getFluid(1) != null){ - Logger.MATERIALS("[Debug] State set as liquid."); - materialState = MaterialState.LIQUID; - } - else if (material.getGas(1) != null){ - Logger.MATERIALS("[Debug] State set as gas."); - materialState = MaterialState.GAS; - }/* - else if (material.getPlasma(1) != null){ - Logger.MATERIALS("[Debug] State set as plasma."); - materialState = MaterialState.PLASMA; - }*/ - else { - Logger.MATERIALS("[Debug] State set as solid. This material has no alternative states, so for safety we wont generate anything."); - materialState = MaterialState.SOLID; - mGenerateFluid = false; - } - - - if (name.toLowerCase().contains("infused")){ - final String tempname = name.substring(7, name.length()); - name = "Infused " + tempname; - } - if (hasValidRGBA(rgba) || (element == Element.H) || ((material == Materials.InfusedAir) || (material == Materials.InfusedFire) || (material == Materials.InfusedEarth) || (material == Materials.InfusedWater))){ - //ModItems.itemBaseDecidust = UtilsItems.generateDecidust(material); - //ModItems.itemBaseCentidust = UtilsItems.generateCentidust(material); - Material M = new Material(name, materialState,iconSet, durability, rgba, melting, boiling, protons, neutrons, blastFurnace, chemicalFormula, radioactivity.intValue(), mGenerateCell, mGenerateFluid); - mGeneratedMaterialMap.put(aMaterialKey, M); - return M; - } - else { - Logger.DEBUG_MATERIALS("Failed to generate GT++ material instance for "+material.name() +" | Valid RGB? "+(hasValidRGBA(rgba))); - } - } - catch (Throwable t) { - Logger.DEBUG_MATERIALS("Failed to generate GT++ material instance for "+material.name()); - t.printStackTrace(); - } - return null; - - } - - public static Material generateQuickMaterial(final String materialName, final MaterialState defaultState, final short[] colour, final int sRadioactivity) { - String aMaterialKey = materialName.toLowerCase(); - if (mGeneratedMaterialMap.containsKey(aMaterialKey)) { - return mGeneratedMaterialMap.get(aMaterialKey); - } - - final Material temp = new Material( - materialName, - defaultState, - colour, - 1000, //melting - 3000, //boiling - 50, //Protons - 50, //Neutrons - false, - "", - sRadioactivity); - mGeneratedMaterialMap.put(aMaterialKey, temp); - return temp; - } - - public static boolean hasValidRGBA(final short[] rgba){ - if (rgba == null || rgba.length < 3 || rgba.length > 4){ - return false; - } - return true; - } - - public static int getTierOfMaterial(final double aMeltingPoint){ - - return aMeltingPoint < 1000 ? 0 : (MathUtils.roundToClosestInt(aMeltingPoint/1000f)); - - - /*if ((aMeltingPoint >= 0) && (aMeltingPoint <= 1000)){ - return 1; - } - else if((aMeltingPoint >= 1001) && (aMeltingPoint <= 2000)){ - return 2; - } - else if((aMeltingPoint >= 2001) && (aMeltingPoint <= 3000)){ - return 3; - } - else if((aMeltingPoint >= 3001) && (aMeltingPoint <= 4000)){ - return 4; - } - else if((aMeltingPoint >= 4001) && (aMeltingPoint <= 5000)){ - return 5; - } - else if((aMeltingPoint >= 5001) && (aMeltingPoint <= 6000)){ - return 6; - } - else if((aMeltingPoint >= 6001) && (aMeltingPoint <= 7000)){ - return 7; - } - else if((aMeltingPoint >= 7001) && (aMeltingPoint <= 8000)){ - return 8; - } - else if((aMeltingPoint >= 8001) && (aMeltingPoint <= 9000)){ - return 9; - } - else if((aMeltingPoint >= 9001) && (aMeltingPoint <= 9999)){ - return 10; - } - else { - return 0; - }*/ - } - - public static int getVoltageForTier(int aTier) { - //aTier += 1; - Probably some logic to this, idk. - - switch(aTier){ - case 0: - return 16; - case 1: - return 30; - case 2: - return 120; - case 3: - return 480; - case 4: - return 1920; - case 5: - return 7680; - case 6: - return 30720; - case 7: - return 122880; - case 8: - return 491520; - case 9: - return 1966080; - case 10: - return 7864320; - case 11: - return 31457280; - case 12: - return 125829120; - case 13: - return 503316480; - case 14: - return 2013265920; - default: - return Integer.MAX_VALUE; - } - - /*else { - int newTier = aTier - 1; - return (int) ((4*(Math.pow(4, newTier)))*7.5); - }*/ - } - - private static Materials getMaterialByName(String materialName) { - - if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { - return (Materials) EnumUtils.getValue(gregtech.api.enums.Materials.class, materialName, false); - } - else { - for (Materials m : Materials.values()) { - if (MaterialUtils.getMaterialName(m).toLowerCase().equals(materialName.toLowerCase())) { - return m; - } - } - return null; - } - } - - @SuppressWarnings("deprecation") - public static String getMaterialName(Materials mat){ - - String mName = null; - - try { - mName = (String) ReflectionUtils.getField(Materials.class, "mDefaultLocalName").get(mat); - if (mName == null) { - mName = (String) ReflectionUtils.getField(Materials.class, "mName").get(mat); - } - } - catch (IllegalArgumentException | IllegalAccessException e) { - } - - - if (mName == null || mName.equals("")){ - mName = mat.name(); - } - return mName; - } - - public static TextureSet getMostCommonTextureSet(List<Material> list) { - TypeCounter<TextureSet> aCounter = new TypeCounter<TextureSet>(TextureSet.class); - for (Material m : list) { - TextureSet t = m.getTextureSet(); - if (t == null) { - t = Materials.Gold.mIconSet; - } - if (t != null) { - aCounter.add(t, t.mSetName); - } - } - return aCounter.getResults(); - /*Optional<TextureSet> r = list.stream().map(Material::getTextureSet).collect(Collectors.groupingBy(Function.identity(), Collectors.counting())).entrySet().stream().max(Map.Entry.comparingByValue()).map(Map.Entry::getKey); - TextureSet o = (r != null && r.isPresent() && r.get() != null) ? r.get() : null; - return o;*/ - } - - - - public static Materials getMaterial(String aMaterialName, String aFallbackMaterialName) { - Materials g = getMaterial(aMaterialName); - if (g == null) { - g = getMaterial(aFallbackMaterialName); - } - if (g == null) { - Logger.INFO("Failed finding material '"+aMaterialName+"' & fallback '"+aFallbackMaterialName+"', returning _NULL."); - CORE.crash(); - //g = Materials._NULL; - } - return g; - } - - public static Materials getMaterial(String aMaterialName) { - Materials m = gtPlusPlus.xmod.gregtech.common.StaticFields59.getMaterial(aMaterialName); - if (m == null) { - m = getMaterialByName(aMaterialName); - } - if (m == null) { - Logger.INFO("Failed finding material '"+aMaterialName+"', returning _NULL."); - m = Materials._NULL; - } - return m; - } - - public static AutoMap<Material> getCompoundMaterialsRecursively(Material aMat){ - return getCompoundMaterialsRecursively_Speiger(aMat); - /* - AutoMap<Material> aDataSet = new AutoMap<Material>(); - final int HARD_LIMIT = 1000; - int mLoopCounter = 0; - if (aMat.getComposites().size() > 0) { - try { - List<Material> xList = Lists.newLinkedList(); - for (MaterialStack kj : aMat.getComposites()) { - xList.add(kj.getStackMaterial()); - } - if (xList.isEmpty()) { - aDataSet.put(aMat); - return aDataSet; - } - ListIterator<Material> listIterator = xList.listIterator(); - while(listIterator.hasNext()){ - Material e = listIterator.next(); - listIterator.remove(); - if (mLoopCounter > HARD_LIMIT) { - break; - } - - if (e.getComposites().isEmpty()) { - aDataSet.put(e); - } - else { - for (MaterialStack x : e.getComposites()) { - listIterator.add(x.getStackMaterial()); - } - } - mLoopCounter++; - - - }} - catch (Throwable t) { - aDataSet.put(aMat); - t.printStackTrace(); - } - } - if (aDataSet.isEmpty()) { - aDataSet.put(aMat); - return aDataSet; - } - return aDataSet; - */} - - public static AutoMap<Material> getCompoundMaterialsRecursively_Speiger(Material toSearch) { - AutoMap<Material> resultList = new AutoMap<Material>(); - if (toSearch.getComposites().isEmpty()) { - resultList.put(toSearch); - return resultList; - } - final int HARD_LIMIT = 1000; - - // Could be a Deque but i dont use the interface - // enough to use it as default. - LinkedList<Material> toCheck = new LinkedList<Material>(); - - toCheck.add(toSearch); - int processed = 0; - while (toCheck.size() > 0 && processed < HARD_LIMIT) { - Material current = toCheck.remove(); - if (current.getComposites().isEmpty()) { - resultList.put(current); - } else { - for (MaterialStack entry : current.getComposites()) { - toCheck.add(entry.getStackMaterial()); - } - } - processed++; - } - return resultList; - } - - public static void generateComponentAndAssignToAMaterial(ComponentTypes aType, Material aMaterial) { - generateComponentAndAssignToAMaterial(aType, aMaterial, true); - } - - public static void generateComponentAndAssignToAMaterial(ComponentTypes aType, Material aMaterial, boolean generateRecipes) { - Item aGC; - if (aType == ComponentTypes.PLATEHEAVY) { - aGC = new BaseItemPlateHeavy(aMaterial); - } - else { - aGC = new BaseItemComponent(aMaterial, aType); - } - if (aGC != null) { - String aFormattedLangName = aType.getName(); - - if (!aFormattedLangName.startsWith(" ")) { - if (aFormattedLangName.contains("@")) { - String[] aSplit = aFormattedLangName.split("@"); - aFormattedLangName = aSplit[0] + " " + aMaterial.getLocalizedName() + " " + aSplit[1]; - } - } - - if (aFormattedLangName.equals(aType.getName())) { - aFormattedLangName = aMaterial.getLocalizedName() + aFormattedLangName; - - } - - - - Logger.MATERIALS("[Lang] "+aGC.getUnlocalizedName()+".name="+aFormattedLangName); - aMaterial.registerComponentForMaterial(aType, ItemUtils.getSimpleStack(aGC)); - } - } - - - - - - - - - public static void generateSpecialDustAndAssignToAMaterial(Material aMaterial) { - generateSpecialDustAndAssignToAMaterial(aMaterial, true); - } - - public static void generateSpecialDustAndAssignToAMaterial(Material aMaterial, boolean generateMixerRecipes) { - Item[] aDusts = ItemUtils.generateSpecialUseDusts(aMaterial, false, Utils.invertBoolean(generateMixerRecipes)); - if (aDusts != null && aDusts.length > 0) { - aMaterial.registerComponentForMaterial(OrePrefixes.dust, ItemUtils.getSimpleStack(aDusts[0])); - aMaterial.registerComponentForMaterial(OrePrefixes.dustSmall, ItemUtils.getSimpleStack(aDusts[1])); - aMaterial.registerComponentForMaterial(OrePrefixes.dustTiny, ItemUtils.getSimpleStack(aDusts[2])); - } - - } - - public static boolean doesMaterialExist(String aMatName) { - for (Materials m : Materials.values()) { - if (m.name().toLowerCase().equals(aMatName.toLowerCase())) { - return true; - } - } - return false; - } - - public static boolean isNullGregtechMaterial(Materials aGregtechMaterial) { - if (aGregtechMaterial == Materials._NULL || aGregtechMaterial.equals(Materials._NULL) || aGregtechMaterial.name().equals(Materials._NULL.name())) { - return true; - } - return false; - } - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/minecraft/MiningUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/MiningUtils.java deleted file mode 100644 index 080b5665a3..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/MiningUtils.java +++ /dev/null @@ -1,265 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import java.util.HashMap; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; - -import gregtech.common.GT_Worldgen_GT_Ore_Layer; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class MiningUtils { - - public static Boolean canPickaxeBlock(final Block currentBlock, final World currentWorld){ - String correctTool = ""; - if (!currentWorld.isRemote){ - try { - correctTool = currentBlock.getHarvestTool(0); - //Utils.LOG_WARNING(correctTool); - if (correctTool.equals("pickaxe")){ - return true;} - } catch (final NullPointerException e){ - return false;} - } - return false; - } - - private static void removeBlockAndDropAsItem(final World world, final int X, final int Y, final int Z){ - try { - final Block block = world.getBlock(X, Y, Z); - if (canPickaxeBlock(block, world)){ - if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) != -1) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ - block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0); - world.setBlockToAir(X, Y, Z); - - } - else { - Logger.WARNING("Incorrect Tool for mining this block."); - } - } - } catch (final NullPointerException e){ - - } - } - - public static boolean getBlockType(final Block block, final World world, final int[] xyz, final int miningLevel){ - final String LIQUID = "liquid"; - final String BLOCK = "block"; - final String ORE = "ore"; - final String AIR = "air"; - String blockClass = ""; - - if (world.isRemote){ - return false; - } - - if (block == Blocks.end_stone) { - return true; - } - if (block == Blocks.stone) { - return true; - } - if (block == Blocks.sandstone) { - return true; - } - if (block == Blocks.netherrack) { - return true; - } - if (block == Blocks.nether_brick) { - return true; - } - if (block == Blocks.nether_brick_stairs) { - return true; - } - if (block == Blocks.nether_brick_fence) { - return true; - } - if (block == Blocks.glowstone) { - return true; - } - - - - try { - blockClass = block.getClass().toString().toLowerCase(); - Logger.WARNING(blockClass); - if (blockClass.toLowerCase().contains(LIQUID)){ - Logger.WARNING(block.toString()+" is a Liquid."); - return false; - } - else if (blockClass.toLowerCase().contains(ORE)){ - Logger.WARNING(block.toString()+" is an Ore."); - return true; - } - else if (block.getHarvestLevel(world.getBlockMetadata(xyz[0], xyz[1], xyz[2])) >= miningLevel){ - Logger.WARNING(block.toString()+" is minable."); - return true; - } - else if (blockClass.toLowerCase().contains(AIR)){ - Logger.WARNING(block.toString()+" is Air."); - return false; - } - else if (blockClass.toLowerCase().contains(BLOCK)){ - Logger.WARNING(block.toString()+" is a block of some kind."); - return false; - } - else { - Logger.WARNING(block.toString()+" is mystery."); - return false; - } - } - catch(final NullPointerException e){ - return false; - } - } - - public static int mMoonID =-99; - public static int mMarsID = -99; - public static int mCometsID = -99; - public static AutoMap<GT_Worldgen_GT_Ore_Layer> getOresForDim(int dim) { - if (dim == -1) { - return Ores_Nether; - } - else if (dim == 1) { - return Ores_End; - } - else if (dim == mMoonID) { - return Ores_Moon; - } - else if (dim == mMarsID) { - return Ores_Mars; - } - else if (dim == mCometsID) { - return Ores_Comets; - } - else { - return Ores_Overworld; - } - - } - - public static void iterateAllOreTypes() { - HashMap<String, Integer> M = new HashMap<String, Integer>(); - String aTextWorldGen = null; - if (MiningUtils.findAndMapOreTypesFromGT()) { - int mapKey = 0; - for (AutoMap<GT_Worldgen_GT_Ore_Layer> g : MiningUtils.mOreMaps) { - for (GT_Worldgen_GT_Ore_Layer h : g) { - - try { - aTextWorldGen = (String) ReflectionUtils.getField(GT_Worldgen_GT_Ore_Layer.class, "aTextWorldgen").get(h); - } catch (IllegalArgumentException | IllegalAccessException e) { - aTextWorldGen = h.mWorldGenName; - } - - //if (M.containsKey(h.aTextWorldgen + h.mWorldGenName)) { - M.put(aTextWorldGen + h.mWorldGenName, mapKey); - Logger.INFO("Found Vein type: " + aTextWorldGen + h.mWorldGenName + " in map with key: "+mapKey); - //} - } - mapKey++; - } - } - } - - public static AutoMap<GT_Worldgen_GT_Ore_Layer>[] mOreMaps = new AutoMap[7]; - private static AutoMap<GT_Worldgen_GT_Ore_Layer> Ores_Overworld = new AutoMap<GT_Worldgen_GT_Ore_Layer>(); - private static AutoMap<GT_Worldgen_GT_Ore_Layer> Ores_Nether = new AutoMap<GT_Worldgen_GT_Ore_Layer>(); - private static AutoMap<GT_Worldgen_GT_Ore_Layer> Ores_End = new AutoMap<GT_Worldgen_GT_Ore_Layer>(); - private static AutoMap<GT_Worldgen_GT_Ore_Layer> Ores_Moon = new AutoMap<GT_Worldgen_GT_Ore_Layer>(); - private static AutoMap<GT_Worldgen_GT_Ore_Layer> Ores_Mars = new AutoMap<GT_Worldgen_GT_Ore_Layer>(); - private static AutoMap<GT_Worldgen_GT_Ore_Layer> Ores_Comets = new AutoMap<GT_Worldgen_GT_Ore_Layer>(); - private static AutoMap<GT_Worldgen_GT_Ore_Layer> Ores_Misc = new AutoMap<GT_Worldgen_GT_Ore_Layer>(); - - public static boolean findAndMapOreTypesFromGT() { - //Gets Moon ID - - boolean aEndAsteroids; - try { - if (ReflectionUtils.getClass("micdoodle8.mods.galacticraft.core.util.ConfigManagerCore") != null && mMoonID == -99) { - mMoonID = ReflectionUtils.getField(ReflectionUtils.getClass("micdoodle8.mods.galacticraft.core.util.ConfigManagerCore"), "idDimensionMoon").getInt(null); - } - } - catch (IllegalArgumentException | IllegalAccessException e) {} - - //Gets Mars ID - try { - if (ReflectionUtils.getClass("micdoodle8.mods.galacticraft.planets.mars.ConfigManagerMars") != null && mMarsID == -99) { - mMarsID = ReflectionUtils.getField(ReflectionUtils.getClass("micdoodle8.mods.galacticraft.planets.mars.ConfigManagerMars"), "dimensionIDMars").getInt(null); - } - } - catch (IllegalArgumentException | IllegalAccessException e) {} - - //Get Comets ID - try { - if (ReflectionUtils.getClass("micdoodle8.mods.galacticraft.planets.asteroids.ConfigManagerAsteroids") != null && mCometsID == -99) { - mCometsID = ReflectionUtils.getField(ReflectionUtils.getClass("micdoodle8.mods.galacticraft.planets.asteroids.ConfigManagerAsteroids"), "dimensionIDAsteroids").getInt(null); - } - } - catch (IllegalArgumentException | IllegalAccessException e) {} - - //Clear Cache - Ores_Overworld.clear(); - Ores_Nether.clear(); - Ores_End.clear(); - Ores_Misc.clear(); - - for (GT_Worldgen_GT_Ore_Layer x : GT_Worldgen_GT_Ore_Layer.sList) { - if (x.mEnabled) { - - - try { - aEndAsteroids = ReflectionUtils.getField(GT_Worldgen_GT_Ore_Layer.class, "mEndAsteroid").getBoolean(x); - } - catch (IllegalArgumentException | IllegalAccessException e) { - aEndAsteroids = false; - } - - if (x.mOverworld) { - Ores_Overworld.put(x); - } - if (x.mNether) { - Ores_Nether.put(x); - } - if (x.mEnd || aEndAsteroids) { - Ores_End.put(x); - } - if (x.mOverworld || x.mNether || (x.mEnd || aEndAsteroids)) { - continue; - } - /*if (x.mMoon) { - Ores_Moon.put(x); - continue; - } - if (x.mMars) { - Ores_Mars.put(x); - continue; - } - if (x.mAsteroid) { - Ores_Comets.put(x); - continue; - }*/ - Ores_Misc.put(x); - continue; - } - else { - Ores_Comets.put(x); - } - } - - - mOreMaps[0] = Ores_Overworld; - mOreMaps[1] = Ores_Nether; - mOreMaps[2] = Ores_End; - mOreMaps[3] = Ores_Moon; - mOreMaps[4] = Ores_Mars; - mOreMaps[5] = Ores_Comets; - mOreMaps[6] = Ores_Misc; - return true; - } - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ModularArmourUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ModularArmourUtils.java deleted file mode 100644 index e3ffb5c410..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/ModularArmourUtils.java +++ /dev/null @@ -1,161 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import gregtech.api.util.GT_Utility; - -import baubles.api.BaubleType; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.Pair; - -public class ModularArmourUtils { - - public static ItemStack addComponent(ItemStack tArmour, ItemStack[] tComponents) { - if (tArmour != null) { - ItemStack rArmour = NBTUtils.writeItemsToGtCraftingComponents(tArmour, tComponents, true); - if (rArmour != null) { - - } - } - return null; - } - - public static enum Modifiers { - BOOST_HP("skill.hpboost"), BOOST_DEF("skill.defenceboost"), BOOST_SPEED("skill.speedboost"), BOOST_MINING( - "skill.miningboost"), BOOST_DAMAGE("skill.damageboost"), BOOST_HOLY("skill.holyboost"); - private String MODIFIER_NAME; - - private Modifiers(final String mModifier) { - this.MODIFIER_NAME = mModifier; - } - - public String getModifier() { - return this.MODIFIER_NAME; - } - - public boolean isValidLevel(int i) { - if (i >= 0 && i <= 100) { - return true; - } - return false; - } - } - - public static enum BT { - TYPE_AMULET(BaubleType.AMULET, 0), TYPE_RING(BaubleType.RING, 1), TYPE_BELT(BaubleType.BELT, 2); - private final BaubleType mType; - private final int mID; - private final String mBaubleType; - - private BT(final BaubleType tType, int tID) { - this.mType = tType; - this.mID = tID; - this.mBaubleType = tType.name().toLowerCase(); - } - - public BaubleType getType() { - return this.mType; - } - - public BT getThis() { - return this; - } - - public BaubleType getBaubleByID(int tID) { - if (tID == 0) { - return BaubleType.AMULET; - } else if (tID == 1) { - return BaubleType.RING; - } else if (tID == 2) { - return BaubleType.BELT; - } else { - return BaubleType.RING; - } - } - - public int getID() { - return this.mID; - } - - public String getTypeAsString() { - return this.mBaubleType; - } - } - - public static void setModifierLevel(ItemStack aStack, Pair<Modifiers, Integer> mPair) { - setModifierLevel(aStack, mPair.getKey(), mPair.getValue().intValue()); - } - - public static void setModifierLevel(ItemStack aStack, Modifiers aMod, Integer aInt) { - setModifierLevel(aStack, aMod, aInt.intValue()); - } - - public static void setModifierLevel(ItemStack aStack, Modifiers aMod, int aInt) { - - int mCurrentLevel = getModifierLevel(aStack, aMod); - int mNewTotalLevel = mCurrentLevel + aInt; - - NBTTagCompound tNBT = NBTUtils.getNBT(aStack); - if (aMod.isValidLevel(mNewTotalLevel)) { - tNBT.setInteger(aMod.getModifier(), mNewTotalLevel); - GT_Utility.ItemNBT.setNBT(aStack, tNBT); - } else { - if (getModifierLevel(aStack, aMod) > 100) { - setModifierLevel(aStack, aMod, 100); - } - } - } - - public static int getModifierLevel(ItemStack aStack, Pair<Modifiers, Integer> newPair) { - return getModifierLevel(aStack, newPair.getKey()); - } - - public static int getModifierLevel(ItemStack aStack, Modifiers aMod) { - NBTTagCompound tNBT = NBTUtils.getNBT(aStack); - return tNBT.getInteger(aMod.getModifier()); - } - - public static void setBaubleType(ItemStack aStack, BT aMod) { - Logger.INFO("Changing bauble type."); - NBTTagCompound tNBT = NBTUtils.getNBT(aStack); - if (aMod != null) { - tNBT.setInteger("mBaubleType", aMod.getID()); - GT_Utility.ItemNBT.setNBT(aStack, tNBT); - } - } - - public static int getBaubleTypeID(ItemStack aStack) { - NBTTagCompound tNBT = NBTUtils.getNBT(aStack); - return tNBT.getInteger("mBaubleType"); - } - - public static BaubleType getBaubleType(ItemStack aStack) { - NBTTagCompound tNBT = NBTUtils.getNBT(aStack); - return getBaubleByID(tNBT.getInteger("mBaubleType")); - } - - public static BaubleType getBaubleByID(int tID) { - if (tID == 0) { - return BaubleType.AMULET; - } else if (tID == 1) { - return BaubleType.RING; - } else if (tID == 2) { - return BaubleType.BELT; - } else { - return BaubleType.RING; - } - } - - public static ItemStack setDefaultStats(ItemStack aStack) { - ItemStack tempStack = aStack; - setModifierLevel(tempStack, Modifiers.BOOST_DAMAGE, 0); - setModifierLevel(tempStack, Modifiers.BOOST_DEF, 0); - setModifierLevel(tempStack, Modifiers.BOOST_HOLY, 0); - setModifierLevel(tempStack, Modifiers.BOOST_HP, 0); - setModifierLevel(tempStack, Modifiers.BOOST_MINING, 0); - setModifierLevel(tempStack, Modifiers.BOOST_SPEED, 0); - return tempStack; - } - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/NBTUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/NBTUtils.java deleted file mode 100644 index 7ed4d887cc..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/NBTUtils.java +++ /dev/null @@ -1,580 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import static gtPlusPlus.core.item.ModItems.ZZZ_Empty; - -import java.util.HashMap; -import java.util.Map; - -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; - -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class NBTUtils { - - public static NBTTagCompound getNBT(ItemStack aStack) { - NBTTagCompound rNBT = aStack.getTagCompound(); - return ((rNBT == null) ? new NBTTagCompound() : rNBT); - } - - public static void setBookTitle(ItemStack aStack, String aTitle) { - NBTTagCompound tNBT = getNBT(aStack); - tNBT.setString("title", aTitle); - GT_Utility.ItemNBT.setNBT(aStack, tNBT); - } - - public static String getBookTitle(ItemStack aStack) { - NBTTagCompound tNBT = getNBT(aStack); - return tNBT.getString("title"); - } - - public static ItemStack[] readItemsFromNBT(ItemStack itemstack) { - NBTTagCompound tNBT = getNBT(itemstack); - final NBTTagList list = tNBT.getTagList("Items", 10); - ItemStack inventory[] = new ItemStack[list.tagCount()]; - for (int i = 0; i < list.tagCount(); i++) { - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if ((slot >= 0) && (slot < list.tagCount())) { - if (ItemStack.loadItemStackFromNBT(data) == ItemUtils.getSimpleStack(ZZZ_Empty)) { - inventory[slot] = null; - } else { - inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - - } - } - return inventory; - } - - public static ItemStack[] readItemsFromNBT(ItemStack itemstack, String customkey) { - NBTTagCompound tNBT = getNBT(itemstack); - final NBTTagList list = tNBT.getTagList(customkey, 10); - ItemStack inventory[] = new ItemStack[list.tagCount()]; - for (int i = 0; i < list.tagCount(); i++) { - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if ((slot >= 0) && (slot < list.tagCount())) { - if (ItemStack.loadItemStackFromNBT(data) == ItemUtils.getSimpleStack(ZZZ_Empty)) { - inventory[slot] = null; - } else { - inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - - } - } - return inventory; - } - - public static ItemStack writeItemsToNBT(ItemStack itemstack, ItemStack[] stored) { - NBTTagCompound tNBT = getNBT(itemstack); - final NBTTagList list = new NBTTagList(); - for (int i = 0; i < stored.length; i++) { - final ItemStack stack = stored[i]; - if (stack != null) { - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } else { - final NBTTagCompound data = new NBTTagCompound(); - ItemStack nullstack = ItemUtils.getSimpleStack(ZZZ_Empty); - nullstack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - tNBT.setTag("Items", list); - itemstack.setTagCompound(tNBT); - return itemstack; - } - - public static ItemStack writeItemsToNBT(ItemStack itemstack, ItemStack[] stored, String customkey) { - NBTTagCompound tNBT = getNBT(itemstack); - final NBTTagList list = new NBTTagList(); - for (int i = 0; i < stored.length; i++) { - final ItemStack stack = stored[i]; - if (stack != null) { - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - tNBT.setTag(customkey, list); - itemstack.setTagCompound(tNBT); - return itemstack; - } - - public static ItemStack writeItemsToGtCraftingComponents(ItemStack rStack, ItemStack[] input, boolean copyTags) { - try { - ItemStack stored[] = new ItemStack[9]; - if (input.length != 9) { - for (int e=0;e<input.length;e++) { - if (input[e] != null) - stored[e] = input[e]; - } - } - - if (copyTags) { - for (int i = 0; i < stored.length; i++) { - if (stored[i] != null && stored[i].hasTagCompound()) { - rStack.setTagCompound((NBTTagCompound) stored[i].getTagCompound().copy()); - break; - } - } - } - - NBTTagCompound rNBT = rStack.getTagCompound(), tNBT = new NBTTagCompound(); - if (rNBT == null) - rNBT = new NBTTagCompound(); - for (int i = 0; i < 9; i++) { - ItemStack tStack = stored[i]; - if (tStack != null && GT_Utility.getContainerItem(tStack, true) == null - && !(tStack.getItem() instanceof GT_MetaGenerated_Tool)) { - tStack = GT_Utility.copyAmount(1, tStack); - if (GT_Utility.isStackValid(tStack)) { - GT_ModHandler.dischargeElectricItem(tStack, Integer.MAX_VALUE, Integer.MAX_VALUE, true, false, - true); - tNBT.setTag("Ingredient." + i, tStack.writeToNBT(new NBTTagCompound())); - } - } - } - rNBT.setTag("GT.CraftingComponents", tNBT); - rStack.setTagCompound(rNBT); - } - catch (Throwable t) { - t.printStackTrace(); - } - return rStack; - } - - public static void setBoolean(ItemStack aStack, String aTag, boolean aBoolean) { - NBTTagCompound tNBT = getNBT(aStack); - tNBT.setBoolean(aTag, aBoolean); - GT_Utility.ItemNBT.setNBT(aStack, tNBT); - } - - public static boolean getBoolean(ItemStack aStack, String aTag) { - NBTTagCompound tNBT = getNBT(aStack); - return tNBT.getBoolean(aTag); - } - - public static void setInteger(ItemStack aStack, String aTag, int aInt) { - NBTTagCompound tNBT = getNBT(aStack); - tNBT.setInteger(aTag, aInt); - GT_Utility.ItemNBT.setNBT(aStack, tNBT); - } - - public static int getInteger(ItemStack aStack, String aTag) { - NBTTagCompound tNBT = getNBT(aStack); - return tNBT.getInteger(aTag); - } - - public static void setLong(ItemStack aStack, String aTag, long aInt) { - NBTTagCompound tNBT = getNBT(aStack); - tNBT.setLong(aTag, aInt); - GT_Utility.ItemNBT.setNBT(aStack, tNBT); - } - - public static long getLong(ItemStack aStack, String aTag) { - NBTTagCompound tNBT = getNBT(aStack); - return tNBT.getLong(aTag); - } - - public static void setFloat(ItemStack aStack, String aTag, float aInt) { - NBTTagCompound tNBT = getNBT(aStack); - tNBT.setFloat(aTag, aInt); - GT_Utility.ItemNBT.setNBT(aStack, tNBT); - } - - public static float getFloat(ItemStack aStack, String aTag) { - NBTTagCompound tNBT = getNBT(aStack); - return tNBT.getFloat(aTag); - } - - public static void setString(ItemStack aStack, String aTag, String aString) { - NBTTagCompound tNBT = getNBT(aStack); - tNBT.setString(aTag, aString); - GT_Utility.ItemNBT.setNBT(aStack, tNBT); - } - - public static String getString(ItemStack aStack, String aTag) { - NBTTagCompound tNBT = getNBT(aStack); - return tNBT.getString(aTag); - } - - public static boolean doesStringExist(ItemStack aStack, String aTag) { - NBTTagCompound tNBT = getNBT(aStack); - return tNBT.hasKey(aTag); - } - - public static boolean tryIterateNBTData(ItemStack aStack) { - try { - NBTTagCompound aNBT = NBTUtils.getNBT(aStack); - if (aNBT != null) { - if (!aNBT.hasNoTags()) { - Map<?, ?> mInternalMap = ReflectionUtils.getField(aNBT, "tagMap"); - if (mInternalMap != null) { - for (Map.Entry<?, ?> e : mInternalMap.entrySet()) { - Logger.INFO("Key: " + e.getKey().toString() + " | Value: " + e.getValue()); - } - return true; - } else { - Logger.INFO("Data map reflected from NBTTagCompound was not valid."); - return false; - } - } - } - } catch (Throwable t) {} - return false; - } - - // Botania soulbind handling - public static boolean setBotanicaSoulboundOwner(ItemStack aStack, String aName) { - final String TAG_SOULBIND = "soulbind"; - NBTTagCompound tNBT = getNBT(aStack); - tNBT.setString(TAG_SOULBIND, aName); - GT_Utility.ItemNBT.setNBT(aStack, tNBT); - if (NBTUtils.doesStringExist(aStack, TAG_SOULBIND)) { - return true; - } else { - return false; - } - } - - public static String getBotanicaSoulboundOwner(ItemStack aStack) { - final String TAG_SOULBIND = "soulbind"; - NBTTagCompound tNBT = getNBT(aStack); - return tNBT.getString(TAG_SOULBIND); - } - - public static boolean hasKey(ItemStack stack, String key) { - final NBTTagCompound itemData = getNBT(stack); - if (itemData.hasKey(key)) { - return true; - } - return false; - } - - public static boolean createIntegerTagCompound(ItemStack rStack, String tagName, String keyName, int keyValue) { - final NBTTagCompound tagMain = getNBT(rStack); - final NBTTagCompound tagNBT = new NBTTagCompound(); - tagNBT.setInteger(keyName, keyValue); - tagMain.setTag(tagName, tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - public static boolean createLongTagCompound(ItemStack rStack, String tagName, String keyName, long keyValue) { - final NBTTagCompound tagMain = getNBT(rStack); - final NBTTagCompound tagNBT = new NBTTagCompound(); - tagNBT.setLong(keyName, keyValue); - tagMain.setTag(tagName, tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - public static boolean createStringTagCompound(ItemStack rStack, String tagName, String keyName, String keyValue) { - final NBTTagCompound tagMain = getNBT(rStack); - final NBTTagCompound tagNBT = new NBTTagCompound(); - tagNBT.setString(keyName, keyValue); - tagMain.setTag(tagName, tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - public static boolean createFloatTagCompound(ItemStack rStack, String tagName, String keyName, float keyValue) { - final NBTTagCompound tagMain = getNBT(rStack); - final NBTTagCompound tagNBT = new NBTTagCompound(); - tagNBT.setFloat(keyName, keyValue); - tagMain.setTag(tagName, tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - public static boolean createDoubleTagCompound(ItemStack rStack, String tagName, String keyName, double keyValue) { - final NBTTagCompound tagMain = getNBT(rStack); - final NBTTagCompound tagNBT = new NBTTagCompound(); - tagNBT.setDouble(keyName, keyValue); - tagMain.setTag(tagName, tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - public static boolean createBooleanTagCompound(ItemStack rStack, String tagName, String keyName, boolean keyValue) { - final NBTTagCompound tagMain = getNBT(rStack); - final NBTTagCompound tagNBT = new NBTTagCompound(); - tagNBT.setBoolean(keyName, keyValue); - tagMain.setTag(tagName, tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - public static boolean createTagCompound(ItemStack rStack, String tagName, NBTTagCompound keyValue) { - final NBTTagCompound tagMain = getNBT(rStack); - NBTTagCompound tagNBT = keyValue; - tagMain.setTag(tagName, tagNBT); - rStack.setTagCompound(tagMain); - return true; - } - - public static int getIntegerTagCompound(ItemStack aStack, String tagName, String keyName) { - NBTTagCompound aNBT = getNBT(aStack); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag(tagName); - if (aNBT != null) { - return aNBT.getInteger(keyName); - } - } - return 0; - } - - public static long getLongTagCompound(ItemStack aStack, String tagName, String keyName) { - NBTTagCompound aNBT = getNBT(aStack); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag(tagName); - if (aNBT != null) { - return aNBT.getLong(keyName); - } - } - return 0L; - } - - public static String getStringTagCompound(ItemStack aStack, String tagName, String keyName) { - NBTTagCompound aNBT = getNBT(aStack); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag(tagName); - if (aNBT != null) { - return aNBT.getString(keyName); - } - } - return null; - } - - public static float getFloatTagCompound(ItemStack aStack, String tagName, String keyName) { - NBTTagCompound aNBT = getNBT(aStack); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag(tagName); - if (aNBT != null) { - return aNBT.getFloat(keyName); - } - } - return 0; - } - - public static double getDoubleTagCompound(ItemStack aStack, String tagName, String keyName) { - NBTTagCompound aNBT = getNBT(aStack); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag(tagName); - if (aNBT != null) { - return aNBT.getDouble(keyName); - } - } - return 0; - } - - public static boolean getBooleanTagCompound(ItemStack aStack, String tagName, String keyName) { - NBTTagCompound aNBT = getNBT(aStack); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag(tagName); - if (aNBT != null) { - return aNBT.getBoolean(keyName); - } - } - return false; - } - - public static NBTTagCompound getTagCompound(ItemStack aStack, String tagName) { - NBTTagCompound aNBT = getNBT(aStack); - if (aNBT != null && hasKey(aStack, tagName)) { - aNBT = aNBT.getCompoundTag(tagName); - if (aNBT != null) { - return aNBT; - } - } - return null; - } - - public static boolean hasKeyInTagCompound(ItemStack stack, String tag, String key) { - NBTTagCompound aNBT = stack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag(tag); - if (aNBT.hasKey(key)) { - return true; - } - } - return false; - } - - public static Map getTagMap(NBTTagCompound aNBT) { - Map tagMap = new HashMap(); - if (!aNBT.hasNoTags()) { - Map<?, ?> mInternalMap = ReflectionUtils.getField(aNBT, "tagMap"); - if (mInternalMap != null && !mInternalMap.isEmpty()) { - tagMap.putAll(mInternalMap); - } - } - return tagMap; - } - - public static boolean isTagString(NBTTagCompound aNBT, String aTagName) { - Map<?, ?> aTagMap = getTagMap(aNBT); - if (aTagMap != null && !aTagMap.isEmpty()) { - for (Map.Entry<?, ?> e : aTagMap.entrySet()) { - if (e.getKey().equals(aTagName)) { - Object aValue = e.getValue(); - if (aValue instanceof String) { - return true; - } - } - } - } - return false; - } - - public static boolean isTagInteger(NBTTagCompound aNBT, String aTagName) { - Map<?, ?> aTagMap = getTagMap(aNBT); - if (aTagMap != null && !aTagMap.isEmpty()) { - for (Map.Entry<?, ?> e : aTagMap.entrySet()) { - if (e.getKey().equals(aTagName)) { - Object aValue = e.getValue(); - if (int.class.isInstance(aValue) || aValue instanceof Integer) { - return true; - } - } - } - } - return false; - } - - public static boolean isTagLong(NBTTagCompound aNBT, String aTagName) { - Map<?, ?> aTagMap = getTagMap(aNBT); - if (aTagMap != null && !aTagMap.isEmpty()) { - for (Map.Entry<?, ?> e : aTagMap.entrySet()) { - if (e.getKey().equals(aTagName)) { - Object aValue = e.getValue(); - if (long.class.isInstance(aValue) || aValue instanceof Long) { - return true; - } - } - } - } - return false; - } - - public static boolean isTagFloat(NBTTagCompound aNBT, String aTagName) { - Map<?, ?> aTagMap = getTagMap(aNBT); - if (aTagMap != null && !aTagMap.isEmpty()) { - for (Map.Entry<?, ?> e : aTagMap.entrySet()) { - if (e.getKey().equals(aTagName)) { - Object aValue = e.getValue(); - if (float.class.isInstance(aValue) || aValue instanceof Float) { - return true; - } - } - } - } - return false; - } - - public static boolean isTagDouble(NBTTagCompound aNBT, String aTagName) { - Map<?, ?> aTagMap = getTagMap(aNBT); - if (aTagMap != null && !aTagMap.isEmpty()) { - for (Map.Entry<?, ?> e : aTagMap.entrySet()) { - if (e.getKey().equals(aTagName)) { - Object aValue = e.getValue(); - if (double.class.isInstance(aValue) || aValue instanceof Double) { - return true; - } - } - } - } - return false; - } - - public static boolean isTagBoolean(NBTTagCompound aNBT, String aTagName) { - Map<?, ?> aTagMap = getTagMap(aNBT); - if (aTagMap != null && !aTagMap.isEmpty()) { - for (Map.Entry<?, ?> e : aTagMap.entrySet()) { - if (e.getKey().equals(aTagName)) { - Object aValue = e.getValue(); - if (boolean.class.isInstance(aValue) || aValue instanceof Boolean) { - return true; - } - } - } - } - return false; - } - - public static boolean tryCloneTagCompoundDataIntoSubTag(ItemStack aStack, NBTTagCompound aTagCompound) { - try { - NBTTagCompound aNBT = aTagCompound; - if (aNBT != null) { - if (!aNBT.hasNoTags()) { - Map<?, ?> mInternalMap = ReflectionUtils.getField(aNBT, "tagMap"); - if (mInternalMap != null) { - for (Map.Entry<?, ?> e : mInternalMap.entrySet()) { - Logger.INFO("Key: " + e.getKey().toString() + " | Value: " + e.getValue().toString()); - if (e.getValue().getClass() == String.class){ - createStringTagCompound(aStack, "mEntityTag", (String) e.getKey(), (String) e.getValue()); - } - else if (e.getValue().getClass() == Boolean.class || e.getValue().getClass() == boolean.class){ - createBooleanTagCompound(aStack, "mEntityTag", (String) e.getKey(), (Boolean) e.getValue()); - } - else if (e.getValue().getClass() == Integer.class || e.getValue().getClass() == int.class){ - createIntegerTagCompound(aStack, "mEntityTag", (String) e.getKey(), (Integer) e.getValue()); - } - else if (e.getValue().getClass() == Double.class || e.getValue().getClass() == double.class){ - createDoubleTagCompound(aStack, "mEntityTag", (String) e.getKey(), (Double) e.getValue()); - } - else if (e.getValue().getClass() == Long.class || e.getValue().getClass() == long.class){ - createLongTagCompound(aStack, "mEntityTag", (String) e.getKey(), (Long) e.getValue()); - } - else if (e.getValue().getClass() == Float.class || e.getValue().getClass() == float.class){ - createFloatTagCompound(aStack, "mEntityTag", (String) e.getKey(), (Float) e.getValue()); - } - else { - - - } - - } - return true; - } - } - } - return false; - } catch (Throwable t) { - return false; - } - } - - public static NBTTagCompound getEntityCustomData(Entity aEntity){ - return ReflectionUtils.getField(aEntity, "customEntityData"); - } - - public static boolean setEntityCustomData(Entity aEntity, NBTTagCompound aTag){ - return ReflectionUtils.setField(aEntity, "customEntityData", aTag); - } - - public static boolean hasTagCompound(ItemStack aStack) { - return aStack.hasTagCompound(); - } - - public static void createEmptyTagCompound(ItemStack aStack) { - if (!hasTagCompound(aStack)) { - NBTTagCompound aTag = new NBTTagCompound(); - aStack.setTagCompound(aTag); - } - } - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/OreDictUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/OreDictUtils.java deleted file mode 100644 index 324d39b863..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/OreDictUtils.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -public class OreDictUtils { - - public static boolean containsValidEntries(String aOreName) { - boolean a = OreDictionary.doesOreNameExist(aOreName); - List<ItemStack> b = OreDictionary.getOres(aOreName, false); - - if (!a) { - return false; - } - else { - if (b == null || b.isEmpty()) { - return false; - } - } - return true; - } - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java deleted file mode 100644 index 24ffa295b7..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java +++ /dev/null @@ -1,260 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import java.util.*; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.world.World; -import net.minecraftforge.common.util.FakePlayer; - -public class PlayerUtils { - - public static final Map<String, EntityPlayer> mCachedFakePlayers = new WeakHashMap<String, EntityPlayer>(); - private static final Class mThaumcraftFakePlayer; - - static { - if (ReflectionUtils.doesClassExist("thaumcraft.common.lib.FakeThaumcraftPlayer")) { - mThaumcraftFakePlayer = ReflectionUtils.getClass("thaumcraft.common.lib.FakeThaumcraftPlayer"); - } - else { - mThaumcraftFakePlayer = null; - } - } - - public static void messagePlayer(final EntityPlayer P, final String S){ - gregtech.api.util.GT_Utility.sendChatToPlayer(P, S); - } - - public static EntityPlayer getPlayer(final String name){ - try{ - final List<EntityPlayer> i = new ArrayList<>(); - final Iterator<EntityPlayerMP> iterator = MinecraftServer.getServer().getConfigurationManager().playerEntityList.iterator(); - while (iterator.hasNext()) { - i.add((iterator.next())); - } - for (final EntityPlayer temp : i) { - if (temp.getDisplayName().toLowerCase().equals(name.toLowerCase())){ - return temp; - } - } - } - catch(final Throwable e){} - return null; - } - - public static EntityPlayer getPlayerOnServerFromUUID(final UUID parUUID){ - if (parUUID == null) - { - return null; - } - final List<EntityPlayerMP> allPlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList; - for (final EntityPlayerMP player : allPlayers) - { - if (player.getUniqueID().equals(parUUID)) - { - return player; - } - } - return null; - } - - //Not Clientside - public static EntityPlayer getPlayerInWorld(final World world, final String Name){ - final List<EntityPlayer> i = world.playerEntities; - final Minecraft mc = Minecraft.getMinecraft(); - try{ - for (final EntityPlayer temp : i) { - if (temp.getDisplayName().toLowerCase().equals(Name.toLowerCase())){ - return temp; - } - } - } - catch(final NullPointerException e){} - return null; - } - - public static boolean isPlayerOP(final EntityPlayer player){ - if (player.canCommandSenderUseCommand(2, "")){ - return true; - } - return false; - } - - //Not Clientside - public static ItemStack getItemStackInPlayersHand(final World world, final String Name){ - final EntityPlayer thePlayer = getPlayer(Name); - ItemStack heldItem = null; - try{heldItem = thePlayer.getHeldItem(); - }catch(final NullPointerException e){return null;} - if (heldItem != null){ - return heldItem; - } - return null; - } - - @SideOnly(Side.CLIENT) - public static ItemStack getItemStackInPlayersHand(){ - final Minecraft mc = Minecraft.getMinecraft(); - ItemStack heldItem = null; - try{heldItem = mc.thePlayer.getHeldItem(); - }catch(final NullPointerException e){return null;} - if (heldItem != null){ - return heldItem; - } - return null; - } - - public static ItemStack getItemStackInPlayersHand(final EntityPlayer player){ - ItemStack heldItem = null; - try{ - heldItem = player.getHeldItem(); - } - catch(final NullPointerException e){ - e.printStackTrace(); - return null; - } - if (heldItem != null){ - return heldItem; - } - else { - if (Utils.isClient()) { - heldItem = player.getItemInUse(); - } - else { - heldItem = player.getCurrentEquippedItem(); - } - } - return heldItem; - } - - @SideOnly(Side.CLIENT) - public static Item getItemInPlayersHandClient(){ - final Minecraft mc = Minecraft.getMinecraft(); - Item heldItem = null; - - try{heldItem = mc.thePlayer.getHeldItem().getItem(); - }catch(final NullPointerException e){return null;} - - if (heldItem != null){ - return heldItem; - } - - return null; - } - - public static Item getItemInPlayersHand(final EntityPlayer player){ - Item heldItem = null; - try{ - heldItem = player.getHeldItem().getItem(); - }catch(final NullPointerException e){return null;} - - if (heldItem != null){ - return heldItem; - } - return null; - } - - public final static EntityPlayer getPlayerEntityByName(final String aPlayerName){ - final EntityPlayer player = PlayerUtils.getPlayer(aPlayerName); - if (player != null){ - return player; - } - return null; - } - - public final static UUID getPlayersUUIDByName(final String aPlayerName){ - final EntityPlayer player = PlayerUtils.getPlayer(aPlayerName); - if (player != null){ - return player.getUniqueID(); - } - return null; - } - - @SideOnly(Side.CLIENT) - public static final boolean isPlayerAlkalus(){ - if (Utils.isServer()){ - return false; - } - return isPlayerAlkalus(Minecraft.getMinecraft().thePlayer); - } - - public static final boolean isPlayerAlkalus(EntityPlayer player){ - if (player != null){ - if (player.getDisplayName().toLowerCase().equals("draknyte1") || player.getDisplayName().toLowerCase().equals("alkalus")){ - return true; - } - } - return false; - } - - public static void messageAllPlayers(String string) { - Utils.sendServerMessage(string); - } - - public static boolean isCreative(EntityPlayer aPlayer) { - return aPlayer.capabilities.isCreativeMode; - } - - public static boolean canTakeDamage(EntityPlayer aPlayer) { - return !aPlayer.capabilities.disableDamage; - } - - public static void cacheFakePlayer(EntityPlayer aPlayer) { - ChunkCoordinates aChunkLocation = aPlayer.getPlayerCoordinates(); - // Cache Fake Player - if (aPlayer instanceof FakePlayer || (mThaumcraftFakePlayer != null && mThaumcraftFakePlayer.isInstance(aPlayer)) - || (aPlayer.getCommandSenderName() == null - || aPlayer.getCommandSenderName().length() <= 0) - || (aPlayer.isEntityInvulnerable() && !aPlayer.canCommandSenderUseCommand(0, "") - && (aChunkLocation == null) || (aChunkLocation.posX == 0 && aChunkLocation.posY == 0 - && aChunkLocation.posZ == 0))) { - mCachedFakePlayers.put(aPlayer.getUniqueID().toString(), aPlayer); - } - } - - public static boolean isCachedFakePlayer(String aUUID) { - return mCachedFakePlayers.containsKey(aUUID); - } - - public static boolean isRealPlayer(EntityLivingBase aEntity) { - if (aEntity instanceof EntityPlayer) { - EntityPlayer p = (EntityPlayer) aEntity; - ChunkCoordinates aChunkLocation = p.getPlayerCoordinates(); - if (p instanceof FakePlayer) { - cacheFakePlayer(p); - return false; - } - if (mThaumcraftFakePlayer != null && mThaumcraftFakePlayer.isInstance(p) ) { - cacheFakePlayer(p); - return false; - } - if (p.getCommandSenderName() == null) { - cacheFakePlayer(p); - return false; - } - if (p.getCommandSenderName().length() <= 0) { - cacheFakePlayer(p); - return false; - } - if (p.isEntityInvulnerable() && !p.canCommandSenderUseCommand(0, "") && (aChunkLocation.posX == 0 && aChunkLocation.posY == 0 && aChunkLocation.posZ == 0)) { - cacheFakePlayer(p); - return false; - } - if (!isCachedFakePlayer(p.getUniqueID().toString())) { - return true; - } - } - return false; - } - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java deleted file mode 100644 index da5bc071bc..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java +++ /dev/null @@ -1,803 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.enums.Materials; -import gregtech.api.objects.ItemData; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.ShapedRecipe; -import gtPlusPlus.core.handler.COMPAT_HANDLER; -import gtPlusPlus.core.handler.Recipes.LateRegistrationHandler; -import gtPlusPlus.core.handler.Recipes.RegistrationHandler; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.data.ArrayUtils; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapelessRecipes; -import net.minecraftforge.oredict.OreDictionary; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -public class RecipeUtils { -public static int mInvalidID = 1; - public static boolean recipeBuilder(final Object slot_1, final Object slot_2, final Object slot_3, final Object slot_4, final Object slot_5, final Object slot_6, final Object slot_7, final Object slot_8, final Object slot_9, ItemStack resultItem){ - - //Old Debug Code, useful for finding recipes loading too early. - /*if (gtPlusPlus.GTplusplus.CURRENT_LOAD_PHASE != GTplusplus.INIT_PHASE.POST_INIT) { - Logger.RECIPE(ReflectionUtils.getMethodName(1)); - Logger.RECIPE(ReflectionUtils.getMethodName(2)); - Logger.RECIPE(ReflectionUtils.getMethodName(3)); - Logger.RECIPE(ReflectionUtils.getMethodName(4)); - Logger.RECIPE(ReflectionUtils.getMethodName(5)); - Logger.RECIPE(ReflectionUtils.getMethodName(6)); - Logger.RECIPE(ReflectionUtils.getMethodName(7)); - Logger.RECIPE(ReflectionUtils.getMethodName(8)); - Logger.RECIPE(ReflectionUtils.getMethodName(9)); - FMLCommonHandler.instance().exitJava(1, true); - }*/ - - if (resultItem == null){ - Logger.RECIPE("[Fix] Found a recipe with an invalid output, yet had a valid inputs. Using Dummy output so recipe can be found.."); - resultItem = ItemUtils.getItemStackOfAmountFromOreDict("givemeabrokenitem", 1); - resultItem.setItemDamage(mInvalidID++); - RegistrationHandler.recipesFailed++; - //return false; - } - else if ((slot_1 == null) && (slot_2 == null) && (slot_3 == null) && - (slot_4 == null) && (slot_5 == null) && (slot_6 == null) && - (slot_7 == null) && (slot_8 == null) && (slot_9 == null)){ - Logger.RECIPE("[Fix] Found a recipe with 0 inputs, yet had a valid output."); - Logger.RECIPE("[Fix] Error found while adding a recipe for: "+resultItem != null ? resultItem.getDisplayName() : "Bad Output Item"+" | Please report this issue on Github."); - RegistrationHandler.recipesFailed++; - return false; - } - - Object[] o = new Object[] {slot_1, slot_2, slot_3, slot_4, slot_5, slot_6, slot_7, slot_8, slot_9}; - - try { - int size = COMPAT_HANDLER.mRecipesToGenerate.size(); - COMPAT_HANDLER.mRecipesToGenerate.put(new InternalRecipeObject(o, resultItem, false)); - //Utils.LOG_WARNING("Success! Added a recipe for "+resultItem.getDisplayName()); - if (COMPAT_HANDLER.mRecipesToGenerate.size() > size) { - if (!COMPAT_HANDLER.areInitItemsLoaded){ - RegistrationHandler.recipesSuccess++; - } - else { - LateRegistrationHandler.recipesSuccess++; - } - return true; - } - return false; - } - catch(RuntimeException k){ - //k.getMessage(); - //k.getClass(); - //k.printStackTrace(); - //k.getLocalizedMessage(); - Logger.RECIPE("[Fix] Invalid Recipe detected for: "+resultItem != null ? resultItem.getUnlocalizedName() : "INVALID OUTPUT ITEM"); - if (!COMPAT_HANDLER.areInitItemsLoaded){ - RegistrationHandler.recipesFailed++; - } - else { - LateRegistrationHandler.recipesFailed++; - } - return false; - } - } - - public static void shapelessBuilder(final ItemStack Output, final Object slot_1, final Object slot_2, final Object slot_3, final Object slot_4, final Object slot_5, final Object slot_6, final Object slot_7, final Object slot_8, final Object slot_9){ - //Item output_ITEM = Output.getItem(); - - final ArrayList<Object> validSlots = new ArrayList<>(); - - Logger.WARNING("Trying to add a recipe for "+Output.toString()); - String a,b,c,d,e,f,g,h,i; - if (slot_1 == null){ a = " ";} else { a = "1";validSlots.add('1');validSlots.add(slot_1);} - Logger.WARNING(a); - if (slot_2 == null){ b = " ";} else { b = "2";validSlots.add('2');validSlots.add(slot_2);} - Logger.WARNING(b); - if (slot_3 == null){ c = " ";} else { c = "3";validSlots.add('3');validSlots.add(slot_3);} - Logger.WARNING(c); - if (slot_4 == null){ d = " ";} else { d = "4";validSlots.add('4');validSlots.add(slot_4);} - Logger.WARNING(d); - if (slot_5 == null){ e = " ";} else { e = "5";validSlots.add('5');validSlots.add(slot_5);} - Logger.WARNING(e); - if (slot_6 == null){ f = " ";} else { f = "6";validSlots.add('6');validSlots.add(slot_6);} - Logger.WARNING(f); - if (slot_7 == null){ g = " ";} else { g = "7";validSlots.add('7');validSlots.add(slot_7);} - Logger.WARNING(g); - if (slot_8 == null){ h = " ";} else { h = "8";validSlots.add('8');validSlots.add(slot_8);} - Logger.WARNING(h); - if (slot_9 == null){ i = " ";} else { i = "9";validSlots.add('9');validSlots.add(slot_9);} - Logger.WARNING(i); - - - Logger.ERROR("_______"); - Logger.ERROR("|"+a+"|"+b+"|"+c+"|"); - Logger.ERROR("_______"); - Logger.ERROR("|"+d+"|"+e+"|"+f+"|"); - Logger.ERROR("_______"); - Logger.ERROR("|"+g+"|"+h+"|"+i+"|"); - Logger.ERROR("_______"); - - validSlots.add(0, a); - validSlots.add(1, b); - validSlots.add(2, c); - validSlots.add(3, d); - validSlots.add(4, e); - validSlots.add(5, f); - validSlots.add(6, g); - validSlots.add(7, h); - validSlots.add(8, i); - - try { - //GameRegistry.addRecipe(new ShapelessOreRecipe(Output, outputAmount), (Object[]) validSlots.toArray()); - GameRegistry.addRecipe(new ShapelessOreRecipe(Output, validSlots.toArray())); - //GameRegistry.addShapelessRecipe(new ItemStack(output_ITEM, 1), new Object[] {slot_1, slot_2}); - Logger.RECIPE("Success! Added a recipe for "+Output.getDisplayName()); - RegistrationHandler.recipesSuccess++; - } - catch(final RuntimeException k){ - k.getMessage(); - k.getClass(); - k.printStackTrace(); - k.getLocalizedMessage(); - Logger.RECIPE("[Fix] Invalid Recipe detected for: "+Output.getUnlocalizedName()); - RegistrationHandler.recipesFailed++; - } - - - //GameRegistry.addShapelessRecipe(new ItemStack(output_ITEM, 1), new Object[] {slot_1, slot_2}); - } - - public static void recipeBuilder(final Object[] array, final ItemStack outPut) { - Logger.SPECIFIC_WARNING("object Array - recipeBuilder", "Attempting to build a recipe using an object array as an input, splitting it, then running the normal recipeBuilder() method.", 396); - Object a=null; - Object b=null; - Object c=null; - Object d=null; - Object e=null; - Object f=null; - Object g=null; - Object h=null; - Object i=null; - for(int z =0; z <= array.length; z++){ - array[z].toString(); - switch(z) - { - case 0: - a = array[z]; - break; - case 1: - b = array[z]; - break; - case 2: - c = array[z]; - break; - case 3: - d = array[z]; - break; - case 4: - e = array[z]; - break; - case 5: - f = array[z]; - break; - case 6: - g = array[z]; - break; - case 7: - h = array[z]; - break; - case 8: - i = array[z]; - break; - default: - break; - } - recipeBuilder(a, b, c, d, e, f, g, h, i, outPut); - } - } - - public static boolean removeCraftingRecipe(Object x){ - if (null == x){return false;} - if (x instanceof String){ - final Item R = ItemUtils.getItemFromFQRN((String) x); - if (R != null){ - x = R; - } - else { - return false; - } - } - if ((x instanceof Item) || (x instanceof ItemStack)){ - if (x instanceof Item){ - final ItemStack r = new ItemStack((Item) x); - Logger.RECIPE("Removing Recipe for "+r.getUnlocalizedName()); - } - else { - Logger.RECIPE("Removing Recipe for "+((ItemStack) x).getUnlocalizedName()); - } - if (x instanceof ItemStack){ - final Item r = ((ItemStack) x).getItem(); - if (null != r){ - x = r; - } - else { - Logger.RECIPE("Recipe removal failed - Tell Alkalus."); - return false; - } - } - if (RecipeUtils.attemptRecipeRemoval((Item) x)){ - Logger.RECIPE("Recipe removal successful"); - return true; - } - Logger.RECIPE("Recipe removal failed - Tell Alkalus."); - return false; - } - return false; - } - - private static boolean attemptRecipeRemoval(final Item I){ - Logger.RECIPE("Create list of recipes."); - final List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList(); - final Iterator<IRecipe> items = recipes.iterator(); - Logger.RECIPE("Begin list iteration."); - while (items.hasNext()) { - final ItemStack is = items.next().getRecipeOutput(); - if ((is != null) && (is.getItem() == I)){ - items.remove(); - Logger.RECIPE("Remove a recipe with "+I.getUnlocalizedName()+" as output."); - continue; - } - } - Logger.RECIPE("All recipes should be gone?"); - if (!items.hasNext()){ - Logger.RECIPE("We iterated once, let's try again to double check."); - final Iterator<IRecipe> items2 = recipes.iterator(); - while (items2.hasNext()) { - final ItemStack is = items2.next().getRecipeOutput(); - if ((is != null) && (is.getItem() == I)){ - items.remove(); - Logger.RECIPE("REMOVING MISSED RECIPE - RECHECK CONSTRUCTORS"); - return true; - } - } - Logger.RECIPE("Should be all gone now after double checking, so return true."); - return true; - } - Logger.RECIPE("Return false, because something went wrong."); - return false; - } - - - - public static boolean addShapedGregtechRecipeForTypes( - final Object InputItem1, final Object InputItem2, final Object InputItem3, - final Object InputItem4, final Object InputItem5, final Object InputItem6, - final Object InputItem7, final Object InputItem8, final Object InputItem9, - final ItemStack OutputItem){ - - int using = 0, recipeSlotCurrent = 0; - boolean[] hasMultiStack = new boolean[9]; - boolean inUse[] = {false, false, false}; - ItemStack array[][] = new ItemStack[3][9]; - - Object[] inputs = { - InputItem1, InputItem2, InputItem3, - InputItem4, InputItem5, InputItem6, - InputItem7, InputItem8, InputItem9}; - - for (Object o : inputs){ - if (o.getClass().isArray()){ - if (inUse[using] == false){ - inUse[using] = true; - array[using] = (ItemStack[]) o; - hasMultiStack[recipeSlotCurrent] = true; - using++; - } - } - else { - hasMultiStack[recipeSlotCurrent] = false; - } - recipeSlotCurrent++; - } - - int using2 = 0; - for (boolean t : inUse){ - - if (t){ - if (array[using2] != null){ - //addShapedGregtechRecipe - } - } - using2++; - } - - - return false; - } - - - - public static boolean addShapedGregtechRecipe( - final Object InputItem1, final Object InputItem2, final Object InputItem3, - final Object InputItem4, final Object InputItem5, final Object InputItem6, - final Object InputItem7, final Object InputItem8, final Object InputItem9, - final ItemStack OutputItem){ - - Object[] o = { - InputItem1, InputItem2, InputItem3, - InputItem4, InputItem5, InputItem6, - InputItem7, InputItem8, InputItem9 - }; - - - if (gtPlusPlus.GTplusplus.CURRENT_LOAD_PHASE != GTplusplus.INIT_PHASE.POST_INIT) { - CORE.crash("Load Phase "+gtPlusPlus.GTplusplus.CURRENT_LOAD_PHASE+" should be "+GTplusplus.INIT_PHASE.POST_INIT+". Unable to register recipe."); - } - - - int size = COMPAT_HANDLER.mGtRecipesToGenerate.size(); - COMPAT_HANDLER.mGtRecipesToGenerate.put(new InternalRecipeObject(o, OutputItem, true)); - - if (COMPAT_HANDLER.mGtRecipesToGenerate.size() > size) { - if (!COMPAT_HANDLER.areInitItemsLoaded){ - RegistrationHandler.recipesSuccess++; - } - else { - LateRegistrationHandler.recipesSuccess++; - } - return true; - } - return false; - - } - - public static boolean addShapedGregtechRecipe(final Object[] inputs, ItemStack output){ - - if (inputs.length != 9){ - Logger.RECIPE("[Fix] Input array for "+output.getDisplayName()+" does not equal 9. "+inputs.length+" is the actual size."); - RegistrationHandler.recipesFailed++; - return false; - } - - for (int x=0;x<9;x++){ - if (inputs[x] == null){ - inputs[x] = " "; - Logger.WARNING("Input slot "+x+" changed from NULL to a blank space."); - } - else if (!(inputs[x] instanceof ItemStack) && !(inputs[x] instanceof String) && !(inputs[x] instanceof Item)){ - if (output != null){ - Logger.RECIPE("[Fix] Invalid Item inserted into inputArray. Item:"+output.getDisplayName()+" has a bad recipe. Please report to Alkalus."); - RegistrationHandler.recipesFailed++; - return false; - } - else { - Logger.RECIPE("[Fix] Output is Null for a recipe. Report to Alkalus."); - output = ItemUtils.getItemStackOfAmountFromOreDict("sadibasdkjnad", 1); - RegistrationHandler.recipesFailed++; - } - } - } - - int size = COMPAT_HANDLER.mGtRecipesToGenerate.size(); - COMPAT_HANDLER.mGtRecipesToGenerate.put(new InternalRecipeObject(inputs, output, true)); - - if (COMPAT_HANDLER.mGtRecipesToGenerate.size() > size) { - if (!COMPAT_HANDLER.areInitItemsLoaded){ - RegistrationHandler.recipesSuccess++; - } - else { - LateRegistrationHandler.recipesSuccess++; - } - return true; - } - return false; - } - - public static boolean addShapelessGregtechRecipe( - final Object InputItem1, final Object InputItem2, final Object InputItem3, - final Object InputItem4, final Object InputItem5, final Object InputItem6, - final Object InputItem7, final Object InputItem8, final Object InputItem9, - final ItemStack OutputItem){ - - Object[] inputItems = { - InputItem1, InputItem2, InputItem3, - InputItem4, InputItem5, InputItem6, - InputItem7, InputItem8, InputItem9 - }; - return addShapelessGregtechRecipe(inputItems, OutputItem); - } - - public static boolean addShapelessGregtechRecipe(final Object[] inputItems, final ItemStack OutputItem){ - //Catch Invalid Recipes - if (inputItems.length > 9 || inputItems.length < 1){ - if (OutputItem != null){ - Logger.RECIPE("[Fix] Invalid input array for shapeless recipe, which should output "+OutputItem.getDisplayName()); - } - return false; - } - //let gregtech handle shapeless recipes. - if (GT_ModHandler.addShapelessCraftingRecipe(OutputItem, inputItems)){ - return true; - } - return false; - } - - public static ItemStack getItemStackFromOreDict(final String oredictName){ - final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); - return oreDictList.get(0); - } - - public static boolean buildShapelessRecipe(final ItemStack output, final Object[] input){ - return ShapelessUtils.addShapelessRecipe(output, input); - } - - public static boolean generateMortarRecipe(ItemStack aStack, ItemStack aOutput) { - return RecipeUtils.addShapedGregtechRecipe( - aStack, null, null, - CI.craftingToolMortar, null, null, - null, null, null, - aOutput); - } - - public static boolean doesGregtechRecipeHaveEqualCells(GT_Recipe x) { - if (x.mInputs.length == 0 && x.mOutputs.length == 0) { - return true; - } - - final int tInputAmount = GT_ModHandler.getCapsuleCellContainerCountMultipliedWithStackSize(x.mInputs); - final int tOutputAmount = GT_ModHandler.getCapsuleCellContainerCountMultipliedWithStackSize(x.mOutputs); - - if (tInputAmount < tOutputAmount) { - if (!Materials.Tin.contains(x.mInputs)) { - return false; - } - else { - return true; - } - } - else if (tInputAmount > tOutputAmount && !Materials.Tin.contains(x.mOutputs)) { - return false; - } - else { - return true; - } - } - - public static String[] getRecipeInfo(GT_Recipe m) { - if (m == null) { - return new String[] {}; - } - AutoMap<String> result = new AutoMap<String>(); - result.put(m.toString()); - result.put("Input "+ItemUtils.getArrayStackNames(m.mInputs)); - result.put("Output "+ItemUtils.getArrayStackNames(m.mOutputs)); - result.put("Input "+ItemUtils.getArrayStackNames(m.mFluidInputs)); - result.put("Output "+ItemUtils.getArrayStackNames(m.mFluidOutputs)); - result.put("Can be buffered? "+m.mCanBeBuffered); - result.put("Duration: "+m.mDuration); - result.put("EU/t: "+m.mEUt); - result.put("Is Hidden? "+m.mHidden); - result.put("Is Enabled? "+m.mEnabled); - result.put("Special Value: "+m.mSpecialValue); - result.put("====================================="); - String s[] = result.toArray(); - return s; - } - - - public static class InternalRecipeObject implements RunnableWithInfo<String> { - final ItemStack mOutput; - final ShapedOreRecipe mRecipe; - public final boolean isValid; - - public InternalRecipeObject(Object[] aInputs, ItemStack aOutput, boolean gtRecipe) { - Logger.RECIPE("==================================="); - mOutput = aOutput != null ? aOutput.copy() : null; - Object[] aFiltered = new Object[9]; - int aValid = 0; - for (Object o : aInputs) { - if (o instanceof ItemStack) { - aFiltered[aValid++] = o; - } - else if (o instanceof Item) { - aFiltered[aValid++] = ItemUtils.getSimpleStack((Item) o); - } - else if (o instanceof Block) { - aFiltered[aValid++] = ItemUtils.getSimpleStack((Block) o); - } - else if (o instanceof String) { - aFiltered[aValid++] = o; - } - else if (o == null) { - aFiltered[aValid++] = null; - } - else { - Logger.RECIPE("Cleaned a "+o.getClass().getSimpleName()+" from recipe input."); - } - } - - int validCounter = 0, invalidCounter = 0; - for (Object p : aFiltered) { - if (p instanceof ItemStack) { - validCounter++; - } - else if (p instanceof Item) { - validCounter++; - } - else if (p instanceof Block) { - validCounter++; - } - else if (p instanceof String) { - validCounter++; - } - else if (p == null) { - validCounter++; - } - else { - invalidCounter++; - } - } - - Logger.RECIPE("Using "+validCounter+" valid inputs and "+invalidCounter+" invalid inputs."); - ShapedRecipe r = new ShapedRecipe(aFiltered, mOutput); - if (r != null && r.mRecipe != null) { - isValid = true; - } - else { - isValid = false; - } - mRecipe = r != null ? r.mRecipe : null; - } - - @Override - public void run() { - if (this.isValid) { - GameRegistry.addRecipe(mRecipe); - } - else { - Logger.RECIPE("[Fix] Invalid shapped recipe outputting "+mOutput != null ? mOutput.getDisplayName() : "Bad Output Item"); - } - } - - @Override - public String getInfoData() { - if (mOutput != null && mOutput instanceof ItemStack) { - return ((ItemStack) mOutput).getDisplayName(); - } - return ""; - } - - } - - - public static boolean removeGtRecipe(GT_Recipe aRecipeToRemove, GT_Recipe_Map aRecipeMap) { - if (aRecipeMap.mRecipeList.contains(aRecipeToRemove)) { - return aRecipeMap.mRecipeList.remove(aRecipeToRemove); - } - return false; - } - - public static boolean addGtRecipe(GT_Recipe aRecipeToAdd, GT_Recipe_Map aRecipeMap) { - if (!aRecipeMap.mRecipeList.contains(aRecipeToAdd)) { - return aRecipeMap.mRecipeList.add(aRecipeToAdd); - } - return false; - } - - public static boolean removeRecipeByOutput(ItemStack aOutput) { - return removeRecipeByOutput(aOutput, true, false, false); - } - - public static boolean removeRecipeByOutput(ItemStack aOutput, boolean aIgnoreNBT, - boolean aNotRemoveShapelessRecipes, boolean aOnlyRemoveNativeHandlers) { - if (aOutput == null) { - return false; - } else { - boolean rReturn = false; - ArrayList<IRecipe> tList = (ArrayList) CraftingManager.getInstance().getRecipeList(); - aOutput = GT_OreDictUnificator.get(aOutput); - int tList_sS = tList.size(); - - for (int i = 0; i < tList_sS; ++i) { - IRecipe tRecipe = (IRecipe) tList.get(i); - if (!aNotRemoveShapelessRecipes - || !(tRecipe instanceof ShapelessRecipes) && !(tRecipe instanceof ShapelessOreRecipe)) { - if (aOnlyRemoveNativeHandlers) { - if (!gregtech.api.util.GT_ModHandler.sNativeRecipeClasses.contains(tRecipe.getClass().getName())) { - continue; - } - } else if (gregtech.api.util.GT_ModHandler.sSpecialRecipeClasses.contains(tRecipe.getClass().getName())) { - continue; - } - - ItemStack tStack = tRecipe.getRecipeOutput(); - if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(tStack), aOutput, aIgnoreNBT)) { - tList.remove(i--); - tList_sS = tList.size(); - rReturn = true; - } - } - } - - return rReturn; - } - } - - - public static void addSmeltingRecipe(ItemStack aStackInput, ItemStack aStackOutput) { - addSmeltingRecipe(aStackInput, aStackOutput, 0f); - } - - public static void addSmeltingRecipe(ItemStack aStackInput, ItemStack aStackOutput, float aXpGained) { - - GameRegistry.addSmelting(aStackInput, aStackOutput, aXpGained); - - } - - public static boolean addShapedRecipe( - Object Input_1, Object Input_2, Object Input_3, - Object Input_4, Object Input_5, Object Input_6, - Object Input_7, Object Input_8, Object Input_9, - ItemStack aOutputStack) { - return addShapedRecipe(new Object[] {Input_1, Input_2, Input_3, Input_4, Input_5, Input_6, Input_7, Input_8, Input_9}, aOutputStack); - } - - private static boolean addShapedRecipe(Object[] Inputs, ItemStack aOutputStack) { - Object[] Slots = new Object[9]; - - String aFullString = ""; - String aFullStringExpanded = "abcdefghi"; - - for (int i=0; i<9; i++) { - Object o = Inputs[i]; - - if (o instanceof ItemStack) { - Slots[i] = ItemUtils.getSimpleStack((ItemStack) o, 1); - aFullString += aFullStringExpanded.charAt(i); - } - else if (o instanceof Item) { - Slots[i] = ItemUtils.getSimpleStack((Item) o, 1); - aFullString += aFullStringExpanded.charAt(i); - } - else if (o instanceof Block) { - Slots[i] = ItemUtils.getSimpleStack((Block) o, 1); - aFullString += aFullStringExpanded.charAt(i); - } - else if (o instanceof String) { - Slots[i] = o; - aFullString += aFullStringExpanded.charAt(i); - } - else if (o instanceof ItemData) { - ItemData aData = (ItemData) o; - ItemStack aStackFromGT = ItemUtils.getOrePrefixStack(aData.mPrefix, aData.mMaterial.mMaterial, 1); - Slots[i] = aStackFromGT; - aFullString += aFullStringExpanded.charAt(i); - } - else if (o == null) { - Slots[i] = null; - aFullString += " "; - } - else { - Slots[i] = null; - Logger.INFO("Cleaned a "+o.getClass().getSimpleName()+" from recipe input."); - Logger.INFO("ERROR"); - CORE.crash("Bad Shaped Recipe."); - } - } - Logger.INFO("Using String: "+aFullString); - - String aRow1 = aFullString.substring(0, 3); - String aRow2 = aFullString.substring(3, 6); - String aRow3 = aFullString.substring(6, 9); - Logger.INFO(""+aRow1); - Logger.INFO(""+aRow2); - Logger.INFO(""+aRow3); - - String[] aStringData = new String[] {aRow1, aRow2, aRow3}; - Object[] aDataObject = new Object[19]; - aDataObject[0] = aStringData; - int aIndex = 0; - - - for (int u=1;u<20;u+=2) { - if (aIndex == 9) { - break; - } - if (aFullString.charAt(aIndex) != (' ')) { - aDataObject[u] = aFullString.charAt(aIndex); - aDataObject[u+1] = Slots[aIndex]; - Logger.INFO("("+aIndex+") "+aFullString.charAt(aIndex)+" | "+ (Slots[aIndex] instanceof ItemStack ? ItemUtils.getItemName((ItemStack) Slots[aIndex]) : Slots[aIndex] instanceof String ? (String) Slots[aIndex] : "Unknown")); - } - aIndex++; - } - - Logger.INFO("Data Size: "+aDataObject.length); - aDataObject = ArrayUtils.removeNulls(aDataObject); - Logger.INFO("Clean Size: "+aDataObject.length); - Logger.INFO("ArrayData: "+Arrays.toString(aDataObject)); - - ShapedOreRecipe aRecipe = new ShapedOreRecipe(aOutputStack, aDataObject); - - /*ShapedOreRecipe aRecipe = new ShapedOreRecipe(aOutputStack, - aStringData, - 'a', Slots[0], - 'b', Slots[1], - 'c', Slots[2], - 'd', Slots[3], - 'e', Slots[4], - 'f', Slots[5], - 'g', Slots[6], - 'h', Slots[7], - 'i', Slots[8]);*/ - - int size = COMPAT_HANDLER.mRecipesToGenerate.size(); - COMPAT_HANDLER.mRecipesToGenerate.put(new InternalRecipeObject2(aRecipe)); - if (COMPAT_HANDLER.mRecipesToGenerate.size() > size) { - if (!COMPAT_HANDLER.areInitItemsLoaded){ - RegistrationHandler.recipesSuccess++; - } - else { - LateRegistrationHandler.recipesSuccess++; - } - return true; - } - return false; - } - public static class InternalRecipeObject2 implements RunnableWithInfo<String> { - - final ItemStack mOutput; - final ShapedOreRecipe mRecipe; - final boolean isValid; - - public InternalRecipeObject2(ShapedOreRecipe aRecipe) { - mRecipe = aRecipe; - mOutput = aRecipe.getRecipeOutput(); - if (mOutput != null) { - this.isValid = true; - } - else { - this.isValid = false; - } - } - - @Override - public void run() { - if (this.isValid) { - GameRegistry.addRecipe(mRecipe); - } - else { - Logger.INFO("[Fix] Invalid shapped recipe outputting "+mOutput != null ? mOutput.getDisplayName() : "Bad Output Item"); - } - } - - @Override - public String getInfoData() { - if (mOutput != null && mOutput instanceof ItemStack) { - return ((ItemStack) mOutput).getDisplayName(); - } - return ""; - } - - } - - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ShapelessUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ShapelessUtils.java deleted file mode 100644 index 3caa9d4e4f..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/ShapelessUtils.java +++ /dev/null @@ -1,56 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import java.util.ArrayList; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.ShapelessRecipes; - -import gtPlusPlus.api.objects.Logger; - -public class ShapelessUtils { - - - public static boolean addShapelessRecipe(final ItemStack output, final Object ... params) - { - final ArrayList<ItemStack> arraylist = new ArrayList<>(); - final Object[] aobject = params; - final int i = params.length; - - for (int j = 0; j < i; ++j) - { - final Object object1 = aobject[j]; - - if (object1 instanceof ItemStack) - { - arraylist.add(((ItemStack)object1).copy()); - } - else if (object1 instanceof Item) - { - arraylist.add(new ItemStack((Item)object1)); - } - else - { - if ((object1 == null)) - { - Logger.INFO(("Invalid shapeless input, ignoring!")); - } - else if (!(object1 instanceof Block) && (object1 != null)) - { - Logger.INFO(("Invalid shapeless recipe!")); - return false; - } - else { - arraylist.add(new ItemStack((Block)object1)); - } - } - } - CraftingManager.getInstance().getRecipeList().add(new ShapelessRecipes(output, arraylist)); - //CraftingManager.getInstance().addShapelessRecipe(output, arraylist); - return true; - } - - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java deleted file mode 100644 index 242a63c712..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java +++ /dev/null @@ -1,191 +0,0 @@ -package gtPlusPlus.core.util.minecraft.gregtech; - -import static gtPlusPlus.core.lib.CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK; - -import org.apache.commons.lang3.ArrayUtils; - -import gregtech.GT_Mod; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; -import gregtech.common.GT_Pollution; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.item.base.cell.BaseItemCell; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.MISC_MATERIALS; -import gtPlusPlus.core.material.MaterialGenerator; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.item.ItemStack; -import net.minecraft.world.chunk.Chunk; -import net.minecraftforge.fluids.FluidStack; - -public class PollutionUtils { - - private static boolean mIsPollutionEnabled = true; - - public static AutoMap<FluidStack> mPollutionFluidStacks = new AutoMap<FluidStack>(); - - static { - if (MAIN_GREGTECH_5U_EXPERIMENTAL_FORK || CORE.GTNH) { - mIsPollutionEnabled = mPollution(); - } else { - mIsPollutionEnabled = false; - } - } - - public static boolean isPollutionEnabled() { - return mIsPollutionEnabled; - } - - private static boolean mPollution() { - return GT_Mod.gregtechproxy.mPollution; - } - - public static boolean addPollution(IGregTechTileEntity te, int pollutionValue) { - if (mIsPollutionEnabled) { - GT_Pollution.addPollution(te, pollutionValue); - return true; - } - return false; - } - - public static boolean addPollution(IHasWorldObjectAndCoords aTileOfSomeSort, int pollutionValue) { - if (mIsPollutionEnabled) { - IHasWorldObjectAndCoords j = (IHasWorldObjectAndCoords) aTileOfSomeSort; - Chunk c = j.getWorld().getChunkFromBlockCoords(j.getXCoord(), j.getZCoord()); - return addPollution(c, pollutionValue); - } - return false; - } - - public static boolean addPollution(Chunk aChunk, int pollutionValue) { - if (mIsPollutionEnabled) { - GT_Pollution.addPollution(aChunk, pollutionValue); - return true; - } - return false; - } - - public static boolean removePollution(IGregTechTileEntity te, int pollutionValue) { - return addPollution(te, -pollutionValue); - } - - public static boolean removePollution(IHasWorldObjectAndCoords aTileOfSomeSort, int pollutionValue) { - return addPollution(aTileOfSomeSort, -pollutionValue); - } - - public static boolean removePollution(Chunk aChunk, int pollutionValue) { - return addPollution(aChunk, -pollutionValue); - } - - public static boolean nullifyPollution(IGregTechTileEntity te) { - if (te == null) { - return false; - } - return nullifyPollution((IHasWorldObjectAndCoords) te); - } - - public static boolean nullifyPollution(IHasWorldObjectAndCoords aTileOfSomeSort) { - if (aTileOfSomeSort == null) { - return false; - } - IHasWorldObjectAndCoords j = (IHasWorldObjectAndCoords) aTileOfSomeSort; - Chunk c = j.getWorld().getChunkFromBlockCoords(j.getXCoord(), j.getZCoord()); - return nullifyPollution(c); - } - - public static boolean nullifyPollution(Chunk aChunk) { - if (mIsPollutionEnabled) { - if (aChunk == null) { - return false; - } - int getCurrentPollution = getPollution(aChunk); - if (getCurrentPollution <= 0) { - return false; - } - else { - return removePollution(aChunk, getCurrentPollution); - } - } - return false; - } - - public static int getPollution(IGregTechTileEntity te) { - return GT_Pollution.getPollution(te); - } - - public static int getPollution(Chunk te) { - return GT_Pollution.getPollution(te); - } - - public static boolean setPollutionFluids() { - if (mPollutionFluidStacks.isEmpty()) { - FluidStack CD, CM, SD; - CD = FluidUtils.getFluidStack("carbondioxide", 1000); - CM = FluidUtils.getFluidStack("carbonmonoxide", 1000); - SD = FluidUtils.getFluidStack("sulfurdioxide", 1000); - if (PollutionUtils.mPollutionFluidStacks.size() == 0) { - if (CD != null) { - Logger.INFO("[PollutionCompat] Found carbon dioxide fluid, registering it."); - PollutionUtils.mPollutionFluidStacks.put(CD); - MISC_MATERIALS.CARBON_DIOXIDE.registerComponentForMaterial(CD); - ItemStack cellCD = ItemUtils.getItemStackOfAmountFromOreDict("cellCarbonDioxide", 1); - if (ItemUtils.checkForInvalidItems(cellCD)) { - Logger.INFO("[PollutionCompat] Found carbon dioxide cell, registering component."); - MISC_MATERIALS.CARBON_DIOXIDE.registerComponentForMaterial(OrePrefixes.cell, cellCD); - } - else { - Logger.INFO("[PollutionCompat] Did not find carbon dioxide cell, registering new component."); - new BaseItemCell(MISC_MATERIALS.CARBON_DIOXIDE); - } - } - else { - MaterialGenerator.generate(MISC_MATERIALS.CARBON_DIOXIDE, false, false); - } - - if (CM != null) { - Logger.INFO("[PollutionCompat] Found carbon monoxide fluid, registering it."); - PollutionUtils.mPollutionFluidStacks.put(CM); - MISC_MATERIALS.CARBON_MONOXIDE.registerComponentForMaterial(CM); - ItemStack cellCD = ItemUtils.getItemStackOfAmountFromOreDict("cellCarbonMonoxide", 1); - if (ItemUtils.checkForInvalidItems(cellCD)) { - Logger.INFO("[PollutionCompat] Found carbon monoxide cell, registering component."); - MISC_MATERIALS.CARBON_MONOXIDE.registerComponentForMaterial(OrePrefixes.cell, cellCD); - } - else { - Logger.INFO("[PollutionCompat] Did not find carbon monoxide cell, registering new component."); - new BaseItemCell(MISC_MATERIALS.CARBON_MONOXIDE); - } - } - else { - MaterialGenerator.generate(MISC_MATERIALS.CARBON_MONOXIDE, false, false); - } - - if (SD != null) { - Logger.INFO("[PollutionCompat] Found sulfur dioxide fluid, registering it."); - PollutionUtils.mPollutionFluidStacks.put(SD); - } - } - if (PollutionUtils.mPollutionFluidStacks.size() > 0) { - return true; - } - return false; - } - else { - if (mPollutionFluidStacks.size() != 3) { - Logger.INFO("Unable to detect all 3 pollution fluids. Found: "); - Logger.INFO(ArrayUtils.toString(mPollutionFluidStacks)); - return false; - } - else { - return true; - } - } - - - - } - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/material/MaterialBuilder.java b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/material/MaterialBuilder.java deleted file mode 100644 index 44c0f66732..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/material/MaterialBuilder.java +++ /dev/null @@ -1,244 +0,0 @@ -package gtPlusPlus.core.util.minecraft.gregtech.material; - -public class MaterialBuilder { - /*public static final int DIESEL = 0, GAS = 1, THERMAL = 2, SEMIFLUID = 3, PLASMA = 4, MAGIC = 5; - - private int metaItemSubID; - private TextureSet iconSet; - private float toolSpeed = 1.0f; - private int durability = 0; - private int toolQuality = 0; - private int types = 0; - private int r = 255, g = 255, b = 255, a = 0; - private String name; - private String defaultLocalName; - private int fuelType = 0; - private int fuelPower = 0; - private int meltingPoint = 0; - private int blastFurnaceTemp = 0; - private boolean blastFurnaceRequired = false; - private boolean transparent = false; - private int oreValue = 1; - private int densityMultiplier = 1; - private int densityDivider = 1; - private Dyes color = Dyes._NULL; - private int extraData = 0; - private List<MaterialStack> materialList = new ArrayList<MaterialStack>(); - private List<TC_Aspects.TC_AspectStack> aspects = new ArrayList<TC_Aspects.TC_AspectStack>(); - private boolean canBeCracked = false; - private int liquidTemperature = 300; - private int gasTemperature = 300; - - public MaterialBuilder(int metaItemSubID, TextureSet iconSet, String defaultLocalName) { - this.metaItemSubID = metaItemSubID; - this.iconSet = iconSet; - this.name = defaultLocalName.replace(" ", "").replace("-", ""); - this.defaultLocalName = defaultLocalName; - } - - public Materials constructMaterial() { - return new Materials( - metaItemSubID, iconSet, toolSpeed, durability, toolQuality, types, r, g, b, a, name, defaultLocalName, fuelType, fuelPower, meltingPoint, blastFurnaceTemp, - blastFurnaceRequired, transparent, oreValue, densityMultiplier, densityDivider, color, extraData, materialList, aspects); - - } - - public MaterialBuilder setName(String name){ - this.name = name; - return this; - } - - public MaterialBuilder setTypes(int types){ - this.types = types; - return this; - } - - public MaterialBuilder addDustItems(){ - types = types | 1; - return this; - } - - public MaterialBuilder addMetalItems(){ - types = types | 2; - return this; - } - - public MaterialBuilder addGemItems(){ - types = types | 4; - return this; - } - - public MaterialBuilder addOreItems(){ - types = types | 8; - return this; - } - - public MaterialBuilder addCell(){ - types = types | 16; - return this; - } - - public MaterialBuilder addPlasma(){ - types = types | 32; - return this; - } - - public MaterialBuilder addToolHeadItems(){ - types = types | 64; - return this; - } - - public MaterialBuilder addGearItems(){ - types = types | 128; - return this; - } - - public MaterialBuilder addFluid(){ - return this; - } - - public MaterialBuilder addGas(){ - return this; - } - - - public MaterialBuilder setRGBA(int r, int g, int b, int a){ - this.r = r; - this.g = g; - this.b = b; - this.a = a; - return this; - } - - public MaterialBuilder setRGB(int r, int g, int b){ - this.r = r; - this.g = g; - this.b = b; - return this; - } - - public MaterialBuilder setTransparent(boolean transparent){ - this.transparent = transparent; - return this; - } - - public MaterialBuilder setColor(Dyes color){ - this.color = color; - return this; - } - - - public MaterialBuilder setToolSpeed(float toolSpeed) { - this.toolSpeed = toolSpeed; - return this; - } - - public MaterialBuilder setDurability(int durability) { - this.durability = durability; - return this; - } - - public MaterialBuilder setToolQuality(int toolQuality) { - this.toolQuality = toolQuality; - return this; - } - - - public MaterialBuilder setFuelType(int fuelType) { - this.fuelType = fuelType; - return this; - } - - public MaterialBuilder setFuelPower(int fuelPower) { - this.fuelPower = fuelPower; - return this; - } - - public MaterialBuilder setMeltingPoint(int meltingPoint) { - this.meltingPoint = meltingPoint; - return this; - } - - public MaterialBuilder setBlastFurnaceTemp(int blastFurnaceTemp) { - this.blastFurnaceTemp = blastFurnaceTemp; - return this; - } - - public MaterialBuilder setBlastFurnaceRequired(boolean blastFurnaceRequired) { - this.blastFurnaceRequired = blastFurnaceRequired; - return this; - } - - public MaterialBuilder setOreValue(int oreValue) { - this.oreValue = oreValue; - return this; - } - - public MaterialBuilder setDensityMultiplier(int densityMultiplier) { - this.densityMultiplier = densityMultiplier; - return this; - } - - public MaterialBuilder setDensityDivider(int densityDivider) { - this.densityDivider = densityDivider; - return this; - } - - public MaterialBuilder setExtraData(int extraData) { - this.extraData = extraData; - return this; - } - - public MaterialBuilder addElectrolyzerRecipe(){ - extraData = extraData | 1; - return this; - } - - public MaterialBuilder addCentrifugeRecipe(){ - extraData = extraData | 2; - return this; - } - - public MaterialBuilder setMaterialList(List<MaterialStack> materialList) { - this.materialList = materialList; - return this; - } - - public MaterialBuilder setMaterialList(MaterialStack ... materials) { - this.materialList = Arrays.asList(materials); - return this; - } - - public MaterialBuilder setAspects(List<TC_Aspects.TC_AspectStack> aspects) { - this.aspects = aspects; - return this; - } - - public int getLiquidTemperature() { - return liquidTemperature; - } - - public MaterialBuilder setLiquidTemperature(int liquidTemperature) { - this.liquidTemperature = liquidTemperature; - return this; - } - - public int getGasTemperature() { - return gasTemperature; - } - - public MaterialBuilder setGasTemperature(int gasTemperature) { - this.gasTemperature = gasTemperature; - return this; - } - - public boolean canBeCracked() { - return canBeCracked; - } - - public MaterialBuilder setCanBeCracked(boolean canBeCracked) { - this.canBeCracked = canBeCracked; - return this; - } -*/ -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/recipehandlers/GregtechRecipe.java b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/recipehandlers/GregtechRecipe.java deleted file mode 100644 index 635239bbfc..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/recipehandlers/GregtechRecipe.java +++ /dev/null @@ -1,3 +0,0 @@ -package gtPlusPlus.core.util.minecraft.gregtech.recipehandlers; - -public final class GregtechRecipe {}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/minecraft/network/CustomPacket.java b/src/Java/gtPlusPlus/core/util/minecraft/network/CustomPacket.java deleted file mode 100644 index def836eac9..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/network/CustomPacket.java +++ /dev/null @@ -1,39 +0,0 @@ -package gtPlusPlus.core.util.minecraft.network; - -import cpw.mods.fml.common.network.internal.FMLProxyPacket; -import io.netty.buffer.Unpooled; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import mods.railcraft.common.util.misc.Game; - -public abstract class CustomPacket { - public static final String CHANNEL_NAME = "GTPP"; - - public enum PacketType { - TILE_ENTITY, - } - - public FMLProxyPacket getPacket() { - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - DataOutputStream data = new DataOutputStream(bytes); - try { - data.writeByte(this.getID()); - this.writeData(data); - } catch (IOException var4) { - Game.logThrowable("Error constructing packet: {0}", var4, new Object[]{this.getClass()}); - } - return new FMLProxyPacket(Unpooled.wrappedBuffer(bytes.toByteArray()), "GTPP"); - } - - public abstract void writeData(DataOutputStream var1) throws IOException; - - public abstract void readData(DataInputStream var1) throws IOException; - - public abstract int getID(); - - public String toString() { - return this.getClass().getSimpleName(); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/minecraft/network/PacketBuilder.java b/src/Java/gtPlusPlus/core/util/minecraft/network/PacketBuilder.java deleted file mode 100644 index edbc6aaf83..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/network/PacketBuilder.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.core.util.minecraft.network; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.world.WorldServer; - -public class PacketBuilder { - - private static PacketBuilder instance; - - public static PacketBuilder instance() { - if (instance == null) { - instance = new PacketBuilder(); - } - return instance; - } - - public void sendTileEntityPacket(IGregTechTileEntity tile) { - if (tile.getWorld() instanceof WorldServer) { - WorldServer world = (WorldServer) tile.getWorld(); - PacketTileEntity pkt = new PacketTileEntity(tile); - PacketDispatcher.sendToWatchers(pkt, world, tile.getXCoord(), tile.getZCoord()); - } - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/minecraft/network/PacketDispatcher.java b/src/Java/gtPlusPlus/core/util/minecraft/network/PacketDispatcher.java deleted file mode 100644 index f61a6f2b6c..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/network/PacketDispatcher.java +++ /dev/null @@ -1,88 +0,0 @@ -package gtPlusPlus.core.util.minecraft.network; - -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; -import cpw.mods.fml.relauncher.ReflectionHelper; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.preloader.DevHelper; - -import java.lang.reflect.Method; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.network.Packet; -import net.minecraft.server.management.PlayerManager; -import net.minecraft.world.WorldServer; - -@SuppressWarnings("unchecked") -public class PacketDispatcher { - private static final Class playerInstanceClass; - private static final Method getOrCreateChunkWatcher; - private static final Method sendToAllPlayersWatchingChunk; - - public static void sendToServer(CustomPacket packet) { - PacketHandler.INSTANCE.channel.sendToServer(packet.getPacket()); - } - - public static void sendToPlayer(CustomPacket packet, EntityPlayerMP player) { - PacketHandler.INSTANCE.channel.sendTo(packet.getPacket(), player); - } - - public static void sendToAll(CustomPacket packet) { - PacketHandler.INSTANCE.channel.sendToAll(packet.getPacket()); - } - - public static void sendToAllAround(CustomPacket packet, TargetPoint zone) { - PacketHandler.INSTANCE.channel.sendToAllAround(packet.getPacket(), zone); - } - - public static void sendToDimension(CustomPacket packet, int dimensionId) { - PacketHandler.INSTANCE.channel.sendToDimension(packet.getPacket(), dimensionId); - } - - public static void sendToWatchers(CustomPacket packet, WorldServer world, int worldX, int worldZ) { - try { - Object playerInstance = getOrCreateChunkWatcher.invoke(world.getPlayerManager(), worldX >> 4, worldZ >> 4, - false); - if (playerInstance != null) { - sendToAllPlayersWatchingChunk.invoke(playerInstance, packet.getPacket()); - } - - } catch (Exception var5) { - Logger.ERROR("Reflection Failure in PacketDispatcher.sendToWatchers() {0} {1}" + 20 + var5 + - new Object[]{getOrCreateChunkWatcher.getName() + sendToAllPlayersWatchingChunk.getName()}); - throw new RuntimeException(var5); - } - } - - static { - try { - playerInstanceClass = PlayerManager.class.getDeclaredClasses()[0]; - - Method a, b; - - try { - a = DevHelper.getForgeMethod(PlayerManager.class, "getOrCreateChunkWatcher", int.class, int.class, boolean.class); - } - catch (Throwable t) { - a = ReflectionHelper.findMethod(playerInstanceClass, (Object) null, - new String[]{"func_72690_a", "getOrCreateChunkWatcher"}, - new Class[]{Integer.TYPE, Integer.TYPE, Boolean.TYPE}); - } - try { - b = DevHelper.getForgeMethod(PlayerManager.class, "sendToAllPlayersWatchingChunk", Packet.class); - } - catch (Throwable t) { - b = ReflectionHelper.findMethod(playerInstanceClass, (Object) null, - new String[]{"func_151251_a", "sendToAllPlayersWatchingChunk"}, - new Class[]{Packet.class}); - } - - - getOrCreateChunkWatcher = a; - sendToAllPlayersWatchingChunk = b; - getOrCreateChunkWatcher.setAccessible(true); - sendToAllPlayersWatchingChunk.setAccessible(true); - } catch (Exception var1) { - Logger.ERROR("Reflection Failure in PacketDispatcher initalization {0} {1}" + var1); - throw new RuntimeException(var1); - } - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/minecraft/network/PacketHandler.java b/src/Java/gtPlusPlus/core/util/minecraft/network/PacketHandler.java deleted file mode 100644 index 158f9f9483..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/network/PacketHandler.java +++ /dev/null @@ -1,71 +0,0 @@ -package gtPlusPlus.core.util.minecraft.network; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.network.FMLEventChannel; -import cpw.mods.fml.common.network.NetworkRegistry; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.minecraft.network.CustomPacket.PacketType; -import cpw.mods.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent; -import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent; -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; -import java.io.IOException; -import java.util.Arrays; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.network.NetHandlerPlayServer; - -public class PacketHandler { - public static final PacketHandler INSTANCE = new PacketHandler(); - private static final PacketType[] packetTypes = PacketType.values(); - final FMLEventChannel channel; - - private PacketHandler() { - this.channel = NetworkRegistry.INSTANCE.newEventDrivenChannel("GTPP"); - this.channel.register(this); - } - - public static void init() { - } - - @SubscribeEvent - public void onPacket(ServerCustomPacketEvent event) { - byte[] data = new byte[event.packet.payload().readableBytes()]; - event.packet.payload().readBytes(data); - this.onPacketData(data, ((NetHandlerPlayServer) event.handler).playerEntity); - } - - @SubscribeEvent - public void onPacket(ClientCustomPacketEvent event) { - byte[] data = new byte[event.packet.payload().readableBytes()]; - event.packet.payload().readBytes(data); - this.onPacketData(data, (EntityPlayerMP) null); - } - - public void onPacketData(byte[] bData, EntityPlayerMP player) { - DataInputStream data = new DataInputStream(new ByteArrayInputStream(bData)); - - try { - byte packetID = data.readByte(); - if (packetID < 0) { - return; - } - PacketType type = packetTypes[packetID]; - Object pkt; - - switch(type.ordinal()) { - case 0: - pkt = new PacketTileEntity(); - break; - default: - return; - } - - if (pkt != null) { - ((CustomPacket)pkt).readData(data); - } - } catch (IOException var7) { - Logger.ERROR("Exception in PacketHandler.onPacketData: {0}"+ var7 + new Object[]{Arrays.toString(bData)}); - } - - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/minecraft/network/PacketTileEntity.java b/src/Java/gtPlusPlus/core/util/minecraft/network/PacketTileEntity.java deleted file mode 100644 index d59bee3c27..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/network/PacketTileEntity.java +++ /dev/null @@ -1,79 +0,0 @@ -package gtPlusPlus.core.util.minecraft.network; - -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.api.interfaces.IGregtechPacketEntity; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import mods.railcraft.common.util.misc.Game; -import net.minecraft.client.Minecraft; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class PacketTileEntity extends CustomPacket { - private IGregTechTileEntity tile; - private IGregtechPacketEntity ptile; - - public PacketTileEntity() { - } - - public PacketTileEntity(IGregTechTileEntity tile) { - this.tile = tile; - if (tile instanceof IGregtechPacketEntity) { - ptile = (IGregtechPacketEntity) tile; - } - } - - public void writeData(DataOutputStream data) throws IOException { - if (ptile != null) { - data.writeInt(this.tile.getXCoord()); - data.writeInt(this.tile.getYCoord()); - data.writeInt(this.tile.getZCoord()); - data.writeShort(this.tile.getMetaTileID()); - this.ptile.writePacketData(data); - } - } - - @SideOnly(Side.CLIENT) - public void readData(DataInputStream data) throws IOException { - Minecraft mc = FMLClientHandler.instance().getClient(); - World world = mc != null ? mc.theWorld : null; - if (world != null) { - int x = data.readInt(); - int y = data.readInt(); - int z = data.readInt(); - short id = data.readShort(); - if (id >= 0 && y >= 0 && world.blockExists(x, y, z)) { - TileEntity te = world.getTileEntity(x, y, z); - if (te instanceof IGregTechTileEntity) { - this.tile = (IGregTechTileEntity) te; - if (this.tile.getMetaTileID() != id) { - this.tile = null; - } - } else { - this.tile = null; - } - if (this.tile != null) { - if (tile instanceof IGregtechPacketEntity) { - ptile = (IGregtechPacketEntity) tile; - try { - this.ptile.readPacketData(data); - } catch (IOException var10) { - throw var10; - } catch (RuntimeException var11) { - Game.logThrowable("Exception in PacketTileEntity.readData:", var11, new Object[0]); - } - } - } - } - } - } - - public int getID() { - return 0; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/minecraft/particles/BlockBreakParticles.java b/src/Java/gtPlusPlus/core/util/minecraft/particles/BlockBreakParticles.java deleted file mode 100644 index 9046a57120..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/particles/BlockBreakParticles.java +++ /dev/null @@ -1,18 +0,0 @@ -package gtPlusPlus.core.util.minecraft.particles; - -import net.minecraft.block.Block; -import net.minecraft.world.World; - -import gtPlusPlus.xmod.forestry.HANDLER_FR; - -public class BlockBreakParticles { - - public BlockBreakParticles(final World world, final int x, final int y, final int z, final Block block){ - try { - HANDLER_FR.createBlockBreakParticles(world, x, y, z, block); - } catch (final Throwable T){ - - } - } - -} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/particles/EntityParticleFXMysterious.java b/src/Java/gtPlusPlus/core/util/minecraft/particles/EntityParticleFXMysterious.java deleted file mode 100644 index d996cf705a..0000000000 --- a/src/Java/gtPlusPlus/core/util/minecraft/particles/EntityParticleFXMysterious.java +++ /dev/null @@ -1,17 +0,0 @@ -package gtPlusPlus.core.util.minecraft.particles; - -import net.minecraft.client.particle.EntityAuraFX; -import net.minecraft.world.World; - -public class EntityParticleFXMysterious extends EntityAuraFX -{ - public EntityParticleFXMysterious(final World parWorld, - final double parX, final double parY, final double parZ, - final double parMotionX, final double parMotionY, final double parMotionZ) - { - super(parWorld, parX, parY, parZ, parMotionX, parMotionY, parMotionZ); - this.setParticleTextureIndex(82); // same as happy villager - this.particleScale = 2.0F; - this.setRBGColorF(0x88, 0x00, 0x88); - } -} diff --git a/src/Java/gtPlusPlus/core/util/player/PlayerCache.java b/src/Java/gtPlusPlus/core/util/player/PlayerCache.java deleted file mode 100644 index 753124dcd7..0000000000 --- a/src/Java/gtPlusPlus/core/util/player/PlayerCache.java +++ /dev/null @@ -1,160 +0,0 @@ -package gtPlusPlus.core.util.player; - -import java.io.*; -import java.util.*; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.server.MinecraftServer; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; - -public class PlayerCache { - - private static final File cache = new File("PlayerCache.dat"); - - public static final void initCache() { - if (CORE.PlayerCache == null){ - try { - - if (cache != null){ - CORE.PlayerCache = PlayerCache.readPropertiesFileAsMap(); - Logger.INFO("Loaded PlayerCache.dat"); - } - - - } catch (final Exception e) { - Logger.INFO("Failed to initialise PlayerCache.dat"); - PlayerCache.createPropertiesFile("PLAYER_", "DATA"); - //e.printStackTrace(); - } - } - } - - public static void createPropertiesFile(final String playerName, final String playerUUIDasString) { - try { - final Properties props = new Properties(); - props.setProperty(playerName+" ", playerUUIDasString); - final OutputStream out = new FileOutputStream(cache); - props.store(out, "Player Cache."); - Logger.INFO("PlayerCache.dat created for future use."); - out.close(); - } - catch (final Exception e ) { - e.printStackTrace(); - } - } - - public static void appendParamChanges(final String playerName, final String playerUUIDasString) { - final HashMap<String, UUID> playerInfo = new HashMap<>(); - playerInfo.put(playerName, UUID.fromString(playerUUIDasString)); - - /*try { - Utils.LOG_INFO("Attempting to load "+cache.getName()); - properties.load(new FileInputStream(cache)); - if (properties == null || properties.equals(null)){ - Utils.LOG_INFO("Please wait."); - } - else { - Utils.LOG_INFO("Loaded PlayerCache.dat"); - properties.setProperty(playerName+"_", playerUUIDasString); - FileOutputStream fr=new FileOutputStream(cache); - properties.store(fr, "Player Cache."); - fr.close(); - } - - } */ - - try - { - final FileOutputStream fos = new FileOutputStream("PlayerCache.dat"); - final ObjectOutputStream oos = new ObjectOutputStream(fos); - oos.writeObject(playerInfo); - oos.close(); - fos.close(); - Logger.INFO("Serialized Player data saved in PlayerCache.dat"); - } - - catch (final IOException e) { - Logger.INFO("No PlayerCache file found, creating one."); - createPropertiesFile(playerName, playerUUIDasString); - } - } - - /** - * Reads a "properties" file, and returns it as a Map - * (a collection of key/value pairs). - * - * Credit due to Alvin Alexander - http://alvinalexander.com/java/java-properties-file-map-example?nocache=1#comment-8215 - * Changed slightly as the filename and delimiter are constant in my case. - * - * @param filename The properties filename to read. - * @param delimiter The string (or character) that separates the key - * from the value in the properties file. - * @return The Map that contains the key/value pairs. - * @throws Exception - */ - @Deprecated - public static Map<String, String> readPropertiesFileAsMapOld() throws Exception { - final String delimiter = "="; - @SuppressWarnings({ "rawtypes", "unchecked" }) - final - Map<String, String> map = new HashMap<>(); - final BufferedReader reader = new BufferedReader(new FileReader(cache)); - String line; - while ((line = reader.readLine()) != null) - { - if (line.trim().length()==0) { - continue; - } - if (line.charAt(0)=='#') { - continue; - } - // assumption here is that proper lines are like "String : <a href="http://xxx.yyy.zzz/foo/bar"" title="http://xxx.yyy.zzz/foo/bar"">http://xxx.yyy.zzz/foo/bar"</a>, - // and the ":" is the delimiter - final int delimPosition = line.indexOf(delimiter); - final String key = line.substring(0, delimPosition-1).trim(); - final String value = line.substring(delimPosition+1).trim(); - map.put(key, value); - } - reader.close(); - CORE.PlayerCache = map; - return map; - } - - public static HashMap<String, UUID> readPropertiesFileAsMap() { - HashMap<String, UUID> map = null; - try - { - final FileInputStream fis = new FileInputStream(cache); - final ObjectInputStream ois = new ObjectInputStream(fis); - map = (HashMap<String, UUID>) ois.readObject(); - ois.close(); - fis.close(); - }catch(final IOException ioe) - { - ioe.printStackTrace(); - return null; - }catch(final ClassNotFoundException c) - { - Logger.INFO("Class not found"); - c.printStackTrace(); - return null; - } - Logger.WARNING("Deserialized PlayerCache.."); - return map; - } - - public static String lookupPlayerByUUID(final UUID UUID){ - if (UUID == null) { - return null; - } - final List<EntityPlayerMP> allPlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList; - for (final EntityPlayerMP player : allPlayers) { - if (player.getUniqueID().equals(UUID)) { - return player.getDisplayName(); - } - } - return "Offline Player."; - } -} diff --git a/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java b/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java deleted file mode 100644 index fc8e84cb61..0000000000 --- a/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java +++ /dev/null @@ -1,291 +0,0 @@ -package gtPlusPlus.core.util.reflect; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import gregtech.api.enums.GT_Values; -import gregtech.api.interfaces.internal.IGT_RecipeAdder; -import gregtech.api.util.GT_Recipe; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -public final class AddGregtechRecipe { - - - public static boolean importPyroRecipe(GT_Recipe aRecipe) { - - int aModifiedTime = (int) (aRecipe.mDuration * 0.8); - - if (aRecipe.mInputs == null || aRecipe.mFluidInputs == null || aRecipe.mFluidOutputs == null || aRecipe.mOutputs == null) { - return false; - } - if (aRecipe.mInputs.length > 2 || aRecipe.mFluidInputs.length > 1 || aRecipe.mFluidOutputs.length > 1 || aRecipe.mOutputs.length > 9) { - return false; - } - else if (aRecipe.mInputs.length <= 0) { - return false; - } - - int aCircuitNumber = -1; - Item aCircuit = CI.getNumberedCircuit(1).getItem(); - boolean hasCircuit = false; - - for (ItemStack a : aRecipe.mInputs) { - if (a != null && a.getItem() == aCircuit) { - hasCircuit = true; - aCircuitNumber = a.getItemDamage(); - break; - } - } - - ItemStack aInputItem = null; - if (!hasCircuit || aCircuitNumber < 1) { - return false; - } - - for (ItemStack a : aRecipe.mInputs) { - if (a != null && a.getItem() != aCircuit) { - aInputItem = a; - break; - } - } - - return CORE.RA.addCokeOvenRecipe( - aCircuitNumber, - aInputItem, - aRecipe.mFluidInputs, - aRecipe.mFluidOutputs, - aRecipe.mOutputs, - aModifiedTime, - aRecipe.mEUt); - - } - - - public static boolean addCokeAndPyrolyseRecipes( - ItemStack input1, int circuitNumber, - FluidStack inputFluid1, - ItemStack output1, - FluidStack outputFluid1, - int timeInSeconds, - int euTick - ){ - //Seconds Conversion - int TIME = timeInSeconds*20; - int TIMEPYRO = TIME+(TIME/5); - CORE.RA.addCokeOvenRecipe( - input1, - ItemUtils.getGregtechCircuit(circuitNumber), - inputFluid1, - outputFluid1, - output1, - TIME, - euTick); - PyrolyseOven( - input1, - inputFluid1, - circuitNumber, - output1, - outputFluid1, - TIMEPYRO, - euTick); - - - return false; - } - - - - - public static boolean PyrolyseOven(final ItemStack p0, final FluidStack p1, final int p2, final ItemStack p3, - final FluidStack p4, final int p5, final int p6){ - - try { - IGT_RecipeAdder IGT_RecipeAdder = GT_Values.RA; - if (IGT_RecipeAdder != null){ - Class<? extends IGT_RecipeAdder> classRA = IGT_RecipeAdder.getClass(); - Method addRecipe = classRA.getMethod("addPyrolyseRecipe", ItemStack.class, FluidStack.class, int.class, ItemStack.class, FluidStack.class, int.class, int.class); - if (addRecipe != null){ - return (boolean) addRecipe.invoke(IGT_RecipeAdder, p0, p1, p2, p3, p4, p5, p6); - } - } - } - catch (SecurityException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - return false; - } - return false; - } - - - - public static boolean addAssemblylineRecipe( - ItemStack aResearchItem, - int aResearchTime, - ItemStack[] aInputs, - FluidStack[] aFluidInputs, - ItemStack aOutput, - int aDuration, int aEUt){ - /* - try { - IGT_RecipeAdder IGT_RecipeAdder = GT_Values.RA; - if (IGT_RecipeAdder != null){ - Class<? extends IGT_RecipeAdder> classRA = IGT_RecipeAdder.getClass(); - - for(Method current : classRA.getDeclaredMethods()){ - //Utils.LOG_INFO("-----------------------------------------------"); - ////Utils.LOG_INFO("Found method: "+current.getName()); - //Utils.LOG_INFO("With Parameters: "); - //Utils.LOG_INFO("==============================================="); - for (Class<?> P : current.getParameterTypes()){ - //Utils.LOG_INFO(""+P.getName()); - //Utils.LOG_INFO(""+P.getClass().getName()); - } - //Utils.LOG_INFO("==============================================="); - } - - try { - Method testRA = GT_Values.RA.getClass().getMethod("addAssemblylineRecipe", GT_Values.RA.getClass(), aResearchItem.getClass(), int.class, aInputs.getClass(), aFluidInputs.getClass(), aOutput.getClass(), int.class, int.class); - testRA.invoke(aResearchItem, aResearchTime, aInputs, aFluidInputs, aOutput, aDuration, aEUt); - } - catch (Throwable masndj){ - masndj.printStackTrace(); - } - - - Method addRecipe = classRA.getDeclaredMethod( - "addAssemblylineRecipe", - ItemStack.class, - int.class, - ItemStack.class, - FluidStack.class, - ItemStack.class, - int.class, - int.class); - if (addRecipe != null){ - return (boolean) addRecipe.invoke(aResearchItem, aResearchTime, aInputs, aFluidInputs, aOutput, aDuration, aEUt); - } - } - } - catch (SecurityException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - Utils.LOG_INFO("[Assembly Line] - Failed to add recipe, due to GT not being .09 branch. Research: "+aResearchItem.getDisplayName()+" | Result: "+aOutput.getDisplayName()); - e.printStackTrace(); - return false; - } - Utils.LOG_INFO("[Assembly Line] - Failed to add recipe. Research: "+aResearchItem.getDisplayName()+" | Result: "+aOutput.getDisplayName()); - */return false; - } - - public static boolean addCircuitAssemblerRecipe( - ItemStack[] aInputs, - FluidStack aFluidInput, - ItemStack aOutput, - int aDuration, - int aEUt) { - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - try { - IGT_RecipeAdder IGT_RecipeAdder = GT_Values.RA; - if (IGT_RecipeAdder != null){ - Class<? extends IGT_RecipeAdder> classRA = IGT_RecipeAdder.getClass(); - Method addRecipe = classRA.getMethod( - "addCircuitAssemblerRecipe", - ItemStack.class, - FluidStack.class, - ItemStack.class, - int.class, - int.class); - if (addRecipe != null){ - if (aFluidInput.isFluidEqual(FluidUtils.getFluidStack("molten.tin", 1))){ - boolean[] didAdd = new boolean[3]; - FluidStack moltenMetal = FluidUtils.getFluidStack("molten.tin", 144); - //Tin - didAdd[0] = (boolean) addRecipe.invoke( - IGT_RecipeAdder, - aInputs, - moltenMetal, - aOutput, - aDuration, - aEUt); - moltenMetal = FluidUtils.getFluidStack("molten.lead", 144); - //Lead - didAdd[1] = (boolean) addRecipe.invoke( - IGT_RecipeAdder, - aInputs, - moltenMetal, - aOutput, - aDuration, - aEUt); - moltenMetal = FluidUtils.getFluidStack("molten.solderingalloy", 144/2); - //Soldering Alloy - didAdd[2] = (boolean) addRecipe.invoke( - IGT_RecipeAdder, - aInputs, - moltenMetal, - aOutput, - aDuration, - aEUt); - - if (didAdd[0] && didAdd[1] && didAdd[2]){ - return true; - } - else { - return false; - } - } - else { - return (boolean) addRecipe.invoke( - IGT_RecipeAdder, - aInputs, - aFluidInput, - aOutput, - aDuration, - aEUt); - } - } - } - } - catch (SecurityException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - return false; - } - } - return false; - } - - - public static boolean addChemicalRecipeForBasicMachineOnly(final ItemStack p0, final ItemStack p1, final FluidStack p2, final FluidStack p3, final ItemStack p4, final ItemStack p5, final int p6, final int p7){ - - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { - try { - IGT_RecipeAdder IGT_RecipeAdder = GT_Values.RA; - if (IGT_RecipeAdder != null){ - Class<? extends IGT_RecipeAdder> classRA = IGT_RecipeAdder.getClass(); - //final ItemStack p0, final ItemStack p1, final FluidStack p2, final FluidStack p3, final ItemStack p4, final ItemStack p5, final int p6, final int p7 - Method addRecipe = classRA.getMethod("addChemicalRecipeForBasicMachineOnly", ItemStack.class, ItemStack.class, FluidStack.class, FluidStack.class, ItemStack.class, ItemStack.class, int.class, int.class); - if (addRecipe != null){ - return (boolean) addRecipe.invoke(IGT_RecipeAdder, p0, p1, p2, p3, p4, p5, p6, p7); - } - } - } - catch (SecurityException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - - } - } - - return GT_Values.RA.addChemicalRecipe( - p0, - p1, - p2, - p3, - p4, - p6); - - } - - - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/reflect/ProxyFinder.java b/src/Java/gtPlusPlus/core/util/reflect/ProxyFinder.java deleted file mode 100644 index aaa9b2fae7..0000000000 --- a/src/Java/gtPlusPlus/core/util/reflect/ProxyFinder.java +++ /dev/null @@ -1,55 +0,0 @@ -package gtPlusPlus.core.util.reflect; - -import java.lang.reflect.Field; - -import cpw.mods.fml.common.SidedProxy; - -public class ProxyFinder { - - public static Object getServerProxy(final Object modInstance) throws ReflectiveOperationException { - for(final Field field : modInstance.getClass().getDeclaredFields()) { - if(field.isAnnotationPresent(SidedProxy.class)) { - final SidedProxy sidedProxy = field.getAnnotation(SidedProxy.class); - final Object fieldValue = field.get(modInstance); - try { - final Class<?> serverSideClass = ReflectionUtils.getClass(sidedProxy.serverSide()); - if(serverSideClass.isAssignableFrom(fieldValue.getClass())) { - final Object serverProxy = serverSideClass.cast(fieldValue); - //do what you want with server proxy instance - return serverProxy; - } - - } catch (final NoClassDefFoundError err) { - //its client side - return null; - } - break; - } - } - return null; - } - - public static Object getClientProxy(final Object modInstance) throws ReflectiveOperationException { - for(final Field field : modInstance.getClass().getDeclaredFields()) { - if(field.isAnnotationPresent(SidedProxy.class)) { - final SidedProxy sidedProxy = field.getAnnotation(SidedProxy.class); - final Object fieldValue = field.get(modInstance); - try { - final Class<?> clientSideClass = ReflectionUtils.getClass(sidedProxy.clientSide()); - if(clientSideClass.isAssignableFrom(fieldValue.getClass())) { - final Object clientProxy = clientSideClass.cast(fieldValue); - //do what you want with client proxy instance - return clientProxy; - } - - } catch (final NoClassDefFoundError err) { - //its server side - return null; - } - break; - } - } - return null; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java deleted file mode 100644 index 1ef925f793..0000000000 --- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ /dev/null @@ -1,1090 +0,0 @@ -package gtPlusPlus.core.util.reflect; - -import java.io.IOException; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.GenericDeclaration; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.lang.reflect.TypeVariable; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.ArrayUtils; - -import com.google.common.reflect.ClassPath; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.data.StringUtils; -import gtPlusPlus.xmod.gregtech.common.StaticFields59; - -public class ReflectionUtils { - - public static Map<String, Class<?>> mCachedClasses = new LinkedHashMap<String, Class<?>>(); - public static Map<String, CachedMethod> mCachedMethods = new LinkedHashMap<String, CachedMethod>(); - public static Map<String, CachedField> mCachedFields = new LinkedHashMap<String, CachedField>(); - public static Map<String, CachedConstructor> mCachedConstructors = new LinkedHashMap<String, CachedConstructor>(); - - private static class CachedConstructor { - - private final Constructor<?> METHOD; - - public CachedConstructor(Constructor<?> aCons) { - METHOD = aCons; - } - - public Constructor<?> get() { - return METHOD; - } - - } - - private static class CachedMethod { - - private final boolean STATIC; - private final Method METHOD; - - public CachedMethod(Method aMethod, boolean isStatic) { - METHOD = aMethod; - STATIC = isStatic; - } - - public Method get() { - return METHOD; - } - - public boolean type() { - return STATIC; - } - - } - - private static class CachedField { - - private final boolean STATIC; - private final Field FIELD; - - public CachedField(Field aField, boolean isStatic) { - FIELD = aField; - STATIC = isStatic; - } - - public Field get() { - return FIELD; - } - - public boolean type() { - return STATIC; - } - - } - - private static boolean cacheClass(Class<?> aClass) { - if (aClass == null) { - return false; - } - Class<?> y = mCachedClasses.get(aClass.getCanonicalName()); - if (y == null) { - mCachedClasses.put(aClass.getCanonicalName(), aClass); - return true; - } - return false; - } - - private static boolean cacheMethod(Class<?> aClass, Method aMethod) { - if (aMethod == null) { - return false; - } - boolean isStatic = Modifier.isStatic(aMethod.getModifiers()); - CachedMethod y = mCachedMethods.get(aClass.getName()+"."+aMethod.getName()+"."+ArrayUtils.toString(aMethod.getParameterTypes())); - if (y == null) { - mCachedMethods.put(aClass.getName()+"."+aMethod.getName()+"."+ArrayUtils.toString(aMethod.getParameterTypes()), new CachedMethod(aMethod, isStatic)); - return true; - } - return false; - } - - private static boolean cacheField(Class<?> aClass, Field aField) { - if (aField == null) { - return false; - } - boolean isStatic = Modifier.isStatic(aField.getModifiers()); - CachedField y = mCachedFields.get(aClass.getName()+"."+aField.getName()); - if (y == null) { - mCachedFields.put(aClass.getName()+"."+aField.getName(), new CachedField(aField, isStatic)); - return true; - } - return false; - } - - private static boolean cacheConstructor(Class<?> aClass, Constructor<?> aConstructor) { - if (aConstructor == null) { - return false; - } - CachedConstructor y = mCachedConstructors.get(aClass.getName()+"."+ArrayUtils.toString(aConstructor.getParameterTypes())); - if (y == null) { - mCachedConstructors.put(aClass.getName()+"."+ArrayUtils.toString(aConstructor.getParameterTypes()), new CachedConstructor(aConstructor)); - return true; - } - return false; - } - - - /** - * Returns a cached {@link Constructor} object. - * @param aClass - Class containing the Constructor. - * @param aTypes - Varags Class Types for objects constructor. - * @return - Valid, non-final, {@link Method} object, or {@link null}. - */ - public static Constructor<?> getConstructor(Class<?> aClass, Class<?>... aTypes) { - if (aClass == null || aTypes == null) { - return null; - } - - String aMethodKey = ArrayUtils.toString(aTypes); - //Logger.REFLECTION("Looking up method in cache: "+(aClass.getName()+"."+aMethodName + "." + aMethodKey)); - CachedConstructor y = mCachedConstructors.get(aClass.getName() + "." + aMethodKey); - if (y == null) { - Constructor<?> u = getConstructor_Internal(aClass, aTypes); - if (u != null) { - Logger.REFLECTION("Caching Constructor: "+aClass.getName() + "." + aMethodKey); - cacheConstructor(aClass, u); - return u; - } else { - return null; - } - } else { - return y.get(); - } - } - - - - - /** - * Returns a cached {@link Class} object. - * @param aClassCanonicalName - The canonical name of the underlying class. - * @return - Valid, {@link Class} object, or {@link null}. - */ - public static Class<?> getClass(String aClassCanonicalName) { - if (aClassCanonicalName == null || aClassCanonicalName.length() <= 0) { - return null; - } - Class<?> y = mCachedClasses.get(aClassCanonicalName); - if (y == null) { - y = getClass_Internal(aClassCanonicalName); - if (y != null) { - Logger.REFLECTION("Caching Class: "+aClassCanonicalName); - cacheClass(y); - } - } - return y; - } - - - - /** - * Returns a cached {@link Method} object. Wraps {@link #getMethod(Class, String, Class...)}. - * @param aObject - Object containing the Method. - * @param aMethodName - Method's name in {@link String} form. - * @param aTypes - Class Array of Types for {@link Method}'s constructor. - * @return - Valid, non-final, {@link Method} object, or {@link null}. - */ - public static Method getMethod(Object aObject, String aMethodName, Class[] aTypes) { - return getMethod(aObject.getClass(), aMethodName, aTypes); - } - - - /** - * Returns a cached {@link Method} object. - * @param aClass - Class containing the Method. - * @param aMethodName - Method's name in {@link String} form. - * @param aTypes - Varags Class Types for {@link Method}'s constructor. - * @return - Valid, non-final, {@link Method} object, or {@link null}. - */ - public static Method getMethod(Class<?> aClass, String aMethodName, Class<?>... aTypes) { - if (aClass == null || aMethodName == null || aMethodName.length() <= 0) { - return null; - } - String aMethodKey = ArrayUtils.toString(aTypes); - //Logger.REFLECTION("Looking up method in cache: "+(aClass.getName()+"."+aMethodName + "." + aMethodKey)); - CachedMethod y = mCachedMethods.get(aClass.getName()+"."+aMethodName + "." + aMethodKey); - if (y == null) { - Method u = getMethod_Internal(aClass, aMethodName, aTypes); - if (u != null) { - Logger.REFLECTION("Caching Method: "+aMethodName + "." + aMethodKey); - cacheMethod(aClass, u); - return u; - } else { - return null; - } - } else { - return y.get(); - } - } - - public static boolean isStaticMethod(Class<?> aClass, String aMethodName, Class<?>... aTypes) { - return isStaticMethod(ReflectionUtils.getMethod(aClass, aMethodName, aTypes)); - } - - public static boolean isStaticMethod(Method aMethod) { - if (aMethod != null && Modifier.isStatic(aMethod.getModifiers())) { - return true; - } - return false; - } - - - - /** - * Returns a cached {@link Field} object. - * @param aClass - Class containing the Method. - * @param aFieldName - Field name in {@link String} form. - * @return - Valid, non-final, {@link Field} object, or {@link null}. - */ - public static Field getField(final Class<?> aClass, final String aFieldName) { - if (aClass == null || aFieldName == null || aFieldName.length() <= 0) { - return null; - } - CachedField y = mCachedFields.get(aClass.getName()+"."+aFieldName); - if (y == null) { - Field u; - try { - u = getField_Internal(aClass, aFieldName); - if (u != null) { - Logger.REFLECTION("Caching Field '"+aFieldName+"' from "+aClass.getName()); - cacheField(aClass, u); - return u; - } - } catch (NoSuchFieldException e) { - } - return null; - - } else { - return y.get(); - } - } - - /** - * Returns a cached {@link Field} object. - * @param aInstance - {@link Object} to get the field instance from. - * @param aFieldName - Field name in {@link String} form. - * @return - Valid, non-final, {@link Field} object, or {@link null}. - */ - public static <T> T getField(final Object aInstance, final String aFieldName) { - try { - return (T) getField(aInstance.getClass(), aFieldName).get(aInstance); - } catch (IllegalArgumentException | IllegalAccessException e) { - return null; - } - } - - - - - /* - * Utility Functions - */ - - public static boolean doesClassExist(final String classname) { - return isClassPresent(classname); - } - - - /** - * Returns the class of the objects type parameter - * @param o - Object to examine paramters on - * @return - a Class<?> or null - */ - public static Class<?> getTypeOfGenericObject(Object o) { - Class<?> aTypeParam = findSuperClassParameterType(o, o.getClass(), 0); - if (aTypeParam == null) { - aTypeParam = findSubClassParameterType(o, o.getClass(), 0); - } - return aTypeParam; - } - - public static void makeFieldAccessible(final Field field) { - if (!Modifier.isPublic(field.getModifiers()) || - !Modifier.isPublic(field.getDeclaringClass().getModifiers())) - { - field.setAccessible(true); - } - } - - public static void makeMethodAccessible(final Method field) { - if (!Modifier.isPublic(field.getModifiers()) || - !Modifier.isPublic(field.getDeclaringClass().getModifiers())) - { - field.setAccessible(true); - } - } - - /** - * Get the method name for a depth in call stack. <br /> - * Utility function - * @param depth depth in the call stack (0 means current method, 1 means call method, ...) - * @return Method name - */ - public static String getMethodName(final int depth) { - final StackTraceElement[] ste = new Throwable().getStackTrace(); - //System. out.println(ste[ste.length-depth].getClassName()+"#"+ste[ste.length-depth].getMethodName()); - return ste[depth+1].getMethodName(); - } - - - /** - * - * @param aPackageName - The full {@link Package} name in {@link String} form. - * @return - {@link Boolean} object. True if loaded > 0 classes. - */ - public static boolean dynamicallyLoadClassesInPackage(String aPackageName) { - ClassLoader classLoader = ReflectionUtils.class.getClassLoader(); - int loaded = 0; - try { - ClassPath path = ClassPath.from(classLoader); - for (ClassPath.ClassInfo info : path.getTopLevelClassesRecursive(aPackageName)) { - Class<?> clazz = Class.forName(info.getName(), true, classLoader); - if (clazz != null) { - loaded++; - Logger.INFO("Found "+clazz.getCanonicalName()+". ["+loaded+"]"); - } - } - } catch (ClassNotFoundException | IOException e) { - - } - - return loaded > 0; - } - - - - public static boolean setField(final Object object, final String fieldName, final Object fieldValue) { - Class<?> clazz; - if (object instanceof Class) { - clazz = (Class<?>) object; - } - else { - clazz = object.getClass(); - } - while (clazz != null) { - try { - final Field field = getField(clazz, fieldName); - if (field != null) { - setFieldValue_Internal(object, field, fieldValue); - return true; - } - } catch (final NoSuchFieldException e) { - Logger.REFLECTION("setField("+object.toString()+", "+fieldName+") failed."); - clazz = clazz.getSuperclass(); - } catch (final Exception e) { - Logger.REFLECTION("setField("+object.toString()+", "+fieldName+") failed."); - throw new IllegalStateException(e); - } - } - return false; - - - } - - public static boolean setField(final Object object, final Field field, final Object fieldValue) { - Class<?> clazz; - if (object instanceof Class) { - clazz = (Class<?>) object; - } - else { - clazz = object.getClass(); - } - while (clazz != null) { - try { - final Field field2 = getField(clazz, field.getName()); - if (field2 != null) { - setFieldValue_Internal(object, field, fieldValue); - return true; - } - } catch (final NoSuchFieldException e) { - Logger.REFLECTION("setField("+object.toString()+", "+field.getName()+") failed."); - clazz = clazz.getSuperclass(); - } catch (final Exception e) { - Logger.REFLECTION("setField("+object.toString()+", "+field.getName()+") failed."); - throw new IllegalStateException(e); - } - } - return false; - } - - - /** - * Allows to change the state of an immutable instance. Huh?!? - */ - public static void setFinalFieldValue(Class<?> clazz, String fieldName, Object newValue) { - Field nameField = getField(clazz, fieldName); - try { - setFieldValue_Internal(clazz, nameField, newValue); - } - catch (Throwable t) { - t.printStackTrace(); - } - } - - /** - * Allows to change the state of an immutable instance. Huh?!? - */ - public static void setFinalFieldValue(Class<?> clazz, Field field, Object newValue) { - try { - setFieldValue_Internal(clazz, field, newValue); - } - catch (Throwable t) { - t.printStackTrace(); - } - } - - @Deprecated - public static void setFinalStatic(Field field, Object newValue) throws Exception { - field.setAccessible(true); - Field modifiersField = Field.class.getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); - field.set(null, newValue); - } - - - public static void setByte(Object clazz, String fieldName, byte newValue) throws Exception { - Field nameField = getField(clazz.getClass(), fieldName); - nameField.setAccessible(true); - int modifiers = nameField.getModifiers(); - Field modifierField = nameField.getClass().getDeclaredField("modifiers"); - modifiers = modifiers & ~Modifier.FINAL; - modifierField.setAccessible(true); - modifierField.setInt(nameField, modifiers); - //Utils.LOG_INFO("O-"+(byte) nameField.get(clazz) + " | "+newValue); - nameField.setByte(clazz, newValue); - //Utils.LOG_INFO("N-"+(byte) nameField.get(clazz)); - - /*final Field fieldA = getField(clazz.getClass(), fieldName); - fieldA.setAccessible(true); - fieldA.setByte(clazz, newValue);*/ - - } - - public static boolean invoke(Object objectInstance, String methodName, Class[] parameters, Object[] values){ - if (objectInstance == null || methodName == null || parameters == null || values == null){ - return false; - } - Class<?> mLocalClass = (objectInstance instanceof Class ? (Class<?>) objectInstance : objectInstance.getClass()); - Logger.REFLECTION("Trying to invoke "+methodName+" on an instance of "+mLocalClass.getCanonicalName()+"."); - try { - Method mInvokingMethod = mLocalClass.getDeclaredMethod(methodName, parameters); - if (mInvokingMethod != null){ - return invoke(objectInstance, mInvokingMethod, values); - } - } - catch (NoSuchMethodException | SecurityException | IllegalArgumentException e) { - Logger.REFLECTION("Failed to Dynamically invoke "+methodName+" on an object of type: "+mLocalClass.getName()); - } - - Logger.REFLECTION("Invoke failed or did something wrong."); - return false; - } - - public static boolean invoke(Object objectInstance, Method method, Object[] values){ - if (method == null || values == null || (!ReflectionUtils.isStaticMethod(method) && objectInstance == null)){ - //Logger.REFLECTION("Null value when trying to Dynamically invoke "+methodName+" on an object of type: "+objectInstance.getClass().getName()); - return false; - } - String methodName = method.getName(); - String classname = objectInstance != null ? objectInstance.getClass().getCanonicalName() : method.getDeclaringClass().getCanonicalName(); - Logger.REFLECTION("Trying to invoke "+methodName+" on an instance of "+classname+"."); - try { - Method mInvokingMethod = method; - if (mInvokingMethod != null){ - Logger.REFLECTION(methodName+" was not null."); - if ((boolean) mInvokingMethod.invoke(objectInstance, values)){ - Logger.REFLECTION("Successfully invoked "+methodName+"."); - return true; - } - else { - Logger.REFLECTION("Invocation failed for "+methodName+"."); - } - } - } - catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - Logger.REFLECTION("Failed to Dynamically invoke "+methodName+" on an object of type: "+classname); - } - Logger.REFLECTION("Invoke failed or did something wrong."); - return false; - } - - public static boolean invokeVoid(Object objectInstance, Method method, Object[] values){ - if (method == null || values == null || (!ReflectionUtils.isStaticMethod(method) && objectInstance == null)){ - //Logger.REFLECTION("Null value when trying to Dynamically invoke "+methodName+" on an object of type: "+objectInstance.getClass().getName()); - return false; - } - String methodName = method.getName(); - String classname = objectInstance != null ? objectInstance.getClass().getCanonicalName() : method.getDeclaringClass().getCanonicalName(); - Logger.REFLECTION("Trying to invoke "+methodName+" on an instance of "+classname+"."); - try { - Method mInvokingMethod = method; - if (mInvokingMethod != null){ - Logger.REFLECTION(methodName+" was not null."); - mInvokingMethod.invoke(objectInstance, values); - Logger.REFLECTION("Successfully invoked "+methodName+"."); - return true; - } - } - catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - Logger.REFLECTION("Failed to Dynamically invoke "+methodName+" on an object of type: "+classname); - } - Logger.REFLECTION("Invoke failed or did something wrong."); - return false; - } - - public static boolean invokeVoid(Object objectInstance, String methodName, Class[] parameters, Object[] values){ - if (objectInstance == null || methodName == null || parameters == null || values == null){ - return false; - } - Class<?> mLocalClass = (objectInstance instanceof Class ? (Class<?>) objectInstance : objectInstance.getClass()); - Logger.REFLECTION("Trying to invoke "+methodName+" on an instance of "+mLocalClass.getCanonicalName()+"."); - try { - Method mInvokingMethod = mLocalClass.getDeclaredMethod(methodName, parameters); - if (mInvokingMethod != null){ - Logger.REFLECTION(methodName+" was not null."); - mInvokingMethod.invoke(objectInstance, values); - Logger.REFLECTION("Successfully invoked "+methodName+"."); - return true; - } - else { - Logger.REFLECTION(methodName+" is null."); - } - } - catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - Logger.REFLECTION("Failed to Dynamically invoke "+methodName+" on an object of type: "+mLocalClass.getName()); - } - - Logger.REFLECTION("Invoke failed or did something wrong."); - return false; - } - - - public static Object invokeNonBool(Object objectInstance, Method method, Object[] values){ - if ((!ReflectionUtils.isStaticMethod(method) && objectInstance == null) || method == null || values == null){ - return false; - } - String methodName = method.getName(); - String classname = objectInstance != null ? objectInstance.getClass().getCanonicalName() : method.getDeclaringClass().getCanonicalName(); - Logger.REFLECTION("Trying to invoke "+methodName+" on an instance of "+classname+"."); - try { - return method.invoke(objectInstance, values); - } - catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - Logger.REFLECTION("Failed to Dynamically invoke "+methodName+" on an object of type: "+classname); - } - - Logger.REFLECTION("Invoke failed or did something wrong."); - return null; - } - - public static Object invokeNonBool(Object objectInstance, String methodName, Class[] parameters, Object[] values){ - if (objectInstance == null || methodName == null || parameters == null || values == null){ - return false; - } - Class<?> mLocalClass = (objectInstance instanceof Class ? (Class<?>) objectInstance : objectInstance.getClass()); - Logger.REFLECTION("Trying to invoke "+methodName+" on an instance of "+mLocalClass.getCanonicalName()+"."); - try { - Method mInvokingMethod = mLocalClass.getDeclaredMethod(methodName, parameters); - if (mInvokingMethod != null){ - Logger.REFLECTION(methodName+" was not null."); - return mInvokingMethod.invoke(objectInstance, values); - } - else { - Logger.REFLECTION(methodName+" is null."); - } - } - catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - Logger.REFLECTION("Failed to Dynamically invoke "+methodName+" on an object of type: "+mLocalClass.getName()); - } - - Logger.REFLECTION("Invoke failed or did something wrong."); - return null; - } - - - - - - - - - - - - - - - - - - - - - - /* - * Internal Magic that probably should not get exposed. - */ - - - - - - - - - - /* - * - * Below Code block is used for determining generic types associated with type<E> - * - */ - - - //https://xebia.com/blog/acessing-generic-types-at-runtime-in-java/ - //https://www.javacodegeeks.com/2013/12/advanced-java-generics-retreiving-generic-type-arguments.html - public static Class<?> findSuperClassParameterType(Object instance, Class<?> classOfInterest, int parameterIndex) { - Class<?> subClass = instance.getClass(); - while (classOfInterest != subClass.getSuperclass()) { - // instance.getClass() is no subclass of classOfInterest or instance is a direct instance of classOfInterest - subClass = subClass.getSuperclass(); - if (subClass == null) { - return null; - } - } - ParameterizedType parameterizedType = (ParameterizedType) subClass.getGenericSuperclass(); - Class<?> aReturn; - aReturn = (Class<?>) parameterizedType.getActualTypeArguments()[parameterIndex]; - return aReturn; - } - - public static Class<?> findSubClassParameterType(Object instance, Class<?> classOfInterest, int parameterIndex) { - Map<Type, Type> typeMap = new HashMap<Type, Type>(); - Class<?> instanceClass = instance.getClass(); - while (classOfInterest != instanceClass.getSuperclass()) { - extractTypeArguments(typeMap, instanceClass); - instanceClass = instanceClass.getSuperclass(); - if (instanceClass == null) { - return null; - } - } - - ParameterizedType parameterizedType = (ParameterizedType) instanceClass.getGenericSuperclass(); - Type actualType = parameterizedType.getActualTypeArguments()[parameterIndex]; - if (typeMap.containsKey(actualType)) { - actualType = typeMap.get(actualType); - } - if (actualType instanceof Class) { - return (Class<?>) actualType; - } else if (actualType instanceof TypeVariable) { - return browseNestedTypes(instance, (TypeVariable<?>) actualType); - } else { - return null; - } - } - - private static void extractTypeArguments(Map<Type, Type> typeMap, Class<?> clazz) { - Type genericSuperclass = clazz.getGenericSuperclass(); - if (!(genericSuperclass instanceof ParameterizedType)) { - return; - } - - ParameterizedType parameterizedType = (ParameterizedType) genericSuperclass; - Type[] typeParameter = ((Class<?>) parameterizedType.getRawType()).getTypeParameters(); - Type[] actualTypeArgument = parameterizedType.getActualTypeArguments(); - for (int i = 0; i < typeParameter.length; i++) { - if(typeMap.containsKey(actualTypeArgument[i])) { - actualTypeArgument[i] = typeMap.get(actualTypeArgument[i]); - } - typeMap.put(typeParameter[i], actualTypeArgument[i]); - } - } - - private static Class<?> browseNestedTypes(Object instance, TypeVariable<?> actualType) { - Class<?> instanceClass = instance.getClass(); - List<Class<?>> nestedOuterTypes = new LinkedList<Class<?>>(); - for (Class<?> enclosingClass = instanceClass - .getEnclosingClass(); enclosingClass != null; enclosingClass = enclosingClass.getEnclosingClass()) { - try { - Field this$0 = instanceClass.getDeclaredField("this$0"); - Object outerInstance = this$0.get(instance); - Class<?> outerClass = outerInstance.getClass(); - nestedOuterTypes.add(outerClass); - Map<Type, Type> outerTypeMap = new HashMap<Type, Type>(); - extractTypeArguments(outerTypeMap, outerClass); - for (Map.Entry<Type, Type> entry : outerTypeMap.entrySet()) { - if (!(entry.getKey() instanceof TypeVariable)) { - continue; - } - TypeVariable<?> foundType = (TypeVariable<?>) entry.getKey(); - if (foundType.getName().equals(actualType.getName()) - && isInnerClass(foundType.getGenericDeclaration(), actualType.getGenericDeclaration())) { - if (entry.getValue() instanceof Class) { - return (Class<?>) entry.getValue(); - } - actualType = (TypeVariable<?>) entry.getValue(); - } - } - } catch (NoSuchFieldException | IllegalAccessException e) { - - } - - } - return null; - } - - private static boolean isInnerClass(GenericDeclaration outerDeclaration, GenericDeclaration innerDeclaration) { - if (!(outerDeclaration instanceof Class) || !(innerDeclaration instanceof Class)) { - return false; - } - Class<?> outerClass = (Class<?>) outerDeclaration; - Class<?> innerClass = (Class<?>) innerDeclaration; - while ((innerClass = innerClass.getEnclosingClass()) != null) { - if (innerClass == outerClass) { - return true; - } - } - return false; - } - - - /* - * - * End of Generics Block - * - */ - - - - private static Field getField_Internal(final Class<?> clazz, final String fieldName) throws NoSuchFieldException { - try { - Logger.REFLECTION("Field: Internal Lookup: "+fieldName); - Field k = clazz.getDeclaredField(fieldName); - makeFieldAccessible(k); - //Logger.REFLECTION("Got Field from Class. "+fieldName+" did exist within "+clazz.getCanonicalName()+"."); - return k; - } catch (final NoSuchFieldException e) { - Logger.REFLECTION("Field: Internal Lookup Failed: "+fieldName); - final Class<?> superClass = clazz.getSuperclass(); - if (superClass == null) { - Logger.REFLECTION("Unable to find field '"+fieldName+"'"); - //Logger.REFLECTION("Failed to get Field from Class. "+fieldName+" does not existing within "+clazz.getCanonicalName()+"."); - throw e; - } - Logger.REFLECTION("Method: Recursion Lookup: "+fieldName+" - Checking in "+superClass.getName()); - //Logger.REFLECTION("Failed to get Field from Class. "+fieldName+" does not existing within "+clazz.getCanonicalName()+". Trying super class."); - return getField_Internal(superClass, fieldName); - } - } - - /** - * if (isPresent("com.optionaldependency.DependencyClass")) || - * This block will never execute when the dependency is not present. There is - * therefore no more risk of code throwing NoClassDefFoundException. - */ - private static boolean isClassPresent(final String className) { - try { - Class.forName(className); - return true; - } catch (final Throwable ex) { - // Class or one of its dependencies is not present... - return false; - } - } - - @Deprecated - public static Method getMethodViaReflection(final Class<?> lookupClass, final String methodName, - final boolean invoke) throws Exception { - final Class<? extends Class> lookup = lookupClass.getClass(); - final Method m = lookup.getDeclaredMethod(methodName); - m.setAccessible(true);// Abracadabra - if (invoke) { - m.invoke(lookup);// now its OK - } - return m; - } - - private static Method getMethod_Internal(Class<?> aClass, String aMethodName, Class<?>... aTypes) { - Method m = null; - try { - Logger.REFLECTION("Method: Internal Lookup: "+aMethodName); - m = aClass.getDeclaredMethod(aMethodName, aTypes); - if (m != null) { - m.setAccessible(true); - int modifiers = m.getModifiers(); - Field modifierField = m.getClass().getDeclaredField("modifiers"); - modifiers = modifiers & ~Modifier.FINAL; - modifierField.setAccessible(true); - modifierField.setInt(m, modifiers); - } - } - catch (Throwable t) { - Logger.REFLECTION("Method: Internal Lookup Failed: "+aMethodName); - try { - m = getMethodRecursively(aClass, aMethodName); - } catch (NoSuchMethodException e) { - Logger.REFLECTION("Unable to find method '"+aMethodName+"'"); - e.printStackTrace(); - dumpClassInfo(aClass); - } - } - return m; - } - - private static Constructor<?> getConstructor_Internal(Class<?> aClass, Class<?>... aTypes) { - Constructor<?> c = null; - try { - Logger.REFLECTION("Constructor: Internal Lookup: "+aClass.getName()); - c = aClass.getDeclaredConstructor(aTypes); - if (c != null) { - c.setAccessible(true); - int modifiers = c.getModifiers(); - Field modifierField = c.getClass().getDeclaredField("modifiers"); - modifiers = modifiers & ~Modifier.FINAL; - modifierField.setAccessible(true); - modifierField.setInt(c, modifiers); - } - } - catch (Throwable t) { - Logger.REFLECTION("Constructor: Internal Lookup Failed: "+aClass.getName()); - try { - c = getConstructorRecursively(aClass, aTypes); - } catch (Exception e) { - Logger.REFLECTION("Unable to find method '"+aClass.getName()+"'"); - e.printStackTrace(); - dumpClassInfo(aClass); - } - } - return c; - } - - private static Constructor<?> getConstructorRecursively(Class<?> aClass, Class<?>... aTypes) throws Exception { - try { - Logger.REFLECTION("Constructor: Recursion Lookup: "+aClass.getName()); - Constructor<?> c = aClass.getConstructor(aTypes); - if (c != null) { - c.setAccessible(true); - int modifiers = c.getModifiers(); - Field modifierField = c.getClass().getDeclaredField("modifiers"); - modifiers = modifiers & ~Modifier.FINAL; - modifierField.setAccessible(true); - modifierField.setInt(c, modifiers); - } - return c; - } catch (final NoSuchMethodException | IllegalArgumentException | IllegalAccessException e) { - final Class<?> superClass = aClass.getSuperclass(); - if (superClass == null || superClass == Object.class) { - throw e; - } - return getConstructor_Internal(superClass, aTypes); - } - } - - private static Method getMethodRecursively(final Class<?> clazz, final String aMethodName) throws NoSuchMethodException { - try { - Logger.REFLECTION("Method: Recursion Lookup: "+aMethodName); - Method k = clazz.getDeclaredMethod(aMethodName); - makeMethodAccessible(k); - return k; - } catch (final NoSuchMethodException e) { - final Class<?> superClass = clazz.getSuperclass(); - if (superClass == null || superClass == Object.class) { - throw e; - } - return getMethod_Internal(superClass, aMethodName); - } - } - - private static void dumpClassInfo(Class<?> aClass) { - Logger.INFO("We ran into an error processing reflection in "+aClass.getName()+", dumping all data for debugging."); - // Get the methods - Method[] methods = aClass.getDeclaredMethods(); - Field[] fields = aClass.getDeclaredFields(); - Constructor[] consts = aClass.getDeclaredConstructors(); - - Logger.INFO("Dumping all Methods."); - for (Method method : methods) { - System.out.println(method.getName()+" | "+StringUtils.getDataStringFromArray(method.getParameterTypes())); - } - Logger.INFO("Dumping all Fields."); - for (Field f : fields) { - System.out.println(f.getName()); - } - Logger.INFO("Dumping all Constructors."); - for (Constructor<?> c : consts) { - System.out.println(c.getName()+" | "+c.getParameterCount()+" | "+StringUtils.getDataStringFromArray(c.getParameterTypes())); - } - } - - private static Class<?> getNonPublicClass(final String className) { - Class<?> c = null; - try { - c = Class.forName(className); - } catch (final ClassNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - // full package name --------^^^^^^^^^^ - // or simpler without Class.forName: - // Class<package1.A> c = package1.A.class; - - if (null != c) { - // In our case we need to use - Constructor<?> constructor = null; - try { - constructor = c.getDeclaredConstructor(); - } catch (NoSuchMethodException | SecurityException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - // note: getConstructor() can return only public constructors - // so we needed to search for any Declared constructor - - // now we need to make this constructor accessible - if (null != constructor) { - constructor.setAccessible(true);// ABRACADABRA! - - try { - final Object o = constructor.newInstance(); - return (Class<?>) o; - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - return null; - } - - private static Class<?> getClass_Internal(String string) { - Class<?> aClass = null; - if (ReflectionUtils.doesClassExist(string)) { - try { - aClass = Class.forName(string); - } - catch (ClassNotFoundException e) { - aClass = getNonPublicClass(string); - } - } - - if (aClass == null) { - String aClassName = ""; - Logger.REFLECTION("Splitting "+string+" to try look for hidden classes."); - String[] aData = string.split("\\."); - Logger.REFLECTION("Obtained "+aData.length+" pieces."); - for (int i=0;i<(aData.length-1);i++) { - aClassName += (i > 0) ? "."+aData[i] : ""+aData[i]; - Logger.REFLECTION("Building: "+aClassName); - } - if (aClassName != null && aClassName.length() > 0) { - Logger.REFLECTION("Trying to search '"+aClassName+"' for inner classes."); - Class<?> clazz = ReflectionUtils.getClass(aClassName); - if (clazz != null) { - Class[] y = clazz.getDeclaredClasses(); - if (y == null || y.length <= 0) { - Logger.REFLECTION("No hidden inner classes found."); - return null; - } - else { - boolean found = false; - for (Class<?> h : y) { - Logger.REFLECTION("Found hidden inner class: "+h.getCanonicalName()); - if (h.getSimpleName().toLowerCase().equals(aData[aData.length-1].toLowerCase())) { - Logger.REFLECTION("Found correct class. ["+aData[aData.length-1]+"] Caching at correct location: "+string); - Logger.REFLECTION("Found at location: "+h.getCanonicalName()); - ReflectionUtils.mCachedClasses.put(string, h); - aClass = h; - found = true; - break; - } - } - if (!found) { - return null; - } - } - } - else { - return null; - } - } - else { - return null; - } - } - return aClass; - } - - /** - * - * Set the value of a field reflectively. - */ - private static void setFieldValue_Internal(Object owner, Field field, Object value) throws Exception { - makeModifiable(field); - field.set(owner, value); - } - - /** - * Force the field to be modifiable and accessible. - */ - private static void makeModifiable(Field nameField) throws Exception { - nameField.setAccessible(true); - Field modifiers = getField(Field.class, "modifiers"); - modifiers.setAccessible(true); - modifiers.setInt(nameField, nameField.getModifiers() & ~Modifier.FINAL); - } - - - public static boolean doesFieldExist(String clazz, String string) { - return doesFieldExist(ReflectionUtils.getClass(clazz), string); - } - - public static boolean doesFieldExist(Class<?> clazz, String string) { - if (clazz != null) { - if (ReflectionUtils.getField(clazz, string) != null) { - return true; - } - } - return false; - } - - public static Object getFieldValue(Field field) { - return getFieldValue(field, null); - } - - public static Object getFieldValue(Field field, Object instance) { - try { - return field.get(instance); - } catch (IllegalArgumentException | IllegalAccessException e) { - } - return null; - } - - public static <T> T createNewInstanceFromConstructor(Constructor aConstructor, Object[] aArgs) { - T aInstance; - try { - aInstance = (T) aConstructor.newInstance(aArgs); - if (aInstance != null) { - return aInstance; - } - } - catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - } - return null; - } - - -} diff --git a/src/Java/gtPlusPlus/core/util/sys/KeyboardUtils.java b/src/Java/gtPlusPlus/core/util/sys/KeyboardUtils.java deleted file mode 100644 index ea87677ee2..0000000000 --- a/src/Java/gtPlusPlus/core/util/sys/KeyboardUtils.java +++ /dev/null @@ -1,39 +0,0 @@ -package gtPlusPlus.core.util.sys; - -import org.lwjgl.input.Keyboard; - -import net.minecraft.client.Minecraft; - -public class KeyboardUtils { - - public static boolean isCtrlKeyDown(){ - try { - if (!Keyboard.isCreated()) { - return false; - } - // prioritize CONTROL, but allow OPTION as well on Mac (note: GuiScreen's isCtrlKeyDown only checks for the OPTION key on Mac) - boolean isCtrlKeyDown = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL); - if (!isCtrlKeyDown && Minecraft.isRunningOnMac) - isCtrlKeyDown = Keyboard.isKeyDown(Keyboard.KEY_LMETA) || Keyboard.isKeyDown(Keyboard.KEY_RMETA); - - return isCtrlKeyDown; - } - catch (Throwable t) { - return false; - } - } - - public static boolean isShiftKeyDown(){ - try { - if (!Keyboard.isCreated()) { - return false; - } - return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); - } - catch (Throwable t) { - return false; - } - - } - -} diff --git a/src/Java/gtPlusPlus/core/util/sys/Log.java b/src/Java/gtPlusPlus/core/util/sys/Log.java deleted file mode 100644 index fcd4f34c1b..0000000000 --- a/src/Java/gtPlusPlus/core/util/sys/Log.java +++ /dev/null @@ -1,24 +0,0 @@ -package gtPlusPlus.core.util.sys; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public final class Log { - public static final Logger LOGGER = LogManager.getLogger("MiscUtils"); - - public static void warn(final String msg) { - LOGGER.warn(msg); - } - - public static void error(final String msg) { - LOGGER.error(msg); - } - - public static void info(final String msg) { - LOGGER.info(msg); - } - - public static void debug(final String msg) { - LOGGER.debug(msg); - } -} diff --git a/src/Java/gtPlusPlus/core/util/sys/SystemUtils.java b/src/Java/gtPlusPlus/core/util/sys/SystemUtils.java deleted file mode 100644 index 2788ba688e..0000000000 --- a/src/Java/gtPlusPlus/core/util/sys/SystemUtils.java +++ /dev/null @@ -1,90 +0,0 @@ -package gtPlusPlus.core.util.sys; - -public class SystemUtils { - - private static OS SystemType; - - public static OS getOS(){ - if (SystemType != null){ - return SystemType; - } - else { - SystemType = getOperatingSystem(); - return SystemType; - } - } - - /** - * Try invoke the runtime's Garbage Collector. - */ - public static void invokeGC() { - try { - Runtime r = Runtime.getRuntime(); - r.gc(); - } - catch (Throwable t) { - //Do nothing. - } - } - - public static boolean isWindows() { - return (getOSString().indexOf("win") >= 0); - } - - public static boolean isMac() { - return (getOSString().indexOf("mac") >= 0); - } - - public static boolean isUnix() { - return (getOSString().indexOf("nix") >= 0 || getOSString().indexOf("nux") >= 0 || getOSString().indexOf("aix") > 0 ); - } - - public static boolean isSolaris() { - return (getOSString().indexOf("sunos") >= 0); - } - - public static String getOSString(){ - try { - return System.getProperty("os.name").toLowerCase(); - } - catch (Throwable t){ - return "other"; - } - } - - public static OS getOperatingSystem(){ - if (isMac()){ - return OS.MAC; - } - else if (isWindows()){ - return OS.WINDOWS; - } - else if (isUnix()){ - return OS.UNIX; - } - else if (isSolaris()){ - return OS.SOLARIS; - } - else { - return OS.OTHER; - } - } - - public static enum OS { - MAC(1), - WINDOWS(2), - UNIX(3), - SOLARIS(4), - OTHER(0); - - private int mID; - private OS (final int ID){ - this.mID = ID; - } - - public int getID() { - return this.mID; - } - } - -} diff --git a/src/Java/gtPlusPlus/core/world/damage/BaseCustomDamageSource.java b/src/Java/gtPlusPlus/core/world/damage/BaseCustomDamageSource.java deleted file mode 100644 index 3778beacfb..0000000000 --- a/src/Java/gtPlusPlus/core/world/damage/BaseCustomDamageSource.java +++ /dev/null @@ -1,22 +0,0 @@ -package gtPlusPlus.core.world.damage; - -import net.minecraft.entity.Entity; -import net.minecraft.util.EntityDamageSourceIndirect; - -public class BaseCustomDamageSource extends EntityDamageSourceIndirect { - - public BaseCustomDamageSource(String name, Entity transmitter, Entity indirectSource) { - super(name, transmitter, indirectSource); - this.setDifficultyScaled(); - } - - /** - * Return whether this damage source will have its damage amount scaled based on the current difficulty. - */ - public boolean isDifficultyScaled() - { - return true; - } - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/world/explosions/ExplosionHandler.java b/src/Java/gtPlusPlus/core/world/explosions/ExplosionHandler.java deleted file mode 100644 index 8d96aa2ff1..0000000000 --- a/src/Java/gtPlusPlus/core/world/explosions/ExplosionHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -package gtPlusPlus.core.world.explosions; - -import net.minecraft.entity.Entity; -import net.minecraft.world.World; - -public class ExplosionHandler { - - /** - * Creates an explosion. Args: entity, x, y, z, strength - */ - public MiningExplosion createExplosion(final World world, final Entity entityObj, final double x, final double y, final double z, final float size, final boolean makesFlames, final boolean makesSmoke) - { - return this.newExplosion(world, entityObj, x, y, z, size, makesFlames, makesSmoke); - } - - /** - * returns a new explosion. - */ - public MiningExplosion newExplosion(final World world, final Entity entityObj, final double x, final double y, final double z, final float size, final boolean makesFlames, final boolean makesSmoke){ - final MiningExplosion explosion = new MiningExplosion(world, entityObj, x, y, z, size); - explosion.isFlaming = makesFlames; - explosion.isSmoking = makesSmoke; - if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(world, explosion)) { - return explosion; - } - explosion.doExplosionA(); - explosion.doExplosionB(true); - return explosion; - } - -} diff --git a/src/Java/gtPlusPlus/core/world/explosions/MiningExplosion.java b/src/Java/gtPlusPlus/core/world/explosions/MiningExplosion.java deleted file mode 100644 index 792e47085e..0000000000 --- a/src/Java/gtPlusPlus/core/world/explosions/MiningExplosion.java +++ /dev/null @@ -1,275 +0,0 @@ -package gtPlusPlus.core.world.explosions; - -import java.util.*; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.enchantment.EnchantmentProtection; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.util.*; -import net.minecraft.world.ChunkPosition; -import net.minecraft.world.Explosion; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.random.XSTR; -import gtPlusPlus.core.entity.EntityPrimedMiningExplosive; -import gtPlusPlus.core.util.math.MathUtils; - -public class MiningExplosion extends Explosion { - private final int field_77289_h = 16; - private final Random explosionRNG = new XSTR(); - private final World worldObj; - - private final Map<Entity, Vec3> field_77288_k = new HashMap<>(); - public MiningExplosion(final World worldObj, final Entity entityObj, final double x, final double y, final double z, final float size) - { - super(worldObj, entityObj, x, y, z, size); - this.worldObj = worldObj; - this.exploder = entityObj; - this.explosionSize = size; - this.explosionX = x; - this.explosionY = y; - this.explosionZ = z; - } - - /** - * Does the first part of the explosion (destroy blocks) - */ - @SuppressWarnings("unchecked") - @Override - public void doExplosionA() - { - final float f = this.explosionSize; - final HashSet<ChunkPosition> hashset = new HashSet<>(); - int i; - int j; - int k; - double d5; - double d6; - double d7; - - for (i = 0; i < this.field_77289_h; ++i) - { - for (j = 0; j < this.field_77289_h; ++j) - { - for (k = 0; k < this.field_77289_h; ++k) - { - if ((i == 0) || (i == (this.field_77289_h - 1)) || (j == 0) || (j == (this.field_77289_h - 1)) || (k == 0) || (k == (this.field_77289_h - 1))) - { - double d0 = ((i / (this.field_77289_h - 1.0F)) * 2.0F) - 1.0F; - double d1 = ((j / (this.field_77289_h - 1.0F)) * 2.0F) - 1.0F; - double d2 = ((k / (this.field_77289_h - 1.0F)) * 2.0F) - 1.0F; - final double d3 = Math.sqrt((d0 * d0) + (d1 * d1) + (d2 * d2)); - d0 /= d3; - d1 /= d3; - d2 /= d3; - float f1 = this.explosionSize * (0.7F + (this.worldObj.rand.nextFloat() * 0.6F)); - d5 = this.explosionX; - d6 = this.explosionY; - d7 = this.explosionZ; - - for (final float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F) - { - final int j1 = MathHelper.floor_double(d5); - final int k1 = MathHelper.floor_double(d6); - final int l1 = MathHelper.floor_double(d7); - final Block block = this.worldObj.getBlock(j1, k1, l1); - - if (block.getMaterial() != Material.air) - { - final float f3 = this.exploder != null ? this.exploder.func_145772_a(this, this.worldObj, j1, k1, l1, block) : block.getExplosionResistance(this.exploder, this.worldObj, j1, k1, l1, this.explosionX, this.explosionY, this.explosionZ); - f1 -= (f3 + 0.3F) * f2; - } - - if ((f1 > 0.0F) && ((this.exploder == null) || this.exploder.func_145774_a(this, this.worldObj, j1, k1, l1, block, f1))) - { - hashset.add(new ChunkPosition(j1, k1, l1)); - } - - d5 += d0 * f2; - d6 += d1 * f2; - d7 += d2 * f2; - } - } - } - } - } - - this.affectedBlockPositions.addAll(hashset); - this.explosionSize *= 2.0F; - i = MathHelper.floor_double(this.explosionX - this.explosionSize - 1.0D); - j = MathHelper.floor_double(this.explosionX + this.explosionSize + 1.0D); - k = MathHelper.floor_double(this.explosionY - this.explosionSize - 1.0D); - final int i2 = MathHelper.floor_double(this.explosionY + this.explosionSize + 1.0D); - final int l = MathHelper.floor_double(this.explosionZ - this.explosionSize - 1.0D); - final int j2 = MathHelper.floor_double(this.explosionZ + this.explosionSize + 1.0D); - final List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, AxisAlignedBB.getBoundingBox(i, k, l, j, i2, j2)); - net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, this.explosionSize); - final Vec3 vec3 = Vec3.createVectorHelper(this.explosionX, this.explosionY, this.explosionZ); - - for (int i1 = 0; i1 < list.size(); ++i1) - { - final Entity entity = list.get(i1); - final double d4 = entity.getDistance(this.explosionX, this.explosionY, this.explosionZ) / this.explosionSize; - - if (d4 <= 1.0D) - { - d5 = entity.posX - this.explosionX; - d6 = (entity.posY + entity.getEyeHeight()) - this.explosionY; - d7 = entity.posZ - this.explosionZ; - final double d9 = MathHelper.sqrt_double((d5 * d5) + (d6 * d6) + (d7 * d7)); - - if (d9 != 0.0D) - { - d5 /= d9; - d6 /= d9; - d7 /= d9; - final double d10 = this.worldObj.getBlockDensity(vec3, entity.boundingBox); - final double d11 = (1.0D - d4) * d10; - entity.attackEntityFrom(DamageSource.setExplosionSource(this), ((int)(((((d11 * d11) + d11) / 2.0D) * 8.0D * this.explosionSize) + 1.0D))); - final double d8 = EnchantmentProtection.func_92092_a(entity, d11); - entity.motionX += d5 * d8; - entity.motionY += d6 * d8; - entity.motionZ += d7 * d8; - - if (entity instanceof EntityPlayer) - { - this.field_77288_k.put(entity, Vec3.createVectorHelper(d5 * d11, d6 * d11, d7 * d11)); - } - } - } - } - - this.explosionSize = f; - } - - /** - * Does the second part of the explosion (sound, particles, drop spawn) - */ - @Override - public void doExplosionB(final boolean p_77279_1_) - { - this.worldObj.playSoundEffect(this.explosionX, this.explosionY, this.explosionZ, "random.explode", 4.0F, (1.0F + ((this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F)) * 0.7F); - - if ((this.explosionSize >= 2.0F) && this.isSmoking) - { - this.worldObj.spawnParticle("hugeexplosion", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("smoke", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("cloud", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("explode", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largeexplode", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("hugeexplosion", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - } - else - { - this.worldObj.spawnParticle("largeexplode", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("smoke", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("cloud", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("explode", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largeexplode", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - } - - Iterator<ChunkPosition> iterator; - ChunkPosition chunkposition; - int i; - int j; - int k; - Block block; - - if (this.isSmoking) - { - iterator = this.affectedBlockPositions.iterator(); - - while (iterator.hasNext()) - { - chunkposition = iterator.next(); - i = chunkposition.chunkPosX; - j = chunkposition.chunkPosY; - k = chunkposition.chunkPosZ; - block = this.worldObj.getBlock(i, j, k); - - if (p_77279_1_) - { - final double d0 = i + this.worldObj.rand.nextFloat(); - final double d1 = j + this.worldObj.rand.nextFloat(); - final double d2 = k + this.worldObj.rand.nextFloat(); - double d3 = d0 - this.explosionX; - double d4 = d1 - this.explosionY; - double d5 = d2 - this.explosionZ; - final double d6 = MathHelper.sqrt_double((d3 * d3) + (d4 * d4) + (d5 * d5)); - d3 /= d6; - d4 /= d6; - d5 /= d6; - double d7 = 0.5D / ((d6 / this.explosionSize) + 0.1D); - d7 *= (this.worldObj.rand.nextFloat() * this.worldObj.rand.nextFloat()) + 0.3F; - d3 *= d7; - d4 *= d7; - d5 *= d7; - this.worldObj.spawnParticle("explode", (d0 + (this.explosionX * 1.0D)) / 2.0D, (d1 + (this.explosionY * 1.0D)) / 2.0D, (d2 + (this.explosionZ * 1.0D)) / 2.0D, d3, d4, d5); - this.worldObj.spawnParticle("smoke", d0, d1, d2, d3, d4, d5); - this.worldObj.spawnParticle("smoke", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largesmoke", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("cloud", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("flame", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("explode", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("largeexplode", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - this.worldObj.spawnParticle("hugeexplosion", this.explosionX+MathUtils.randDouble(0, 1), this.explosionY+MathUtils.randDouble(0, 1), this.explosionZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D); - - } - - if (block.getMaterial() != Material.air) - { - if (block.canDropFromExplosion(this)) - { - //world, x, y, z, world.getBlockMetadata(x, y, z), dropProb, 0 - block.dropBlockAsItemWithChance(this.worldObj, i, j, k, this.worldObj.getBlockMetadata(i, j, k), 1F, 0); - } - - block.onBlockExploded(this.worldObj, i, j, k, this); - } - } - } - - if (this.isFlaming) - { - iterator = this.affectedBlockPositions.iterator(); - - while (iterator.hasNext()) - { - chunkposition = iterator.next(); - i = chunkposition.chunkPosX; - j = chunkposition.chunkPosY; - k = chunkposition.chunkPosZ; - block = this.worldObj.getBlock(i, j, k); - final Block block1 = this.worldObj.getBlock(i, j - 1, k); - - if ((block.getMaterial() == Material.air) && block1.func_149730_j() && (this.explosionRNG.nextInt(3) == 0)) - { - this.worldObj.setBlock(i, j, k, Blocks.fire); - } - } - } - } - - @Override - public Map<Entity, Vec3> func_77277_b() - { - return this.field_77288_k; - } - - /** - * Returns either the entity that placed the explosive block, the entity that caused the explosion or null. - */ - @Override - public EntityLivingBase getExplosivePlacedBy() - { - return this.exploder == null ? null : (this.exploder instanceof EntityPrimedMiningExplosive ? ((EntityPrimedMiningExplosive)this.exploder).getTntPlacedBy() : (this.exploder instanceof EntityLivingBase ? (EntityLivingBase)this.exploder : null)); - } -}
\ No newline at end of file |