diff options
author | botn365 <42187820+botn365@users.noreply.github.com> | 2019-12-08 12:54:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-08 12:54:21 +0100 |
commit | 584ebeaa18fba9de4922b09def9f7cf1b5d31eae (patch) | |
tree | f74277077620b21df5dae75083975be3ca11dc8a /src | |
parent | 9ba6d563d1b69bc8aa88d48754c273dae77aa713 (diff) | |
parent | e49fbd1330c0875ff531ff25119afe15b54c9448 (diff) | |
download | GT5-Unofficial-584ebeaa18fba9de4922b09def9f7cf1b5d31eae.tar.gz GT5-Unofficial-584ebeaa18fba9de4922b09def9f7cf1b5d31eae.tar.bz2 GT5-Unofficial-584ebeaa18fba9de4922b09def9f7cf1b5d31eae.zip |
Merge pull request #1 from alkcorp/DevTop
Dev top
Diffstat (limited to 'src')
59 files changed, 2876 insertions, 734 deletions
diff --git a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java index 9e7f702200..02517097cf 100644 --- a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java +++ b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java @@ -70,6 +70,20 @@ public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable, Collect } } } + + /** + * Generates an AutoMap from a Array. + * @param aArray - Data to be inserted into the AutoMap. + */ + public AutoMap(V[] aArray) { + mInternalMap = new LinkedHashMap<Integer, V>(); + mInternalNameMap = new LinkedHashMap<String, Integer>(); + if (aArray != null && aArray.length > 0) { + for (V obj : aArray) { + add(obj); + } + } + } @Override public Iterator<V> iterator() { diff --git a/src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java b/src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java new file mode 100644 index 0000000000..991908e402 --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java @@ -0,0 +1,18 @@ +package gtPlusPlus.api.objects.data; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +public class ConcurrentHashSet<V> extends ConcurrentSet<V> { + + private static final long serialVersionUID = -1293478938482781728L; + + public ConcurrentHashSet() { + this(new ConcurrentHashMap<Integer, V>()); + } + + public ConcurrentHashSet(ConcurrentMap<Integer, V> defaultMapType) { + super(defaultMapType); + } + +} diff --git a/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java b/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java new file mode 100644 index 0000000000..1d3ffc1c01 --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java @@ -0,0 +1,53 @@ +package gtPlusPlus.api.objects.data; + +import java.io.Serializable; +import java.util.AbstractSet; +import java.util.Iterator; +import java.util.concurrent.ConcurrentMap; + +public abstract class ConcurrentSet<E> extends AbstractSet<E> implements Serializable { + + private static final long serialVersionUID = -6761513279741915432L; + + private final ConcurrentMap<Integer, E> mInternalMap; + + private int mInternalID = 0; + + /** + * Creates a new instance which wraps the specified {@code map}. + */ + public ConcurrentSet(ConcurrentMap<Integer, E> aMap) { + mInternalMap = aMap; + } + + @Override + public int size() { + return mInternalMap.size(); + } + + @Override + public boolean contains(Object o) { + return mInternalMap.containsKey(o); + } + + @Override + public boolean add(E o) { + return mInternalMap.putIfAbsent(mInternalID++, o) == null; + } + + @Override + public boolean remove(Object o) { + return mInternalMap.remove(o) != null; + } + + @Override + public void clear() { + this.mInternalID = 0; + mInternalMap.clear(); + } + + @Override + public Iterator<E> iterator() { + return mInternalMap.values().iterator(); + } +} diff --git a/src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java b/src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java new file mode 100644 index 0000000000..64f57b4e5a --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java @@ -0,0 +1,39 @@ +package gtPlusPlus.api.objects.data; + +import java.io.Serializable; + +import com.google.common.base.Objects; + +public class FlexiblePair<K,V> implements Serializable { + + /** + * SVUID + */ + private static final long serialVersionUID = 1250550491092812443L; + private final K key; + private V value; + + public FlexiblePair(final K key, final V value){ + this.key = key; + this.value = value; + } + + final public K getKey(){ + return this.key; + } + + final public V getValue(){ + return this.value; + } + + final public void setValue(V aObj) { + value = aObj; + } + + @Override + public int hashCode() { + Integer aCode = Objects.hashCode(getKey(), getValue()); + return aCode != null ? aCode : super.hashCode(); + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/CubicObject.java b/src/Java/gtPlusPlus/api/objects/minecraft/CubicObject.java new file mode 100644 index 0000000000..8c76513d09 --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/minecraft/CubicObject.java @@ -0,0 +1,62 @@ +package gtPlusPlus.api.objects.minecraft; + +import gtPlusPlus.api.objects.data.AutoMap; +import net.minecraftforge.common.util.ForgeDirection; + +public class CubicObject<T> { + + public final T NORTH; + public final T SOUTH; + + public final T WEST; + public final T EAST; + + public final T UP; + public final T DOWN; + + public CubicObject(AutoMap<T> aDataSet) { + this(aDataSet.get(0), aDataSet.get(1), aDataSet.get(2), aDataSet.get(3), aDataSet.get(4), aDataSet.get(5)); + } + + public CubicObject(T[] aDataSet) { + this(aDataSet[0], aDataSet[1], aDataSet[2], aDataSet[3], aDataSet[4], aDataSet[5]); + } + + public CubicObject(T aDOWN, T aUP, T aNORTH, T aSOUTH, T aWEST, T aEAST) { + DOWN = aDOWN; + UP = aUP; + NORTH = aNORTH; + SOUTH = aSOUTH; + WEST = aWEST; + EAST = aEAST; + } + + public T get(int aSide) { + return get(ForgeDirection.getOrientation(aSide)); + } + + public T get(ForgeDirection aSide) { + if (aSide == ForgeDirection.DOWN) { + return DOWN; + } + else if (aSide == ForgeDirection.UP) { + return UP; + } + else if (aSide == ForgeDirection.NORTH) { + return NORTH; + } + else if (aSide == ForgeDirection.SOUTH) { + return SOUTH; + } + else if (aSide == ForgeDirection.WEST) { + return WEST; + } + else if (aSide == ForgeDirection.EAST) { + return EAST; + } + else { + return null; + } + } + +} diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/SafeTexture.java b/src/Java/gtPlusPlus/api/objects/minecraft/SafeTexture.java new file mode 100644 index 0000000000..7c418b5a77 --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/minecraft/SafeTexture.java @@ -0,0 +1,64 @@ +package gtPlusPlus.api.objects.minecraft; + +import java.util.HashMap; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.GregTech_API; +import gtPlusPlus.core.util.Utils; +import net.minecraft.util.IIcon; + +/** + * A Server Side safe object that can hold {@link IIcon}s. + * @author Alkalus + * + */ +public class SafeTexture implements Runnable { + + @SideOnly(Side.CLIENT) + private static final HashMap<Integer, IIcon> mHashToIconCache = new HashMap<Integer, IIcon>(); + + @SideOnly(Side.CLIENT) + private static final HashMap<String, Integer> mPathToHashCash = new HashMap<String, Integer>(); + + private static final HashMap<String, SafeTexture> mTextureObjectCache = new HashMap<String, SafeTexture>(); + + private final int mHash; + + private final String mTextureName; + + private final static String getKey(String aTexPath) { + String aNameKey = Utils.sanitizeString(aTexPath); + aNameKey = aNameKey.replace('/', ' '); + aNameKey = aNameKey.toLowerCase(); + return aNameKey; + } + + public static SafeTexture register(String aTexturePath) { + String aNameKey = getKey(aTexturePath); + SafeTexture g = mTextureObjectCache.get(aNameKey); + if (g == null) { + g = new SafeTexture(aTexturePath); + mTextureObjectCache.put(aNameKey, g); + mPathToHashCash.put(aTexturePath, aTexturePath.hashCode()); + } + return g; + } + + private SafeTexture(String aTexturePath) { + mTextureName = aTexturePath; + mHash = getKey(aTexturePath).hashCode(); + GregTech_API.sGTBlockIconload.add(this); + } + + @SideOnly(Side.CLIENT) + public IIcon getIcon() { + return mHashToIconCache.get(mHash); + } + + @Override + public void run() { + mHashToIconCache.put(getKey(mTextureName).hashCode(), GregTech_API.sBlockIcons.registerIcon(mTextureName)); + } + +} diff --git a/src/Java/gtPlusPlus/core/block/base/BasicTileBlockWithTooltip.java b/src/Java/gtPlusPlus/core/block/base/BasicTileBlockWithTooltip.java new file mode 100644 index 0000000000..098b670509 --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/base/BasicTileBlockWithTooltip.java @@ -0,0 +1,309 @@ +package gtPlusPlus.core.block.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 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.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 = new AutoMap<CubicObject<SafeTexture>>(); + + /** + * 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 = new AutoMap<CubicObject<String>>(); + + /** + * 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()+"."); + //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; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java b/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java index 6ae1a52aba..7d8b3eb708 100644 --- a/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java +++ b/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java @@ -1,42 +1,27 @@ 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.common.items.GT_MetaGenerated_Tool_01; -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; +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.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.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 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.TileEntityCircuitProgrammer; -import gtPlusPlus.core.util.minecraft.InventoryUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; - -public class CircuitProgrammer extends BlockContainer implements ITileTooltip -{ - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; +public class CircuitProgrammer extends BasicTileBlockWithTooltip { /** * Determines which tooltip is displayed within the itemblock. @@ -51,33 +36,7 @@ public class CircuitProgrammer extends BlockContainer implements ITileTooltip @SuppressWarnings("deprecation") public CircuitProgrammer(){ super(Material.iron); - this.setHardness(5f); - this.setResistance(1f); - this.setBlockName("blockCircuitProgrammer"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockCircuitProgrammer"); LanguageRegistry.addName(this, "Circuit Programmer"); - - } - - /** - * 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 + ":" + "metro/" + "TEXTURE_TECH_PANEL_B"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "metro/" + "TEXTURE_TECH_PANEL_B"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_G"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_I"); } /** @@ -142,12 +101,6 @@ public class CircuitProgrammer extends BlockContainer implements ITileTooltip } @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()) { ((TileEntityCircuitProgrammer) world.getTileEntity(x,y,z)).setCustomName(stack.getDisplayName()); @@ -159,4 +112,48 @@ public class CircuitProgrammer extends BlockContainer implements ITileTooltip 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/Machine_RoundRobinator.java b/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java index cd480dcffe..dc87b885b9 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java @@ -1,85 +1,27 @@ package gtPlusPlus.core.block.machine; -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.common.items.GT_MetaGenerated_Tool_01; -import gtPlusPlus.api.interfaces.ITileTooltip; +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.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.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 class Machine_RoundRobinator extends BlockContainer implements ITileTooltip -{ - @SideOnly(Side.CLIENT) - private IIcon[] textureTop = new IIcon[5]; - @SideOnly(Side.CLIENT) - private IIcon[] textureFront = new IIcon[5]; +public class Machine_RoundRobinator extends BasicTileBlockWithTooltip { + - /** - * Determines which tooltip is displayed within the itemblock. - */ - private final int mTooltipID = 7; - - @Override - public int getTooltipID() { - return this.mTooltipID; - } - - @SuppressWarnings("deprecation") public Machine_RoundRobinator(){ super(Material.iron); - this.setHardness(1f); - this.setResistance(1f); - this.setBlockName("blockRoundRobinator"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, ItemBlockRoundRobinator.class, "blockRoundRobinator"); - //LanguageRegistry.addName(this, "Round-Robinator"); - - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int aSide, final int aMeta) { - if (aSide < 2) { - return this.textureTop[aMeta]; - } - else { - return this.textureFront[aMeta]; - } - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_){ - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "RoundRobinator_Side"); - for (int i=0;i<5;i++) { - this.textureTop[i] = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/RoundRobinator/" + "RoundRobinator_Top_"+i); - this.textureFront[i] = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/RoundRobinator/" + "RoundRobinator_Side_"+i); - } } /** @@ -97,13 +39,11 @@ public class Machine_RoundRobinator extends BlockContainer implements ITileToolt // 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)))) { + 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) {} @@ -122,52 +62,70 @@ public class Machine_RoundRobinator extends BlockContainer implements ITileToolt } @Override - public int getRenderBlockPass() { - return 0; + public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { + return new TileEntityRoundRobinator(); } @Override - public boolean isOpaqueCube() { - return false; + public int getMetaCount() { + return 5; } @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - return new TileEntityRoundRobinator(); + public String getUnlocalBlockName() { + return "blockRoundRobinator"; } @Override - public void onBlockAdded(final World world, final int x, final int y, final int z) { - super.onBlockAdded(world, x, y, z); + protected float initBlockHardness() { + return 1; } @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); + protected float initBlockResistance() { + return 1; } @Override - public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase entity, final ItemStack stack) { - super.onBlockPlacedBy(world, x, y, z, entity, stack); + protected CreativeTabs initCreativeTab() { + return AddToCreativeTab.tabMachines; } @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; + public int getTooltipID() { + return -1; } @Override - public void getSubBlocks(Item aItem, CreativeTabs p_149666_2_, List aList) { - //super.getSubBlocks(aItem, p_149666_2_, aList); - for (int i=0;i<5;i++) { - aList.add(ItemUtils.simpleMetaStack(aItem, i, 1)); - } + protected String getTileEntityName() { + return "Round Robinator"; + } + + @Override + public Class<? extends ItemBlock> getItemBlockClass() { + return ItemBlockRoundRobinator.class; } @Override - public IIcon getIcon(IBlockAccess aBlockAccess, int x, int y, int z, int aSide) { - return super.getIcon(aBlockAccess, x, y, z, aSide); + 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/common/BasePlayer.java b/src/Java/gtPlusPlus/core/common/BasePlayer.java index d60925102a..4686f34207 100644 --- a/src/Java/gtPlusPlus/core/common/BasePlayer.java +++ b/src/Java/gtPlusPlus/core/common/BasePlayer.java @@ -1,19 +1,14 @@ package gtPlusPlus.core.common; -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.client.entity.EntityClientPlayerMP; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.network.play.client.C0BPacketEntityAction; -import net.minecraft.potion.Potion; -import net.minecraft.util.MovementInputFromOptions; -import net.minecraft.util.ResourceLocation; - 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 { @@ -30,8 +25,17 @@ public class BasePlayer extends ClientPlayerBase * EntityPlayerSP.onLivingUpdate() - Adapted to PlayerAPI */ @Override - public void onLivingUpdate() - { + 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; @@ -57,54 +61,9 @@ public class BasePlayer extends ClientPlayerBase } else { - this.player.prevTimeInPortal = this.player.timeInPortal; - if(this.playerAPI.getInPortalField()) - { - if(this.mc.currentScreen != null) - { - this.mc.displayGuiScreen((GuiScreen)null); - } - - if(this.player.timeInPortal == 0.0F) - { - this.mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("portal.trigger"), (this.player.getRNG().nextFloat() * 0.4F) + 0.8F)); - } - - this.player.timeInPortal += 0.0125F; - - if(this.player.timeInPortal >= 1.0F) - { - this.player.timeInPortal = 1.0F; - } - - this.playerAPI.setInPortalField(false); - } - else if(this.player.isPotionActive(Potion.confusion) && (this.player.getActivePotionEffect(Potion.confusion).getDuration() > 60)) - { - this.player.timeInPortal += 0.006666667F; - if(this.player.timeInPortal > 1.0F) - { - this.player.timeInPortal = 1.0F; - } - } - else - { - if(this.player.timeInPortal > 0.0F) - { - this.player.timeInPortal -= 0.05F; - } - - if(this.player.timeInPortal < 0.0F) - { - this.player.timeInPortal = 0.0F; - } - } - if(this.player.timeUntilPortal > 0) - { - --this.player.timeUntilPortal; - } + final boolean isJumping = this.player.movementInput.jump; @@ -112,23 +71,6 @@ public class BasePlayer extends ClientPlayerBase final boolean isMovingForward = this.player.movementInput.moveForward >= minSpeed; this.customMovementInput.update(this.mc, (MovementInputFromOptions)this.player.movementInput, this.player); - if(this.player.isUsingItem() && !this.player.isRiding()) - { - this.player.movementInput.moveStrafe *= 0.2F; - this.player.movementInput.moveForward *= 0.2F; - this.playerAPI.setSprintToggleTimerField(0); - } - - if(this.player.movementInput.sneak && (this.player.ySize < 0.2F)) - { - this.player.ySize = 0.2F; - } - - this.playerAPI.localPushOutOfBlocks(this.player.posX - (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ + (this.player.width * 0.35D)); - this.playerAPI.localPushOutOfBlocks(this.player.posX - (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ - (this.player.width * 0.35D)); - this.playerAPI.localPushOutOfBlocks(this.player.posX + (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ - (this.player.width * 0.35D)); - this.playerAPI.localPushOutOfBlocks(this.player.posX + (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ + (this.player.width * 0.35D)); - final boolean enoughHunger = (this.player.getFoodStats().getFoodLevel() > 6.0F) || this.player.capabilities.isFlying; /* * Begin ToggleSneak Changes - ToggleSprint @@ -151,7 +93,7 @@ public class BasePlayer extends ClientPlayerBase if(isSprintDisabled) { //Utils.LOG_INFO("Sprint pressed"); - if(aSneak.optionDoubleTap && this.player.onGround && !isMovingForward && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isSprinting() && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness)) + 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()) { @@ -170,7 +112,7 @@ public class BasePlayer extends ClientPlayerBase } } - if(!this.player.isSprinting() && (this.player.movementInput.moveForward >= minSpeed) && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && this.settings.keyBindSprint.getIsKeyPressed()) + 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); @@ -192,7 +134,7 @@ public class BasePlayer extends ClientPlayerBase // 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(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) { @@ -204,7 +146,7 @@ public class BasePlayer extends ClientPlayerBase } } - if(canDoubleTap && !state && this.player.onGround && !isMovingForward && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isSprinting() && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness)) + 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) { @@ -223,7 +165,7 @@ public class BasePlayer extends ClientPlayerBase // 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 || !enoughHunger)) + if(this.player.isSprinting() && ((this.player.movementInput.moveForward < minSpeed) || this.player.isCollidedHorizontally)) { this.player.setSprinting(false); @@ -265,87 +207,6 @@ public class BasePlayer extends ClientPlayerBase // this.handledDebugPress = false; // } - // - // Fly Speed Boosting - Added 5/7/2014 - // - if(this.player.capabilities.getFlySpeed() != 0.05F) - { - this.player.capabilities.setFlySpeed(0.05F); - } - - - if(this.player.capabilities.allowFlying && !isJumping && this.player.movementInput.jump) - { - if(this.playerAPI.getFlyToggleTimerField() == 0) - { - this.playerAPI.setFlyToggleTimerField(7); - } - else - { - this.player.capabilities.isFlying = !this.player.capabilities.isFlying; - this.player.sendPlayerAbilities(); - this.playerAPI.setFlyToggleTimerField(0); - } - } - - if(this.player.capabilities.isFlying) - { - if(this.player.movementInput.sneak) - { - this.player.motionY -= 0.15D; - } - if(this.player.movementInput.jump) - { - this.player.motionY += 0.15D; - } - } - - if(this.player.isRidingHorse()) - { - if(this.playerAPI.getHorseJumpPowerCounterField() < 0) - { - this.playerAPI.setHorseJumpPowerCounterField(this.playerAPI.getHorseJumpPowerCounterField() + 1); - if(this.playerAPI.getHorseJumpPowerCounterField() == 0) - { - this.playerAPI.setHorseJumpPowerField(0.0F); - } - } - - if(isJumping && !this.player.movementInput.jump) - { - this.playerAPI.setHorseJumpPowerCounterField(this.playerAPI.getHorseJumpPowerCounterField() - 10); - this.playerAPI.setHorseJumpPowerCounterField(-10); - ((EntityClientPlayerMP)this.player).sendQueue.addToSendQueue(new C0BPacketEntityAction(this.player, 6, (int)(this.player.getHorseJumpPower() * 100.0F))); - } - else if(!isJumping && this.player.movementInput.jump) - { - this.playerAPI.setHorseJumpPowerCounterField(0); - this.playerAPI.setHorseJumpPowerField(0.0F); - } - else if(isJumping) - { - this.playerAPI.setHorseJumpPowerCounterField(this.playerAPI.getHorseJumpPowerCounterField() + 1); - if(this.playerAPI.getHorseJumpPowerCounterField() < 10) - { - this.playerAPI.setHorseJumpPowerField(this.playerAPI.getHorseJumpPowerCounterField() * 0.1F); - } - else - { - this.playerAPI.setHorseJumpPowerField(0.8F + ((2.0F / (this.playerAPI.getHorseJumpPowerCounterField() - 9)) * 0.1F)); - } - } - } - else - { - this.playerAPI.setHorseJumpPowerField(0.0F); - } - - this.playerAPI.superOnLivingUpdate(); - if(this.player.onGround && this.player.capabilities.isFlying) - { - this.player.capabilities.isFlying = false; - this.player.sendPlayerAbilities(); - } } } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index 0b1078366a..ca62a524c1 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -136,6 +136,7 @@ public class COMPAT_HANDLER { GregtechLargeTurbinesAndHeatExchanger.run(); GregtechPowerBreakers.run(); GregtechFluidReactor.run(); + GregtechAlgaeContent.run(); //New Horizons Content NewHorizonsAccelerator.run(); diff --git a/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java b/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java index b10e67aeaf..8853acd4b7 100644 --- a/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java +++ b/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java @@ -1,8 +1,8 @@ package gtPlusPlus.core.handler; +import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; +import net.minecraft.client.Minecraft; import net.minecraft.stats.AchievementList; import net.minecraftforge.event.entity.player.AchievementEvent; @@ -12,12 +12,15 @@ public class StopAnnoyingFuckingAchievements { * Stops me getting fireworks every fucking time I open my inventory upon first loading a dev client. * @param event */ - @SubscribeEvent + @SubscribeEvent(priority=EventPriority.HIGHEST) public void FUCK_OFF(AchievementEvent event) { if (event.achievement.equals(AchievementList.openInventory)) { - if (MathUtils.randInt(0, 10) >= 9) - PlayerUtils.messagePlayer(event.entityPlayer, "Bang! Nah, Just joking, there's no fireworks. :)"); event.setCanceled(true); + if (Minecraft.getMinecraft() != null) { + if (Minecraft.getMinecraft().gameSettings != null) { + Minecraft.getMinecraft().gameSettings.showInventoryAchievementHint = false; + } + } } } diff --git a/src/Java/gtPlusPlus/core/handler/events/SneakManager.java b/src/Java/gtPlusPlus/core/handler/events/SneakManager.java index 2b067be477..3e51c6488a 100644 --- a/src/Java/gtPlusPlus/core/handler/events/SneakManager.java +++ b/src/Java/gtPlusPlus/core/handler/events/SneakManager.java @@ -37,10 +37,11 @@ public class SneakManager { public boolean canSprint = true; public boolean isSneaking = true; public boolean optionDoubleTap = true; - public boolean wasSprintDisabled = false; + public boolean wasSprintDisabled = false; + public boolean mIsWearingRing = false; - private static State Sprinting = State.ON; - private static State Crouching = State.OFF; + private State Sprinting = State.ON; + private State Crouching = State.OFF; public SneakManager(EntityPlayer aPlayer) { owner = aPlayer; @@ -78,22 +79,38 @@ public class SneakManager { return State.ON; } - public State setCrouchingStateON(){ + private State setCrouchingStateON(){ return Crouching = State.ON; } - public State setCrouchingStateOFF(){ + private State setCrouchingStateOFF(){ return Crouching = State.OFF; } - public State setSprintingStateON(){ + private State setSprintingStateON(){ return Sprinting = State.ON; } - public State setSprintingStateOFF(){ + 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); diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java index 42890ddfa6..251230932c 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java @@ -26,28 +26,43 @@ public class ItemBlockBasicTile extends ItemBlock { 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 + } + else if (this.mID == 1) { // Modularity list.add("Used to construct modular armour & bauble upgrades.."); - } else if (this.mID == 2) { // Trade + } + else if (this.mID == 2) { // Trade list.add("Allows for SMP trade-o-mat type trading."); - } else if (this.mID == 3) { // Project + } + 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 + } + 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 + } + 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 + } + 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) { - } else { - list.add("Bad Tooltip ID - " + mID); + } + else if (this.mID == 7) { + } + else if (this.mID == 8){ + + } + 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/ItemBlockBasicTooltip.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTooltip.java deleted file mode 100644 index 9badd384d8..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTooltip.java +++ /dev/null @@ -1,34 +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 ItemBlockBasicTooltip extends ItemBlock{ - - protected final int mID; - - public ItemBlockBasicTooltip(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){ //blockDarkWorldPortalFrame - list.add("Assembled in the same shape as the Nether Portal."); - } - else if (this.mID == 1){ //Modularity - list.add("Used to construct modular armour & bauble upgrades.."); - } - } - - -} diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java index f586695eb7..2d0fd00dd9 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java @@ -16,8 +16,6 @@ public class ItemBlockRoundRobinator extends ItemBlockWithMetadata public ItemBlockRoundRobinator(final Block aBlock){ super(aBlock, aBlock); this.mBlock = aBlock; - this.setMaxDamage(4); - this.setHasSubtypes(true); } @@ -40,7 +38,7 @@ public class ItemBlockRoundRobinator extends ItemBlockWithMetadata 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 item in"); + 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); @@ -62,7 +60,7 @@ public class ItemBlockRoundRobinator extends ItemBlockWithMetadata @Override public int getMetadata(final int p_77647_1_) { - return super.getMetadata(p_77647_1_); + return p_77647_1_; } @Override diff --git a/src/Java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java b/src/Java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java index 1c28f99ff8..3f8e31d8d2 100644 --- a/src/Java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java +++ b/src/Java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java @@ -26,7 +26,9 @@ public class ItemDummyResearch extends ItemGenericToken { 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_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"); diff --git a/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java b/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java index c151a16f09..fa008bf1a3 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java @@ -2,10 +2,15 @@ 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 net.minecraft.client.Minecraft; +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; @@ -14,14 +19,6 @@ import net.minecraft.item.ItemStack; 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.handler.events.CustomMovementHandler; -import gtPlusPlus.core.handler.events.SneakManager; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; - @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{ @@ -84,7 +81,17 @@ public class ItemSlowBuildingRing extends Item implements IBauble{ @Override //TODO public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) { - doEffect(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 @@ -94,8 +101,7 @@ public class ItemSlowBuildingRing extends Item implements IBauble{ if (arg1 instanceof EntityPlayer) { aPlayer = (EntityPlayer) arg1; SneakManager s = SneakManager.get(aPlayer); - s.setSprintingStateON(); - s.setCrouchingStateOFF(); + s.takeRingOff(); } } catch (Throwable t) { @@ -122,9 +128,7 @@ public class ItemSlowBuildingRing extends Item implements IBauble{ } if (aPlayer.isSprinting()) { aPlayer.setSprinting(false); - } - s.setSprintingStateOFF(); - s.setCrouchingStateON(); + } } } } diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index 04f1861cfe..3330ad8c3f 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -5,10 +5,13 @@ 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.Utils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.core.util.sys.GeoUtils; import gtPlusPlus.core.util.sys.NetworkUtils; import gtPlusPlus.preloader.CORE_Preloader; @@ -52,7 +55,7 @@ public class CORE { public static final String name = "GT++"; public static final String MODID = "miscutils"; - public static final String VERSION = "1.7.03.01"; + public static final String VERSION = "1.7.03.45"; public static String MASTER_VERSION = NetworkUtils.getContentFromURL("https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt").toLowerCase(); public static String USER_COUNTRY = GeoUtils.determineUsersCountry(); public static boolean isModUpToDate = Utils.isModUpToDate(); @@ -76,7 +79,7 @@ public class CORE { public static int turbineCutoffBase = 75000; //GT++ Fake Player Profile - public static GameProfile gameProfile = new GameProfile(UUID.nameUUIDFromBytes("gtplusplus.core".getBytes()), "[GT++]"); + 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++]"; @@ -88,6 +91,7 @@ public class CORE { //Because I want to be lazy. Beyond Reality Classic Var. public static boolean BRC = false; + public static final String SEPERATOR = "/"; /** @@ -286,7 +290,20 @@ public class CORE { } public static final void crash() { - System.exit(0); + Logger.ERROR("=========================================================="); + Logger.ERROR("[GT++ CRASH]"); + Logger.ERROR("=========================================================="); + Logger.ERROR("Oooops..."); + Logger.ERROR("This should only happy in a development environment or when something really bad happens."); + Logger.ERROR("=========================================================="); + Logger.ERROR("Called from: "+ReflectionUtils.getMethodName(0)); + Logger.ERROR(ReflectionUtils.getMethodName(1)); + Logger.ERROR(ReflectionUtils.getMethodName(2)); + Logger.ERROR(ReflectionUtils.getMethodName(3)); + Logger.ERROR(ReflectionUtils.getMethodName(4)); + Logger.ERROR(ReflectionUtils.getMethodName(5)); + Logger.ERROR(ReflectionUtils.getMethodName(6)); + FMLCommonHandler.instance().exitJava(0, true); } public static final void gc() { diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index 3f631e0bca..cac54cec4e 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -276,6 +276,35 @@ public class RECIPES_GREGTECH { 20 * 60 * 1 * (GTNH ? 2 : 1), (int) GT_Values.V[5]); + // Turbine Automation Port + CORE.RA.addAssemblylineRecipe( + ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_8_TURBINE_AUTOMATION, 1), + 20 * 60 * 60 * 24, + new ItemStack[] { + 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), + CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 20 : 10), + 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.getFluid(128 * 144), + ALLOY.ZERON_100.getFluid(144 * 64) + + }, + GregtechItemList.Hatch_Input_TurbineHousing.get(4), + 20 * 60 * 60 * (GTNH ? 2 : 1), + (int) GT_Values.V[8]); + /* * Contianment casings @@ -360,88 +389,116 @@ public class RECIPES_GREGTECH { } - //Nano Healer - CORE.RA.addAssemblylineRecipe( - ItemUtils.simpleMetaStack(Items.golden_apple, 1, 1), - 20 * 60 * 10, - new ItemStack[] { - ItemUtils.getSimpleStack(aGemCasings[2], GTNH ? 4 : 2), - CI.getTieredComponent(OrePrefixes.plate, 8, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 16 : 4), - 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) GT_Values.V[7]); - - - - //Charge Pack LuV-UV - - ItemStack[] aChargeResearch = new ItemStack[] { - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore7", 1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_1, 1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_2, 1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_3, 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), - }; + if (LoadedMods.Baubles) { + //Nano Healer + CORE.RA.addAssemblylineRecipe( + ItemUtils.simpleMetaStack(Items.golden_apple, 1, 1), + 20 * 60 * 10, + new ItemStack[] { + ItemUtils.getSimpleStack(aGemCasings[2], GTNH ? 4 : 2), + CI.getTieredComponent(OrePrefixes.plate, 8, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 16 : 4), + 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)), - ItemStack[] aBufferCoreInputs = new ItemStack[] { - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore7", GTNH ? 8 : 4), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore8", GTNH ? 8 : 4), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore9", GTNH ? 8 : 4), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore10", GTNH ? 8 : 4), - }; + }, + ItemUtils.getItemStackFromFQRN("miscutils:personalHealingDevice", 1), + 20 * 60 * 30 * (GTNH ? 2 : 1), + (int) GT_Values.V[7]); + + + + //Charge Pack LuV-UV + + ItemStack[] aChargeResearch = new ItemStack[] { + ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore7", 1), + ItemUtils.getSimpleStack(ModItems.itemChargePack_High_1, 1), + ItemUtils.getSimpleStack(ModItems.itemChargePack_High_2, 1), + ItemUtils.getSimpleStack(ModItems.itemChargePack_High_3, 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), + }; + + ItemStack[] aBufferCoreInputs = new ItemStack[] { + ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore7", GTNH ? 8 : 4), + ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore8", GTNH ? 8 : 4), + ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore9", GTNH ? 8 : 4), + ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore10", GTNH ? 8 : 4), + }; + + int aCurrSlot = 0; + for (int h = 6; h < 10; h++) { + CORE.RA.addAssemblylineRecipe( + aChargeResearch[aCurrSlot], + 20 * 60 * 10 * (aCurrSlot + 1), + new ItemStack[] { + ItemUtils.getSimpleStack( + aGemBatteries[aCurrSlot], GTNH ? 4 : 2), + aBufferCoreInputs[aCurrSlot], + aCoilWire[aCurrSlot], + CI.getTieredComponent(OrePrefixes.plate, h, GTNH ? 16 : 8), + CI.getTieredComponent(OrePrefixes.plate, h-1, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.circuit, h, GTNH ? 16 : 4), + CI.getTieredComponent(OrePrefixes.circuit, h-1, GTNH ? 32 : 8), + CI.getTieredComponent(OrePrefixes.cableGt12, h-1, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.screw, h, GTNH ? 16 : 8), + CI.getTieredComponent(OrePrefixes.bolt, h-2, GTNH ? 32 : 16), + CI.getElectricMotor(h, GTNH ? 8 : 4), + CI.getFieldGenerator(h-1, 2), + CI.getRobotArm(h-2, GTNH ? 4 : 2), + }, + new FluidStack[] { + CI.getTieredFluid(h, 144 * 18 * (GTNH ? 8 : 4)), + CI.getTertiaryTieredFluid(h-1, 144 * 18 * (GTNH ? 8 : 4)), + CI.getAlternativeTieredFluid(h-1, 144 * 18 * (GTNH ? 8 : 4)), + CI.getAlternativeTieredFluid(h-2, 144 * 18 * (GTNH ? 8 : 4)), + }, + aChargeOutputs[aCurrSlot], + 20 * 60 * 30 * (GTNH ? 2 : 1) * (aCurrSlot+1), + (int) GT_Values.V[h]); + aCurrSlot++; + } - int aCurrSlot = 0; - for (int h = 6; h < 10; h++) { + //Cloaking device CORE.RA.addAssemblylineRecipe( - aChargeResearch[aCurrSlot], - 20 * 60 * 10 * (aCurrSlot + 1), + ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_9_CLOAKING, 1), + 20 * 60 * 10, new ItemStack[] { - ItemUtils.getSimpleStack( - aGemBatteries[aCurrSlot], GTNH ? 4 : 2), - aBufferCoreInputs[aCurrSlot], - aCoilWire[aCurrSlot], - CI.getTieredComponent(OrePrefixes.plate, h, GTNH ? 16 : 8), - CI.getTieredComponent(OrePrefixes.plate, h-1, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.circuit, h, GTNH ? 16 : 4), - CI.getTieredComponent(OrePrefixes.circuit, h-1, GTNH ? 32 : 8), - CI.getTieredComponent(OrePrefixes.cableGt12, h-1, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.screw, h, GTNH ? 16 : 8), - CI.getTieredComponent(OrePrefixes.bolt, h-2, GTNH ? 32 : 16), - CI.getElectricMotor(h, GTNH ? 8 : 4), - CI.getFieldGenerator(h-1, 2), - CI.getRobotArm(h-2, GTNH ? 4 : 2), + ItemUtils.getSimpleStack(aGemCasings[3], GTNH ? 4 : 2), + CI.getTieredComponent(OrePrefixes.plate, 8, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 16 : 4), + 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(h, 144 * 18 * (GTNH ? 8 : 4)), - CI.getTertiaryTieredFluid(h-1, 144 * 18 * (GTNH ? 8 : 4)), - CI.getAlternativeTieredFluid(h-1, 144 * 18 * (GTNH ? 8 : 4)), - CI.getAlternativeTieredFluid(h-2, 144 * 18 * (GTNH ? 8 : 4)), + 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)), + }, - aChargeOutputs[aCurrSlot], - 20 * 60 * 30 * (GTNH ? 2 : 1) * (aCurrSlot+1), - (int) GT_Values.V[h]); - aCurrSlot++; + ItemUtils.getItemStackFromFQRN("miscutils:personalCloakingDevice", 1), + 20 * 60 * 30 * (GTNH ? 2 : 1), + (int) GT_Values.V[8]); } @@ -1491,6 +1548,53 @@ public class RECIPES_GREGTECH { 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); + } @@ -1641,7 +1745,7 @@ public class RECIPES_GREGTECH { } private static void centrifugeRecipes() { - + //Try use all woods found, fix/add methane extraction. ArrayList<ItemStack> aLogData = OreDictionary.getOres("logWood"); ArrayList<ItemStack> aRubberLogs = OreDictionary.getOres("logRubber"); diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index bc1c7fc398..f5bd390aee 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -1063,7 +1063,20 @@ public class RECIPES_Machines { RECIPE_ThermalBoilerCasing); //Lava Filter Recipe - GT_Values.RA.addAssemblerRecipe(ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:itemPartCarbonMesh", "RawCarbonMesh", 0, 16), CI.getNumberedCircuit(18), ItemUtils.getSimpleStack(ModItems.itemLavaFilter), 80*20, 16); + 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 + ); } if (CORE.ConfigSwitches.enableMultiblock_LiquidFluorideThoriumReactor){ @@ -2201,10 +2214,10 @@ public class RECIPES_Machines { 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_ULV.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[] { @@ -2214,20 +2227,66 @@ public class RECIPES_Machines { 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_ULV.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 = 0; i < 10; i++) { + for (int i = 1; i < 10; i++) { CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - CI.getNumberedCircuit(16), + CI.getNumberedCircuit(17), mInputHatch[i], CI.getElectricMotor(i, GTNH ? 8 : 2), CI.getConveyor(i, GTNH ? 10 : 5), - CI.getGear(i, GTNH ? 6 : 3), + CI.getBolt(i, GTNH ? 32 : 16), CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2) }, CI.getAlternativeTieredFluid(i, 144 * 8), @@ -2235,7 +2294,7 @@ public class RECIPES_Machines { (int) GT_Values.V[i]); } //Output Buses - for (int i = 0; i < 10; i++) { + for (int i = 1; i < 10; i++) { CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { CI.getNumberedCircuit(18), mOutputHatch[i], @@ -2259,7 +2318,7 @@ public class RECIPES_Machines { 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), @@ -2272,6 +2331,17 @@ public class RECIPES_Machines { 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; @@ -2283,10 +2353,10 @@ public class RECIPES_Machines { CI.getTieredComponent(OrePrefixes.plate, aTier, 4 * aCostMultiplier), CI.getTieredComponent(OrePrefixes.circuit, i, 2 * aCostMultiplier), }; - + CORE.RA.addSixSlotAssemblingRecipe( aInputs, - CI.getAlternativeTieredFluid(aTier, (144 * 2 * i)), //Input Fluid + GT_Values.NF, //Input Fluid aRobinators[i], 45 * 10 * 1 * (i+1), MaterialUtils.getVoltageForTier(i)); diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_SeleniumProcessing.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_SeleniumProcessing.java index 73c7279bb8..902806e026 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_SeleniumProcessing.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_SeleniumProcessing.java @@ -86,15 +86,15 @@ public class RECIPES_SeleniumProcessing { public static void processCopperRecipes() { - //Copper + //Copper CORE.RA.addDehydratorRecipe( new ItemStack[]{ - ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Copper, 1), // Item Input + ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Copper, 1), // Item Input }, FluidUtils.getHotWater(1000), // Fluid MISC_MATERIALS.SELENIUM_DIOXIDE.getFluid(20), // Fluid new ItemStack[] { - ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Copper, 1), + 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), @@ -121,12 +121,12 @@ public class RECIPES_SeleniumProcessing { //Tetra CORE.RA.addDehydratorRecipe( new ItemStack[]{ - ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Tetrahedrite, 1), // Item Input + ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Tetrahedrite, 1), // Item Input }, FluidUtils.getHotWater(1000), // Fluid MISC_MATERIALS.SELENIUM_DIOXIDE.getFluid(10), // Fluid new ItemStack[] { - ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Tetrahedrite, 1), + 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), @@ -153,12 +153,12 @@ public class RECIPES_SeleniumProcessing { //Chalco CORE.RA.addDehydratorRecipe( new ItemStack[]{ - ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Chalcopyrite, 1), // Item Input + ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Chalcopyrite, 1), // Item Input }, FluidUtils.getHotWater(1000), // Fluid MISC_MATERIALS.SELENIUM_DIOXIDE.getFluid(10), // Fluid new ItemStack[] { - ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Chalcopyrite, 1), + 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), @@ -185,12 +185,12 @@ public class RECIPES_SeleniumProcessing { //Malachite CORE.RA.addDehydratorRecipe( new ItemStack[]{ - ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Malachite, 1), // Item Input + ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Malachite, 1), // Item Input }, FluidUtils.getHotWater(1000), // Fluid MISC_MATERIALS.SELENIUM_DIOXIDE.getFluid(10), // Fluid new ItemStack[] { - ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Malachite, 1), + 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), diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java index 10cefdf0c4..2cc6d7b41a 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java @@ -154,16 +154,7 @@ public class RECIPES_Tools { CobbleStone, sandHammer, CobbleStone, CobbleStone, CobbleStone, CobbleStone, RECIPE_Sand); - - if (LoadedMods.Baubles){ - //Cloaking Device - RecipeUtils.recipeBuilder( - plateDoubleNiChrome, plateIridiumAlloy, plateDoubleNiChrome, - plateIridiumAlloy, batteryUltimate, plateIridiumAlloy, - plateDoubleNiChrome, plateIridiumAlloy, plateDoubleNiChrome, - personalCloakingDevice); - - } + //Sand to Sandstone RecipeUtils.recipeBuilder( Sand, Sand, Sand, diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java index 63477cda19..968a96135e 100644 --- a/src/Java/gtPlusPlus/core/recipe/common/CI.java +++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java @@ -634,12 +634,22 @@ public class CI { } public static FluidStack getTieredFluid(int aTier, int aAmount, int aType) { - ItemStack aCell = getTieredComponent(OrePrefixes.liquid, aTier, 1); + // 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); - } - a.amount = aAmount; + }*/ + + // Modern Handling + FluidStack a = aMaster[aType][aTier].getFluid(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; } diff --git a/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java b/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java index cca58467ef..3e96220995 100644 --- a/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java +++ b/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java @@ -1,10 +1,15 @@ package gtPlusPlus.core.util.data; -import java.util.*; +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 net.minecraft.item.ItemStack; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; +import net.minecraft.item.ItemStack; public class ArrayUtils { @@ -75,5 +80,13 @@ public class ArrayUtils { } } + 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); + } + } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ClientUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ClientUtils.java new file mode 100644 index 0000000000..806f83d830 --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/minecraft/ClientUtils.java @@ -0,0 +1,18 @@ +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/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index 88fdda555c..cb490203df 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -47,6 +47,7 @@ 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; @@ -1083,6 +1084,14 @@ public class ItemUtils { } + + 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) { diff --git a/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java new file mode 100644 index 0000000000..1de4209bf9 --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java @@ -0,0 +1,51 @@ +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 gtPlusPlus.core.util.reflect.ReflectionUtils; + +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; + } + +} diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java index 5c5d1169aa..e4279cf489 100644 --- a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java +++ b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java @@ -65,7 +65,7 @@ extends TemplateRecipeHandler { @Override public void loadCraftingRecipes(final String outputId, final Object... results) { - if (outputId.equals(this.getOverlayIdentifier())) { + if (outputId.equals(this.mRecipeMap.mNEIName)) { for (final GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { if (!tRecipe.mHidden) { this.arecipes.add(new CachedDefaultRecipe(tRecipe)); @@ -146,7 +146,8 @@ extends TemplateRecipeHandler { @Override public String getOverlayIdentifier() { - return this.mRecipeMap.mNEIName; + //return this.mRecipeMap.mNEIName; + return "Penis"; } @Override @@ -163,7 +164,8 @@ extends TemplateRecipeHandler { @Override public String getRecipeName() { - return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); + //return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); + return " Chem Plant"; } @Override @@ -201,24 +203,24 @@ extends TemplateRecipeHandler { @Override public void drawExtras(final int aRecipeIndex) { - final int tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; + final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; if (tEUt != 0) { - drawText(10, 73, "Total: " + (tDuration * tEUt) + " EU", -16777216); - drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216); + drawText(10, 73, "Total: " + (long) (tDuration * tEUt) + " EU", -16777216); + //drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216); if (this.mRecipeMap.mShowVoltageAmperageInNEI) { - drawText(10, 93, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU", -16777216); - drawText(10, 103, "Amperage: " + this.mRecipeMap.mAmperage, -16777216); + drawText(10, 83, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU/t", -16777216); + drawText(10, 93, "Amperage: " + this.mRecipeMap.mAmperage, -16777216); } else { drawText(10, 93, "Voltage: unspecified", -16777216); drawText(10, 103, "Amperage: unspecified", -16777216); } } if (tDuration > 0) { - drawText(10, 113, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216); + drawText(10, 103, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216); } if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { - drawText(10, 123, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216); + drawText(10, 113, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 588c04d7e5..3fc6d9d667 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -228,6 +228,9 @@ public enum GregtechItemList implements GregtechItemContainer { //Fish Pond Industrial_FishingPond, Casing_FishPond, + + //Algae + AlgaeFarm_Controller, //GT4 autoCrafter @@ -343,6 +346,9 @@ public enum GregtechItemList implements GregtechItemContainer { //XL Turbine Rotor Hatch Hatch_Turbine_Rotor, + //Standard Turbine Rotor Hatch + Hatch_Input_TurbineHousing, + //Control Core Hatch_Control_Core, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java index d3e22875ae..88b9661c95 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java @@ -101,32 +101,32 @@ public class CONTAINER_MultiMachine extends GT_ContainerMetaTile_Machine { //crafters = ReflectionUtils.getField(getClass(), "crafters"); } if (timer != null && crafters != null && mControllerSet) { - Logger.INFO("Trying to update clientside GUI data"); + //Logger.INFO("Trying to update clientside GUI data"); try { - Logger.INFO("0"); + //Logger.INFO("0"); int aTimer = (int) ReflectionUtils.getFieldValue(timer, this); //List crafters1List = (List) crafters1; List<ICrafting> crafters2 = new ArrayList<ICrafting>(); - Logger.INFO("1"); + //Logger.INFO("1"); for (Object o : crafters) { if (o instanceof ICrafting) { crafters2.add((ICrafting) o); } } - Logger.INFO("2"); + //Logger.INFO("2"); if (!crafters2.isEmpty()) { - Logger.INFO("3"); + //Logger.INFO("3"); handleInitialFieldSetting(); try { - Logger.INFO("4"); + //Logger.INFO("4"); for (final ICrafting var3 : crafters2) { handleCraftingEvent(aTimer, var3); } - Logger.INFO("5"); + //Logger.INFO("5"); handleInternalFieldSetting(); - Logger.INFO("6"); + //Logger.INFO("6"); } catch (Throwable t) { } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java index d4d2fcacd7..e6203823b6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java @@ -36,11 +36,11 @@ public class CONTAINER_1by1_Turbine extends GT_Container_1by1 { } @Override public boolean isItemValid(final ItemStack itemstack) { - /*if (itemstack.getItem() instanceof GT_MetaGenerated_Tool) { + if (itemstack.getItem() instanceof GT_MetaGenerated_Tool) { if (itemstack.getItemDamage() >= 170 && itemstack.getItemDamage() <= 176) { return true; } - }*/ + } return false; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java new file mode 100644 index 0000000000..d9e2692b09 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java @@ -0,0 +1,212 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; + +import gregtech.api.interfaces.ITexture; +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.GT_MetaTileEntity_Hatch_InputBus; +import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.core.util.sys.KeyboardUtils; +import gtPlusPlus.xmod.gregtech.api.gui.hatches.CONTAINER_1by1_Turbine; +import gtPlusPlus.xmod.gregtech.api.gui.hatches.GUI_1by1_Turbine; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; + +public class GT_MetaTileEntity_Hatch_TurbineProvider extends GT_MetaTileEntity_Hatch_InputBus { + + public GT_MetaTileEntity_Hatch_TurbineProvider(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier); + } + + public GT_MetaTileEntity_Hatch_TurbineProvider(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + public GT_MetaTileEntity_Hatch_TurbineProvider(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_TurbineProvider(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); + } + + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new CONTAINER_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity); + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity, "Turbine Housing"); + } + + @Override + public String[] getDescription() { + return new String[]{ + "An automation port for Large Turbines", "Will attempt once per 1200 ticks to fill the turbine slot of it's parent turbine", "You may adjust this with a screwdriver", "Hold shift to adjust in finer amounts", "Hold control to adjust direction", "Left Click with Screwdriver to reset", "This module assumes the entire turbine is in the same Chunk"}; + } + + + private GT_MetaTileEntity_LargeTurbine mParent = null; + + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + super.onPostTick(aBaseMetaTileEntity, aTimer); + if (aTimer % mRefreshTime == 0 && this.getBaseMetaTileEntity().isServerSide()) { + tryRefillTurbine(); + } + } + + private final void tryFindParentTurbine() { + Logger.INFO("This turbine housing has no parent, searching world."); + IGregTechTileEntity T = this.getBaseMetaTileEntity(); + World W = T.getWorld(); + Chunk C = W.getChunkFromBlockCoords(T.getXCoord(), T.getZCoord()); + for (Object o : C.chunkTileEntityMap.values()) { + if (o instanceof IGregTechTileEntity) { + IGregTechTileEntity G = (IGregTechTileEntity) o; + final IMetaTileEntity aMetaTileEntity = G.getMetaTileEntity(); + if (aMetaTileEntity == null) { + continue; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine) { + GT_MetaTileEntity_LargeTurbine aTurb = (GT_MetaTileEntity_LargeTurbine) aMetaTileEntity; + for (GT_MetaTileEntity_Hatch_InputBus ee : aTurb.mInputBusses) { + if (ee.equals(this)) { + mParent = aTurb; + Logger.INFO("Found a Parent to attach to this housing."); + return; + } + } + } + } + } + } + + private final void tryRefillTurbine() { + if (mParent == null) { + tryFindParentTurbine(); + } + if (mParent != null && mParent.mInventory[1] == null) { + for (ItemStack aStack : this.mInventory) { + if (isItemStackTurbine(aStack)) { + setGUIItemStack(aStack); + } + } + } + } + + protected boolean setGUIItemStack(ItemStack aNewGuiSlotContents) { + boolean result = false; + if (mParent.mInventory[1] == null) { + mParent.mInventory[1] = aNewGuiSlotContents != null ? aNewGuiSlotContents.copy() : null; + mParent.depleteInput(aNewGuiSlotContents); + mParent.updateSlots(); + this.updateSlots(); + result = true; + } + return result; + } + + public boolean isItemStackTurbine(ItemStack aStack) { + if (aStack.getItem() instanceof GT_MetaGenerated_Tool) { + if (aStack.getItemDamage() >= 170 && aStack.getItemDamage() <= 176) { + return true; + } + } + return false; + } + + public boolean isItemStackScrewdriver(ItemStack aStack) { + if (aStack.getItem() instanceof GT_MetaGenerated_Tool) { + if (aStack.getItemDamage() == 22 || aStack.getItemDamage() == 150) { + return true; + } + } + return false; + } + + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return false; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return isItemStackTurbine(aStack); + } + + private int mRefreshTime = 1200; + private boolean mDescending = true; + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setInteger("mRefreshTime", mRefreshTime); + aNBT.setBoolean("mDescending", mDescending); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + mRefreshTime = aNBT.getInteger("mRefreshTime"); + mDescending = aNBT.getBoolean("mDescending"); + } + + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (aPlayer != null) { + if (KeyboardUtils.isCtrlKeyDown()) { + mDescending = Utils.invertBoolean(mDescending); + PlayerUtils.messagePlayer(aPlayer, "Direction: "+(mDescending ? "DOWN" : "UP")); + } + else { + int aAmount = 0; + if (KeyboardUtils.isShiftKeyDown()) { + aAmount = 10; + } + else { + aAmount = 100; + } + if (mDescending) { + mRefreshTime -= aAmount; + if (mRefreshTime < 0) { + mRefreshTime = 1200; + } + } + else { + mRefreshTime += aAmount; + if (mRefreshTime > 1200) { + mRefreshTime = 0; + } + } + PlayerUtils.messagePlayer(aPlayer, "Set check time to be every "+mRefreshTime+" ticks."); + } + } + } + + @Override + public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + boolean aDidScrewdriver = false; + if (aPlayer != null) { + if (aPlayer.getHeldItem() != null) { + if (isItemStackScrewdriver(aPlayer.getHeldItem())) { + aDidScrewdriver = true; + mRefreshTime = 1200; + PlayerUtils.messagePlayer(aPlayer, "Reset check time to "+mRefreshTime+" ticks."); + } + } + } + if (!aDidScrewdriver) { + super.onLeftclick(aBaseMetaTileEntity, aPlayer); + } + } + + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java index 3afa3312b1..cca5a39de3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java @@ -58,7 +58,7 @@ public class GT_MetaTileEntity_SuperBus_Output extends GT_MetaTileEntity_Hatch_O if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { this.fillStacksIntoFirstSlots(); } - + super.onPostTick(aBaseMetaTileEntity, aTimer); } public void updateSlots() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 68b81182fc..3c3345d130 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -42,6 +42,11 @@ import gtPlusPlus.GTplusplus; import gtPlusPlus.GTplusplus.INIT_PHASE; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.data.ConcurrentHashSet; +import gtPlusPlus.api.objects.data.ConcurrentSet; +import gtPlusPlus.api.objects.data.FlexiblePair; +import gtPlusPlus.api.objects.data.Pair; +import gtPlusPlus.api.objects.data.Triplet; import gtPlusPlus.api.objects.minecraft.BlockPos; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; @@ -49,6 +54,7 @@ import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.preloader.asm.AsmConfig; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine_NoPlayerInventory; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; @@ -59,6 +65,7 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEn import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery; import gtPlusPlus.xmod.gregtech.api.objects.MultiblockRequirements; + import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -92,12 +99,12 @@ GT_MetaTileEntity_MultiBlockBase { else { aLogger = ReflectionUtils.getMethod(Logger.class, "MACHINE_INFO", String.class); } - + try { calculatePollutionReduction = GT_MetaTileEntity_Hatch_Muffler.class.getDeclaredMethod("calculatePollutionReduction", int.class); } catch (NoSuchMethodException | SecurityException e) {} - - + + //gregtech.api.util.GT_Recipe.GT_Recipe_Map.findRecipe(IHasWorldObjectAndCoords, GT_Recipe, boolean, long, FluidStack[], ItemStack, ItemStack...) } @@ -135,7 +142,7 @@ GT_MetaTileEntity_MultiBlockBase { } public abstract boolean hasSlotInGUI(); - + public long getTotalRuntimeInTicks() { return this.mTotalRunTime; } @@ -276,7 +283,7 @@ GT_MetaTileEntity_MultiBlockBase { } - + public int getPollutionReductionForAllMufflers() { int mPollutionReduction=0; for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { @@ -286,7 +293,7 @@ GT_MetaTileEntity_MultiBlockBase { } return mPollutionReduction; } - + public long getStoredEnergyInAllEnergyHatches() { long storedEnergy=0; for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { @@ -296,7 +303,7 @@ GT_MetaTileEntity_MultiBlockBase { } return storedEnergy; } - + public long getMaxEnergyStorageOfAllEnergyHatches() { long maxEnergy=0; for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { @@ -408,7 +415,7 @@ GT_MetaTileEntity_MultiBlockBase { String[] aToolTip = new String[(a2 + a3)]; aToolTip = ArrayUtils.addAll(aToolTip, x); aToolTip = ArrayUtils.addAll(aToolTip, z); - + if (aCachedToolTip == null || aCachedToolTip.length <= 0) { aCachedToolTip = aToolTip; } @@ -465,66 +472,300 @@ GT_MetaTileEntity_MultiBlockBase { public String getSound() { return ""; } public boolean canBufferOutputs(final GT_Recipe aRecipe, int aParallelRecipes) { - if (aRecipe.mOutputs.length > 16) { - // Gendustry custom comb with a billion centrifuge outputs? Do it anyway. - return true; - } - // Count slots available in output buses - ArrayList<ItemStack> tBusStacks = new ArrayList<>(); + Logger.INFO("Determining if we have space to buffer outputs. Parallel: "+aParallelRecipes); - int tEmptySlots = 0; - for (final GT_MetaTileEntity_Hatch_OutputBus tBus : this.mOutputBusses) { - if (!isValidMetaTileEntity(tBus)) { - continue; + // Null recipe or a recipe with lots of outputs? + // E.G. Gendustry custom comb with a billion centrifuge outputs? + // Do it anyway. + if (aRecipe == null || aRecipe.mOutputs.length > 16) { + return aRecipe == null ? false : true; + } + + // Do we even need to check for item outputs? + boolean aDoesOutputItems = aRecipe.mOutputs.length > 0; + // Do we even need to check for fluid outputs? + boolean aDoesOutputFluids = aRecipe.mFluidOutputs.length > 0; + + + + /* ======================================== + * Item Management + * ======================================== + */ + + if (aDoesOutputItems) { + Logger.INFO("We have items to output."); + + // How many slots are free across all the output buses? + int aInputBusSlotsFree = 0; + + /* + * Create Variables for Item Output + */ + + AutoMap<FlexiblePair<ItemStack, Integer>> aItemMap = new AutoMap<FlexiblePair<ItemStack, Integer>>(); + AutoMap<ItemStack> aOutputs = new AutoMap<ItemStack>(aRecipe.mOutputs); + + for (final GT_MetaTileEntity_Hatch_OutputBus tBus : this.mOutputBusses) { + if (!isValidMetaTileEntity(tBus)) { + continue; + } + final IInventory tBusInv = tBus.getBaseMetaTileEntity(); + for (int i = 0; i < tBusInv.getSizeInventory(); i++) { + if (tBus.getStackInSlot(i) == null) { + aInputBusSlotsFree++; + } + else { + ItemStack aT = tBus.getStackInSlot(i); + int aSize = aT.stackSize; + aT = aT.copy(); + aT.stackSize = 0; + aItemMap.put(new FlexiblePair<ItemStack, Integer>(aT, aSize)); + } + } } - final IInventory tBusInv = tBus.getBaseMetaTileEntity(); - for (int i = 0; i < tBusInv.getSizeInventory(); i++) { - if (tBus.getStackInSlot(i) == null) { - tEmptySlots++; + + // Count the slots we need, later we can check if any are able to merge with existing stacks + int aRecipeSlotsRequired = 0; + + // A map to hold the items we will be 'inputting' into the output buses. These itemstacks are actually the recipe outputs. + ConcurrentSet<FlexiblePair<ItemStack, Integer>> aInputMap = new ConcurrentHashSet<FlexiblePair<ItemStack, Integer>>(); + + // Iterate over the outputs, calculating require stack spacing they will require. + for (int i=0;i<aOutputs.size();i++) { + ItemStack aY = aOutputs.get(i); + if (aY == null) { + continue; } else { - tBusStacks.add(tBus.getStackInSlot(i)); - } + int aStackSize = aY.stackSize * aParallelRecipes; + if (aStackSize > 64) { + int aSlotsNeedsForThisStack = (int) Math.ceil((double) ((float) aStackSize / 64f)); + // Should round up and add as many stacks as required nicely. + aRecipeSlotsRequired += aSlotsNeedsForThisStack; + for (int o=0;o<aRecipeSlotsRequired;o++) { + int aStackToRemove = (aStackSize -= 64) > 64 ? 64 : aStackSize; + aY = aY.copy(); + aY.stackSize = 0; + aInputMap.add(new FlexiblePair<ItemStack, Integer>(aY, aStackToRemove)); + } + } + else { + // Only requires one slot + aRecipeSlotsRequired++; + aY = aY.copy(); + aY.stackSize = 0; + aInputMap.add(new FlexiblePair<ItemStack, Integer>(aY, aStackSize)); + } + } + } + + // We have items to add to the output buses. See if any are not full stacks and see if we can make them full. + if (aInputMap.size() > 0) { + // Iterate over the current stored items in the Output busses, if any match and are not full, we can try account for merging. + busItems: for (FlexiblePair<ItemStack, Integer> y : aItemMap) { + // Iterate over the 'inputs', we can safely remove these as we go. + outputItems: for (FlexiblePair<ItemStack, Integer> u : aInputMap) { + // Create local vars for readability. + ItemStack aOutputBusStack = y.getKey(); + ItemStack aOutputStack = u.getKey(); + // Stacks match, including NBT. + if (GT_Utility.areStacksEqual(aOutputBusStack, aOutputStack, false)) { + // Stack Matches, but it's full, continue. + if (aOutputBusStack.stackSize >= 64) { + // This stack is full, no point checking it. + continue busItems; + } + else { + // We can merge these two stacks without any hassle. + if ((aOutputBusStack.stackSize + aOutputStack.stackSize) <= 64) { + // Update the stack size in the bus storage map. + y.setValue(aOutputBusStack.stackSize + aOutputStack.stackSize); + // Remove the 'input' stack from the recipe outputs, so we don't try count it again. + aInputMap.remove(u); + continue outputItems; + } + // Stack merging is too much, so we fill this stack, leave the remainder. + else { + int aRemainder = (aOutputBusStack.stackSize + aOutputStack.stackSize) - 64; + // Update the stack size in the bus storage map. + y.setValue(64); + // Create a new object to iterate over later, with the remainder data; + FlexiblePair<ItemStack, Integer> t = new FlexiblePair<ItemStack, Integer>(u.getKey(), aRemainder); + // Remove the 'input' stack from the recipe outputs, so we don't try count it again. + aInputMap.remove(u); + // Add the remainder stack. + aInputMap.add(t); + continue outputItems; + } + } + } + else { + continue outputItems; + } + } + } } + + // We have stacks that did not merge, do we have space for them? + if (aInputMap.size() > 0) { + if (aInputMap.size() > aInputBusSlotsFree) { + // We do not have enough free slots in total to accommodate the remaining managed stacks. + Logger.INFO("Failed to find enough space for all item outputs. Free: "+aInputBusSlotsFree+", Required: "+aInputMap.size()); + return false; + } + } + + /* + * End Item Management + */ + } - int slotsNeeded = aRecipe.mOutputs.length; - for (final ItemStack tRecipeOutput: aRecipe.mOutputs) { - if (tRecipeOutput == null) continue; - int amount = tRecipeOutput.stackSize * aParallelRecipes; - for (final ItemStack tBusStack : tBusStacks) { - if (GT_Utility.areStacksEqual(tBusStack, tRecipeOutput)) { - if (tBusStack.stackSize + amount <= tBusStack.getMaxStackSize()) { - slotsNeeded--; - break; - } + + + + + /* ======================================== + * Fluid Management + * ======================================== + */ + + + + if (aDoesOutputFluids) { + Logger.INFO("We have Fluids to output."); + // How many slots are free across all the output buses? + int aFluidHatches = 0; + int aEmptyFluidHatches = 0; + int aFullFluidHatches = 0; + // Create Map for Fluid Output + ConcurrentHashSet<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>> aOutputHatches = new ConcurrentHashSet<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>>(); + for (final GT_MetaTileEntity_Hatch_Output tBus : this.mOutputHatches) { + if (!isValidMetaTileEntity(tBus)) { + continue; + } + aFluidHatches++; + // Map the Hatch with the space left for easy checking later. + if (tBus.getFluid() == null) { + aOutputHatches.add(new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(tBus, null, tBus.getCapacity())); + } + else { + int aSpaceLeft = tBus.getCapacity() - tBus.getFluidAmount(); + aOutputHatches.add(new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(tBus, tBus.getFluid(), aSpaceLeft)); } } - } - // Enough open slots? - if (tEmptySlots < slotsNeeded) return false; - - // For each output fluid, make sure an output hatch can accept it. - for (FluidStack tRecipeFluid: aRecipe.mFluidOutputs) { - if (tRecipeFluid == null) continue; - boolean tCanBufferFluid = false; - int tRecipeAmount = tRecipeFluid.amount; - for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { - FluidStack tHatchFluid = tHatch.getFluid(); - if (tHatchFluid == null) { - if(tHatch.getCapacity() > tRecipeAmount) { - tCanBufferFluid = true; - break; - } + // Create a map of all the fluids we would like to output, we can iterate over this and see how many we can merge into existing hatch stacks. + ConcurrentHashSet<FluidStack> aOutputFluids = new ConcurrentHashSet<FluidStack>(); + // Ugly ass boxing + aOutputFluids.addAll(new AutoMap<FluidStack>(aRecipe.mFluidOutputs)); + // Iterate the Hatches, updating their 'stored' data. + aHatchIterator: for (Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aHatchData : aOutputHatches) { + // The Hatch Itself + GT_MetaTileEntity_Hatch_Output aHatch = aHatchData.getValue_1(); + // Fluid in the Hatch + FluidStack aHatchStack = aHatchData.getValue_2(); + // Space left in Hatch + int aSpaceLeftInHatch = aHatch.getCapacity() - aHatch.getFluidAmount(); + // Hatch is full, + if (aSpaceLeftInHatch <= 0) { + aFullFluidHatches++; + aOutputHatches.remove(aHatchData); + continue aHatchIterator; } - else if (tHatchFluid.isFluidEqual(tRecipeFluid) && tHatch.getCapacity() - tHatchFluid.amount > tRecipeAmount) { - tCanBufferFluid = true; - break; + // Hatch has space + else { + // Check if any fluids match + aFluidMatch: for (FluidStack aOutputStack : aOutputFluids) { + if (GT_Utility.areFluidsEqual(aHatchStack, aOutputStack)) { + int aFluidToPutIntoHatch = aOutputStack.amount; + // Not Enough space to insert all of the fluid. + // We fill this hatch and add a smaller Fluidstack back to the iterator. + if (aSpaceLeftInHatch < aFluidToPutIntoHatch) { + // Copy existing Hatch Stack + FluidStack aNewHatchStack = aHatchStack.copy(); + aNewHatchStack.amount = 0; + // Copy existing Hatch Stack again + FluidStack aNewOutputStack = aHatchStack.copy(); + aNewOutputStack.amount = 0; + // How much fluid do we have left after we fill the hatch? + int aFluidLeftAfterInsert = aFluidToPutIntoHatch - aSpaceLeftInHatch; + // Set new stacks to appropriate values + aNewHatchStack.amount = aHatch.getCapacity(); + aNewOutputStack.amount = aFluidLeftAfterInsert; + // Remove fluid from output list, merge success + aOutputFluids.remove(aOutputStack); + // Remove hatch from hatch list, data is now invalid. + aOutputHatches.remove(aHatchData); + // Add remaining Fluid to Output list + aOutputFluids.add(aNewOutputStack); + // Re-add hatch to hatch list, with new data. + Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount); + aOutputHatches.add(aNewHatchData); + continue aHatchIterator; + } + // We can fill this hatch perfectly (rare case), may as well add it directly to the full list. + else if (aSpaceLeftInHatch == aFluidToPutIntoHatch) { + // Copy Old Stack + FluidStack aNewHatchStack = aHatchStack.copy(); + // Add in amount from output stack + aNewHatchStack.amount += aOutputStack.amount; + // Remove fluid from output list, merge success + aOutputFluids.remove(aOutputStack); + // Remove hatch from hatch list, data is now invalid. + aOutputHatches.remove(aHatchData); + // Re-add hatch to hatch list, with new data. + Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount); + aOutputHatches.add(aNewHatchData); + continue aHatchIterator; + } + // We have more space than we need to merge, so we remove the stack from the output list and update the hatch list. + else { + // Copy Old Stack + FluidStack aNewHatchStack = aHatchStack.copy(); + // Add in amount from output stack + aNewHatchStack.amount += aOutputStack.amount; + // Remove fluid from output list, merge success + aOutputFluids.remove(aOutputStack); + // Remove hatch from hatch list, data is now invalid. + aOutputHatches.remove(aHatchData); + // Re-add hatch to hatch list, with new data. + Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount); + aOutputHatches.add(aNewHatchData); + // Check next fluid + continue aFluidMatch; + } + + } + else { + continue aFluidMatch; + } + } + } + } + + for (Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aFreeHatchCheck : aOutputHatches) { + // Free Hatch + if (aFreeHatchCheck.getValue_2() == null || aFreeHatchCheck.getValue_3() == 0 || aFreeHatchCheck.getValue_1().getFluid() == null) { + aEmptyFluidHatches++; + } + } + + // We have Fluid Stacks we did not merge. Do we have space? + if (aOutputFluids.size() > 0) { + // Not enough space to add fluids. + if (aOutputFluids.size() < aEmptyFluidHatches) { + Logger.INFO("Failed to find enough space for all fluid outputs."); + return false; } } - if (!tCanBufferFluid) return false; + + /* + * End Fluid Management + */ } + return true; } @@ -534,20 +775,17 @@ GT_MetaTileEntity_MultiBlockBase { public static Method aLogger = null; public void log(String s) { - - boolean isDebugLogging = CORE.DEBUG; - boolean reset = false; - - if (reset) { - if (isDebugLogging) { + boolean reset = true; + if (reset || aLogger == null) { + if (!AsmConfig.disableAllLogging) { aLogger = ReflectionUtils.getMethod( Logger.class, "INFO", String.class - ); + ); } else { aLogger = ReflectionUtils.getMethod( Logger.class, "MACHINE_INFO", String.class - ); + ); } } try { @@ -555,6 +793,7 @@ GT_MetaTileEntity_MultiBlockBase { } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + e.printStackTrace(); } } @@ -739,8 +978,7 @@ GT_MetaTileEntity_MultiBlockBase { ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { - // Based on the Processing Array. A bit overkill, but very flexible. - + // Based on the Processing Array. A bit overkill, but very flexible. // Reset outputs and progress stats this.mEUt = 0; @@ -800,6 +1038,7 @@ GT_MetaTileEntity_MultiBlockBase { // -- Try not to fail after this point - inputs have already been consumed! -- + // Convert speed bonus to duration multiplier // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); @@ -1315,7 +1554,7 @@ GT_MetaTileEntity_MultiBlockBase { boolean result = false; if (this.mInventory[1] == null) { this.mInventory[1] = aNewGuiSlotContents != null ? aNewGuiSlotContents.copy() : null; - aNewGuiSlotContents = null; + this.depleteInput(aNewGuiSlotContents); this.updateSlots(); result = true; } @@ -1383,36 +1622,36 @@ GT_MetaTileEntity_MultiBlockBase { public boolean causeMaintenanceIssue() { boolean b = false; switch (this.getBaseMetaTileEntity().getRandomNumber(6)) { - case 0 : { - this.mWrench = false; - b = true; - break; - } - case 1 : { - this.mScrewdriver = false; - b = true; - break; - } - case 2 : { - this.mSoftHammer = false; - b = true; - break; - } - case 3 : { - this.mHardHammer = false; - b = true; - break; - } - case 4 : { - this.mSolderingTool = false; - b = true; - break; - } - case 5 : { - this.mCrowbar = false; - b = true; - break; - } + case 0 : { + this.mWrench = false; + b = true; + break; + } + case 1 : { + this.mScrewdriver = false; + b = true; + break; + } + case 2 : { + this.mSoftHammer = false; + b = true; + break; + } + case 3 : { + this.mHardHammer = false; + b = true; + break; + } + case 4 : { + this.mSolderingTool = false; + b = true; + break; + } + case 5 : { + this.mCrowbar = false; + b = true; + break; + } } return b; } @@ -1849,7 +2088,7 @@ GT_MetaTileEntity_MultiBlockBase { @SuppressWarnings("rawtypes") public boolean isThisHatchMultiDynamo(Object aMetaTileEntity){ - Class mDynamoClass; + Class<?> mDynamoClass; mDynamoClass = ReflectionUtils.getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti"); if (mDynamoClass != null){ if (mDynamoClass.isInstance(aMetaTileEntity)){ @@ -1894,7 +2133,7 @@ GT_MetaTileEntity_MultiBlockBase { try { return (int) calculatePollutionReduction.invoke(i, g); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - + } } return 0; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java index d507b3c814..aad05f1730 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java @@ -36,6 +36,7 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.LangUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; @@ -131,32 +132,84 @@ public class Meta_GT_Proxy { public static void fixIC2FluidNames() { //Fix IC2 Hot Water name try { - String aNewHeatedWaterName = "Heated Water"; - Logger.INFO("Renaming [IC2 Hotspring Water] --> ["+aNewHeatedWaterName+"].");LanguageRegistry.instance().addStringLocalization("fluidHotWater", "Heated Water"); - LanguageRegistry.instance().addStringLocalization("fluidHotWater", aNewHeatedWaterName); - LanguageRegistry.instance().addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName); - GT_LanguageManager.addStringLocalization("fluidHotWater", aNewHeatedWaterName); - GT_LanguageManager.addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName); - - Block b = BlocksItems.getFluidBlock(InternalName.fluidHotWater); - if (b != null) { - LanguageRegistry.addName(ItemUtils.getSimpleStack(b), aNewHeatedWaterName); - LanguageRegistry.instance().addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName); - GT_LanguageManager.addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName); - } - Fluid f = BlocksItems.getFluid(InternalName.fluidHotWater); - if (f != null) { - LanguageRegistry.instance().addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName); - GT_LanguageManager.addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName); - int aDam = FluidRegistry.getFluidID(f); - ItemStack s = ItemList.Display_Fluid.getWithDamage(1, aDam); - if (s != null) { - LanguageRegistry.addName(s, aNewHeatedWaterName); - } - } + String aNewHeatedWaterName = "Heated Water"; + Logger.INFO("Renaming [IC2 Hotspring Water] --> ["+aNewHeatedWaterName+"].");LanguageRegistry.instance().addStringLocalization("fluidHotWater", "Heated Water"); + LanguageRegistry.instance().addStringLocalization("fluidHotWater", aNewHeatedWaterName); + LanguageRegistry.instance().addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName); + GT_LanguageManager.addStringLocalization("fluidHotWater", aNewHeatedWaterName); + GT_LanguageManager.addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName); + + Block b = BlocksItems.getFluidBlock(InternalName.fluidHotWater); + if (b != null) { + LanguageRegistry.addName(ItemUtils.getSimpleStack(b), aNewHeatedWaterName); + LanguageRegistry.instance().addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName); + GT_LanguageManager.addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName); + } + Fluid f = BlocksItems.getFluid(InternalName.fluidHotWater); + if (f != null) { + LanguageRegistry.instance().addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName); + GT_LanguageManager.addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName); + int aDam = FluidRegistry.getFluidID(f); + ItemStack s = ItemList.Display_Fluid.getWithDamage(1, aDam); + if (s != null) { + LanguageRegistry.addName(s, aNewHeatedWaterName); + } + } + + String[] aLangs = new String[] { + "de_DE", + "en_US", + "en_GB", + "en_IC", + "es_AR", + "es_ES", + "es_MX", + "es_UY", + "es_VE", + "fr_CA", + "fr_FR", + "it_IT", + "ko_KR", + "pt_BR", + "pt_PT", + "ru_RU", + "sv_SE", + "tr_TR", + "zh_CN", + "zh_TW", + }; + String[] aLangValues = new String[] { + "Erhitztes Wasser", + "Heated Water", + "Heated Water", + "Heated Water", + "Agua caliente", + "Agua caliente", + "Agua caliente", + "Agua caliente", + "Agua caliente", + "Eau chauffée", + "Eau chauffée", + "Acqua riscaldata", + "온수", + "Água aquecida", + "Água aquecida", + "Вода с подогревом", + "Uppvärmt vatten", + "Isıtılmış Su", + "热水", + "热水", + + }; + for (int i=0;i<aLangs.length;i++) { + Logger.REFLECTION("Trying to inject new lang data for "+aLangs[i]+", using value: "+aLangValues[i]); + LangUtils.rewriteEntryForLanguageRegistry(aLangs[i], "fluidHotWater", aLangValues[i]); + LangUtils.rewriteEntryForLanguageRegistry(aLangs[i], "ic2.fluidHotWater", aLangValues[i]); + } } + catch (Throwable t) { - + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java index 763a4a129d..6201a782de 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java @@ -63,7 +63,6 @@ public class GTPP_CapeRenderer extends RenderPlayer { private final ArrayList<String> mData; public GTPP_CapeRenderer() { - setRenderManager(RenderManager.instance); downloadCapeList(); ArrayList<String> aTemp = new ArrayList<String>(); try { @@ -76,10 +75,19 @@ public class GTPP_CapeRenderer extends RenderPlayer { } private static boolean hasResourceChecked = false; + private static boolean hasSetRenderer = false; private boolean hasCape = false; private ResourceLocation tResource = null; public synchronized void receiveRenderSpecialsEvent(RenderPlayerEvent.Specials.Pre aEvent) { + if (this.renderManager == null) { + hasSetRenderer = false; + } + if (!hasSetRenderer) { + if (RenderManager.instance != null) { + setRenderManager(RenderManager.instance); + } + } AbstractClientPlayer aPlayer = (AbstractClientPlayer) aEvent.entityPlayer; if (!ConfigSwitches.enableCustomCapes) { aEvent.setCanceled(true); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java index 1ee27afbf0..2f00600af6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java @@ -22,6 +22,7 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.core.util.sys.KeyboardUtils; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GregtechMetaEnergyBuffer; @@ -48,7 +49,7 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { @Override public String[] getDescription() { - return new String[] {this.mDescription, "Use Screwdriver to change voltage", EnumChatFormatting.GREEN+"CREATIVE MACHINE"}; + return new String[] {this.mDescription, "Use Screwdriver to change voltage", "Hold Shift while using Screwdriver to change amperage", EnumChatFormatting.GREEN+"CREATIVE MACHINE"}; } /* @@ -177,43 +178,48 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (this.mTier < 9) { - this.mTier++; + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (KeyboardUtils.isShiftKeyDown()) { + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); } else { - this.mTier = 0; - } - this.markDirty(); - try { - Field field = ReflectionUtils.getField(this.getClass(), "mTextures"); - field.setAccessible(true); - Field modifiersField = Field.class.getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); - ITexture[][][] V = getTextureSet(null); - if (V != null) { - Logger.REFLECTION("Got Valid Textures."); - if (this.getBaseMetaTileEntity().isClientSide()) { - Logger.REFLECTION("Clientside Call."); - Logger.REFLECTION("Refreshing Textures on buffer."); - field.set(this, V); - Logger.REFLECTION("Refreshed Textures on buffer."); + if (this.mTier < (CORE.GTNH ? GT_Values.V.length : 9)) { + this.mTier++; + } + else { + this.mTier = 0; + } + this.markDirty(); + try { + Field field = ReflectionUtils.getField(this.getClass(), "mTextures"); + field.setAccessible(true); + Field modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); + ITexture[][][] V = getTextureSet(null); + if (V != null) { + Logger.REFLECTION("Got Valid Textures."); + if (this.getBaseMetaTileEntity().isClientSide()) { + Logger.REFLECTION("Clientside Call."); + Logger.REFLECTION("Refreshing Textures on buffer."); + field.set(this, V); + Logger.REFLECTION("Refreshed Textures on buffer."); + } + else { + Logger.REFLECTION("Serverside Call."); + } } else { - Logger.REFLECTION("Serverside Call."); - } + Logger.REFLECTION("Bad mTextures setter."); + } } - else { - Logger.REFLECTION("Bad mTextures setter."); - } - } - catch (Throwable t) { - //Bad refresh. - t.printStackTrace(); - Logger.REFLECTION("Bad mTextures setter."); - } - PlayerUtils.messagePlayer(aPlayer, "Now running at "+GT_Values.VOLTAGE_NAMES[this.mTier]+". ["+MathUtils.isNumberEven(this.mTier)+"]"); - super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + catch (Throwable t) { + //Bad refresh. + t.printStackTrace(); + Logger.REFLECTION("Bad mTextures setter."); + } + PlayerUtils.messagePlayer(aPlayer, "Now running at "+GT_Values.VOLTAGE_NAMES[this.mTier]+"."); + } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java index ed312b704d..7717bf6379 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java @@ -5,6 +5,7 @@ import static gregtech.api.enums.GT_Values.E; import java.util.HashSet; import java.util.List; +import cpw.mods.fml.common.registry.LanguageRegistry; import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.ITexture; @@ -22,6 +23,7 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.slots.SlotChemicalPlantInput; import gtPlusPlus.xmod.gregtech.api.gui.fluidreactor.Container_FluidReactor; import gtPlusPlus.xmod.gregtech.api.gui.fluidreactor.GUI_FluidReactor; +import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -142,7 +144,7 @@ public class GregtechMetaTileEntity_ChemicalReactor extends GT_MetaTileEntity_Ba @Override public int getCapacity() { - return 8000 * Math.max(1, this.mTier); + return 32000 * Math.max(1, this.mTier) / 4; } @Override @@ -255,7 +257,7 @@ public class GregtechMetaTileEntity_ChemicalReactor extends GT_MetaTileEntity_Ba @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - // Re-implement basic machine logic from the ground up. + // Re-implement basic machine logic from the ground up.= if (aBaseMetaTileEntity.isServerSide()) { this.mCharge = aBaseMetaTileEntity.getStoredEU() / 2L > aBaseMetaTileEntity.getEUCapacity() / 3L; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java index 611cb4da71..b8517533e6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java @@ -55,7 +55,7 @@ extends GregtechMeta_MultiBlockBase { "1x Input Bus", "1x Output Bus", "1x Energy Hatch" - }; + }; } @Override @@ -101,7 +101,7 @@ extends GregtechMeta_MultiBlockBase { public boolean checkRecipe(final ItemStack aStack) { return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 0); } - + @Override public int getMaxParallelRecipes() { return this.mLevel * 12; @@ -118,19 +118,21 @@ extends GregtechMeta_MultiBlockBase { final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; this.mLevel = 0; if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { + Logger.INFO("No air? "+xDir+", 1, "+zDir); return false; } final byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir); switch (tUsedMeta) { - case 2: - this.mLevel = 1; - break; - case 3: - this.mLevel = 2; - break; - default: - return false; + case 2: + this.mLevel = 1; + break; + case 3: + this.mLevel = 2; + break; + default: + Logger.INFO("Bad Heating Coils."); + return false; } for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { @@ -140,7 +142,7 @@ extends GregtechMeta_MultiBlockBase { Logger.INFO("Heating Coils missing."); return false; } - + if (!isValidBlockForStructure(tTileEntity2, TAE.GTPP_INDEX(1), true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j), ModBlocks.blockCasingsMisc, 1)) { Logger.INFO("Casings missing from top layer of coke oven."); return false; @@ -158,7 +160,7 @@ extends GregtechMeta_MultiBlockBase { } } } - } + } return true; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java index c55fe10829..6e7039f8ca 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java @@ -292,7 +292,19 @@ extends GregtechMeta_MultiBlockBase @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()){ - //Utils.LOG_INFO("tick: "+aTick); + // Reload Lava Filter + if (this.getGUIItemStack() == null) { + if (this.mInputBusses.size() > 0) { + for (GT_MetaTileEntity_Hatch_InputBus aBus : this.mInputBusses) { + for (ItemStack aStack : aBus.mInventory) { + if (aStack.getItem() instanceof ItemLavaFilter) { + this.setGUIItemStack(aStack); + } + } + } + } + } + if (this.mEUt > 0){ if (aTick % 600L == 0L){ damageFilter(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java new file mode 100644 index 0000000000..004fd8d94e --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java @@ -0,0 +1,622 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.algae; + +import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.apache.commons.lang3.ArrayUtils; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.TAE; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.Recipe_GT; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.item.chemistry.AgriculturalChem; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import ic2.core.init.BlocksItems; +import ic2.core.init.InternalName; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase { + + private int mLevel = -1; + + public GregtechMTE_AlgaePondBase(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMTE_AlgaePondBase(final String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMTE_AlgaePondBase(this.mName); + } + + @Override + public String getMachineType() { + return "Algae Pond"; + } + + @Override + public String[] getTooltip() { + return new String[] { + "Grows Algae!", + "Controller Block for the Algae Farm", + "Size: 9x3x9 [WxHxL] (open)", + "X X", + "X X", + "XXXXXXXXX", + "Can process (Tier * 10) recipes", + "Machine Hulls (all bottom layer)", + "Sterile Farm Casings (all non-hatches)", + "Controller (front centered)", + "All hatches must be on the bottom layer", + "All hulls must be the same tier, this dictates machine speed", + "Does not require power or maintenance", + "1x Output Bus", + "1x Input Bus (optional)", + "1x Input Hatch (fill with water)", + }; + } + + @Override + public String getSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(207)); + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + + int aID = TAE.getIndexFromPage(1, 15); + if (mLevel > -1) { + aID = mLevel; + } + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[aID], new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[aID]}; + } + + @Override + public boolean hasSlotInGUI() { + return true; + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return null; + } + + @Override + public boolean isFacingValid(final byte aFacing) { + return aFacing > 1; + } + + @Override + public int getMaxParallelRecipes() { + return (this.mLevel+1) * 10; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; + } + + @Override + public boolean checkMultiblock(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + + this.mLevel = 0; + + + // Get Facing direction + int mCurrentDirectionX; + int mCurrentDirectionZ; + + int mOffsetX_Lower = 0; + int mOffsetX_Upper = 0; + int mOffsetZ_Lower = 0; + int mOffsetZ_Upper = 0; + + mCurrentDirectionX = 4; + mCurrentDirectionZ = 4; + + mOffsetX_Lower = -4; + mOffsetX_Upper = 4; + mOffsetZ_Lower = -4; + mOffsetZ_Upper = 4; + + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX + * mCurrentDirectionX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ + * mCurrentDirectionZ; + + // Get Expected Tier + Block aCasingBlock = aBaseMetaTileEntity.getBlockAtSide((byte) 0); + int aCasingMeta = aBaseMetaTileEntity.getMetaIDAtSide((byte) 0); + + // Bad Casings + if ((aCasingBlock != GregTech_API.sBlockCasings1) || aCasingMeta > 9) { + return false; + } + else { + mLevel = aCasingMeta; + } + + + /* + * if (!(aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir))) { return false; } + */ + int tAmount = 0; + check : for (int i = mOffsetX_Lower; i <= mOffsetX_Upper; ++i) { + for (int j = mOffsetZ_Lower; j <= mOffsetZ_Upper; ++j) { + for (int h = -1; h < 2; ++h) { + if ((h != 0) || ((((xDir + i != 0) || (zDir + j != 0))) && (((i != 0) || (j != 0))))) { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + + Logger.INFO("X: " + i + " | Z: " + j+" | Tier: "+mLevel); + if (h == -1 && tTileEntity != null && addToMachineList(tTileEntity, mLevel)) { + continue; + } + else if (h != -1 && tTileEntity != null) { + Logger.INFO("Found hatch in wrong place, expected casing."); + return false; + } + + Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); + + if ((tBlock == ModBlocks.blockCasings2Misc) && (tMeta == 15) && (h >= 0)) { + ++tAmount; + } + else if ((tBlock == GregTech_API.sBlockCasings1) && (tMeta == mLevel) && (h == -1)) { + ++tAmount; + } + else if ((tBlock == GregTech_API.sBlockCasings1) && (tMeta != mLevel) && (h == -1)) { + Logger.INFO("Found wrong tiered casing."); + return false; + } + else { + if ((i != mOffsetX_Lower && j != mOffsetZ_Lower && i != mOffsetX_Upper + && j != mOffsetZ_Upper) && (h == 0 || h == 1)) { + continue; + } else { + if (tBlock.getLocalizedName().contains("gt.blockmachines") || tBlock == Blocks.water + || tBlock == Blocks.flowing_water + || tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)) { + continue; + + } else { + Logger.INFO("[x] Did not form - Found: " + tBlock.getLocalizedName() + " | " + + tBlock.getDamageValue(aBaseMetaTileEntity.getWorld(), + aBaseMetaTileEntity.getXCoord() + i, + aBaseMetaTileEntity.getYCoord(), + aBaseMetaTileEntity.getZCoord() + j) + + " | Special Meta: " + + (tTileEntity == null ? "0" : tTileEntity.getMetaTileID())); + Logger.INFO("[x] Did not form - Found: " + + (aBaseMetaTileEntity.getXCoord() + xDir + i) + " | " + + aBaseMetaTileEntity.getYCoord() + " | " + + (aBaseMetaTileEntity.getZCoord() + zDir + j)); + break check; + } + } + + } + + } + } + } + } + if ((tAmount >= 64)) { + Logger.INFO("Made structure."); + } else { + Logger.INFO("Did not make structure."); + } + return (tAmount >= 64); + } + + public boolean checkForWater() { + + // Get Facing direction + IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); + int mDirectionX = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int mCurrentDirectionX; + int mCurrentDirectionZ; + int mOffsetX_Lower = 0; + int mOffsetX_Upper = 0; + int mOffsetZ_Lower = 0; + int mOffsetZ_Upper = 0; + + mCurrentDirectionX = 4; + mCurrentDirectionZ = 4; + + mOffsetX_Lower = -4; + mOffsetX_Upper = 4; + mOffsetZ_Lower = -4; + mOffsetZ_Upper = 4; + + // if (aBaseMetaTileEntity.fac) + + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX + * mCurrentDirectionX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ + * mCurrentDirectionZ; + + int tAmount = 0; + for (int i = mOffsetX_Lower + 1; i <= mOffsetX_Upper - 1; ++i) { + for (int j = mOffsetZ_Lower + 1; j <= mOffsetZ_Upper - 1; ++j) { + for (int h = 0; h < 2; h++) { + Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + // byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); + if (tBlock == Blocks.air || tBlock == Blocks.flowing_water || tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)) { + if (this.getStoredFluids() != null) { + for (FluidStack stored : this.getStoredFluids()) { + if (stored.isFluidEqual(FluidUtils.getFluidStack("water", 1))) { + if (stored.amount >= 1000) { + // Utils.LOG_WARNING("Going to try swap an air block for water from inut bus."); + stored.amount -= 1000; + Block fluidUsed = Blocks.water; + aBaseMetaTileEntity.getWorld().setBlock( + aBaseMetaTileEntity.getXCoord() + xDir + i, + aBaseMetaTileEntity.getYCoord() + h, + aBaseMetaTileEntity.getZCoord() + zDir + j, fluidUsed); + + } + } + } + } + } + tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + if (tBlock == Blocks.water || tBlock == Blocks.flowing_water) { + ++tAmount; + // Logger.INFO("Found Water"); + } + } + } + } + + boolean isValidWater = tAmount >= 60; + + if (isValidWater) { + Logger.INFO("Filled structure."); + return true; + } + else { + return false; + } + } + + @Override + public int getMaxEfficiency(final ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(final ItemStack aStack) { + return 0; + } + + @Override + public int getAmountOfOutputs() { + return 1; + } + + @Override + public boolean explodesOnComponentBreak(final ItemStack aStack) { + return false; + } + + @Override + public String getCustomGUIResourceName() { + return null; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPreTick(aBaseMetaTileEntity, aTick); + this.fixAllMaintenanceIssue(); + } + + @Override + public boolean checkRecipe(final ItemStack aStack) { + return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 0); + } + + public boolean checkRecipeGeneric( + ItemStack[] aItemInputs, FluidStack[] aFluidInputs, + int aMaxParallelRecipes, int aEUPercent, + int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { + + if (this.mLevel < 0) { + Logger.INFO("Bad Tier."); + return false; + } + + if (mRecipeCache.isEmpty()) { + Logger.INFO("Generating Recipes."); + generateRecipes(); + } + + if (mRecipeCache.isEmpty() || !checkForWater()) { + if (mRecipeCache.isEmpty()) { + Logger.INFO("No Recipes."); + } + if (!checkForWater()) { + Logger.INFO("Not enough Water."); + } + return false; + } + + // Reset outputs and progress stats + this.mEUt = 0; + this.mMaxProgresstime = 0; + this.mOutputItems = new ItemStack[]{}; + this.mOutputFluids = new FluidStack[]{}; + + Logger.INFO("Running checkRecipeGeneric(0)"); + + GT_Recipe tRecipe = getTieredRecipeFromCache(this.mLevel); + + this.mLastRecipe = tRecipe; + + if (tRecipe == null) { + return false; + } + + if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { + return false; + } + + + // -- Try not to fail after this point - inputs have already been consumed! -- + + + + // Convert speed bonus to duration multiplier + // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. + aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); + float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent); + this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor * 24); + + this.mEUt = 0; + + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + // Overclock + if (this.mEUt <= 16) { + this.mEUt = (this.mEUt * (1 << mLevel - 1) * (1 << mLevel - 1)); + this.mMaxProgresstime = (this.mMaxProgresstime / (1 << mLevel - 1)); + } else { + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(mLevel - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + + // Collect fluid outputs + FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length]; + for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) { + if (tRecipe.getFluidOutput(h) != null) { + tOutputFluids[h] = tRecipe.getFluidOutput(h).copy(); + tOutputFluids[h].amount *= aMaxParallelRecipes; + } + } + + // Collect output item types + ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length]; + for (int h = 0; h < tRecipe.mOutputs.length; h++) { + if (tRecipe.getOutput(h) != null) { + tOutputItems[h] = tRecipe.getOutput(h).copy(); + tOutputItems[h].stackSize = 0; + } + } + + // Set output item stack sizes (taking output chance into account) + for (int f = 0; f < tOutputItems.length; f++) { + if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) { + for (int g = 0; g < aMaxParallelRecipes; g++) { + if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f)) + tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize; + } + } + } + + tOutputItems = removeNulls(tOutputItems); + + // Sanitize item stack size, splitting any stacks greater than max stack size + List<ItemStack> splitStacks = new ArrayList<ItemStack>(); + for (ItemStack tItem : tOutputItems) { + while (tItem.getMaxStackSize() < tItem.stackSize) { + ItemStack tmp = tItem.copy(); + tmp.stackSize = tmp.getMaxStackSize(); + tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize(); + splitStacks.add(tmp); + } + } + + if (splitStacks.size() > 0) { + ItemStack[] tmp = new ItemStack[splitStacks.size()]; + tmp = splitStacks.toArray(tmp); + tOutputItems = ArrayUtils.addAll(tOutputItems, tmp); + } + + // Strip empty stacks + List<ItemStack> tSList = new ArrayList<ItemStack>(); + for (ItemStack tS : tOutputItems) { + if (tS.stackSize > 0) tSList.add(tS); + } + tOutputItems = tSList.toArray(new ItemStack[tSList.size()]); + + // Commit outputs + this.mOutputItems = tOutputItems; + this.mOutputFluids = tOutputFluids; + updateSlots(); + + // Play sounds (GT++ addition - GT multiblocks play no sounds) + startProcess(); + + Logger.INFO("GOOD RETURN - 1"); + return true; + + } + + private boolean isUsingCompost(ItemStack[] aItemInputs) { + ItemStack aCompost = ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1); + for (ItemStack i : aItemInputs) { + if (GT_Utility.areStacksEqual(aCompost, i)) { + if (i.stackSize >= 8) { + return true; + } + else { + continue; + } + } + } + return false; + } + + private GT_Recipe generateAlgaeOutput(boolean aUsingCompost) { + + // Type Safety + if (this.mLevel < 0) { + return null; + } + int[] aBrownChance = new int[] { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, + 5, 5, + 6, 7, 8, 9, 10 + }; + int[] aGoldChance = new int[] { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, + 3, 3, 3, + 4, 4, + 5 + }; + int[] aRedChance = new int[] { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, + 2 + }; + + ItemStack aAlgaeBasic = ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, MathUtils.randInt(20, 60)); + ItemStack aAlgaeBasic2 = ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, MathUtils.randInt(20, 60)); + ItemStack aAlgaeGreen = ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(10, 60)); + ItemStack aAlgaeBrown = ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, MathUtils.getRandomFromArray(aBrownChance)); + ItemStack aAlgaeGoldenBrown = ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, MathUtils.getRandomFromArray(aGoldChance)); + ItemStack aAlgaeRed = ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, MathUtils.getRandomFromArray(aRedChance)); + + // Make it use 8 compost if we have some available + ItemStack aCompost = ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 8); + ItemStack[] aInputs = new ItemStack[] {}; + if (aUsingCompost) { + aInputs = new ItemStack[] { + aCompost + }; + } + + ItemStack[] aOutputs = new ItemStack[] { + aAlgaeBasic, aAlgaeBasic2, aAlgaeGreen, + aAlgaeBrown, aAlgaeGoldenBrown, + aAlgaeRed + }; + + // 20 ticks per second, 60 seconds per minute, 20 minutes per MC day, divide by 24 portions. + int aMinecraftHour = (20 * 60 * 20 / 24); + + GT_Recipe tRecipe = new Recipe_GT( + false, + aInputs, + aOutputs, + (Object) null, + new int[] {}, + new FluidStack[] {GT_Values.NF}, + new FluidStack[] {GT_Values.NF}, + aMinecraftHour * MathUtils.randInt(24, 72), // Time + 0, + 0); + + + return tRecipe; + } + + + + + private static final HashMap<Integer, AutoMap<GT_Recipe>> mRecipeCache = new HashMap<Integer, AutoMap<GT_Recipe>>(); + + private final void generateRecipes() { + for (int i=0;i<10;i++) { + getTieredRecipeFromCache(i); + } + } + + public GT_Recipe getTieredRecipeFromCache(int aTier) { + + AutoMap<GT_Recipe> aTemp = mRecipeCache.get(aTier); + if (aTemp == null || aTemp.isEmpty()) { + aTemp = new AutoMap<GT_Recipe>(); + mRecipeCache.put(aTier, aTemp); + } + if (aTemp.size() < 500) { + for (int i=aTemp.size();i<500;i++) { + aTemp.put(generateAlgaeOutput(false)); + } + } + int aIndex = MathUtils.randInt(0, aTemp.isEmpty() ? 1 : aTemp.size()); + return aTemp.get(aIndex); + } + + + + + + + + + + + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index d43adb2be3..cd853dfb0d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -706,6 +706,17 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { if (ttTest != null) { T = ttTest; } + else { + Method[] aDump = TTRecipeAdder.getDeclaredMethods(); + for (Method m : aDump) { + if (m != null) { + Logger.INFO("Found "+m.getName()+" | "+m.getModifiers()+" | "+ArrayUtils.toString(m.getParameters(), "EMPTY")+""); + if (m.getName().toLowerCase().equals("addresearchableassemblylinerecipe")){ + Logger.INFO("Types: "+ArrayUtils.toString(m.getParameterTypes())); + } + } + } + } } } else { @@ -787,7 +798,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { Logger.INFO("Failed to generate TecTech recipe for "+ItemUtils.getItemName(aResearchItem)+", please report this to Alkalus."); } catch (Throwable t) { - + t.printStackTrace(); } } return (boolean) mAssemblyLine.invoke(GT_Values.RA, aResearchItem, aResearchTime, aInputs, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechAlgaeContent.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechAlgaeContent.java new file mode 100644 index 0000000000..57a726f7e8 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechAlgaeContent.java @@ -0,0 +1,24 @@ +package gtPlusPlus.xmod.gregtech.registration.gregtech; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.algae.GregtechMTE_AlgaePondBase; + +public class GregtechAlgaeContent { + + public static void run() { + if (LoadedMods.Gregtech) { + Logger.INFO("Gregtech5u Content | Registering Algae Content."); + run1(); + } + } + + private static void run1() { + // Industrial Centrifuge Multiblock + GregtechItemList.AlgaeFarm_Controller.set( + new GregtechMTE_AlgaePondBase(997, "algaefarm.controller.tier.single", "Algae Farm").getStackForm(1L)); + + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java index 45a23fb184..9f67363302 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java @@ -11,6 +11,7 @@ import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler_Adv; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Naquadah; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_TurbineProvider; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Input; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Output; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GT_MetaTileEntity_Hatch_CustomFluidBase; @@ -62,6 +63,19 @@ public class GregtechCustomHatches { "Naquadah Reactor Input hatch" // Local name ).getStackForm(1L)); + + GregtechItemList.Hatch_Input_TurbineHousing.set(new GT_MetaTileEntity_Hatch_TurbineProvider(31025, // ID + "hatch.turbine.input.tier.00", // unlocal name + "Turbine Housing", // Local name + 8 + ).getStackForm(1L)); + + + + + + + } private static void run2() { diff --git a/src/Java/gtPlusPlus/xmod/ic2/item/CustomKineticRotor.java b/src/Java/gtPlusPlus/xmod/ic2/item/CustomKineticRotor.java new file mode 100644 index 0000000000..e433396a1b --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/ic2/item/CustomKineticRotor.java @@ -0,0 +1,274 @@ +package gtPlusPlus.xmod.ic2.item; + +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.lib.LoadedMods; +import ic2.api.item.IKineticRotor; +import ic2.core.IC2; +import ic2.core.block.kineticgenerator.gui.GuiWaterKineticGenerator; +import ic2.core.block.kineticgenerator.gui.GuiWindKineticGenerator; +import net.minecraft.client.Minecraft; +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.util.IIcon; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; + +public class CustomKineticRotor extends Item implements IKineticRotor { + + private final int mTier; + + @SideOnly(Side.CLIENT) + private final IIcon[] mTextures = new IIcon[6]; + + private static final String[] mRegistrationNames = new String[] { + "itemwoodrotor", "itemironrotor", "itemsteelrotor", "itemwcarbonrotor" + }; + + private static final String[] mUnlocalNames = new String[] { + "itemEnergeticRotor", + "itemTungstenSteelRotor", + "itemVibrantRotor", + "itemIridiumRotor", + "itemMagnaliumRotor", + "itemUltimetRotor", + }; + private static final int[] mMaxDurability = new int[] { + 512000, 809600, 1600000, 3200000 + }; + private static final int[] mRadius = new int[] { + 9, 11, 13, 15 + }; + private static final float[] mEfficiency = new float[] { + 0.9f, 1.0f, 1.2f, 1.5f + }; + private static final int[] mMinWindStrength = new int[] { + 12, 14, 16, 18 + }; + private static final int[] mMaxWindStrength = new int[] { + 80, 120, 160, 320 + }; + + private static final ResourceLocation[] mResourceLocations = new ResourceLocation[] { + new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorEnergeticModel.png"), + new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorTungstenSteelModel.png"), + new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorVibrantModel.png"), + new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorIridiumModel.png"), + new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorMagnaliumModel.png"), + new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorUltimetModel.png"), + }; + + private final int maxWindStrength; + private final int minWindStrength; + private final int radius; + private final float efficiency; + private final ResourceLocation renderTexture; + + public CustomKineticRotor(int aTier) { + mTier = aTier; + this.setMaxStackSize(1); + // Handle Differences if EIO is not loaded + if (!LoadedMods.EnderIO && (aTier == 0 || aTier == 2)) { + this.renderTexture = mResourceLocations[(aTier == 0 ? 4 : 5)]; + this.setUnlocalizedName(mUnlocalNames[(aTier == 0 ? 4 : 5)]); + } + else { + this.renderTexture = mResourceLocations[aTier]; + this.setUnlocalizedName(mUnlocalNames[aTier]); + } + this.setMaxDamage(mMaxDurability[aTier]); + this.radius = mRadius[aTier]; + this.efficiency = mEfficiency[aTier]; + this.minWindStrength = mMinWindStrength[aTier]; + this.maxWindStrength = mMaxWindStrength[aTier]; + this.setNoRepair(); + this.setCreativeTab(IC2.tabIC2); + GameRegistry.registerItem(this, mRegistrationNames[aTier]); + } + + @Override + public void setDamage(final ItemStack stack, final int damage) { + if (mTier < 3) { + super.setDamage(stack, damage); + } + } + + @Override + public void addInformation(final ItemStack itemStack, final EntityPlayer player, final List info, final boolean b) { + + info.add(StatCollector.translateToLocalFormatted("ic2.itemrotor.wind.info", new Object[]{this.minWindStrength, this.maxWindStrength})); + + GearboxType type = null; + if (Minecraft.getMinecraft().currentScreen != null && Minecraft.getMinecraft().currentScreen instanceof GuiWaterKineticGenerator) { + type = GearboxType.WATER; + } + else if (Minecraft.getMinecraft().currentScreen != null && Minecraft.getMinecraft().currentScreen instanceof GuiWindKineticGenerator) { + type = GearboxType.WIND; + } + + if (type != null) { + info.add(StatCollector.translateToLocal("ic2.itemrotor.fitsin." + this.isAcceptedType(itemStack, type))); + } + + } + + @Override + public int getDiameter(final ItemStack stack) + { + return this.radius; + } + + @Override + public ResourceLocation getRotorRenderTexture(final ItemStack stack) + { + return this.renderTexture; + } + + @Override + public float getEfficiency(final ItemStack stack) + { + return this.efficiency; + } + + @Override + public int getMinWindStrength(final ItemStack stack) + { + return this.minWindStrength; + } + + @Override + public int getMaxWindStrength(final ItemStack stack) + { + return this.maxWindStrength; + } + + @Override + public boolean isAcceptedType(final ItemStack stack, final IKineticRotor.GearboxType type){ + return (type == IKineticRotor.GearboxType.WIND) || (type == IKineticRotor.GearboxType.WATER); + } + + public String getUnlocalizedName() { + return "ic2." + super.getUnlocalizedName().substring(5); + } + + public String getUnlocalizedName(ItemStack itemStack) { + return this.getUnlocalizedName(); + } + + public String getItemStackDisplayName(ItemStack itemStack) { + return StatCollector.translateToLocal(this.getUnlocalizedName(itemStack)); + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return mTier < 3; + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int meta) { + if (!LoadedMods.EnderIO && (mTier == 0 || mTier == 2)) { + if (mTier == 0) { + return mTextures[4]; + } + else { + return mTextures[5]; + } + } + else { + return mTextures[mTier]; + } + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconIndex(ItemStack aIndex) { + if (!LoadedMods.EnderIO && (mTier == 0 || mTier == 2)) { + if (mTier == 0) { + return mTextures[4]; + } + else { + return mTextures[5]; + } + } + else { + return mTextures[mTier]; + } + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamageForRenderPass(int aDmg, int aPass) { + if (!LoadedMods.EnderIO && (mTier == 0 || mTier == 2)) { + if (mTier == 0) { + return mTextures[4]; + } + else { + return mTextures[5]; + } + } + else { + return mTextures[mTier]; + } + } + + @Override + protected String getIconString() { + return super.getIconString(); + } + + @Override + public int getDisplayDamage(ItemStack stack) { + return super.getDisplayDamage(stack); + } + + @Override + public double getDurabilityForDisplay(ItemStack stack) { + return super.getDurabilityForDisplay(stack); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { + if (!LoadedMods.EnderIO && (mTier == 0 || mTier == 2)) { + if (mTier == 0) { + return mTextures[4]; + } + else { + return mTextures[5]; + } + } + else { + return mTextures[mTier]; + } + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(ItemStack stack, int pass) { + if (!LoadedMods.EnderIO && (mTier == 0 || mTier == 2)) { + if (mTier == 0) { + return mTextures[4]; + } + else { + return mTextures[5]; + } + } + else { + return mTextures[mTier]; + } + } + + @Override + public void registerIcons(IIconRegister iconRegister) { + int aIndex = 0; + for (String y : mUnlocalNames) { + mTextures[aIndex++] = iconRegister.registerIcon(IC2.textureDomain + ":" + "rotors/" + y); + } + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/ic2/item/IC2_Items.java b/src/Java/gtPlusPlus/xmod/ic2/item/IC2_Items.java index 64aa7f99bf..862ba38748 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/item/IC2_Items.java +++ b/src/Java/gtPlusPlus/xmod/ic2/item/IC2_Items.java @@ -1,13 +1,9 @@ package gtPlusPlus.xmod.ic2.item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.item.base.CoreItem; import gtPlusPlus.core.lib.LoadedMods; -import ic2.core.IC2; -import ic2.core.init.InternalName; +import net.minecraft.item.ItemStack; public class IC2_Items { @@ -29,45 +25,33 @@ public class IC2_Items { public static ItemStack blockRTG; public static ItemStack blockKineticGenerator; - public static void register(){ + private static final String[] mData1 = new String[] {"itemEnergeticRotorBlade", "itemMagnaliumRotorBlade"}; + private static final String[] mData2 = new String[] {"itemEnergeticShaft", "itemMagnaliumShaft"}; + private static final String[] mData3 = new String[] {"itemVibrantRotorBlade", "itemUltimetRotorBlade"}; + private static final String[] mData4 = new String[] {"itemVibrantShaft", "itemUltimetShaft"}; + - if(LoadedMods.EnderIO){ - //Tier 1 - rotor_Blade_Material_1 = new ItemStack (new CoreItem("itemEnergeticRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - shaft_Material_1 = new ItemStack (new CoreItem("itemEnergeticShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - rotor_Material_1 = new ItemStack (new RotorBase(InternalName.itemwoodrotor, 9, 512000, 0.9F, 12, 80, new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorEnergeticModel.png")).setCreativeTab(AddToCreativeTab.tabMachines).setUnlocalizedName("itemEnergeticRotor")); - //Tier 2 - rotor_Blade_Material_2 = new ItemStack (new CoreItem("itemTungstenSteelRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - shaft_Material_2 = new ItemStack (new CoreItem("itemTungstenSteelShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - rotor_Material_2 = new ItemStack (new RotorBase(InternalName.itemironrotor, 11, 809600, 1.0F, 14, 120, new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorTungstenSteelModel.png")).setCreativeTab(AddToCreativeTab.tabMachines).setUnlocalizedName("itemTungstenSteelRotor")); - //Tier 3 - rotor_Blade_Material_3 = new ItemStack (new CoreItem("itemVibrantRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - shaft_Material_3 = new ItemStack (new CoreItem("itemVibrantShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - rotor_Material_3 = new ItemStack (new RotorBase(InternalName.itemsteelrotor, 13, 1600000, 1.2F, 16, 160, new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorVibrantModel.png")).setCreativeTab(AddToCreativeTab.tabMachines).setUnlocalizedName("itemVibrantRotor")); - //Tier 4 - rotor_Blade_Material_4 = new ItemStack (new CoreItem("itemIridiumRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - shaft_Material_4 = new ItemStack (new CoreItem("itemIridiumShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - rotor_Material_4 = new ItemStack (new RotorIridium(InternalName.itemwcarbonrotor, 15, 3200000, 1.5F, 18, 320, new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorIridiumModel.png")).setCreativeTab(AddToCreativeTab.tabMachines).setUnlocalizedName("itemIridiumRotor")); + public static void register(){ - } - else { - //Tier 1 - Magnalium - rotor_Blade_Material_1 = new ItemStack (new CoreItem("itemMagnaliumRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - shaft_Material_1 = new ItemStack (new CoreItem("itemMagnaliumShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - rotor_Material_1 = new ItemStack (new RotorBase(InternalName.itemwoodrotor, 9, 512000, 0.9F, 12, 80, new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorMagnaliumModel.png")).setCreativeTab(AddToCreativeTab.tabMachines).setUnlocalizedName("itemMagnaliumRotor")); - //Tier 2 - rotor_Blade_Material_2 = new ItemStack (new CoreItem("itemTungstenSteelRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - shaft_Material_2 = new ItemStack (new CoreItem("itemTungstenSteelShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - rotor_Material_2 = new ItemStack (new RotorBase(InternalName.itemironrotor, 11, 809600, 1.0F, 14, 120, new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorTungstenSteelModel.png")).setCreativeTab(AddToCreativeTab.tabMachines).setUnlocalizedName("itemTungstenSteelRotor")); - //Tier 3 - Ultimet - rotor_Blade_Material_3 = new ItemStack (new CoreItem("itemUltimetRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - shaft_Material_3 = new ItemStack (new CoreItem("itemUltimetShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - rotor_Material_3 = new ItemStack (new RotorBase(InternalName.itemsteelrotor, 13, 1600000, 1.2F, 16, 160, new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorUltimetModel.png")).setCreativeTab(AddToCreativeTab.tabMachines).setUnlocalizedName("itemUltimetRotor")); - //Tier 4 - rotor_Blade_Material_4 = new ItemStack (new CoreItem("itemIridiumRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - shaft_Material_4 = new ItemStack (new CoreItem("itemIridiumShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - rotor_Material_4 = new ItemStack (new RotorIridium(InternalName.itemwcarbonrotor, 15, 3200000, 1.5F, 18, 320, new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorIridiumModel.png")).setCreativeTab(AddToCreativeTab.tabMachines).setUnlocalizedName("itemIridiumRotor")); - } + int aIndexEIO = (LoadedMods.EnderIO ? 0 : 1); + + // Rotor Blades + rotor_Blade_Material_1 = new ItemStack (new CoreItem(mData1[aIndexEIO], AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); + rotor_Blade_Material_2 = new ItemStack (new CoreItem("itemTungstenSteelRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); + rotor_Blade_Material_3 = new ItemStack (new CoreItem(mData3[aIndexEIO], AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); + rotor_Blade_Material_4 = new ItemStack (new CoreItem("itemIridiumRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); + + // Rotor Shafts + shaft_Material_1 = new ItemStack (new CoreItem(mData2[aIndexEIO], AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); + shaft_Material_2 = new ItemStack (new CoreItem("itemTungstenSteelShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); + shaft_Material_3 = new ItemStack (new CoreItem(mData4[aIndexEIO], AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); + shaft_Material_4 = new ItemStack (new CoreItem("itemIridiumShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); + + // Rotors + rotor_Material_1 = new ItemStack (new CustomKineticRotor(0)); + rotor_Material_2 = new ItemStack (new CustomKineticRotor(1)); + rotor_Material_3 = new ItemStack (new CustomKineticRotor(2)); + rotor_Material_4 = new ItemStack (new CustomKineticRotor(3)); } } diff --git a/src/Java/gtPlusPlus/xmod/ic2/item/RotorIridium.java b/src/Java/gtPlusPlus/xmod/ic2/item/RotorIridium.java index aca1c6a310..b9dffbd371 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/item/RotorIridium.java +++ b/src/Java/gtPlusPlus/xmod/ic2/item/RotorIridium.java @@ -118,5 +118,10 @@ public class RotorIridium extends RotorBase{ this.setCustomDamage(stack, this.getCustomDamage(stack) + damage); return true; } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return false; + } } diff --git a/src/resources/assets/gregtech/lang/en_US.lang b/src/resources/assets/gregtech/lang/en_US.lang index 9989bffcf0..e2120fdf7b 100644 --- a/src/resources/assets/gregtech/lang/en_US.lang +++ b/src/resources/assets/gregtech/lang/en_US.lang @@ -212,7 +212,9 @@ achievement.decay.technetium99.desc=Cyclotron Product - +//24/11/19 +achievement.gt.blockmachines.hatch.turbine.input.tier.00=Turbine Housing +achievement.gt.blockmachines.hatch.turbine.input.tier.00.desc=[AL] Pickup this item to see the recipe in NEI diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_0.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_0.png Binary files differindex cbf604f2b3..cbf604f2b3 100644 --- a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_0.png +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_0.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_1.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_1.png Binary files differindex 3b7ac3d50e..3b7ac3d50e 100644 --- a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_1.png +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_1.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_2.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_2.png Binary files differindex a5a5e2c559..a5a5e2c559 100644 --- a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_2.png +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_2.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_3.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_3.png Binary files differindex b68c900ddd..b68c900ddd 100644 --- a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_3.png +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_3.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_4.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_4.png Binary files differindex df182aeaa5..df182aeaa5 100644 --- a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_4.png +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_4.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_0.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_0.png Binary files differindex 85bc3f16cd..85bc3f16cd 100644 --- a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_0.png +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_0.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_1.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_1.png Binary files differindex f82185ebdb..f82185ebdb 100644 --- a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_1.png +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_1.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_2.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_2.png Binary files differindex 345476e03c..345476e03c 100644 --- a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_2.png +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_2.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_3.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_3.png Binary files differindex 971164eb3e..971164eb3e 100644 --- a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_3.png +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_3.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_4.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_4.png Binary files differindex 5b5bac3ad2..5b5bac3ad2 100644 --- a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_4.png +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_4.png |