aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDecay.java6
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java2
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/core/stacks/cElementalInstanceStack.java48
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java4
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/eNeutrinoDefinition.java4
-rw-r--r--src/main/java/com/github/technus/tectech/loader/MachineLoader.java7
-rw-r--r--src/main/java/com/github/technus/tectech/loader/RecipeLoader.java9
-rw-r--r--src/main/java/com/github/technus/tectech/proxy/CommonProxy.java34
-rw-r--r--src/main/java/com/github/technus/tectech/thing/CustomItemList.java1
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java26
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_OwnerDetector.java223
-rw-r--r--src/main/resources/assets/gregtech/textures/blocks/iconsets/OWNER_OFFLINE.pngbin0 -> 640 bytes
-rw-r--r--src/main/resources/assets/gregtech/textures/blocks/iconsets/OWNER_ONLINE.pngbin0 -> 730 bytes
14 files changed, 335 insertions, 31 deletions
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDecay.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDecay.java
index 609f92b1a1..a2b6eed324 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDecay.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDecay.java
@@ -48,7 +48,7 @@ public final class cElementalDecay {
this.probability = probability;
}
- public cElementalInstanceStackMap getResults(float lifeMult, long age, long energy, long amountDecaying) {
+ public cElementalInstanceStackMap getResults(float lifeMult, long age, long energyTotalForProducts, long amountDecaying) {
cElementalInstanceStackMap decayResult = new cElementalInstanceStackMap();
if (outputStacks == null) {
return decayResult;//This is to prevent null pointer exceptions.
@@ -61,12 +61,12 @@ public final class cElementalDecay {
if (qtty <= 0) {
return decayResult;
}
- //energy /= qtty;
+ //energyTotalForProducts /= qtty;
//lifeMult /= (float) qtty;
for (cElementalDefinitionStack stack : outputStacks.values()) {
decayResult.putUnify(new cElementalInstanceStack(stack.definition,
amountDecaying * stack.amount,
- lifeMult, age/*new products*/, energy / Math.max(1, stack.amount)));//get instances from stack
+ lifeMult, age/*new products*/, energyTotalForProducts / Math.max(1, Math.abs(stack.amount))));//get instances from stack
}
return decayResult;
}
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java
index b360a5a997..e85166776f 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java
@@ -407,7 +407,7 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn
if (newInstances == null) {
instance.nextColor();
} else {
- map.remove(instance.definition);
+ removeAmount(false,instance);
for (cElementalInstanceStack newInstance : newInstances.values()) {
putUnify(newInstance);
newInstance.nextColor();
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/stacks/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/stacks/cElementalInstanceStack.java
index de677f7197..f8a52cf6a3 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/core/stacks/cElementalInstanceStack.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/stacks/cElementalInstanceStack.java
@@ -52,8 +52,8 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
this.color = (byte) TecTech.Rnd.nextInt(3);
}
this.lifeTimeMult = lifeTimeMult;
- this.energy = energy;
lifeTime = definition.getRawTimeSpan(energy) * this.lifeTimeMult;
+ setEnergy(energy);
this.age = age;
this.amount = amount;
}
@@ -61,12 +61,12 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
//Clone proxy
private cElementalInstanceStack(cElementalInstanceStack stack) {
definition = stack.definition;
- energy = stack.energy;
color = stack.color;
age = stack.age;
amount = stack.amount;
lifeTime = stack.lifeTime;
lifeTimeMult = stack.lifeTimeMult;
+ energy = stack.energy;
}
@Override
@@ -177,11 +177,17 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
long amountPer=amount/decayCnt;
amount-=amountPer*(--decayCnt);
cElementalInstanceStackMap output=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel);
- if(output==null)return null;
+ if(output==null){
+ amount=amountTemp;
+ return null;
+ }
if(amountPer>0){
amount=amountPer;
for(int i=0;i<decayCnt;i++){
- output.putUnifyAll(decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel));
+ cElementalInstanceStackMap map=decayMechanics(lifeTimeMult,apparentAge,newEnergyLevel);
+ if(map!=null){
+ output.putUnifyAll(map);
+ }
}
}
amount=amountTemp;
@@ -210,7 +216,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
}
//Use to get direct decay output providing correct decay array
- private cElementalInstanceStackMap exponentialDecayCompute(cElementalDecay[] decays, float lifeTimeMult, long newProductsAge, long energy) {
+ private cElementalInstanceStackMap exponentialDecayCompute(cElementalDecay[] decays, float lifeTimeMult, long newProductsAge, long newEnergyLevel) {
double decayInverseRatio=Math.pow(2d,1d/* 1 second *//(double)lifeTime);
double newAmount=(double)amount/decayInverseRatio;
long amountRemaining= (long)Math.floor(newAmount) +(TecTech.Rnd.nextDouble()<=newAmount-Math.floor(newAmount)?1:0);
@@ -227,12 +233,12 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
if(amountRemaining==amount) {
return null;//nothing decayed
} else if(amountRemaining<=0) {
- return decayCompute(decays, lifeTimeMult, newProductsAge, energy);
+ return decayCompute(decays, lifeTimeMult, newProductsAge, newEnergyLevel);
}
//split to non decaying and decaying part
long amount=this.amount;
this.amount-=amountRemaining;
- cElementalInstanceStackMap products=decayCompute(decays,lifeTimeMult,newProductsAge,energy);
+ cElementalInstanceStackMap products=decayCompute(decays,lifeTimeMult,newProductsAge,newEnergyLevel);
this.amount=amountRemaining;
products.putUnify(clone());
this.amount=amount;
@@ -240,7 +246,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
}
//Use to get direct decay output providing correct decay array
- private cElementalInstanceStackMap decayCompute(cElementalDecay[] decays, float lifeTimeMult, long newProductsAge, long energy) {
+ private cElementalInstanceStackMap decayCompute(cElementalDecay[] decays, float lifeTimeMult, long newProductsAge, long newEnergyLevel) {
if (decays == null) {
return null;//Can not decay so it wont
}
@@ -251,23 +257,26 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
return new cElementalInstanceStackMap();//provide non null 0 length array for annihilation
} else if (decays.length == 1) {//only one type of decay :D, doesn't need dead end
if(decays[0]==deadEnd && definition.decayMakesEnergy(this.energy)) {
- return null;
+ return null;//no extra photons
}
- cElementalInstanceStackMap products=decays[0].getResults(lifeTimeMult, newProductsAge, energy, amount);
+ cElementalInstanceStackMap products=decays[0].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, amount);
if(newProductsAge<0){
for(cElementalInstanceStack stack:products.values()){
if(stack.definition.equals(definition)){
stack.age= age;
- stack.energy=this.energy;
+ stack.setEnergy(energy);
}
}
}else{
for(cElementalInstanceStack stack:products.values()){
if(stack.definition.equals(definition)){
- stack.energy=this.energy;
+ stack.setEnergy(energy);
}
}
}
+ if(this.energy <= 0 && products.getMass() > getMass()){
+ return null;//no energy usage to decay
+ }
return products;
} else {
cElementalInstanceStackMap output = new cElementalInstanceStackMap();
@@ -326,14 +335,14 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
clone.amount=qttyOfDecay[i];
output.putUnify(clone);
}else {
- output.putUnifyAll(decays[i].getResults(lifeTimeMult, newProductsAge, energy, qttyOfDecay[i]));
+ output.putUnifyAll(decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]));
}
}
}
}else{
for (int i = 0; i < differentDecays; i++) {
if (qttyOfDecay[i] > 0) {
- output.putUnifyAll(decays[i].getResults(lifeTimeMult, newProductsAge, energy, qttyOfDecay[i]));
+ output.putUnifyAll(decays[i].getResults(lifeTimeMult, newProductsAge, newEnergyLevel, qttyOfDecay[i]));
}
}
}
@@ -342,16 +351,19 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
for(cElementalInstanceStack stack:output.values()){
if(stack.definition.equals(definition)){
stack.age= age;
- stack.energy=this.energy;
+ stack.setEnergy(energy);
}
}
}else{
for(cElementalInstanceStack stack:output.values()){
if(stack.definition.equals(definition)){
- stack.energy=this.energy;
+ stack.setEnergy(energy);
}
}
}
+ if(this.energy <= 0 && output.getMass() > getMass()){
+ return null;//no energy usage to decay
+ }
return output;
}
}
@@ -376,9 +388,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition {
if (amount != 0) {
energy /= Math.abs(amount);
}
-
- this.energy = energy;
- setLifeTimeMultiplier(lifeTimeMul);
+ setEnergy(energy);
return this;
}
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java
index c7b754432f..9522b166d6 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java
@@ -112,6 +112,8 @@ public abstract class cElementalPrimitive extends cElementalDefinition {
public cElementalDecay[] getNaturalDecayInstant() {
if (naturalDecayInstant < 0) {
return elementalDecays;
+ }else if (naturalDecayInstant>=elementalDecays.length){
+ return cElementalDecay.noProduct;
}
return new cElementalDecay[]{elementalDecays[naturalDecayInstant]};
}
@@ -120,6 +122,8 @@ public abstract class cElementalPrimitive extends cElementalDefinition {
public cElementalDecay[] getEnergyInducedDecay(long energyLevel) {
if (energeticDecayInstant < 0) {
return elementalDecays;
+ }else if (energeticDecayInstant>=elementalDecays.length){
+ return cElementalDecay.noProduct;
}
return new cElementalDecay[]{elementalDecays[energeticDecayInstant]};
}
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/eNeutrinoDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/eNeutrinoDefinition.java
index 459719a8a4..d5e3d38b4d 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/eNeutrinoDefinition.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/primitive/eNeutrinoDefinition.java
@@ -26,7 +26,7 @@ public final class eNeutrinoDefinition extends cElementalPrimitive {
}
public static void run() {
- lepton_Ve.init(lepton_Ve_, 1F, 0, 0,
+ lepton_Ve.init(lepton_Ve_, 1F, -1, -1,
cElementalDecay.noProduct);
lepton_Vm.init(lepton_Vm_, 1F, 1, 0,
new cElementalDecay(0.825F, nothing),
@@ -35,7 +35,7 @@ public final class eNeutrinoDefinition extends cElementalPrimitive {
new cElementalDecay(0.75F, nothing),
eBosonDefinition.deadEnd);
- lepton_Ve_.init(lepton_Ve, 1F, 0, 0,
+ lepton_Ve_.init(lepton_Ve, 1F, -1, -1,
cElementalDecay.noProduct);
lepton_Vm_.init(lepton_Vm, 1F, 1, 0,
new cElementalDecay(0.825F, nothing),
diff --git a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java
index 131f0e42c8..cf162d465e 100644
--- a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java
@@ -10,6 +10,7 @@ import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pi
import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_EM;
import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DebugPowerGenerator;
import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DebugStructureWriter;
+import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_OwnerDetector;
import static com.github.technus.tectech.thing.CustomItemList.*;
@@ -285,6 +286,12 @@ public class MachineLoader implements Runnable {
DATApipe.set(new GT_MetaTileEntity_Pipe_Data(15470, "pipe.datastream", "Optical Fiber Cable").getStackForm(1L));
// ===================================================================================================
+ // Single Blocks
+ // ===================================================================================================
+
+ Machine_OwnerDetector.set(new GT_MetaTileEntity_OwnerDetector(15480, "machine.tt.ownerdetector", "Owner detector", 15).getStackForm(1L));
+
+ // ===================================================================================================
// Debug Stuff
// ===================================================================================================
diff --git a/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java
index 0b44eacca5..9d39bbda27 100644
--- a/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java
@@ -3,6 +3,7 @@ package com.github.technus.tectech.loader;
import com.github.technus.tectech.compatibility.dreamcraft.DreamCraftRecipeLoader;
import com.github.technus.tectech.elementalMatter.definitions.complex.atom.dAtomDefinition;
import com.github.technus.tectech.elementalMatter.definitions.complex.hadron.dHadronDefinition;
+import com.github.technus.tectech.thing.CustomItemList;
import com.github.technus.tectech.thing.casing.TT_Container_Casings;
import com.github.technus.tectech.thing.item.ConstructableTriggerItem;
import com.github.technus.tectech.thing.item.EuMeterGT;
@@ -53,6 +54,14 @@ public class RecipeLoader implements Runnable {
'R', Dyes.dyeRed,
'N', Dyes.dyeBlack,});
+ //Owner detector
+ GT_ModHandler.addCraftingRecipe(CustomItemList.Machine_OwnerDetector.get(1),
+ GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE,
+ new Object[]{"PPP","GEG","PPP",
+ 'P', OrePrefixes.plate.get(Materials.IronMagnetic),
+ 'G', OrePrefixes.plate.get(Materials.Glass),
+ 'E', OrePrefixes.gem.get(Materials.EnderPearl)});
+
if (Loader.isModLoaded("dreamcraft")) {
new DreamCraftRecipeLoader().run();//init recipes for GTNH version
} else {
diff --git a/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java b/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java
index 7ccbe7472f..598a8b148f 100644
--- a/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java
+++ b/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java
@@ -8,6 +8,7 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
+import net.minecraft.world.WorldServer;
public class CommonProxy implements IGuiHandler {
public void registerRenderInfo() {}
@@ -47,4 +48,37 @@ public class CommonProxy implements IGuiHandler {
public void renderAABB(AxisAlignedBB box){}
public void renderAABB(World w,AxisAlignedBB box){}
+
+ public String getUUID(String name) {
+ for(WorldServer worldServer:MinecraftServer.getServer().worldServers){
+ for(Object o:worldServer.playerEntities){
+ if(o instanceof EntityPlayer && ((EntityPlayer) o).getGameProfile().getName().equals(name)){
+ return ((EntityPlayer) o).getGameProfile().getId().toString();
+ }
+ }
+ }
+ return null;
+ }
+
+ public boolean isOnlineName(String name) {
+ for(WorldServer worldServer:MinecraftServer.getServer().worldServers){
+ for(Object o:worldServer.playerEntities){
+ if(o instanceof EntityPlayer && ((EntityPlayer) o).getGameProfile().getName().equals(name)){
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public boolean isOnlineUUID(String uuid) {
+ for(WorldServer worldServer:MinecraftServer.getServer().worldServers){
+ for(Object o:worldServer.playerEntities){
+ if(o instanceof EntityPlayer && ((EntityPlayer) o).getGameProfile().getId().toString().equals(uuid)){
+ return true;
+ }
+ }
+ }
+ return false;
+ }
}
diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
index 0f7bb3997e..fb34e68925 100644
--- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
+++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
@@ -11,6 +11,7 @@ import net.minecraft.item.ItemStack;
import static gregtech.api.enums.GT_Values.W;
public enum CustomItemList implements IItemContainer {
+ Machine_OwnerDetector,
Machine_DebugWriter,Machine_DebugGenny,
EMpipe, DATApipe, rack_Hatch, holder_Hatch,
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java
index 4ff8a5db75..0f78875bcc 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java
@@ -141,6 +141,8 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta
if (TecTech.ModConfig.BOOM_ENABLE) {
getBaseMetaTileEntity().doExplosion(V[14]);
} else {
+ deathDelay=3;
+ overflowMatter=0;
TecTech.proxy.broadcast("Container0 BOOM! " + getBaseMetaTileEntity().getXCoord() + ' ' + getBaseMetaTileEntity().getYCoord() + ' ' + getBaseMetaTileEntity().getZCoord());
}
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java
index e0f309d941..a1e11e8ff4 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java
@@ -16,6 +16,8 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
+import ic2.core.init.MainConfig;
+import ic2.core.util.ConfigUtil;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
@@ -35,6 +37,11 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase
private static Textures.BlockIcons.CustomIcon ScreenON;
private cElementalInstanceStackMap contents=new cElementalInstanceStackMap();
+ private static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10;
+ private static final double MASS_TO_EU=ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear")*800000.0/URANIUM_INGOT_MASS_DIFF;//*20
+
+ private float temp=0;
+
//region structure
private static final String[][] shape = new String[][]{
{"0C0","A ","A . ","A ","0C0",},
@@ -120,9 +127,10 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase
for(GT_MetaTileEntity_Hatch_InputElemental i:eInputHatches){
i.getContainerHandler().clear();
}
- return startRecipe(map.getFirst());
+ return startRecipe(map);
}else if(eSafeVoid){
contents.clear();
+ temp=0;
}else if(contents.hasStacks()){
return startRecipe(null);
}
@@ -134,9 +142,9 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase
super.afterRecipeCheckFailed();
}
- private boolean startRecipe(cElementalInstanceStack input) {
+ private boolean startRecipe(cElementalInstanceStackMap input) {
if(input!=null) {
- contents.putUnify(input);
+ contents.putUnifyAll(input);
}
mMaxProgresstime = 20;
@@ -146,14 +154,20 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase
System.out.println("INPUT");
for(cElementalInstanceStack stack:contents.values()){
- System.out.println(stack.definition.getSymbol()+" "+stack.amount);
+ if(stack.getEnergy()==0 && stack.definition.decayMakesEnergy(1)){
+ stack.setEnergy(1);
+ }
+ //System.out.println(stack.definition.getSymbol()+" "+stack.amount);
}
+
contents.tickContent(1,0,1);
- System.out.println("MASS DIFF = " +(mass-contents.getMass()));
+ System.out.println("MASS DIFF = " +((mass-contents.getMass())*MASS_TO_EU));
+ temp+=(mass-contents.getMass())*MASS_TO_EU;
+ System.out.println("TOTAL = " +temp);
- //todo remove not actually decaying crap
+ //todo move not actually decaying crap, beware of energy using decays?
//for(cElementalInstanceStack stack:contents.values()){
// System.out.println(stack.definition.getSymbol()+" "+stack.amount);
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_OwnerDetector.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_OwnerDetector.java
new file mode 100644
index 0000000000..80048e4bb9
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_OwnerDetector.java
@@ -0,0 +1,223 @@
+package com.github.technus.tectech.thing.metaTileEntity.single;
+
+import com.github.technus.tectech.CommonValues;
+import com.github.technus.tectech.TecTech;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.client.renderer.texture.IIconRegister;
+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.EnumChatFormatting;
+
+import static com.github.technus.tectech.CommonValues.RECIPE_AT;
+
+/**
+ * Created by Tec on 23.03.2017.
+ */
+public class GT_MetaTileEntity_OwnerDetector extends GT_MetaTileEntity_TieredMachineBlock {
+ private static GT_RenderedTexture OWNER_ONLINE,OWNER_OFFLINE;
+ private String uuid;
+ private boolean interdimensional=true;
+
+ public GT_MetaTileEntity_OwnerDetector(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 0, "Screwdrive to change mode");
+ }
+
+ public GT_MetaTileEntity_OwnerDetector(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, 0, aDescription, aTextures);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_OwnerDetector(mName, mTier, mDescription, mTextures);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister aBlockIconRegister) {
+ super.registerIcons(aBlockIconRegister);
+ OWNER_ONLINE = new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("iconsets/OWNER_ONLINE"));
+ OWNER_OFFLINE = new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("iconsets/OWNER_OFFLINE"));
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], aActive ? OWNER_ONLINE : OWNER_OFFLINE};
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ return null;
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return null;
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return null;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity iGregTechTileEntity, int i, byte b, ItemStack itemStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity iGregTechTileEntity, int i, byte b, ItemStack itemStack) {
+ return false;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setString("eUUID",uuid);
+ aNBT.setBoolean("eInterDim",interdimensional);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ uuid=aNBT.getString("eUUID");
+ interdimensional=aNBT.getBoolean("eInterDim");
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return false;
+ }
+
+ @Override
+ public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
+ if(aBaseMetaTileEntity.isServerSide()) {
+ if (uuid == null || uuid.length() == 0) {
+ String name = aBaseMetaTileEntity.getOwnerName();
+ if (!("Player".equals(name))) {
+ uuid= TecTech.proxy.getUUID(name);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isServerSide() && aTick%20==RECIPE_AT) {
+ boolean detected=TecTech.proxy.isOnlineUUID(uuid) || (uuid!=null && uuid.length()>0 && TecTech.proxy.isOnlineName(aBaseMetaTileEntity.getOwnerName()));
+ aBaseMetaTileEntity.setActive(detected);
+ aBaseMetaTileEntity.setGenericRedstoneOutput(detected);
+ byte value=(byte)(detected?15:0);
+ for(byte b=0;b<6;b++){
+ aBaseMetaTileEntity.setStrongOutputRedstoneSignal(b,value);
+ }
+ }
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ interdimensional^=true;
+ GT_Utility.sendChatToPlayer(aPlayer,interdimensional?"Running interdimensional scan":"Running local dimension scan");
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ CommonValues.TEC_MARK_GENERAL, mDescription,
+ EnumChatFormatting.BLUE + "Looks for his pa",
+ EnumChatFormatting.BLUE + "Emits signal when happy"
+ };
+ }
+
+ @Override
+ public boolean isElectric() {
+ return false;
+ }
+
+ @Override
+ public boolean isEnetOutput() {
+ return false;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return false;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return false;
+ }
+
+ @Override
+ public boolean isOutputFacing(byte aSide) {
+ return false;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 0;
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return 0;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return Integer.MAX_VALUE;
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return 0;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return 0;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return 0;
+ }
+
+ @Override
+ public int getProgresstime() {
+ return interdimensional?1:0;
+ }
+
+ @Override
+ public int maxProgresstime() {
+ return 1;
+ }
+
+ @Override
+ public boolean hasSidedRedstoneOutputBehavior() {
+ return true;
+ }
+
+ @Override
+ public boolean allowGeneralRedstoneOutput() {
+ return true;
+ }
+}
diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OWNER_OFFLINE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OWNER_OFFLINE.png
new file mode 100644
index 0000000000..ebf319261a
--- /dev/null
+++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OWNER_OFFLINE.png
Binary files differ
diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OWNER_ONLINE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OWNER_ONLINE.png
new file mode 100644
index 0000000000..ba8786cf7e
--- /dev/null
+++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OWNER_ONLINE.png
Binary files differ