aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTechnus <daniel112092@gmail.com>2017-04-21 23:52:13 +0200
committerTechnus <daniel112092@gmail.com>2017-04-21 23:52:13 +0200
commit6867a4945e17a16273545dd5fe9781b8e52acfc1 (patch)
treea948a72c46d3185ad1db2bee91d889cd38fc0f47
parent509c740d1b7e9d183884dc1440181bb90547b39e (diff)
downloadGT5-Unofficial-6867a4945e17a16273545dd5fe9781b8e52acfc1.tar.gz
GT5-Unofficial-6867a4945e17a16273545dd5fe9781b8e52acfc1.tar.bz2
GT5-Unofficial-6867a4945e17a16273545dd5fe9781b8e52acfc1.zip
Some work on server rack, and computer.
-rw-r--r--src/main/java/com/github/technus/tectech/TecTech.java9
-rw-r--r--src/main/java/com/github/technus/tectech/Util.java5
-rw-r--r--src/main/java/com/github/technus/tectech/loader/MainLoader.java14
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java114
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java7
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java3
6 files changed, 115 insertions, 37 deletions
diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java
index b8abed2abf..9014a71c52 100644
--- a/src/main/java/com/github/technus/tectech/TecTech.java
+++ b/src/main/java/com/github/technus/tectech/TecTech.java
@@ -11,10 +11,7 @@ import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
-import cpw.mods.fml.common.event.FMLInitializationEvent;
-import cpw.mods.fml.common.event.FMLPostInitializationEvent;
-import cpw.mods.fml.common.event.FMLPreInitializationEvent;
-import cpw.mods.fml.common.event.FMLServerStartingEvent;
+import cpw.mods.fml.common.event.*;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import eu.usrv.yamcore.auxiliary.IngameErrorLog;
@@ -111,6 +108,10 @@ public class TecTech {
@EventHandler
public void serverLoad(FMLServerStartingEvent pEvent) {
+ }
+
+ @EventHandler
+ public void onServerAboutToStart(FMLServerAboutToStartEvent ev){
if(!oneTimeFix) {
oneTimeFix=true;
if (ModConfig.NERF_FUSION) FixBrokenFusionRecipes();
diff --git a/src/main/java/com/github/technus/tectech/Util.java b/src/main/java/com/github/technus/tectech/Util.java
index 8bfacc056f..2d14abea5a 100644
--- a/src/main/java/com/github/technus/tectech/Util.java
+++ b/src/main/java/com/github/technus/tectech/Util.java
@@ -1,5 +1,6 @@
package com.github.technus.tectech;
+import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.GregTech_API;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -566,4 +567,8 @@ public class Util {
return true;
}
+
+ public static String getUniqueIdentifier(ItemStack is){
+ return GameRegistry.findUniqueIdentifierFor(is.getItem()).modId+":"+is.getUnlocalizedName();
+ }
}
diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java
index 34a831147c..e9455f3f80 100644
--- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java
@@ -9,27 +9,22 @@ import com.github.technus.tectech.thing.item.DebugContainer_EM;
import static com.github.technus.tectech.TecTech.mainTab;
public class MainLoader {
- private MachineLoader machineLoader;
- private CasingLoader casingLoader;
- private RecipeLoader recipeLoader;
- private ThingsLoader thingsLoader;
-
public MainLoader() {}
public void things() {
- casingLoader = new CasingLoader();
+ CasingLoader casingLoader = new CasingLoader();
casingLoader.run();
TecTech.Logger.info("Casing Init Done");
- machineLoader = new MachineLoader();
+ MachineLoader machineLoader = new MachineLoader();
machineLoader.run();
TecTech.Logger.info("Machine Init Done");
- thingsLoader = new ThingsLoader();
+ ThingsLoader thingsLoader = new ThingsLoader();
thingsLoader.run();
TecTech.Logger.info("Other things Init Done");
}
public void recipes() {
- recipeLoader = new RecipeLoader();
+ RecipeLoader recipeLoader = new RecipeLoader();
recipeLoader.run();
TecTech.Logger.info("Recipe Init Done");
}
@@ -39,5 +34,6 @@ public class MainLoader {
GT_Container_CasingsTT.sBlockCasingsTT.setCreativeTab(mainTab);
DebugContainer_EM.INSTANCE.setCreativeTab(mainTab);
DebugBuilder.INSTANCE.setCreativeTab(mainTab);
+ TecTech.Logger.info("CreativeTab initiation complete");
}
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java
index 190726a634..458cd2bbd8 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java
@@ -5,10 +5,9 @@ import com.github.technus.tectech.TecTech;
import com.github.technus.tectech.thing.machineTT;
import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Rack;
import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Rack;
+import cpw.mods.fml.common.Loader;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
-import gregtech.api.gui.GT_Container_2by2;
-import gregtech.api.gui.GT_GUIContainer_2by2;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
@@ -19,12 +18,12 @@ 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.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import java.util.TreeMap;
import static com.github.technus.tectech.CommonValues.multiCheckAt;
+import static com.github.technus.tectech.Util.getUniqueIdentifier;
/**
* Created by Tec on 03.04.2017.
@@ -104,13 +103,13 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch implem
@Override
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- if(aBaseMetaTileEntity.isActive() || heat>0) return false;
+ if(aBaseMetaTileEntity.isActive() || heat>500) return false;
return aSide == aBaseMetaTileEntity.getFrontFacing();
}
@Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- if(aBaseMetaTileEntity.isActive() || heat>0) return false;
+ if(aBaseMetaTileEntity.isActive() || heat>500) return false;
return aSide == aBaseMetaTileEntity.getFrontFacing();
}
@@ -140,17 +139,18 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch implem
float computation=0,heat=0;
for(int i=0;i<mInventory.length;i++){
if(mInventory[i]==null || mInventory[i].stackSize!=1) continue;
- component comp=componentBinds.get(mInventory[i].getUnlocalizedName());
+ component comp=componentBinds.get(getUniqueIdentifier(mInventory[i]));
if(comp==null) continue;
if(tickingComponents) {
if (this.heat > comp.maxHeat) {
mInventory[i] = null;
continue;
- } else if (comp.subZero || this.heat > 0)
- heat += comp.heat > 0 ? comp.heat * overclock * overclock * overvolt: comp.heat;
- //=MAX(0;MIN(MIN($B4;1*C$3+C$3-0,25);1+RAND()+(C$3-1)-($B4-1)/2))
- if(overvolt*10f>7f+TecTech.Rnd.nextFloat())
- computation+=comp.computation*Math.max(0,Math.min(Math.min(overclock,overvolt+overvolt-0.25),1+TecTech.Rnd.nextFloat()+(overvolt-1)-(overclock-1)/2));
+ } else if (comp.subZero || this.heat >= 0) {
+ heat += (1f + (comp.coEff * this.heat / 10000f)) * (comp.heat > 0 ? comp.heat * overclock * overclock * overvolt : comp.heat);
+ //=MAX(0;MIN(MIN($B4;1*C$3+C$3-0,25);1+RAND()+(C$3-1)-($B4-1)/2))
+ if (overvolt * 10f > 7f + TecTech.Rnd.nextFloat())
+ computation += comp.computation * Math.max(0, Math.min(Math.min(overclock, overvolt + overvolt - 0.25), 1 + TecTech.Rnd.nextFloat() + (overvolt - 1) - (overclock - 1) / 2));
+ }
}else{
computation+=comp.computation*overclock;
}
@@ -176,21 +176,42 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch implem
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if(aBaseMetaTileEntity.isServerSide()){
if(aTick%20==multiCheckAt){
+ if(this.heat>0) {
+ float heatC = 0;
+ for (int i = 0; i < mInventory.length; i++) {
+ if (mInventory[i] == null || mInventory[i].stackSize != 1) continue;
+ component comp = componentBinds.get(getUniqueIdentifier(mInventory[i]));
+ if (comp == null) continue;
+ if (this.heat > comp.maxHeat) {
+ mInventory[i] = null;
+ continue;
+ } else if (comp.heat<0) {
+ heatC += comp.heat * (this.heat/10000);
+ }
+ }
+ this.heat += Math.min(-this.heat, Math.ceil(heatC));
+ }
+
if(heat>0)heat-=Math.max(heat/1000,1);
else if(heat<0)heat-=Math.min(heat/1000,-1);
if(heat>9000) aBaseMetaTileEntity.setOnFire();
else if(heat>10000) aBaseMetaTileEntity.setToFire();
- else if(heat<-20000)this.heat=-20000;
+ else if(heat<-10000)this.heat=-10000;
}
}
}
+ //@Override
+ //public void onRemoval() {
+ // if(mInventory!=null && (heat>0 || (getBaseMetaTileEntity()!=null && getBaseMetaTileEntity().isActive())))
+ // for(int i=0;i<mInventory.length;i++)
+ // mInventory[i]=null;
+ //}
+
@Override
- public void onRemoval() {
- if(mInventory!=null && (heat>0 || (getBaseMetaTileEntity()!=null && getBaseMetaTileEntity().isActive())))
- for(int i=0;i<mInventory.length;i++)
- mInventory[i]=null;
+ public int getSizeInventory() {//HACK TO NOT DROP CONTENTS!!!
+ return heat>500 || getBaseMetaTileEntity().isActive()?0:mInventory.length;
}
@Override
@@ -217,20 +238,67 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch implem
//Heat==1-10? --> 1
}
- public static void run(){
- new component(ItemList.Circuit_Elite.get(1),4,32,5000,true);
- new component(ItemList.Circuit_Advanced.get(1),1,2,2000,true);
- new component(ItemList.Circuit_Basic.get(1),2,1,1000,true);
+ public static void run(){//20k heat cap max!
+ new component(ItemList.Circuit_Primitive.get(1),1,4,0,500,true);
+ new component(ItemList.Circuit_Basic.get(1),4,8,0,1000,true);
+ new component(ItemList.Circuit_Good.get(1),6,9,-.05f,1500,true);
+ new component(ItemList.Circuit_Parts_Advanced.get(1),1,2,-.05f,2000,true);
+ new component(ItemList.Circuit_Advanced.get(1),8,10,-.1f,2500,true);
+ new component(ItemList.Circuit_Data.get(1),1,1,-.1f,3000,true);
+ new component(ItemList.Circuit_Master.get(1),12,10,-.2F,5000,true);
+ new component(ItemList.Circuit_Elite.get(1),16,12,-.15F,3500,true);
+
+ new component("IC2:ic2.reactorVent",0,-1,10f,1000,false);
+ new component("IC2:ic2.reactorVentCore",0,-1,20f,2500,false);
+ new component("IC2:ic2.reactorVentGold",0,-1,40f,5000,false);
+ new component("IC2:ic2.reactorVentDiamond",0,-1,80f,10000,false);//2x oc
+
+ if(Loader.isModLoaded("dreamcraft")) {
+ new component("dreamcraft:item.HighEnergyCircuitParts", 3, 2,-.1f, 9001, true);
+ new component("dreamcraft:item.HighEnergyFlowCircuit",24,16,-.25f,10000,true);
+ new component("dreamcraft:item.NanoCircuit",32,20,-.15f,8000,true);
+ new component("dreamcraft:item.PikoCircuit",64,32,-.2f,8500,true);
+ new component("dreamcraft:item.QuantumCircuit",128,48,-.3f,9000,true);
+ }
+ if(Loader.isModLoaded("OpenComputers")){
+ new component("OpenComputers:item.23", 0, 1,0f, 100, true);//Transistor
+ new component("OpenComputers:item.24", 7, 12,-.05f, 1500, true);//chip t1
+ new component("OpenComputers:item.25", 18, 20,-.1f, 3000, true);//chip t2
+ new component("OpenComputers:item.26", 25, 22, -.15f,4500, true);//chip t3
+ new component("OpenComputers:item.27", 10, 15, -.05f,3000, true);//alu
+ new component("OpenComputers:item.28", 25, 18, -.05f,1500, true);//cu
+
+ new component("OpenComputers:item.70", 42, 30, -.05f,1500, true);//bus t1
+ new component("OpenComputers:item.71", 70, 50, -.1f,3000, true);//bus t2
+ new component("OpenComputers:item.72", 105, 72, -.15f,4500, true);//bus t3
+
+ new component("OpenComputers:item.29", 106, 73, -.1f,1500, true);//cpu t1
+ new component("OpenComputers:item.42", 226, 153, -.15f,3000, true);//cpu t2
+ new component("OpenComputers:item.43", 374, 241, -.2f,4500, true);//cpu t3
+
+ new component("OpenComputers:item.8", 20, 27, -.1f,1500, true);//gpu t1
+ new component("OpenComputers:item.9", 62, 67, -.2f,3000, true);//gpu t2
+ new component("OpenComputers:item.10", 130, 111, -.3f,4500, true);//gpu t3
+
+ new component("OpenComputers:item.101", 350, 234, -.1f,1500, true);//apu t1
+ new component("OpenComputers:item.102", 606, 398, -.2f,4500, true);//apu t2
+ new component("OpenComputers:item.103", 1590, 1006, -.3f,9000, true);//apu tC
+ }
}
public static class component implements Comparable<component>{
private final String unlocalizedName;
- private final float heat,computation,maxHeat;
+ private final float heat,coEff,computation,maxHeat;
private final boolean subZero;
- component(ItemStack is,float heat,float computation,float maxHeat, boolean subZero){
- unlocalizedName=is.getUnlocalizedName();
+ component(ItemStack is,float computation,float heat, float coEff,float maxHeat, boolean subZero){
+ this(getUniqueIdentifier(is),computation,heat,coEff,maxHeat,subZero);
+ }
+
+ component(String is,float computation,float heat, float coEff,float maxHeat, boolean subZero){
+ unlocalizedName=is;
this.heat=heat;
+ this.coEff=coEff;
this.computation=computation;
this.maxHeat=maxHeat;
this.subZero=subZero;
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java
index ecd6333cec..1eef5d81f7 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java
@@ -177,6 +177,9 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB
@Override
public boolean EM_checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) {
+ for(GT_MetaTileEntity_Hatch_Rack rack:eRacks)
+ if (isValidMetaTileEntity(rack))
+ rack.getBaseMetaTileEntity().setActive(false);
eRacks.clear();
if(!EM_StructureCheckAdvanced(front,blockType,blockMeta,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback,1,2,0))return false;
if(!EM_StructureCheckAdvanced(cap,blockType,blockMeta,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback,1,2,-1))return false;
@@ -186,9 +189,13 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB
slices++;
i--;
}
+ if(slices>16)return false;
if(!EM_StructureCheckAdvanced(cap,blockType,blockMeta,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback,1,2,++i))return false;
if(!EM_StructureCheckAdvanced(terminator,blockType,blockMeta,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback,1,2,--i))return false;
eCertainMode=(byte)Math.min(slices/3,5);
+ for(GT_MetaTileEntity_Hatch_Rack rack:eRacks)
+ if (isValidMetaTileEntity(rack))
+ rack.getBaseMetaTileEntity().setActive(iGregTechTileEntity.isActive());
return eUncertainHatches.size() == 1;
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java
index 0b785004c2..f40e279726 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java
@@ -18,6 +18,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import static com.github.technus.tectech.Util.StructureWriter;
+import static com.github.technus.tectech.Util.getUniqueIdentifier;
/**
* Created by Tec on 23.03.2017.
@@ -120,7 +121,7 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti
if (aBaseMetaTileEntity.isClientSide()) return true;
aBaseMetaTileEntity.openGUI(aPlayer);
if(TecTech.ModConfig.DEBUG_MODE && aPlayer.getHeldItem()!=null)
- TecTech.Logger.info("UnlocalizedName: "+aPlayer.getHeldItem().getUnlocalizedName());
+ TecTech.Logger.info("UnlocalizedName: "+ getUniqueIdentifier(aPlayer.getHeldItem()));
return true;
}