aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/api')
-rw-r--r--src/main/java/gtPlusPlus/api/enums/ParticleNames.java35
-rw-r--r--src/main/java/gtPlusPlus/api/enums/Quality.java66
-rw-r--r--src/main/java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java174
-rw-r--r--src/main/java/gtPlusPlus/api/interfaces/IChunkLoader.java32
-rw-r--r--src/main/java/gtPlusPlus/api/interfaces/IComparableRecipe.java6
-rw-r--r--src/main/java/gtPlusPlus/api/interfaces/IGeneratorWorld.java18
-rw-r--r--src/main/java/gtPlusPlus/api/interfaces/IGregtechPacketEntity.java12
-rw-r--r--src/main/java/gtPlusPlus/api/interfaces/IGregtechPower.java142
-rw-r--r--src/main/java/gtPlusPlus/api/interfaces/IRandomGenerator.java38
-rw-r--r--src/main/java/gtPlusPlus/api/objects/data/ObjMap.java243
-rw-r--r--src/main/java/gtPlusPlus/api/objects/data/ReverseAutoMap.java176
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/DimChunkPos.java50
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/GenericStack.java41
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java122
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/TexturePackage.java54
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java108
-rw-r--r--src/main/java/gtPlusPlus/api/objects/random/CSPRNG_DO_NOT_USE.java236
-rw-r--r--src/main/java/gtPlusPlus/api/objects/random/UUIDGenerator.java436
-rw-r--r--src/main/java/gtPlusPlus/api/thermal/energy/IThermalConnection.java8
-rw-r--r--src/main/java/gtPlusPlus/api/thermal/energy/IThermalContainerItem.java14
-rw-r--r--src/main/java/gtPlusPlus/api/thermal/energy/IThermalHandler.java18
-rw-r--r--src/main/java/gtPlusPlus/api/thermal/energy/IThermalProvider.java12
-rw-r--r--src/main/java/gtPlusPlus/api/thermal/energy/IThermalReceiver.java12
-rw-r--r--src/main/java/gtPlusPlus/api/thermal/energy/IThermalStorage.java12
-rw-r--r--src/main/java/gtPlusPlus/api/thermal/energy/ThermalStorage.java117
-rw-r--r--src/main/java/gtPlusPlus/api/thermal/energy/ThermalStorageAdv.java34
-rw-r--r--src/main/java/gtPlusPlus/api/thermal/sample/ItemThermalContainer.java89
-rw-r--r--src/main/java/gtPlusPlus/api/thermal/sample/TileThermalHandler.java50
-rw-r--r--src/main/java/gtPlusPlus/api/thermal/tileentity/IThermalInfo.java12
29 files changed, 0 insertions, 2367 deletions
diff --git a/src/main/java/gtPlusPlus/api/enums/ParticleNames.java b/src/main/java/gtPlusPlus/api/enums/ParticleNames.java
deleted file mode 100644
index 335442dbc7..0000000000
--- a/src/main/java/gtPlusPlus/api/enums/ParticleNames.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package gtPlusPlus.api.enums;
-
-public enum ParticleNames {
- explode,
- largeexplode,
- hugeexplosion,
- bubble,
- splash,
- suspended,
- depthsuspend,
- crit,
- magicCrit,
- smoke,
- largesmoke,
- spell,
- instantSpell,
- mobSpell,
- dripWater,
- dripLava,
- townaura,
- note,
- portal,
- enchantmenttable,
- flame,
- lava,
- footstep,
- cloud,
- reddust,
- snowballpoof,
- snowshovel,
- slime,
- heart,
- iconcrack_,
- tilecrack_;
-}
diff --git a/src/main/java/gtPlusPlus/api/enums/Quality.java b/src/main/java/gtPlusPlus/api/enums/Quality.java
deleted file mode 100644
index efcf2a015f..0000000000
--- a/src/main/java/gtPlusPlus/api/enums/Quality.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package gtPlusPlus.api.enums;
-
-import net.minecraft.util.EnumChatFormatting;
-
-import gtPlusPlus.core.util.math.MathUtils;
-
-public enum Quality {
-
- // Magic Blue
- // Rare Yellow
- // Set Green
- // Unique Gold/Purple
- // Trade-off Brown
-
- POOR("Poor", EnumChatFormatting.GRAY),
- COMMON("Common", EnumChatFormatting.WHITE),
- UNCOMMON("Uncommon", EnumChatFormatting.DARK_GREEN),
- MAGIC("Magic", EnumChatFormatting.BLUE),
- RARE("Rare", EnumChatFormatting.YELLOW),
- UNIQUE("Unique", EnumChatFormatting.GOLD),
- ARTIFACT("Artifact", EnumChatFormatting.AQUA),
- SET("Set Piece", EnumChatFormatting.GREEN),
- TRADEOFF("Trade-off", EnumChatFormatting.DARK_RED),
- EPIC("Epic", EnumChatFormatting.LIGHT_PURPLE);
-
- private String LOOT;
- private EnumChatFormatting COLOUR;
-
- private Quality(final String lootTier, final EnumChatFormatting tooltipColour) {
- this.LOOT = lootTier;
- this.COLOUR = tooltipColour;
- }
-
- public String getQuality() {
- return this.LOOT;
- }
-
- protected EnumChatFormatting getColour() {
- return this.COLOUR;
- }
-
- public String formatted() {
- return this.COLOUR + this.LOOT;
- }
-
- public static Quality getRandomQuality() {
- final int lootChance = MathUtils.randInt(0, 100);
- if (lootChance <= 10) {
- return Quality.POOR;
- } else if (lootChance <= 45) {
- return Quality.COMMON;
- } else if (lootChance <= 65) {
- return Quality.UNCOMMON;
- } else if (lootChance <= 82) {
- return Quality.MAGIC;
- } else if (lootChance <= 92) {
- return Quality.EPIC;
- } else if (lootChance <= 97) {
- return Quality.RARE;
- } else if (lootChance <= 99) {
- return Quality.ARTIFACT;
- } else {
- return null;
- }
- }
-}
diff --git a/src/main/java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java b/src/main/java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java
index a85bd42213..24d2da3134 100644
--- a/src/main/java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java
+++ b/src/main/java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java
@@ -2,26 +2,13 @@ package gtPlusPlus.api.helpers;
import java.util.HashMap;
-import net.minecraft.block.Block;
-import net.minecraft.item.ItemStack;
-
import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.api.objects.data.WeightedCollection;
import gtPlusPlus.api.objects.minecraft.multi.SpecialMultiBehaviour;
-import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy_RTG;
import gtPlusPlus.xmod.gregtech.api.util.SpecialBehaviourTooltipHandler;
public class GregtechPlusPlus_API {
- public static class MolecularTransformer_API {
-
- public static boolean addRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEU) {
- return CORE.RA.addMolecularTransformerRecipe(aInput, aOutput, aDuration, aEU, 1);
- }
- }
-
public static class Multiblock_API {
private static final HashMap<String, SpecialMultiBehaviour> mSpecialBehaviourItemMap = new HashMap<String, SpecialMultiBehaviour>();
@@ -50,166 +37,5 @@ public class GregtechPlusPlus_API {
public static final HashMap<String, SpecialMultiBehaviour> getSpecialBehaviourItemMap() {
return mSpecialBehaviourItemMap;
}
-
- /**
- * Allows RTG Fuel pellets from other mods to be used in the RTG hatch.
- *
- * @param aStack - The Pellet Stack, sanitsed after passing through.
- * @param aFuelValue - The Fuel Value of the Pellet to be added to the energy storage.
- * @return - Did register?
- */
- public static boolean registerPelletForRtgHatch(ItemStack aStack, long aFuelValue) {
- return GT_MetaTileEntity_Hatch_Energy_RTG.registerPelletForHatch(aStack, aFuelValue);
- }
- }
-
- public static class VoidMiner_API {
-
- private static final HashMap<Integer, HashMap<String, WeightedCollection<Block>>> mMinerLootCache;
-
- static {
- mMinerLootCache = new HashMap<Integer, HashMap<String, WeightedCollection<Block>>>();
- }
-
- /**
- *
- * Registers an ore block for a dimension. Uses a default weight of 100.
- *
- * @param aDim - The Dimension ID
- * @param aOredictName - The OreDict name of the Ore to be mined.
- * @return - If there was a valid Block found in the OreDict for the provided name.
- */
- public static boolean registerOreForVoidMiner(int aDim, String aOredictName) {
- return registerOreForVoidMiner(aDim, aOredictName, 100);
- }
-
- /**
- *
- * Registers an ore block for a dimension. Uses a default weight of 100.
- *
- * @param aDim - The Dimension ID
- * @param aOredictName - The OreDict name of the Ore to be mined.
- * @param aWeight - The weight of this ore Block.
- * @return - If there was a valid Block found in the OreDict for the provided name.
- */
- public static boolean registerOreForVoidMiner(int aDim, String aOredictName, int aWeight) {
- Block b = null;
- ItemStack[] aValidItems = ItemUtils.validItemsForOreDict(aOredictName);
- for (ItemStack g : aValidItems) {
- if (g != null) {
- b = Block.getBlockFromItem(g.getItem());
- if (b != null) {
- break;
- }
- }
- }
- if (b != null) {
- registerOreForVoidMiner(aDim, b, aWeight);
- return true;
- }
- return false;
- }
-
- /**
- * Registers an ore block for a dimension. Uses a default weight of 100.
- *
- * @param aDim - The Dimension ID
- * @param aOreBlock - The Ore Block to be mined.
- */
- public static void registerOreForVoidMiner(int aDim, Block aOreBlock) {
- registerOreForVoidMiner(aDim, aOreBlock, 100);
- }
-
- /**
- * Registers an ore block for a dimension.
- *
- * @param aDim - The Dimension ID
- * @param aOreBlock - The Ore Block to be mined.
- * @param aWeight - The weight of this ore Block.
- */
- public static void registerOreForVoidMiner(int aDim, Block aOreBlock, int aWeight) {
- GregtechPlusPlus_API_Internal.writeBlockToDimensionInCache(aDim, 0, aOreBlock, aWeight);
- }
-
- /**
- * Registers a surface block for a dimension. Uses a default weight of 100.
- *
- * @param aDim - The Dimension ID
- * @param aDirtBlock - The Dirt/Grass Block to be mined.
- */
- public static void registerEarthSurfaceForVoidMiner(int aDim, Block aDirtBlock) {
- registerEarthSurfaceForVoidMiner(aDim, aDirtBlock, 100);
- }
-
- /**
- * Registers a surface block for a dimension.
- *
- * @param aDim - The Dimension ID
- * @param aDirtBlock - The Dirt/Grass Block to be mined.
- * @param aWeight - The weight of this Dirt/Grass Block.
- */
- public static void registerEarthSurfaceForVoidMiner(int aDim, Block aDirtBlock, int aWeight) {
- GregtechPlusPlus_API_Internal.writeBlockToDimensionInCache(aDim, 0, aDirtBlock, aWeight);
- }
-
- /**
- * Registers a stone block for a dimension. Uses a default weight of 100.
- *
- * @param aDim - The Dimension ID
- * @param aStoneBlock - The Stone Block to be mined.
- */
- public static void registerEarthStoneForVoidMiner(int aDim, Block aStoneBlock) {
- registerEarthStoneForVoidMiner(aDim, aStoneBlock, 100);
- }
-
- /**
- * Registers a stone block for a dimension.
- *
- * @param aDim - The Dimension ID
- * @param aStoneBlock - The Stone Block to be mined.
- * @param aWeight - The weight of this Stone Block.
- */
- public static void registerEarthStoneForVoidMiner(int aDim, Block aStoneBlock, int aWeight) {
- GregtechPlusPlus_API_Internal.writeBlockToDimensionInCache(aDim, 0, aStoneBlock, aWeight);
- }
-
- public static WeightedCollection<Block> getAllRegisteredOresForDimension(int aDim) {
- return mMinerLootCache.get(aDim).get("ore");
- }
-
- public static WeightedCollection<Block> getAllRegisteredDirtTypesForDimension(int aDim) {
- return mMinerLootCache.get(aDim).get("dirt");
- }
-
- public static WeightedCollection<Block> getAllRegisteredStoneTypesForDimension(int aDim) {
- return mMinerLootCache.get(aDim).get("stone");
- }
-
- public static final HashMap<Integer, HashMap<String, WeightedCollection<Block>>> getVoidMinerLootCache() {
- return mMinerLootCache;
- }
- }
-
- private static class GregtechPlusPlus_API_Internal {
-
- private static void writeBlockToDimensionInCache(int aDim, int aType, Block aBlock, int aWeight) {
- HashMap<String, WeightedCollection<Block>> aDimMap = VoidMiner_API.mMinerLootCache.get(aDim);
- if (aDimMap == null) {
- aDimMap = new HashMap<String, WeightedCollection<Block>>();
- }
- WeightedCollection<Block> aMappedBlocks = getBlockMap(aType, aDimMap);
- aMappedBlocks.put(aWeight, aBlock);
- }
-
- private static WeightedCollection<Block> getBlockMap(int aType,
- HashMap<String, WeightedCollection<Block>> aDimMap) {
- WeightedCollection<Block> aMappedBlocks;
- String aTypeName = ((aType == 0) ? "ore" : (aType == 1) ? "dirt" : (aType == 2) ? "stone" : "error");
- aMappedBlocks = aDimMap.get(aTypeName);
- if (aMappedBlocks == null) {
- aMappedBlocks = new WeightedCollection<Block>();
- }
- return aMappedBlocks;
- }
}
}
diff --git a/src/main/java/gtPlusPlus/api/interfaces/IChunkLoader.java b/src/main/java/gtPlusPlus/api/interfaces/IChunkLoader.java
deleted file mode 100644
index cec4d12716..0000000000
--- a/src/main/java/gtPlusPlus/api/interfaces/IChunkLoader.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package gtPlusPlus.api.interfaces;
-
-import java.util.Set;
-
-import net.minecraft.world.ChunkCoordIntPair;
-
-public interface IChunkLoader {
-
- public long getTicksRemaining();
-
- public void setTicksRemaining(long aTicks);
-
- public ChunkCoordIntPair getResidingChunk();
-
- public void setResidingChunk(ChunkCoordIntPair aCurrentChunk);
-
- public boolean getChunkLoadingActive();
-
- public void setChunkLoadingActive(boolean aActive);
-
- public boolean getDoesWorkChunkNeedReload();
-
- public void setDoesWorkChunkNeedReload(boolean aActive);
-
- public boolean addChunkToLoadedList(ChunkCoordIntPair aActiveChunk);
-
- public boolean removeChunkFromLoadedList(ChunkCoordIntPair aActiveChunk);
-
- public Set<ChunkCoordIntPair> getManagedChunks();
-
- public int getChunkloaderTier();
-}
diff --git a/src/main/java/gtPlusPlus/api/interfaces/IComparableRecipe.java b/src/main/java/gtPlusPlus/api/interfaces/IComparableRecipe.java
deleted file mode 100644
index 06727167bf..0000000000
--- a/src/main/java/gtPlusPlus/api/interfaces/IComparableRecipe.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package gtPlusPlus.api.interfaces;
-
-import gregtech.api.util.GT_Recipe;
-
-public interface IComparableRecipe extends Comparable<GT_Recipe> {
-}
diff --git a/src/main/java/gtPlusPlus/api/interfaces/IGeneratorWorld.java b/src/main/java/gtPlusPlus/api/interfaces/IGeneratorWorld.java
deleted file mode 100644
index 95cd46e443..0000000000
--- a/src/main/java/gtPlusPlus/api/interfaces/IGeneratorWorld.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package gtPlusPlus.api.interfaces;
-
-import java.util.Random;
-
-import net.minecraft.world.World;
-
-public abstract interface IGeneratorWorld {
-
- public abstract boolean generate(World paramWorld, Random paramRandom, int paramInt1, int paramInt2);
-
- public abstract void initiate();
-
- public abstract int getExtentX();
-
- public abstract int getExtentZ();
-
- public abstract int getRange();
-}
diff --git a/src/main/java/gtPlusPlus/api/interfaces/IGregtechPacketEntity.java b/src/main/java/gtPlusPlus/api/interfaces/IGregtechPacketEntity.java
deleted file mode 100644
index 4a41e47a7b..0000000000
--- a/src/main/java/gtPlusPlus/api/interfaces/IGregtechPacketEntity.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package gtPlusPlus.api.interfaces;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-public interface IGregtechPacketEntity {
-
- public void writePacketData(DataOutputStream data) throws IOException;
-
- public void readPacketData(DataInputStream data) throws IOException;
-}
diff --git a/src/main/java/gtPlusPlus/api/interfaces/IGregtechPower.java b/src/main/java/gtPlusPlus/api/interfaces/IGregtechPower.java
deleted file mode 100644
index f121926005..0000000000
--- a/src/main/java/gtPlusPlus/api/interfaces/IGregtechPower.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package gtPlusPlus.api.interfaces;
-
-import net.minecraft.block.Block;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
-
-import gregtech.api.interfaces.IDescribable;
-import gregtech.api.interfaces.tileentity.IBasicEnergyContainer;
-import gregtech.api.interfaces.tileentity.IGearEnergyTileEntity;
-import gregtech.api.interfaces.tileentity.IGregTechDeviceInformation;
-import gregtech.api.interfaces.tileentity.ITurnable;
-
-public abstract interface IGregtechPower
- extends IGearEnergyTileEntity, ITurnable, IGregTechDeviceInformation, IDescribable, IBasicEnergyContainer {
-
- @Override
- public String[] getDescription();
-
- @Override
- default boolean isUniversalEnergyStored(long p0) {
- return false;
- }
-
- @Override
- public long getOutputAmperage();
-
- @Override
- public long getOutputVoltage();
-
- @Override
- public long getInputAmperage();
-
- @Override
- public long getInputVoltage();
-
- @Override
- public boolean decreaseStoredEnergyUnits(long p0, boolean p1);
-
- @Override
- public boolean increaseStoredEnergyUnits(long p0, boolean p1);
-
- @Override
- public boolean drainEnergyUnits(ForgeDirection side, long p1, long p2);
-
- @Override
- public long getAverageElectricInput();
-
- @Override
- public long getAverageElectricOutput();
-
- @Override
- public long getStoredEU();
-
- @Override
- public long getEUCapacity();
-
- @Override
- public long getStoredSteam();
-
- @Override
- public long getSteamCapacity();
-
- @Override
- public boolean increaseStoredSteam(long p0, boolean p1);
-
- @Override
- public Block getBlockAtSide(ForgeDirection side);
-
- @Override
- public Block getBlockAtSideAndDistance(ForgeDirection side, int p1);
-
- @Override
- public Block getBlockOffset(int p0, int p1, int p2);
-
- @Override
- public TileEntity getTileEntity(int p0, int p1, int p2);
-
- @Override
- public TileEntity getTileEntityAtSide(ForgeDirection side);
-
- @Override
- public TileEntity getTileEntityAtSideAndDistance(ForgeDirection side, int p1);
-
- @Override
- public TileEntity getTileEntityOffset(int p0, int p1, int p2);
-
- @Override
- public World getWorld();
-
- @Override
- public int getXCoord();
-
- @Override
- public short getYCoord();
-
- @Override
- public int getZCoord();
-
- @Override
- public boolean isClientSide();
-
- @Override
- public boolean isDead();
-
- @Override
- public boolean isInvalidTileEntity();
-
- @Override
- public boolean isServerSide();
-
- @Override
- public void readFromNBT(NBTTagCompound p0);
-
- @Override
- public void writeToNBT(NBTTagCompound p0);
-
- @Override
- public boolean acceptsRotationalEnergy(ForgeDirection side);
-
- @Override
- public boolean injectRotationalEnergy(ForgeDirection side, long p1, long p2);
-
- @Override
- public long injectEnergyUnits(ForgeDirection side, long p1, long p2);
-
- @Override
- public boolean inputEnergyFrom(ForgeDirection side);
-
- @Override
- public boolean outputsEnergyTo(ForgeDirection side);
-
- @Override
- public String[] getInfoData();
-
- @Override
- public default boolean isGivingInformation() {
- return true;
- }
-
-}
diff --git a/src/main/java/gtPlusPlus/api/interfaces/IRandomGenerator.java b/src/main/java/gtPlusPlus/api/interfaces/IRandomGenerator.java
deleted file mode 100644
index ddb4d4d2f1..0000000000
--- a/src/main/java/gtPlusPlus/api/interfaces/IRandomGenerator.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2005, Nick Galbreath -- nickg [at] modp [dot] com All rights reserved. Redistribution and use in source and
- * binary forms, with or without modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
- * disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of
- * the modp.com nor the names of its contributors may be used to endorse or promote products derived from this software
- * without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE. This is the standard "new" BSD license:
- * http://www.opensource.org/licenses/bsd-license.php
- */
-
-package gtPlusPlus.api.interfaces;
-
-/**
- * Simplified interface for random number generation
- *
- * @author Nick Galbreath -- nickg [at] modp [dot] com
- * @version 1 -- 06-Jul-2005
- */
-public interface IRandomGenerator {
-
- /**
- * Returns N random bits
- *
- * See also java.util.Random#next
- *
- * @param numBits
- * @return and int with the LSB being random
- */
- public int next(int numBits);
-}
diff --git a/src/main/java/gtPlusPlus/api/objects/data/ObjMap.java b/src/main/java/gtPlusPlus/api/objects/data/ObjMap.java
deleted file mode 100644
index eff314f9ae..0000000000
--- a/src/main/java/gtPlusPlus/api/objects/data/ObjMap.java
+++ /dev/null
@@ -1,243 +0,0 @@
-package gtPlusPlus.api.objects.data;
-
-import java.util.Arrays;
-
-/**
- * Object-2-object map based on IntIntMap4a
- */
-public class ObjMap<K, V> {
-
- private static final Object FREE_KEY = new Object();
- private static final Object REMOVED_KEY = new Object();
-
- /** Keys and values */
- private Object[] m_data;
-
- /** Value for the null key (if inserted into a map) */
- private Object m_nullValue;
-
- private boolean m_hasNull;
-
- /** Fill factor, must be between (0 and 1) */
- private final float m_fillFactor;
- /** We will resize a map once it reaches this size */
- private int m_threshold;
- /** Current map size */
- private int m_size;
- /** Mask to calculate the original position */
- private int m_mask;
- /** Mask to wrap the actual array pointer */
- private int m_mask2;
-
- public ObjMap(final int size, final float fillFactor) {
- if (fillFactor <= 0 || fillFactor >= 1) throw new IllegalArgumentException("FillFactor must be in (0, 1)");
- if (size <= 0) throw new IllegalArgumentException("Size must be positive!");
- final int capacity = arraySize(size, fillFactor);
- m_mask = capacity - 1;
- m_mask2 = capacity * 2 - 1;
- m_fillFactor = fillFactor;
-
- m_data = new Object[capacity * 2];
- Arrays.fill(m_data, FREE_KEY);
-
- m_threshold = (int) (capacity * fillFactor);
- }
-
- @SuppressWarnings("unchecked")
- public V get(final K key) {
- if (key == null) return (V) m_nullValue; // we null it on remove, so safe not to check a flag here
-
- int ptr = (key.hashCode() & m_mask) << 1;
- Object k = m_data[ptr];
-
- if (k == FREE_KEY) return null; // end of chain already
- if (k.equals(key)) // we check FREE and REMOVED prior to this call
- return (V) m_data[ptr + 1];
- while (true) {
- ptr = (ptr + 2) & m_mask2; // that's next index
- k = m_data[ptr];
- if (k == FREE_KEY) return null;
- if (k.equals(key)) return (V) m_data[ptr + 1];
- }
- }
-
- @SuppressWarnings("unchecked")
- public V put(final K key, final V value) {
- if (key == null) return insertNullKey(value);
-
- int ptr = getStartIndex(key) << 1;
- Object k = m_data[ptr];
-
- if (k == FREE_KEY) // end of chain already
- {
- m_data[ptr] = key;
- m_data[ptr + 1] = value;
- if (m_size >= m_threshold) rehash(m_data.length * 2); // size is set inside
- else++m_size;
- return null;
- } else if (k.equals(key)) // we check FREE and REMOVED prior to this call
- {
- final Object ret = m_data[ptr + 1];
- m_data[ptr + 1] = value;
- return (V) ret;
- }
-
- int firstRemoved = -1;
- if (k == REMOVED_KEY) firstRemoved = ptr; // we may find a key later
-
- while (true) {
- ptr = (ptr + 2) & m_mask2; // that's next index calculation
- k = m_data[ptr];
- if (k == FREE_KEY) {
- if (firstRemoved != -1) ptr = firstRemoved;
- m_data[ptr] = key;
- m_data[ptr + 1] = value;
- if (m_size >= m_threshold) rehash(m_data.length * 2); // size is set inside
- else++m_size;
- return null;
- } else if (k.equals(key)) {
- final Object ret = m_data[ptr + 1];
- m_data[ptr + 1] = value;
- return (V) ret;
- } else if (k == REMOVED_KEY) {
- if (firstRemoved == -1) firstRemoved = ptr;
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- public V remove(final K key) {
- if (key == null) return removeNullKey();
-
- int ptr = getStartIndex(key) << 1;
- Object k = m_data[ptr];
- if (k == FREE_KEY) return null; // end of chain already
- else if (k.equals(key)) // we check FREE and REMOVED prior to this call
- {
- --m_size;
- if (m_data[(ptr + 2) & m_mask2] == FREE_KEY) m_data[ptr] = FREE_KEY;
- else m_data[ptr] = REMOVED_KEY;
- final V ret = (V) m_data[ptr + 1];
- m_data[ptr + 1] = null;
- return ret;
- }
- while (true) {
- ptr = (ptr + 2) & m_mask2; // that's next index calculation
- k = m_data[ptr];
- if (k == FREE_KEY) return null;
- else if (k.equals(key)) {
- --m_size;
- if (m_data[(ptr + 2) & m_mask2] == FREE_KEY) m_data[ptr] = FREE_KEY;
- else m_data[ptr] = REMOVED_KEY;
- final V ret = (V) m_data[ptr + 1];
- m_data[ptr + 1] = null;
- return ret;
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- private V insertNullKey(final V value) {
- if (m_hasNull) {
- final Object ret = m_nullValue;
- m_nullValue = value;
- return (V) ret;
- } else {
- m_nullValue = value;
- ++m_size;
- return null;
- }
- }
-
- @SuppressWarnings("unchecked")
- private V removeNullKey() {
- if (m_hasNull) {
- final Object ret = m_nullValue;
- m_nullValue = null;
- m_hasNull = false;
- --m_size;
- return (V) ret;
- } else {
- return null;
- }
- }
-
- public int size() {
- return m_size;
- }
-
- @SuppressWarnings("unchecked")
- private void rehash(final int newCapacity) {
- m_threshold = (int) (newCapacity / 2 * m_fillFactor);
- m_mask = newCapacity / 2 - 1;
- m_mask2 = newCapacity - 1;
-
- final int oldCapacity = m_data.length;
- final Object[] oldData = m_data;
-
- m_data = new Object[newCapacity];
- Arrays.fill(m_data, FREE_KEY);
-
- m_size = m_hasNull ? 1 : 0;
-
- for (int i = 0; i < oldCapacity; i += 2) {
- final Object oldKey = oldData[i];
- if (oldKey != FREE_KEY && oldKey != REMOVED_KEY) put((K) oldKey, (V) oldData[i + 1]);
- }
- }
-
- public int getStartIndex(final Object key) {
- // key is not null here
- return key.hashCode() & m_mask;
- }
-
- public Object[] values() {
- return m_data;
- }
-
- /** Taken from FastUtil implementation */
-
- /**
- * Return the least power of two greater than or equal to the specified value.
- *
- * <p>
- * Note that this function will return 1 when the argument is 0.
- *
- * @param x a long integer smaller than or equal to 2<sup>62</sup>.
- * @return the least power of two greater than or equal to the specified value.
- */
- public static long nextPowerOfTwo(long x) {
- if (x == 0) return 1;
- x--;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- return (x | x >> 32) + 1;
- }
-
- /**
- * Returns the least power of two smaller than or equal to 2<sup>30</sup> and larger than or equal to
- * <code>Math.ceil( expected / f )</code>.
- *
- * @param expected the expected number of elements in a hash table.
- * @param f the load factor.
- * @return the minimum possible size for a backing array.
- * @throws IllegalArgumentException if the necessary size is larger than 2<sup>30</sup>.
- */
- public static int arraySize(final int expected, final float f) {
- final long s = Math.max(2, nextPowerOfTwo((long) Math.ceil(expected / f)));
- if (s > (1 << 30)) throw new IllegalArgumentException(
- "Too large (" + expected + " expected elements with load factor " + f + ")");
- return (int) s;
- }
-
- // taken from FastUtil
- private static final int INT_PHI = 0x9E3779B9;
-
- public static int phiMix(final int x) {
- final int h = x * INT_PHI;
- return h ^ (h >> 16);
- }
-}
diff --git a/src/main/java/gtPlusPlus/api/objects/data/ReverseAutoMap.java b/src/main/java/gtPlusPlus/api/objects/data/ReverseAutoMap.java
deleted file mode 100644
index 275dad9d42..0000000000
--- a/src/main/java/gtPlusPlus/api/objects/data/ReverseAutoMap.java
+++ /dev/null
@@ -1,176 +0,0 @@
-package gtPlusPlus.api.objects.data;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-public class ReverseAutoMap<N> extends AutoMap<N> {
-
- /**
- * The Internal Map
- */
- private Map<N, Integer> mInternalMapReverseLookup = new HashMap<N, Integer>();
-
- /**
- * The Internal ID
- */
- private int mInternalID = 0;
-
- private static final long serialVersionUID = 3771412318075131790L;
-
- @Override
- public Iterator<N> iterator() {
- return values().iterator();
- }
-
- @Override
- public synchronized boolean setValue(N object) {
- int mOriginalID = this.mInternalID;
- put(object);
- if (this.mInternalMap.get(mOriginalID).equals(object) || mOriginalID > this.mInternalID) {
- return true;
- } else {
- return false;
- }
- }
-
- @Override
- public synchronized N put(N object) {
- return set(object);
- }
-
- @Override
- public synchronized N set(N object) {
- int newID = getNextFreeMapID();
- mInternalMapReverseLookup.put(object, newID);
- return mInternalMap.put(newID, object);
- }
-
- public synchronized int putToInternalMap(N object) {
- return setInternalMap(object);
- }
-
- public synchronized int setInternalMap(N object) {
- int newID = getNextFreeMapID();
- mInternalMap.put(newID, object);
- mInternalMapReverseLookup.put(object, newID);
- return newID;
- }
-
- public synchronized boolean injectCleanDataToAutoMap(Integer g, N object) {
- if (!mInternalMap.containsKey(g) && !mInternalMapReverseLookup.containsKey(object)) {
- int a1 = 0, a2 = 0, a11 = 0, a22 = 0;
- a1 = mInternalMap.size();
- a2 = mInternalMapReverseLookup.size();
- a11 = a1;
- a22 = a2;
- mInternalMap.put(g, object);
- a1 = mInternalMap.size();
- mInternalMapReverseLookup.put(object, g);
- a2 = mInternalMapReverseLookup.size();
- if (a1 > a11 && a2 > a22) return true;
- }
- return false;
- }
-
- public synchronized boolean injectDataToAutoMap(Integer g, N object) {
- int a1 = 0, a2 = 0, a11 = 0, a22 = 0;
- a1 = mInternalMap.size();
- a2 = mInternalMapReverseLookup.size();
- a11 = a1;
- a22 = a2;
- mInternalMap.put(g, object);
- a1 = mInternalMap.size();
- mInternalMapReverseLookup.put(object, g);
- a2 = mInternalMapReverseLookup.size();
- if (a1 > a11 && a2 > a22) return true;
- return false;
- }
-
- private boolean raiseInternalID() {
- int mOld = mInternalID;
- mInternalID++;
- return mInternalID > mOld;
- }
-
- public synchronized int getNextFreeMapID() {
- if (raiseInternalID()) {
- return mInternalID;
- }
- return Short.MIN_VALUE;
- }
-
- @Override
- public synchronized N get(int id) {
- return mInternalMap.get(id);
- }
-
- public synchronized int get(N key) {
- return mInternalMapReverseLookup.get(key);
- }
-
- @Override
- public synchronized Collection<N> values() {
- return mInternalMap.values();
- }
-
- public synchronized Collection<Integer> keys() {
- return mInternalMapReverseLookup.values();
- }
-
- @Override
- public synchronized int size() {
- return mInternalMap.size();
- }
-
- @Override
- public synchronized int hashCode() {
- return mInternalMap.hashCode() + mInternalMapReverseLookup.hashCode();
- }
-
- @Override
- public synchronized boolean containsKey(int key) {
- return mInternalMap.containsKey(key);
- }
-
- @Override
- public synchronized boolean containsValue(N value) {
- return mInternalMap.containsValue(value);
- }
-
- public synchronized boolean containsKey(N key) {
- return mInternalMapReverseLookup.containsKey(key);
- }
-
- public synchronized boolean containsValue(int value) {
- return mInternalMapReverseLookup.containsValue(value);
- }
-
- @Override
- public synchronized boolean isEmpty() {
- return mInternalMap.isEmpty() && mInternalMapReverseLookup.isEmpty();
- }
-
- @Override
- public synchronized void clear() {
- this.mInternalID = 0;
- this.mInternalMap.clear();
- this.mInternalMapReverseLookup.clear();
- return;
- }
-
- @Override
- public synchronized N[] toArray() {
- Collection<N> col = this.mInternalMap.values();
- @SuppressWarnings("unchecked")
- N[] val = (N[]) col.toArray();
- return val;
- }
-
- public synchronized Integer[] toArrayInternalMap() {
- Collection<Integer> col = this.mInternalMapReverseLookup.values();
- Integer[] val = col.toArray(new Integer[col.size()]);
- return val;
- }
-}
diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/DimChunkPos.java b/src/main/java/gtPlusPlus/api/objects/minecraft/DimChunkPos.java
deleted file mode 100644
index 6748b58537..0000000000
--- a/src/main/java/gtPlusPlus/api/objects/minecraft/DimChunkPos.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package gtPlusPlus.api.objects.minecraft;
-
-import net.minecraft.client.Minecraft;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.world.World;
-import net.minecraft.world.chunk.Chunk;
-
-public class DimChunkPos {
-
- public final int dimension;
- public final int xPos;
- public final int zPos;
- public final Chunk mainChunk;
-
- public DimChunkPos(World world, BlockPos block) {
- this.dimension = world.provider.dimensionId;
- this.mainChunk = world.getChunkFromBlockCoords(block.xPos, block.zPos);
- this.xPos = this.mainChunk.xPosition;
- this.zPos = this.mainChunk.zPosition;
- }
-
- public DimChunkPos(TileEntity tile) {
- this.dimension = tile.getWorldObj().provider.dimensionId;
- this.mainChunk = tile.getWorldObj().getChunkFromBlockCoords(tile.xCoord, tile.zCoord);
- this.xPos = this.mainChunk.xPosition;
- this.zPos = this.mainChunk.zPosition;
- }
-
- public DimChunkPos(int dim, int x, int z) {
- this.dimension = dim;
- this.xPos = x;
- this.zPos = z;
- Chunk h = Minecraft.getMinecraft().getIntegratedServer().worldServerForDimension(dim)
- .getChunkFromChunkCoords(xPos, zPos);
- if (h == null) {
- this.mainChunk = null;
- } else {
- this.mainChunk = h;
- }
- }
-
- public Chunk getChunk() {
- if (this.mainChunk != null) {
- return this.mainChunk;
- }
- Chunk h = Minecraft.getMinecraft().getIntegratedServer().worldServerForDimension(this.dimension)
- .getChunkFromChunkCoords(xPos, zPos);
- return h;
- }
-}
diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/GenericStack.java b/src/main/java/gtPlusPlus/api/objects/minecraft/GenericStack.java
deleted file mode 100644
index b49114e610..0000000000
--- a/src/main/java/gtPlusPlus/api/objects/minecraft/GenericStack.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package gtPlusPlus.api.objects.minecraft;
-
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.fluids.FluidStack;
-
-public class GenericStack {
-
- private ItemStack mItemStack;
- private FluidStack mFluidStack;
-
- public GenericStack(ItemStack s) {
- this.mItemStack = s;
- this.mFluidStack = null;
- }
-
- public GenericStack(FluidStack f) {
- this.mItemStack = null;
- this.mFluidStack = f;
- }
-
- public GenericStack() {
- this.mItemStack = null;
- this.mFluidStack = null;
- }
-
- public final synchronized FluidStack getFluidStack() {
- return mFluidStack;
- }
-
- public final synchronized ItemStack getItemStack() {
- return mItemStack;
- }
-
- public final synchronized void setItemStack(ItemStack mItemStack) {
- this.mItemStack = mItemStack;
- }
-
- public final synchronized void setFluidStack(FluidStack mFluidStack) {
- this.mFluidStack = mFluidStack;
- }
-}
diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java b/src/main/java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java
deleted file mode 100644
index df48c24c06..0000000000
--- a/src/main/java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package gtPlusPlus.api.objects.minecraft;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.util.GT_Recipe;
-import gtPlusPlus.api.objects.data.AutoMap;
-
-public class NoConflictGTRecipeMap implements Collection<GT_Recipe> {
-
- private AutoMap<GT_Recipe> mRecipeCache = new AutoMap<GT_Recipe>();
- private final IGregTechTileEntity mMachineType;
-
- public NoConflictGTRecipeMap() {
- this(null);
- }
-
- public NoConflictGTRecipeMap(IGregTechTileEntity tile0) {
- this.mMachineType = tile0;
- }
-
- public boolean put(GT_Recipe recipe) {
- return add(recipe);
- }
-
- @Override
- public boolean add(GT_Recipe recipe) {
- return mRecipeCache.setValue(recipe);
- }
-
- public Collection<GT_Recipe> getRecipeMap() {
- return mRecipeCache.values();
- }
-
- public boolean isMapValidForMachine(IGregTechTileEntity tile) {
- return tile == mMachineType;
- }
-
- @Override
- public boolean addAll(Collection<? extends GT_Recipe> arg0) {
- int a = 0;
- for (Object v : arg0) {
- if (!this.mRecipeCache.containsValue((GT_Recipe) v)) {
- this.mRecipeCache.put((GT_Recipe) v);
- a++;
- }
- }
- return a > 0;
- }
-
- @Override
- public void clear() {
- mRecipeCache.clear();
- }
-
- @Override
- public boolean contains(Object arg0) {
- return mRecipeCache.containsValue((GT_Recipe) arg0);
- }
-
- @Override
- public boolean containsAll(Collection<?> arg0) {
- int a = 0;
- for (Object v : arg0) {
- if (this.mRecipeCache.containsValue((GT_Recipe) v)) {
- a++;
- }
- }
- return a == arg0.size();
- }
-
- @Override
- public boolean isEmpty() {
- return mRecipeCache.isEmpty();
- }
-
- @Override
- public Iterator<GT_Recipe> iterator() {
- return mRecipeCache.iterator();
- }
-
- @Override
- public boolean remove(Object arg0) {
- return mRecipeCache.remove((GT_Recipe) arg0);
- }
-
- @Override
- public boolean removeAll(Collection<?> arg0) {
- int a = 0;
- for (Object v : arg0) {
- if (this.mRecipeCache.containsValue((GT_Recipe) v)) {
- this.mRecipeCache.remove((GT_Recipe) v);
- a++;
- }
- }
- return a > 0;
- }
-
- @Override
- public boolean retainAll(Collection<?> arg0) {
- int mStartSize = this.mRecipeCache.size();
- this.mRecipeCache = (AutoMap<GT_Recipe>) arg0;
- int mEndsize = this.mRecipeCache.size();
- return mStartSize != mEndsize;
- }
-
- @Override
- public int size() {
- return this.mRecipeCache.size();
- }
-
- @Override
- public Object[] toArray() {
- return this.mRecipeCache.toArray();
- }
-
- @Override
- public <T> T[] toArray(T[] arg0) {
- return (T[]) this.mRecipeCache.toArray();
- }
-}
diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/TexturePackage.java b/src/main/java/gtPlusPlus/api/objects/minecraft/TexturePackage.java
deleted file mode 100644
index 4e4e0e9780..0000000000
--- a/src/main/java/gtPlusPlus/api/objects/minecraft/TexturePackage.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package gtPlusPlus.api.objects.minecraft;
-
-import java.util.LinkedHashMap;
-import java.util.Set;
-
-import net.minecraft.util.IIcon;
-
-import gtPlusPlus.api.objects.data.AutoMap;
-
-public class TexturePackage {
-
- private AutoMap<IIcon> mAnimationArray = new AutoMap<IIcon>();
-
- public IIcon getFrame(int aFrame) {
- if (aFrame < 0 || aFrame >= mAnimationArray.size()) {
- return mAnimationArray.get(0);
- }
- return mAnimationArray.get(aFrame);
- }
-
- public boolean addFrame(IIcon aFrame) {
- if (aFrame != null) {
- return mAnimationArray.add(aFrame);
- }
- return false;
- }
-
- public boolean addFrames(AutoMap<IIcon> aFrames) {
- for (IIcon h : aFrames) {
- if (!addFrame(h)) {
- return false;
- }
- }
- return true;
- }
-
- public boolean addFrames(LinkedHashMap<?, IIcon> aFrames) {
- for (IIcon h : aFrames.values()) {
- if (!addFrame(h)) {
- return false;
- }
- }
- return true;
- }
-
- public boolean addFrames(Set<IIcon> aFrames) {
- for (IIcon h : aFrames) {
- if (!addFrame(h)) {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java b/src/main/java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java
deleted file mode 100644
index f38a960044..0000000000
--- a/src/main/java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package gtPlusPlus.api.objects.minecraft;
-
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-
-import net.minecraft.entity.passive.EntityAnimal;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.world.World;
-import net.minecraft.world.chunk.Chunk;
-
-import gtPlusPlus.GTplusplus;
-import gtPlusPlus.GTplusplus.INIT_PHASE;
-import gtPlusPlus.api.objects.data.Pair;
-import gtPlusPlus.core.tileentities.machines.TileEntityPooCollector;
-import gtPlusPlus.core.util.Utils;
-
-public class ThreadPooCollector extends Thread {
-
- public boolean canRun = true;
- public boolean isRunning = false;
-
- private static final long INIT_TIME;
- private static long internalTickCounter = 0;
-
- private static final ThreadPooCollector mThread;
- private static final HashMap<String, Pair<BlockPos, TileEntityPooCollector>> mPooCollectors = new LinkedHashMap<String, Pair<BlockPos, TileEntityPooCollector>>();
-
- static {
- mThread = new ThreadPooCollector();
- INIT_TIME = (System.currentTimeMillis());
- }
-
- public ThreadPooCollector() {
- setName("gtpp.handler.poop");
- start();
- }
-
- public static ThreadPooCollector getInstance() {
- return mThread;
- }
-
- public static void addTask(TileEntityPooCollector aTile) {
- BlockPos aTempPos = new BlockPos(aTile);
- mPooCollectors.put(aTempPos.getUniqueIdentifier(), new Pair<BlockPos, TileEntityPooCollector>(aTempPos, aTile));
- }
-
- public static void stopThread() {
- mThread.canRun = false;
- }
-
- @Override
- public void run() {
-
- if (!isRunning) {
- isRunning = true;
- } else {
- return;
- }
-
- while (canRun) {
- if (mPooCollectors.isEmpty() || GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.STARTED) {
- continue;
- } else {
- internalTickCounter = Utils.getTicksFromSeconds(
- Utils.getSecondsFromMillis(Utils.getMillisSince(INIT_TIME, System.currentTimeMillis())));
- if (internalTickCounter % 100 == 0) {
- for (Pair<BlockPos, TileEntityPooCollector> pair : mPooCollectors.values()) {
- if (pair != null) {
- BlockPos p = pair.getKey();
- if (p != null) {
- if (p.world != null) {
- World w = p.world;
- if (w == null) {
- continue;
- }
- 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) {
- @SuppressWarnings("unchecked")
- List<EntityAnimal> animals = w
- .getEntitiesWithinAABB(EntityAnimal.class, box);
- if (animals != null && !animals.isEmpty()) {
- pair.getValue().onPostTick(animals);
- }
- } else {
- continue;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
-}
diff --git a/src/main/java/gtPlusPlus/api/objects/random/CSPRNG_DO_NOT_USE.java b/src/main/java/gtPlusPlus/api/objects/random/CSPRNG_DO_NOT_USE.java
deleted file mode 100644
index 07c8c3609b..0000000000
--- a/src/main/java/gtPlusPlus/api/objects/random/CSPRNG_DO_NOT_USE.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright 2005, Nick Galbreath -- nickg [at] modp [dot] com All rights reserved. Redistribution and use in source and
- * binary forms, with or without modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
- * disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of
- * the modp.com nor the names of its contributors may be used to endorse or promote products derived from this software
- * without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE. This is the standard "new" BSD license:
- * http://www.opensource.org/licenses/bsd-license.php
- */
-
-package gtPlusPlus.api.objects.random;
-
-import java.math.BigInteger;
-import java.security.SecureRandom;
-import java.util.Random;
-
-import gtPlusPlus.api.interfaces.IRandomGenerator;
-import gtPlusPlus.core.util.Utils;
-
-/**
- * The Blum-Blum-Shub random number generator.
- *
- * <p>
- * The Blum-Blum-Shub is a "cryptographically secure" random number generator. It has been proven that predicting the
- * ouput is equivalent to factoring <i>n</i>, a large integer generated from two prime numbers.
- * </p>
- *
- * <p>
- * The Algorithm:
- * </p>
- * <ol>
- * <li>(setup) generate two secret prime numbers <i>p</i>, <i>q</i> such that <i>p</i> &ne; <i>q</i>, <i>p</i> &equiv; 3
- * mod 4, <i>q</i> &equiv; 3 mod 4.</li>
- * <li>(setup) compute <i>n</i> = <i>pq</i>. <i>n</i> can be re-used, but <i>p</i>, and <i>q</i> are secret and should
- * be disposed of.</li>
- * <li>Generate a (secure) random seed <i>s</i> in the range [1, <i>n</i> -1] such that gcd(<i>s</i>, <i>n</i>) = 1.
- * <li>Compute <i>x</i> = <i>s</i><sup>2</sup> mod <i>n</i></li>
- * <li>Compute a single random bit with:
- * <ol>
- * <li><i>x</i> = <i>x</i><sup>2</sup> mod <i>n</i></li>
- * <li>return Least-Significant-Bit(<i>x</i>) (i.e. <i>x</i> & 1)</li>
- * </ol>
- * Repeat as necessary.</li>
- * </ol>
- *
- * <p>
- * The code originally appeared in <a href="http://modp.com/cida/"><i>Cryptography for Internet and Database
- * Applications </i>, Chapter 4, pages 174-177</a>
- * </p>
- * <p>
- * More details are in the <a href="http://www.cacr.math.uwaterloo.ca/hac/"><i>Handbook of Applied Cryptography</i></a>,
- * <a href="http://www.cacr.math.uwaterloo.ca/hac/about/chap5.pdf">Section 5.5.2</a>
- * </p>
- *
- * @author Nick Galbreath -- nickg [at] modp [dot] com
- * @version 3 -- 06-Jul-2005
- *
- */
-public class CSPRNG_DO_NOT_USE extends Random implements IRandomGenerator {
-
- // pre-compute a few values
- private static final BigInteger two = BigInteger.valueOf(2L);
-
- private static final BigInteger three = BigInteger.valueOf(3L);
-
- private static final BigInteger four = BigInteger.valueOf(4L);
-
- /**
- * main parameter
- */
- private BigInteger n;
-
- private BigInteger state;
-
- /**
- * Generate appropriate prime number for use in Blum-Blum-Shub.
- *
- * This generates the appropriate primes (p = 3 mod 4) needed to compute the "n-value" for Blum-Blum-Shub.
- *
- * @param bits Number of bits in prime
- * @param rand A source of randomness
- */
- private static BigInteger getPrime(int bits, Random rand) {
- BigInteger p;
- while (true) {
- p = new BigInteger(bits, 100, rand);
- if (p.mod(four).equals(three)) break;
- }
- return p;
- }
-
- /**
- * This generates the "n value" -- the multiplication of two equally sized random prime numbers -- for use in the
- * Blum-Blum-Shub algorithm.
- *
- * @param bits The number of bits of security
- * @param rand A random instance to aid in generating primes
- * @return A BigInteger, the <i>n</i>.
- */
- public static BigInteger generateN(int bits, Random rand) {
- BigInteger p = getPrime(bits / 2, rand);
- BigInteger q = getPrime(bits / 2, rand);
-
- // make sure p != q (almost always true, but just in case, check)
- while (p.equals(q)) {
- q = getPrime(bits, rand);
- }
- return p.multiply(q);
- }
-
- /**
- * Constructor, specifing bits for <i>n</i>
- *
- * @param bits number of bits
- */
- public CSPRNG_DO_NOT_USE(int bits) {
- this(bits, new Random());
- }
-
- /**
- * Constructor, generates prime and seed
- *
- * @param bits
- * @param rand
- */
- public CSPRNG_DO_NOT_USE(int bits, Random rand) {
- this(generateN(bits, rand));
- }
-
- /**
- * A constructor to specify the "n-value" to the Blum-Blum-Shub algorithm. The inital seed is computed using Java's
- * internal "true" random number generator.
- *
- * @param n The n-value.
- */
- public CSPRNG_DO_NOT_USE(BigInteger n) {
- this(n, SecureRandom.getSeed(n.bitLength() / 8));
- }
-
- /**
- * A constructor to specify both the n-value and the seed to the Blum-Blum-Shub algorithm.
- *
- * @param n The n-value using a BigInteger
- * @param seed The seed value using a byte[] array.
- */
- public CSPRNG_DO_NOT_USE(BigInteger n, byte[] seed) {
- this.n = n;
- setSeed(seed);
- }
-
- /**
- * Sets or resets the seed value and internal state
- *
- * @param seedBytes The new seed.
- */
- public void setSeed(byte[] seedBytes) {
- // ADD: use hardwired default for n
- BigInteger seed = new BigInteger(1, seedBytes);
- state = seed.mod(n);
- }
-
- /**
- * Returns up to numBit random bits
- *
- * @return int
- */
- @Override
- public int next(int numBits) {
- // TODO: find out how many LSB one can extract per cycle.
- // it is more than one.
- int result = 0;
- for (int i = numBits; i != 0; --i) {
- state = state.modPow(two, n);
- result = (result << 1) | (state.testBit(0) == true ? 1 : 0);
- }
- return result;
- }
-
- public static CSPRNG_DO_NOT_USE generate() {
- return generate(512);
- }
-
- /**
- * @return CSPRNG_DO_NOT_USE
- * @Author Draknyte1/Alkalus
- */
- public static CSPRNG_DO_NOT_USE generate(int bitsize) {
- // First use the internal, stock "true" random number
- // generator to get a "true random seed"
- SecureRandom r = Utils.generateSecureRandom();
- r.nextInt(); // need to do something for SR to be triggered.
- // Use this seed to generate a n-value for Blum-Blum-Shub
- // This value can be re-used if desired.
- BigInteger nval = CSPRNG_DO_NOT_USE.generateN(bitsize, r);
- // now get a seed
- byte[] seed = new byte[bitsize / 8];
- r.nextBytes(seed);
- // now create an instance of BlumBlumShub
- CSPRNG_DO_NOT_USE bbs = new CSPRNG_DO_NOT_USE(nval, seed);
- return bbs;
- }
-
- /**
- * @return CSPRNG_DO_NOT_USE
- * @Author Draknyte1/Alkalus
- */
- public static CSPRNG_DO_NOT_USE generate(Random aRandom) {
- return generate(512, aRandom);
- }
-
- /**
- * @return CSPRNG_DO_NOT_USE
- * @Author Draknyte1/Alkalus
- */
- public static CSPRNG_DO_NOT_USE generate(int aBitSize, Random aRandom) {
- // First use the internal, stock "true" random number
- // generator to get a "true random seed"
- SecureRandom r = Utils.generateSecureRandom();
- r.nextInt(); // need to do something for SR to be triggered.
- // Use this seed to generate a n-value for Blum-Blum-Shub
- // This value can be re-used if desired.
- int bitsize = aBitSize;
- // now create an instance of BlumBlumShub
- // do everything almost automatically
- CSPRNG_DO_NOT_USE bbs = new CSPRNG_DO_NOT_USE(bitsize, aRandom);
- return bbs;
- }
-}
diff --git a/src/main/java/gtPlusPlus/api/objects/random/UUIDGenerator.java b/src/main/java/gtPlusPlus/api/objects/random/UUIDGenerator.java
deleted file mode 100644
index bfed0ce346..0000000000
--- a/src/main/java/gtPlusPlus/api/objects/random/UUIDGenerator.java
+++ /dev/null
@@ -1,436 +0,0 @@
-package gtPlusPlus.api.objects.random;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.util.Random;
-import java.util.UUID;
-
-/**
- *
- * Implement modified version of Apache's OpenJPA UUID generator. This UUID generator is paired with a Blum-Blum-Shub
- * random number generator which in itself is seeded by custom SecureRandom.
- *
- * The UUID generator class has been converted from a static factory to an instanced factory.
- *
- */
-
-// ========================================= APACHE BLOCK =========================================
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
- * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
- * applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
- */
-
-/**
- * UUID value generator. Type 1 generator is based on the time-based generator in the Apache Commons Id project:
- * http://jakarta.apache.org/commons/sandbox /id/uuid.html The type 4 generator uses the standard Java UUID generator.
- *
- * The type 1 code has been vastly simplified and modified to replace the ethernet address of the host machine with the
- * IP, since we do not want to require native libs and Java cannot access the MAC address directly.
- *
- * In spirit, implements the IETF UUID draft specification, found here:<br />
- * http://www1.ics.uci.edu/~ejw/authoring/uuid-guid/draft-leach-uuids-guids-01 .txt
- *
- * @author Abe White, Kevin Sutter
- * @since 0.3.3
- */
-public class UUIDGenerator {
-
- // supported UUID types
- public static final int TYPE1 = 1;
- public static final int TYPE4 = 4;
- // indexes within the uuid array for certain boundaries
- private static final byte IDX_TIME_HI = 6;
- private static final byte IDX_TYPE = 6; // multiplexed
- private static final byte IDX_TIME_MID = 4;
- private static final byte IDX_TIME_LO = 0;
- private static final byte IDX_TIME_SEQ = 8;
- private static final byte IDX_VARIATION = 8; // multiplexed
- // indexes and lengths within the timestamp for certain boundaries
- private static final byte TS_TIME_LO_IDX = 4;
- private static final byte TS_TIME_LO_LEN = 4;
- private static final byte TS_TIME_MID_IDX = 2;
- private static final byte TS_TIME_MID_LEN = 2;
- private static final byte TS_TIME_HI_IDX = 0;
- private static final byte TS_TIME_HI_LEN = 2;
- // offset to move from 1/1/1970, which is 0-time for Java, to gregorian
- // 0-time 10/15/1582, and multiplier to go from 100nsec to msec units
- private static final long GREG_OFFSET = 0xB1D069B5400L;
- private static final long MILLI_MULT = 10000L;
- // type of UUID -- time based
- private static final byte TYPE_TIME_BASED = 0x10;
- // random number generator used to reduce conflicts with other JVMs, and
- // hasher for strings.
- private Random RANDOM;
- // 4-byte IP address + 2 random bytes to compensate for the fact that
- // the MAC address is usually 6 bytes
- private byte[] IP;
- // counter is initialized to 0 and is incremented for each uuid request
- // within the same timestamp window.
- private int _counter;
- // current timestamp (used to detect multiple uuid requests within same
- // timestamp)
- private long _currentMillis;
- // last used millis time, and a semi-random sequence that gets reset
- // when it overflows
- private long _lastMillis = 0L;
- private static final int MAX_14BIT = 0x3FFF;
- private short _seq = 0;
- private boolean type1Initialized = false; /*
- * Initializer for type 1 UUIDs. Creates random generator and genenerates
- * the node portion of the UUID using the IP address.
- */
-
- private synchronized void initializeForType1() {
- if (type1Initialized == true) {
- return;
- }
- // note that secure random is very slow the first time
- // it is used; consider switching to a standard random
- RANDOM = CSPRNG_DO_NOT_USE.generate();
- _seq = (short) RANDOM.nextInt(MAX_14BIT);
-
- byte[] ip = null;
- try {
- ip = InetAddress.getLocalHost().getAddress();
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
- IP = new byte[6];
- RANDOM.nextBytes(IP);
- // OPENJPA-2055: account for the fact that 'getAddress'
- // may return an IPv6 address which is 16 bytes wide.
- for (int i = 0; i < ip.length; ++i) {
- IP[2 + (i % 4)] ^= ip[i];
- }
- type1Initialized = true;
- }
-
- /**
- * Return a unique UUID value.
- */
- public byte[] next(int type) {
- if (type == TYPE4) {
- return createType4();
- }
- return createType1();
- }
-
- /*
- * Creates a type 1 UUID
- */
- public byte[] createType1() {
- if (type1Initialized == false) {
- initializeForType1();
- }
- // set ip addr
- byte[] uuid = new byte[16];
- System.arraycopy(IP, 0, uuid, 10, IP.length);
- // Set time info. Have to do this processing within a synchronized
- // block because of the statics...
- long now = 0;
- synchronized (UUIDGenerator.class) {
- // Get the time to use for this uuid. This method has the side
- // effect of modifying the clock sequence, as well.
- now = getTime();
- // Insert the resulting clock sequence into the uuid
- uuid[IDX_TIME_SEQ] = (byte) ((_seq & 0x3F00) >>> 8);
- uuid[IDX_VARIATION] |= 0x80;
- uuid[IDX_TIME_SEQ + 1] = (byte) (_seq & 0xFF);
- }
- // have to break up time because bytes are spread through uuid
- byte[] timeBytes = Bytes.toBytes(now);
- // Copy time low
- System.arraycopy(timeBytes, TS_TIME_LO_IDX, uuid, IDX_TIME_LO, TS_TIME_LO_LEN);
- // Copy time mid
- System.arraycopy(timeBytes, TS_TIME_MID_IDX, uuid, IDX_TIME_MID, TS_TIME_MID_LEN);
- // Copy time hi
- System.arraycopy(timeBytes, TS_TIME_HI_IDX, uuid, IDX_TIME_HI, TS_TIME_HI_LEN);
- // Set version (time-based)
- uuid[IDX_TYPE] |= TYPE_TIME_BASED; // 0001 0000
- return uuid;
- }
-
- /*
- * Creates a type 4 UUID
- */
- private byte[] createType4() {
- UUID type4 = UUID.randomUUID();
- byte[] uuid = new byte[16];
- longToBytes(type4.getMostSignificantBits(), uuid, 0);
- longToBytes(type4.getLeastSignificantBits(), uuid, 8);
- return uuid;
- }
-
- /*
- * Converts a long to byte values, setting them in a byte array at a given starting position.
- */
- private void longToBytes(long longVal, byte[] buf, int sPos) {
- sPos += 7;
- for (int i = 0; i < 8; i++) buf[sPos - i] = (byte) (longVal >>> (i * 8));
- }
-
- /**
- * Return the next unique uuid value as a 16-character string.
- */
- public String nextString(int type) {
- byte[] bytes = next(type);
- try {
- return new String(bytes, "ISO-8859-1");
- } catch (Exception e) {
- return new String(bytes);
- }
- }
-
- /**
- * Return the next unique uuid value as a 32-character hex string.
- */
- public String nextHex(int type) {
- return Base16Encoder.encode(next(type));
- }
-
- /**
- * Get the timestamp to be used for this uuid. Must be called from a synchronized block.
- *
- * @return long timestamp
- */
- // package-visibility for testing
- private long getTime() {
- if (RANDOM == null) initializeForType1();
- long newTime = getUUIDTime();
- if (newTime <= _lastMillis) {
- incrementSequence();
- newTime = getUUIDTime();
- }
- _lastMillis = newTime;
- return newTime;
- }
-
- /**
- * Gets the appropriately modified timestamep for the UUID. Must be called from a synchronized block.
- *
- * @return long timestamp in 100ns intervals since the Gregorian change offset
- */
- private long getUUIDTime() {
- if (_currentMillis != System.currentTimeMillis()) {
- _currentMillis = System.currentTimeMillis();
- _counter = 0; // reset counter
- }
- // check to see if we have created too many uuid's for this timestamp
- if (_counter + 1 >= MILLI_MULT) {
- // Original algorithm threw exception. Seemed like overkill.
- // Let's just increment the timestamp instead and start over...
- _currentMillis++;
- _counter = 0;
- }
- // calculate time as current millis plus offset times 100 ns ticks
- long currentTime = (_currentMillis + GREG_OFFSET) * MILLI_MULT;
- // return the uuid time plus the artificial tick counter incremented
- return currentTime + _counter++;
- }
-
- /**
- * Increments the clock sequence for this uuid. Must be called from a synchronized block.
- */
- private void incrementSequence() {
- // increment, but if it's greater than its 14-bits, reset it
- if (++_seq > MAX_14BIT) {
- _seq = (short) RANDOM.nextInt(MAX_14BIT); // semi-random
- }
- }
-
- // Add Dependant classes internally
-
- /**
- * This class came from the Apache Commons Id sandbox project in support of the UUIDGenerator implementation.
- *
- * <p>
- * Static methods for managing byte arrays (all methods follow Big Endian order where most significant bits are in
- * front).
- * </p>
- */
- public static final class Bytes {
-
- /**
- * <p>
- * Hide constructor in utility class.
- * </p>
- */
- private Bytes() {}
-
- /**
- * Appends two bytes array into one.
- *
- * @param a A byte[].
- * @param b A byte[].
- * @return A byte[].
- */
- public static byte[] append(byte[] a, byte[] b) {
- byte[] z = new byte[a.length + b.length];
- System.arraycopy(a, 0, z, 0, a.length);
- System.arraycopy(b, 0, z, a.length, b.length);
- return z;
- }
-
- /**
- * Returns a 8-byte array built from a long.
- *
- * @param n The number to convert.
- * @return A byte[].
- */
- public static byte[] toBytes(long n) {
- return toBytes(n, new byte[8]);
- }
-
- /**
- * Build a 8-byte array from a long. No check is performed on the array length.
- *
- * @param n The number to convert.
- * @param b The array to fill.
- * @return A byte[].
- */
- public static byte[] toBytes(long n, byte[] b) {
- b[7] = (byte) (n);
- n >>>= 8;
- b[6] = (byte) (n);
- n >>>= 8;
- b[5] = (byte) (n);
- n >>>= 8;
- b[4] = (byte) (n);
- n >>>= 8;
- b[3] = (byte) (n);
- n >>>= 8;
- b[2] = (byte) (n);
- n >>>= 8;
- b[1] = (byte) (n);
- n >>>= 8;
- b[0] = (byte) (n);
-
- return b;
- }
-
- /**
- * Build a long from first 8 bytes of the array.
- *
- * @param b The byte[] to convert.
- * @return A long.
- */
- public static long toLong(byte[] b) {
- return ((((long) b[7]) & 0xFF) + ((((long) b[6]) & 0xFF) << 8)
- + ((((long) b[5]) & 0xFF) << 16)
- + ((((long) b[4]) & 0xFF) << 24)
- + ((((long) b[3]) & 0xFF) << 32)
- + ((((long) b[2]) & 0xFF) << 40)
- + ((((long) b[1]) & 0xFF) << 48)
- + ((((long) b[0]) & 0xFF) << 56));
- }
-
- /**
- * Compares two byte arrays for equality.
- *
- * @param a A byte[].
- * @param b A byte[].
- * @return True if the arrays have identical contents.
- */
- public static boolean areEqual(byte[] a, byte[] b) {
- int aLength = a.length;
- if (aLength != b.length) {
- return false;
- }
- for (int i = 0; i < aLength; i++) {
- if (a[i] != b[i]) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * <p>
- * Compares two byte arrays as specified by <code>Comparable</code>.
- *
- * @param lhs - left hand value in the comparison operation.
- * @param rhs - right hand value in the comparison operation.
- * @return a negative integer, zero, or a positive integer as <code>lhs</code> is less than, equal to, or
- * greater than <code>rhs</code>.
- */
- public static int compareTo(byte[] lhs, byte[] rhs) {
- if (lhs == rhs) {
- return 0;
- }
- if (lhs == null) {
- return -1;
- }
- if (rhs == null) {
- return +1;
- }
- if (lhs.length != rhs.length) {
- return ((lhs.length < rhs.length) ? -1 : +1);
- }
- for (int i = 0; i < lhs.length; i++) {
- if (lhs[i] < rhs[i]) {
- return -1;
- } else if (lhs[i] > rhs[i]) {
- return 1;
- }
- }
- return 0;
- }
-
- /**
- * Build a short from first 2 bytes of the array.
- *
- * @param b The byte[] to convert.
- * @return A short.
- */
- public static short toShort(byte[] b) {
- return (short) ((b[1] & 0xFF) + ((b[0] & 0xFF) << 8));
- }
- }
-
- /**
- * Base 16 encoder.
- *
- * @author Marc Prud'hommeaux
- */
- public static final class Base16Encoder {
-
- private static final char[] HEX = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C',
- 'D', 'E', 'F' };
-
- /**
- * Convert bytes to a base16 string.
- */
- public static String encode(byte[] byteArray) {
- StringBuilder hexBuffer = new StringBuilder(byteArray.length * 2);
- for (int i = 0; i < byteArray.length; i++)
- for (int j = 1; j >= 0; j--) hexBuffer.append(HEX[(byteArray[i] >> (j * 4)) & 0xF]);
- return hexBuffer.toString();
- }
-
- /**
- * Convert a base16 string into a byte array.
- */
- public static byte[] decode(String s) {
- int len = s.length();
- byte[] r = new byte[len / 2];
- for (int i = 0; i < r.length; i++) {
- int digit1 = s.charAt(i * 2), digit2 = s.charAt(i * 2 + 1);
- if (digit1 >= '0' && digit1 <= '9') digit1 -= '0';
- else if (digit1 >= 'A' && digit1 <= 'F') digit1 -= 'A' - 10;
- if (digit2 >= '0' && digit2 <= '9') digit2 -= '0';
- else if (digit2 >= 'A' && digit2 <= 'F') digit2 -= 'A' - 10;
-
- r[i] = (byte) ((digit1 << 4) + digit2);
- }
- return r;
- }
- }
-}
-
-// ========================================= APACHE BLOCK =========================================
diff --git a/src/main/java/gtPlusPlus/api/thermal/energy/IThermalConnection.java b/src/main/java/gtPlusPlus/api/thermal/energy/IThermalConnection.java
deleted file mode 100644
index fce4ad7c55..0000000000
--- a/src/main/java/gtPlusPlus/api/thermal/energy/IThermalConnection.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package gtPlusPlus.api.thermal.energy;
-
-import net.minecraftforge.common.util.ForgeDirection;
-
-public interface IThermalConnection {
-
- boolean canConnectThermalEnergy(ForgeDirection arg0);
-}
diff --git a/src/main/java/gtPlusPlus/api/thermal/energy/IThermalContainerItem.java b/src/main/java/gtPlusPlus/api/thermal/energy/IThermalContainerItem.java
deleted file mode 100644
index 14f566c1a7..0000000000
--- a/src/main/java/gtPlusPlus/api/thermal/energy/IThermalContainerItem.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package gtPlusPlus.api.thermal.energy;
-
-import net.minecraft.item.ItemStack;
-
-public interface IThermalContainerItem {
-
- int receiveThermalEnergy(ItemStack arg0, int arg1, boolean arg2);
-
- int extractThermalEnergy(ItemStack arg0, int arg1, boolean arg2);
-
- int getThermalEnergyStored(ItemStack arg0);
-
- int getMaxThermalEnergyStored(ItemStack arg0);
-}
diff --git a/src/main/java/gtPlusPlus/api/thermal/energy/IThermalHandler.java b/src/main/java/gtPlusPlus/api/thermal/energy/IThermalHandler.java
deleted file mode 100644
index e50ae45003..0000000000
--- a/src/main/java/gtPlusPlus/api/thermal/energy/IThermalHandler.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package gtPlusPlus.api.thermal.energy;
-
-import net.minecraftforge.common.util.ForgeDirection;
-
-public interface IThermalHandler extends IThermalProvider, IThermalReceiver {
-
- @Override
- int receiveThermalEnergy(ForgeDirection arg0, int arg1, boolean arg2);
-
- @Override
- int extractThermalEnergy(ForgeDirection arg0, int arg1, boolean arg2);
-
- @Override
- int getThermalEnergyStored(ForgeDirection arg0);
-
- @Override
- int getMaxThermalEnergyStored(ForgeDirection arg0);
-}
diff --git a/src/main/java/gtPlusPlus/api/thermal/energy/IThermalProvider.java b/src/main/java/gtPlusPlus/api/thermal/energy/IThermalProvider.java
deleted file mode 100644
index a13a041176..0000000000
--- a/src/main/java/gtPlusPlus/api/thermal/energy/IThermalProvider.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package gtPlusPlus.api.thermal.energy;
-
-import net.minecraftforge.common.util.ForgeDirection;
-
-public interface IThermalProvider extends IThermalConnection {
-
- int extractThermalEnergy(ForgeDirection arg0, int arg1, boolean arg2);
-
- int getThermalEnergyStored(ForgeDirection arg0);
-
- int getMaxThermalEnergyStored(ForgeDirection arg0);
-}
diff --git a/src/main/java/gtPlusPlus/api/thermal/energy/IThermalReceiver.java b/src/main/java/gtPlusPlus/api/thermal/energy/IThermalReceiver.java
deleted file mode 100644
index 85be402658..0000000000
--- a/src/main/java/gtPlusPlus/api/thermal/energy/IThermalReceiver.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package gtPlusPlus.api.thermal.energy;
-
-import net.minecraftforge.common.util.ForgeDirection;
-
-public interface IThermalReceiver extends IThermalConnection {
-
- int receiveThermalEnergy(ForgeDirection arg0, int arg1, boolean arg2);
-
- int getThermalEnergyStored(ForgeDirection arg0);
-
- int getMaxThermalEnergyStored(ForgeDirection arg0);
-}
diff --git a/src/main/java/gtPlusPlus/api/thermal/energy/IThermalStorage.java b/src/main/java/gtPlusPlus/api/thermal/energy/IThermalStorage.java
deleted file mode 100644
index 43d76b73ec..0000000000
--- a/src/main/java/gtPlusPlus/api/thermal/energy/IThermalStorage.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package gtPlusPlus.api.thermal.energy;
-
-public interface IThermalStorage {
-
- int receiveThermalEnergy(int arg0, boolean arg1);
-
- int extractThermalEnergy(int arg0, boolean arg1);
-
- int getThermalEnergyStored();
-
- int getMaxThermalEnergyStored();
-}
diff --git a/src/main/java/gtPlusPlus/api/thermal/energy/ThermalStorage.java b/src/main/java/gtPlusPlus/api/thermal/energy/ThermalStorage.java
deleted file mode 100644
index a2c29ba76a..0000000000
--- a/src/main/java/gtPlusPlus/api/thermal/energy/ThermalStorage.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package gtPlusPlus.api.thermal.energy;
-
-import net.minecraft.nbt.NBTTagCompound;
-
-public class ThermalStorage implements IThermalStorage {
-
- protected int thermal_energy;
- protected int capacity;
- protected int maxReceive;
- protected int maxExtract;
-
- public ThermalStorage(int arg0) {
- this(arg0, arg0, arg0);
- }
-
- public ThermalStorage(int arg0, int arg1) {
- this(arg0, arg1, arg1);
- }
-
- public ThermalStorage(int arg0, int arg1, int arg2) {
- this.capacity = arg0;
- this.maxReceive = arg1;
- this.maxExtract = arg2;
- }
-
- public ThermalStorage readFromNBT(NBTTagCompound arg0) {
- this.thermal_energy = arg0.getInteger("ThermalEnergy");
- if (this.thermal_energy > this.capacity) {
- this.thermal_energy = this.capacity;
- }
- return this;
- }
-
- public NBTTagCompound writeToNBT(NBTTagCompound arg0) {
- if (this.thermal_energy < 0) {
- this.thermal_energy = 0;
- }
- arg0.setInteger("ThermalEnergy", this.thermal_energy);
- return arg0;
- }
-
- public void setCapacity(int arg0) {
- this.capacity = arg0;
- if (this.thermal_energy > arg0) {
- this.thermal_energy = arg0;
- }
- }
-
- public void setMaxTransfer(int arg0) {
- this.setMaxReceive(arg0);
- this.setMaxExtract(arg0);
- }
-
- public void setMaxReceive(int arg0) {
- this.maxReceive = arg0;
- }
-
- public void setMaxExtract(int arg0) {
- this.maxExtract = arg0;
- }
-
- public int getMaxReceive() {
- return this.maxReceive;
- }
-
- public int getMaxExtract() {
- return this.maxExtract;
- }
-
- public void setEnergyStored(int arg0) {
- this.thermal_energy = arg0;
- if (this.thermal_energy > this.capacity) {
- this.thermal_energy = this.capacity;
- } else if (this.thermal_energy < 0) {
- this.thermal_energy = 0;
- }
- }
-
- public void modifyEnergyStored(int arg0) {
- this.thermal_energy += arg0;
- if (this.thermal_energy > this.capacity) {
- this.thermal_energy = this.capacity;
- } else if (this.thermal_energy < 0) {
- this.thermal_energy = 0;
- }
- }
-
- @Override
- public int receiveThermalEnergy(int arg0, boolean arg1) {
- int arg2 = Math.min(this.capacity - this.thermal_energy, Math.min(this.maxReceive, arg0));
- if (!arg1) {
- this.thermal_energy += arg2;
- }
-
- return arg2;
- }
-
- @Override
- public int extractThermalEnergy(int arg0, boolean arg1) {
- int arg2 = Math.min(this.thermal_energy, Math.min(this.maxExtract, arg0));
- if (!arg1) {
- this.thermal_energy -= arg2;
- }
-
- return arg2;
- }
-
- @Override
- public int getThermalEnergyStored() {
- return this.thermal_energy;
- }
-
- @Override
- public int getMaxThermalEnergyStored() {
- return this.capacity;
- }
-}
diff --git a/src/main/java/gtPlusPlus/api/thermal/energy/ThermalStorageAdv.java b/src/main/java/gtPlusPlus/api/thermal/energy/ThermalStorageAdv.java
deleted file mode 100644
index 54fa147efe..0000000000
--- a/src/main/java/gtPlusPlus/api/thermal/energy/ThermalStorageAdv.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package gtPlusPlus.api.thermal.energy;
-
-public class ThermalStorageAdv extends ThermalStorage {
-
- public ThermalStorageAdv(int arg0) {
- this(arg0, arg0, arg0);
- }
-
- public ThermalStorageAdv(int arg0, int arg1) {
- this(arg0, arg1, arg1);
- }
-
- public ThermalStorageAdv(int arg0, int arg1, int arg2) {
- super(arg0, arg1, arg2);
- }
-
- public int receiveEnergyNoLimit(int arg0, boolean arg1) {
- int arg2 = Math.min(super.capacity - super.thermal_energy, arg0);
- if (!arg1) {
- super.thermal_energy += arg2;
- }
-
- return arg2;
- }
-
- public int extractEnergyNoLimit(int arg0, boolean arg1) {
- int arg2 = Math.min(super.thermal_energy, arg0);
- if (!arg1) {
- super.thermal_energy -= arg2;
- }
-
- return arg2;
- }
-}
diff --git a/src/main/java/gtPlusPlus/api/thermal/sample/ItemThermalContainer.java b/src/main/java/gtPlusPlus/api/thermal/sample/ItemThermalContainer.java
deleted file mode 100644
index ff0cf06188..0000000000
--- a/src/main/java/gtPlusPlus/api/thermal/sample/ItemThermalContainer.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package gtPlusPlus.api.thermal.sample;
-
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-
-import gtPlusPlus.api.thermal.energy.IThermalContainerItem;
-
-public class ItemThermalContainer extends Item implements IThermalContainerItem {
-
- protected int capacity;
- protected int maxReceive;
- protected int maxExtract;
-
- public ItemThermalContainer() {}
-
- public ItemThermalContainer(int arg0) {
- this(arg0, arg0, arg0);
- }
-
- public ItemThermalContainer(int arg0, int arg1) {
- this(arg0, arg1, arg1);
- }
-
- public ItemThermalContainer(int arg0, int arg1, int arg2) {
- this.capacity = arg0;
- this.maxReceive = arg1;
- this.maxExtract = arg2;
- }
-
- public ItemThermalContainer setCapacity(int arg0) {
- this.capacity = arg0;
- return this;
- }
-
- public void setMaxTransfer(int arg0) {
- this.setMaxReceive(arg0);
- this.setMaxExtract(arg0);
- }
-
- public void setMaxReceive(int arg0) {
- this.maxReceive = arg0;
- }
-
- public void setMaxExtract(int arg0) {
- this.maxExtract = arg0;
- }
-
- @Override
- public int receiveThermalEnergy(ItemStack arg0, int arg1, boolean arg2) {
- if (arg0.getTagCompound() == null) {
- arg0.stackTagCompound = new NBTTagCompound();
- }
- int arg3 = arg0.stackTagCompound.getInteger("ThermalEnergy");
- int arg4 = Math.min(this.capacity - arg3, Math.min(this.maxReceive, arg1));
- if (!arg2) {
- arg3 += arg4;
- arg0.stackTagCompound.setInteger("ThermalEnergy", arg3);
- }
- return arg4;
- }
-
- @Override
- public int extractThermalEnergy(ItemStack arg0, int arg1, boolean arg2) {
- if (arg0.stackTagCompound != null && arg0.stackTagCompound.hasKey("ThermalEnergy")) {
- int arg3 = arg0.stackTagCompound.getInteger("ThermalEnergy");
- int arg4 = Math.min(arg3, Math.min(this.maxExtract, arg1));
- if (!arg2) {
- arg3 -= arg4;
- arg0.stackTagCompound.setInteger("ThermalEnergy", arg3);
- }
- return arg4;
- } else {
- return 0;
- }
- }
-
- @Override
- public int getThermalEnergyStored(ItemStack arg0) {
- return arg0.stackTagCompound != null && arg0.stackTagCompound.hasKey("ThermalEnergy")
- ? arg0.stackTagCompound.getInteger("ThermalEnergy")
- : 0;
- }
-
- @Override
- public int getMaxThermalEnergyStored(ItemStack arg0) {
- return this.capacity;
- }
-}
diff --git a/src/main/java/gtPlusPlus/api/thermal/sample/TileThermalHandler.java b/src/main/java/gtPlusPlus/api/thermal/sample/TileThermalHandler.java
deleted file mode 100644
index a41b6428cb..0000000000
--- a/src/main/java/gtPlusPlus/api/thermal/sample/TileThermalHandler.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package gtPlusPlus.api.thermal.sample;
-
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraftforge.common.util.ForgeDirection;
-
-import gtPlusPlus.api.thermal.energy.IThermalHandler;
-import gtPlusPlus.api.thermal.energy.ThermalStorage;
-
-public class TileThermalHandler extends TileEntity implements IThermalHandler {
-
- protected ThermalStorage storage = new ThermalStorage(32000);
-
- @Override
- public void readFromNBT(NBTTagCompound arg0) {
- super.readFromNBT(arg0);
- this.storage.readFromNBT(arg0);
- }
-
- @Override
- public void writeToNBT(NBTTagCompound arg0) {
- super.writeToNBT(arg0);
- this.storage.writeToNBT(arg0);
- }
-
- @Override
- public boolean canConnectThermalEnergy(ForgeDirection arg0) {
- return true;
- }
-
- @Override
- public int receiveThermalEnergy(ForgeDirection arg0, int arg1, boolean arg2) {
- return this.storage.receiveThermalEnergy(arg1, arg2);
- }
-
- @Override
- public int extractThermalEnergy(ForgeDirection arg0, int arg1, boolean arg2) {
- return this.storage.extractThermalEnergy(arg1, arg2);
- }
-
- @Override
- public int getThermalEnergyStored(ForgeDirection arg0) {
- return this.storage.getThermalEnergyStored();
- }
-
- @Override
- public int getMaxThermalEnergyStored(ForgeDirection arg0) {
- return this.storage.getMaxThermalEnergyStored();
- }
-}
diff --git a/src/main/java/gtPlusPlus/api/thermal/tileentity/IThermalInfo.java b/src/main/java/gtPlusPlus/api/thermal/tileentity/IThermalInfo.java
deleted file mode 100644
index 2172ff385b..0000000000
--- a/src/main/java/gtPlusPlus/api/thermal/tileentity/IThermalInfo.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package gtPlusPlus.api.thermal.tileentity;
-
-public interface IThermalInfo {
-
- int getInfoEnergyPerTick();
-
- int getInfoMaxEnergyPerTick();
-
- int getInfoEnergyStored();
-
- int getInfoMaxEnergyStored();
-}