aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/item
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2018-05-13 01:46:31 +1000
committerGitHub <noreply@github.com>2018-05-13 01:46:31 +1000
commit4d15336cfb84a61d7609d75c683f21ea084f47bb (patch)
tree1e3e837486ab8843bd97951d3f0cfdf2f69dc0d5 /src/Java/gtPlusPlus/core/item
parent3ce52cc43f1b41ec0b4f9486afc188bd4d11c055 (diff)
downloadGT5-Unofficial-4d15336cfb84a61d7609d75c683f21ea084f47bb.tar.gz
GT5-Unofficial-4d15336cfb84a61d7609d75c683f21ea084f47bb.tar.bz2
GT5-Unofficial-4d15336cfb84a61d7609d75c683f21ea084f47bb.zip
Codeenvy (#273)
+ Added recipes for all Advanced Multis. + Added new casings for Advanced EBF. + Added Turbine Animations. + Added recipe for the Air Intake Hatch. + Added new textures for the Adv. Vac. Freezer and casings. % Gave old Adv. Vac. Freezer texture to Adv. EBF. % Swapped recipe materials for Adv. Vac. and EBF. + Added a book for Power Storage Solutions. + Added book for the FFPP. - Removed some useless Meta Tiles. (This removes advanced Mixer recipes, but not the tiles themselves.) $ Fixed issue with AIC tooltip. $ Fixed some chemical processing recipes. #266 $ Fixed Large Auto-Assembler Name. $ Possible fix for #239. $ Other Bug Fixes. $ Fixed Old School Circuits breaking Integrated Circuit Recipes. % Made all FFPP recipes require/produces 1/10th of the original fluid amounts. #268 % Made Adv. EBF. Use new casing textures. % Streamlined Old School Circuit function call locations to a single handler. % Cleaned up ASM Logging.
Diffstat (limited to 'src/Java/gtPlusPlus/core/item')
-rw-r--r--src/Java/gtPlusPlus/core/item/ModItems.java4
-rw-r--r--src/Java/gtPlusPlus/core/item/general/rfchargingpack/ChargingPackBase.java84
2 files changed, 88 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java
index 657c8f25ee..0f7c28d98d 100644
--- a/src/Java/gtPlusPlus/core/item/ModItems.java
+++ b/src/Java/gtPlusPlus/core/item/ModItems.java
@@ -18,6 +18,7 @@ import gtPlusPlus.core.block.base.BlockBaseModular;
import gtPlusPlus.core.block.base.BasicBlock.BlockTypes;
import gtPlusPlus.core.common.compat.COMPAT_Baubles;
import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.handler.OldCircuitHandler;
import gtPlusPlus.core.item.base.*;
import gtPlusPlus.core.item.base.foil.BaseItemFoil;
import gtPlusPlus.core.item.base.foods.BaseItemFood;
@@ -55,6 +56,7 @@ import gtPlusPlus.core.util.debug.DEBUG_INIT;
import gtPlusPlus.core.util.minecraft.*;
import gtPlusPlus.everglades.GTplusplus_Everglades;
import gtPlusPlus.xmod.eio.material.MaterialEIO;
+import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechItems;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
@@ -277,6 +279,8 @@ public final class ModItems {
itemDebugAreaClear = new ItemAreaClear();
+ //Register meta item, because we need them for everything.
+ MetaGeneratedGregtechItems.INSTANCE.generateMetaItems();
//Some Simple forms of materials
itemStickyRubber = new Item().setUnlocalizedName("itemStickyRubber").setCreativeTab(tabMachines).setTextureName(CORE.MODID + ":itemStickyRubber");
diff --git a/src/Java/gtPlusPlus/core/item/general/rfchargingpack/ChargingPackBase.java b/src/Java/gtPlusPlus/core/item/general/rfchargingpack/ChargingPackBase.java
new file mode 100644
index 0000000000..d4d3a07e6f
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/general/rfchargingpack/ChargingPackBase.java
@@ -0,0 +1,84 @@
+package gtPlusPlus.core.item.general.rfchargingpack;
+
+import java.util.List;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import cofh.energy.ItemEnergyContainer;
+import gtPlusPlus.core.util.math.MathUtils;
+
+public class ChargingPackBase extends ItemEnergyContainer {
+
+ protected final int mCapacityMax;
+ protected final byte mTier;
+
+ public ChargingPackBase(byte tier) {
+ this(tier, (tier == 1 ? 4000000 : tier == 2 ? 8000000 : tier == 3 ? 16000000 : tier == 4 ? 32000000 : 64000000));
+ }
+
+ private ChargingPackBase(byte tier, int maxStorage) {
+ super(maxStorage);
+ mTier = tier;
+ mCapacityMax = maxStorage;
+ }
+
+ public int getMaxEnergyInput(ItemStack container)
+ {
+ return this.maxReceive;
+ }
+
+ public int getMaxEnergyExtracted(ItemStack container)
+ {
+ return this.maxExtract;
+ }
+
+ @Override
+ public void onUpdate(ItemStack aStack, World aWorld, Entity aEnt, int p_77663_4_, boolean p_77663_5_) {
+ super.onUpdate(aStack, aWorld, aEnt, p_77663_4_, p_77663_5_);
+
+ ItemEnergyContainer current = this;
+ int currentStored = 0;
+ if (current != null) {
+ currentStored = current.getEnergyStored(aStack);
+ }
+ if (currentStored > 0) {
+ if (aEnt instanceof EntityPlayer) {
+ if (((EntityPlayer) aEnt).inventory != null) {
+ for (ItemStack invStack : ((EntityPlayer) aEnt).inventory.mainInventory) {
+ if (invStack != null) {
+ if (invStack.getItem() instanceof ItemEnergyContainer) {
+ if (current != null) {
+ currentStored = current.getEnergyStored(aStack);
+ if (currentStored > 0) {
+ int mTransLimit;
+ int mMaxStorage;
+ int mCurrent;
+ mTransLimit = getMaxEnergyInput(invStack);
+ mMaxStorage = current.getMaxEnergyStored(invStack);
+ mCurrent = current.getEnergyStored(invStack);
+ if (mCurrent+mTransLimit <= mMaxStorage) {
+ current.extractEnergy(aStack, current.receiveEnergy(invStack, mTransLimit, false), false);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) {
+ list.add(EnumChatFormatting.RED+"RF Information");
+ list.add(EnumChatFormatting.GRAY+"Extraction Rate: [" +EnumChatFormatting.RED+ this.maxExtract + EnumChatFormatting.GRAY + "Rf/t]" + " Insert Rate: [" +EnumChatFormatting.RED+ this.maxReceive+EnumChatFormatting.GRAY+"Rf/t]");
+ list.add(EnumChatFormatting.GRAY+"Current Charge: ["+EnumChatFormatting.RED+this.getEnergyStored(stack) + EnumChatFormatting.GRAY + "Rf / " + this.getMaxEnergyStored(stack)+"Rf] "+EnumChatFormatting.RED+MathUtils.findPercentage(this.getEnergyStored(stack), this.getMaxEnergyStored(stack))+EnumChatFormatting.GRAY+"%");
+ super.addInformation(stack, p_77624_2_, list, p_77624_4_);
+ }
+
+}