aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbasdxz <tudurap.com@gmail.com>2019-03-09 13:06:55 +0000
committerbasdxz <tudurap.com@gmail.com>2019-03-09 13:06:55 +0000
commit4cd1a33c1eabda81996aa21f706212eb442eb503 (patch)
treeb4541c6a2ba04334f6cd4ac59cd17117d159c841 /src
parent1e002770e5333e1b90a05bf65c84f84bfdae118e (diff)
downloadGT5-Unofficial-4cd1a33c1eabda81996aa21f706212eb442eb503.tar.gz
GT5-Unofficial-4cd1a33c1eabda81996aa21f706212eb442eb503.tar.bz2
GT5-Unofficial-4cd1a33c1eabda81996aa21f706212eb442eb503.zip
Capacitor Hatch Work
Capacitor hatches should now know about what capacitors exist
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java1
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java62
2 files changed, 61 insertions, 2 deletions
diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java
index 61ce45c031..292d446bc4 100644
--- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java
@@ -351,6 +351,7 @@ public class MachineLoader implements Runnable {
GT_MetaTileEntity_MultiblockBase_EM.run();
GT_MetaTileEntity_Hatch_Rack.run();
+ GT_MetaTileEntity_Hatch_Capacitor.run();
GT_MetaTileEntity_EM_computer.run();
GT_MetaTileEntity_EM_research.run();
GT_MetaTileEntity_EM_dataBank.run();
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java
index 61062f22ca..7648bfbe4a 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java
@@ -1,11 +1,15 @@
package com.github.technus.tectech.thing.metaTileEntity.hatch;
import com.github.technus.tectech.CommonValues;
+import com.github.technus.tectech.Reference;
+import com.github.technus.tectech.TecTech;
import com.github.technus.tectech.Util;
import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Capacitor;
import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Capacitor;
+import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -18,12 +22,21 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.github.technus.tectech.CommonValues.V;
+import static com.github.technus.tectech.Util.getUniqueIdentifier;
+import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
+
/**
* Created by Tec on 03.04.2017.
*/
public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch {
private static Textures.BlockIcons.CustomIcon EM_H;
private static Textures.BlockIcons.CustomIcon EM_H_ACTIVE;
+ private static Map<String, GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent> componentBinds = new HashMap<>();
+ private float energyStoredFrac = 0;
public GT_MetaTileEntity_Hatch_Capacitor(int aID, String aName, String aNameRegional, int aTier, String descr) {
super(aID, aName, aNameRegional, aTier, 1, descr);
@@ -107,11 +120,10 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch {
}
@Override
- public int getSizeInventory() {//HACK TO NOT DROP CONTENTS!!!
+ public int getSizeInventory() {
return energyStoredFrac >= 0.25 || getBaseMetaTileEntity().isActive() ? 0 : mInventory.length;
}
-
@Override
public String[] getDescription() {
return new String[]{
@@ -120,6 +132,52 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch {
EnumChatFormatting.AQUA + "Stores 'nergy! (for a while)"
};
}
+
+ public static void run() {
+ new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":tm.teslaCoilCapacitor.0", 0, 1, 1024, 1);//LV Capacitor
+ new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":tm.teslaCoilCapacitor.1", 1, 1, 1024, 1);//MV Capacitor
+ new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":tm.teslaCoilCapacitor.2", 2, 1, 1024, 1);//HV Capacitor
+ new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":tm.teslaCoilCapacitor.3", 3, 1, 1024, 1);//EV Capacitor
+ new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":tm.teslaCoilCapacitor.4", 4, 1, 1024, 1);//IV Capacitor
+ new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":tm.teslaCoilCapacitor.5", 5, 1, 1024, 1);//LuV Capacitor
+ new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":tm.teslaCoilCapacitor.6", 6, 1, 1024, 1);//ZPM Capacitor
+ new GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent(Reference.MODID+":tm.teslaCoilCapacitor.7", 7, 1, 1024, 1);//UV Capacitor
+ }
+
+ public static class CapacitorComponent implements Comparable<GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent> {
+ private final String unlocalizedName;
+ private final long tier, current, energyMax;
+ private final float efficiency;
+
+ CapacitorComponent(ItemStack is, long tier, long current, long energyMax, float efficiency) {
+ this(getUniqueIdentifier(is), tier, current, energyMax, efficiency);
+ }
+
+ CapacitorComponent(String is, long tier, long current, long energyMax, float efficiency) {
+ unlocalizedName = is;
+ this.tier = tier;
+ this.current = current;
+ this.energyMax = energyMax;
+ this.efficiency = efficiency;
+ componentBinds.put(unlocalizedName, this);
+ if (DEBUG_MODE) {
+ TecTech.LOGGER.info("Tesla Capacitor registered: " + unlocalizedName);
+ }
+ }
+
+ @Override
+ public int compareTo(GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent o) {
+ return unlocalizedName.compareTo(o.unlocalizedName);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if(obj instanceof GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent) {
+ return compareTo((GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent) obj) == 0;
+ }
+ return false;
+ }
+ }
}