aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorTec <daniel112092@gmail.com>2019-07-15 06:17:38 +0200
committerTec <daniel112092@gmail.com>2019-07-15 06:17:38 +0200
commite739e0df9802d2d139c1b3241746af80eef0f4b4 (patch)
treecda2615fc57c8d41ff149d57fc304c4db31c4a87 /src/main/java
parent41e8623f77b750efc531d7c545094991f6ade55a (diff)
parentc3388bf4fb0acad4ebdda64d178453edcc3cfeb8 (diff)
downloadGT5-Unofficial-e739e0df9802d2d139c1b3241746af80eef0f4b4.tar.gz
GT5-Unofficial-e739e0df9802d2d139c1b3241746af80eef0f4b4.tar.bz2
GT5-Unofficial-e739e0df9802d2d139c1b3241746af80eef0f4b4.zip
Merge branch 'betterParametrizers' into BassAddons
# Conflicts: # src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java # src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/github/technus/tectech/TecTech.java23
-rw-r--r--src/main/java/com/github/technus/tectech/Util.java11
-rw-r--r--src/main/java/com/github/technus/tectech/chunkData/ChunkDataHandler.java364
-rw-r--r--src/main/java/com/github/technus/tectech/chunkData/IChunkMetaDataHandler.java37
-rw-r--r--src/main/java/com/github/technus/tectech/chunkData/WorldData.java52
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java10
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java4
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java4
-rw-r--r--src/main/java/com/github/technus/tectech/loader/MainLoader.java3
-rw-r--r--src/main/java/com/github/technus/tectech/loader/network/ChunkDataMessage.java101
-rw-r--r--src/main/java/com/github/technus/tectech/loader/network/NetworkDispatcher.java2
-rw-r--r--src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java68
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java143
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/chunkData/ChunkDataHandler.java226
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/chunkData/ChunkMetaDataHandler.java14
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalInstanceContainer.java2
-rw-r--r--src/main/java/com/github/technus/tectech/proxy/ClientProxy.java18
-rw-r--r--src/main/java/com/github/technus/tectech/proxy/CommonProxy.java19
-rw-r--r--src/main/java/com/github/technus/tectech/recipe/TT_recipe.java10
-rw-r--r--src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java6
-rw-r--r--src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java1
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java10
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java22
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java5
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java38
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java24
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java12
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java14
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java12
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java14
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java14
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java48
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java59
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IHatchAdder.java (renamed from src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/HatchAdder.java)2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/INameFunction.java (renamed from src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/NameFunction.java)2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IStatusFunction.java (renamed from src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/StatusFunction.java)2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java20
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java14
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java18
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java23
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java19
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java7
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java16
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java12
58 files changed, 1010 insertions, 565 deletions
diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java
index 5383b9cf62..9d3273f10e 100644
--- a/src/main/java/com/github/technus/tectech/TecTech.java
+++ b/src/main/java/com/github/technus/tectech/TecTech.java
@@ -5,21 +5,20 @@ import com.github.technus.tectech.loader.TecTechConfig;
import com.github.technus.tectech.mechanics.ConvertFloat;
import com.github.technus.tectech.mechanics.ConvertInteger;
import com.github.technus.tectech.mechanics.anomaly.AnomalyHandler;
-import com.github.technus.tectech.mechanics.chunkData.ChunkDataHandler;
+import com.github.technus.tectech.chunkData.ChunkDataHandler;
import com.github.technus.tectech.mechanics.elementalMatter.core.commands.GiveEM;
import com.github.technus.tectech.mechanics.elementalMatter.core.commands.ListEM;
import com.github.technus.tectech.proxy.CommonProxy;
+import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
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 eu.usrv.yamcore.auxiliary.IngameErrorLog;
import eu.usrv.yamcore.auxiliary.LogHelper;
import gregtech.GT_Mod;
import gregtech.common.GT_Proxy;
+import net.minecraftforge.common.MinecraftForge;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
@@ -80,6 +79,10 @@ public class TecTech {
moduleAdminErrorLogs = new IngameErrorLog();
}
+ chunkDataHandler=new ChunkDataHandler();
+ FMLCommonHandler.instance().bus().register(chunkDataHandler);
+ MinecraftForge.EVENT_BUS.register(chunkDataHandler);
+
MainLoader.preLoad();
}
@@ -90,10 +93,10 @@ public class TecTech {
if(configTecTech.DISABLE_MATERIAL_LOADING_FFS){
try {
- Field field= GT_Proxy.class.getDeclaredField("mEvents");
- field.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField( "modifiers" );
modifiersField.setAccessible( true );
+ Field field= GT_Proxy.class.getDeclaredField("mEvents");
+ field.setAccessible(true);
modifiersField.setInt( field, field.getModifiers() & ~Modifier.FINAL );
field.set(GT_Mod.gregtechproxy, new Collection() {
@Override
@@ -184,7 +187,7 @@ public class TecTech {
@Mod.EventHandler
public void PostLoad(FMLPostInitializationEvent PostEvent) {
MainLoader.postLoad();
- chunkDataHandler=new ChunkDataHandler();
+
chunkDataHandler.registerChunkMetaDataHandler(anomalyHandler=new AnomalyHandler());
}
@@ -199,7 +202,7 @@ public class TecTech {
}
@Mod.EventHandler
- public void onServerStarting(FMLServerStartingEvent aEvent) {
- chunkDataHandler.onServerStarting();
+ public void onServerAboutToStart(FMLServerAboutToStartEvent aEvent) {
+ chunkDataHandler.clearData();
}
}
diff --git a/src/main/java/com/github/technus/tectech/Util.java b/src/main/java/com/github/technus/tectech/Util.java
index e333e70137..53e9627187 100644
--- a/src/main/java/com/github/technus/tectech/Util.java
+++ b/src/main/java/com/github/technus/tectech/Util.java
@@ -2,7 +2,7 @@ package com.github.technus.tectech;
import com.github.technus.tectech.thing.casing.TT_Container_Casings;
import com.github.technus.tectech.thing.metaTileEntity.IFrontRotation;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.GregTech_API;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -20,6 +20,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import org.apache.commons.lang3.StringUtils;
@@ -395,7 +396,7 @@ public final class Util {
String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks
Block[] blockType,//use numbers 0-9 for casing types
byte[] blockMeta,//use numbers 0-9 for casing types
- HatchAdder[] addingMethods,
+ IHatchAdder[] addingMethods,
short[] casingTextures,
Block[] blockTypeFallback,//use numbers 0-9 for casing types
byte[] blockMetaFallback,//use numbers 0-9 for casing types
@@ -1450,4 +1451,10 @@ public final class Util {
}
return Double.toString(value);
}
+
+ public static boolean checkChunkExist(World world, ChunkCoordIntPair chunk){
+ int x=chunk.getCenterXPos();
+ int z=chunk.getCenterZPosition();
+ return world.checkChunksExist(x, 0, z, x, 0, z);
+ }
}
diff --git a/src/main/java/com/github/technus/tectech/chunkData/ChunkDataHandler.java b/src/main/java/com/github/technus/tectech/chunkData/ChunkDataHandler.java
new file mode 100644
index 0000000000..f7b3895a80
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/chunkData/ChunkDataHandler.java
@@ -0,0 +1,364 @@
+package com.github.technus.tectech.chunkData;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import cpw.mods.fml.common.gameevent.TickEvent;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.ChunkCoordIntPair;
+import net.minecraftforge.event.world.ChunkDataEvent;
+import net.minecraftforge.event.world.ChunkEvent;
+import net.minecraftforge.event.world.WorldEvent;
+
+import java.util.*;
+
+public class ChunkDataHandler {
+ private final String BASE_TAG_NAME ="TecTechData";
+ private final HashMap<Integer,HashMap<ChunkCoordIntPair, NBTChunk>> dimensionWiseChunkData=new HashMap<>();
+ private final HashMap<String,HashMap<Integer,ChunkHashMap >> dimensionWiseMetaChunkData=new HashMap<>();
+ private final HashMap<String, IChunkMetaDataHandler> metaDataHandlerHashMap =new HashMap<>();
+ private final ArrayList<IChunkMetaDataHandler> clientSyncHandlers =new ArrayList<>();
+ private final ArrayList<IChunkMetaDataHandler> serverHandlers=new ArrayList<>();
+ private final ArrayList<IChunkMetaDataHandler> worldHandlers=new ArrayList<>();
+ private final ArrayList<IChunkMetaDataHandler> playerHandlers=new ArrayList<>();
+ private final ArrayList<IChunkMetaDataHandler> clientHandlers=new ArrayList<>();
+ private final ArrayList<IChunkMetaDataHandler> renderHandlers=new ArrayList<>();
+
+ @SubscribeEvent
+ public void onWorldLoad(WorldEvent.Load event){
+ int dim=event.world.provider.dimensionId;
+ dimensionWiseChunkData.computeIfAbsent(dim, m->{
+ HashMap<ChunkCoordIntPair, NBTChunk> map = new HashMap<>();
+ for (Map.Entry<String,IChunkMetaDataHandler> meta : metaDataHandlerHashMap.entrySet()) {
+ dimensionWiseMetaChunkData.get(meta.getKey()).put(dim, new ChunkHashMap(meta.getValue(), map));
+ }
+ return map;
+ });
+ }
+
+ @SubscribeEvent
+ public void handleChunkSaveEvent(ChunkDataEvent.Save event) {
+ HashMap<ChunkCoordIntPair, NBTChunk> dimensionData = dimensionWiseChunkData.get(event.world.provider.dimensionId);
+ NBTChunk chunkData = dimensionData != null ? dimensionData.get(event.getChunk().getChunkCoordIntPair()) : null;
+ if (chunkData == null) {
+ event.getData().removeTag(BASE_TAG_NAME);
+ } else {
+ chunkData.isLoaded = true;
+ event.getData().setTag(BASE_TAG_NAME, chunkData.data);
+ }
+ }
+
+ @SubscribeEvent
+ public void handleChunkLoadEvent(ChunkDataEvent.Load event) {
+ NBTTagCompound loadedTag = event.getData().getCompoundTag(BASE_TAG_NAME);
+ if (loadedTag.hasNoTags()) {
+ return;
+ }
+ int dimId = event.world.provider.dimensionId;
+ HashMap<ChunkCoordIntPair, NBTChunk> dimensionMemory = dimensionWiseChunkData.get(dimId);
+ ChunkCoordIntPair chunkCoordIntPair = event.getChunk().getChunkCoordIntPair();
+ Set<String> loadedKeys = loadedTag.func_150296_c();
+ NBTChunk chunkMemory = dimensionMemory.get(chunkCoordIntPair);
+ if (chunkMemory == null) {
+ chunkMemory = new NBTChunk(loadedTag, true);
+ dimensionMemory.put(chunkCoordIntPair, chunkMemory);
+ for (String s : loadedKeys) {
+ dimensionWiseMetaChunkData.get(s).get(dimId).putLoaded(chunkCoordIntPair, loadedTag.getCompoundTag(s));
+ }
+ } else if (!chunkMemory.isLoaded) {
+ chunkMemory.isLoaded = true;
+
+ Set<String> tagsDuplicated = new HashSet(loadedKeys);
+ tagsDuplicated.retainAll(chunkMemory.data.func_150296_c());
+
+ if (tagsDuplicated.isEmpty()) {
+ for (String s : loadedKeys) {
+ NBTTagCompound tag = loadedTag.getCompoundTag(s);
+ chunkMemory.data.setTag(s, tag);
+ dimensionWiseMetaChunkData.get(s).get(dimId).putLoaded(chunkCoordIntPair, tag);
+ }
+ } else {
+ for (String s : loadedKeys) {
+ NBTTagCompound memory = chunkMemory.data.getCompoundTag(s);
+ if (tagsDuplicated.contains(s)) {
+ metaDataHandlerHashMap.get(s).mergeData(memory, loadedTag.getCompoundTag(s));
+ } else {
+ chunkMemory.data.setTag(s, loadedTag.getCompoundTag(s));
+ dimensionWiseMetaChunkData.get(s).get(dimId).putLoaded(chunkCoordIntPair, memory);
+ }
+ }
+ }
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ @SubscribeEvent
+ public void onLoadChunk(ChunkEvent.Load aEvent){
+ clientSyncHandlers.forEach(chunkMetaDataHandler -> chunkMetaDataHandler.requestData(aEvent));
+ }
+
+ @SideOnly(Side.CLIENT)
+ @SubscribeEvent
+ public void onUnLoadChunk(ChunkEvent.Unload aEvent){
+ clientSyncHandlers.forEach(chunkMetaDataHandler -> dimensionWiseMetaChunkData
+ .get(chunkMetaDataHandler.getTagName())
+ .get(aEvent.world.provider.dimensionId)
+ .remove(aEvent.getChunk().getChunkCoordIntPair()));
+ }
+
+ @SideOnly(Side.CLIENT)
+ @SubscribeEvent
+ public void onClientTickEvent(TickEvent.ClientTickEvent aEvent) {
+ clientHandlers.forEach(chunkMetaDataHandler ->
+ chunkMetaDataHandler.tickClient(
+ dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName()), aEvent));
+ }
+
+ @SideOnly(Side.CLIENT)
+ @SubscribeEvent
+ public void onRenderTickEvent(TickEvent.RenderTickEvent aEvent) {
+ renderHandlers.forEach(chunkMetaDataHandler ->
+ chunkMetaDataHandler.tickRender(
+ dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName()), aEvent));
+ }
+
+ @SubscribeEvent
+ public void onServerTickEvent(TickEvent.ServerTickEvent aEvent) {
+ serverHandlers.forEach(chunkMetaDataHandler ->
+ chunkMetaDataHandler.tickServer(
+ dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName()), aEvent));
+ }
+
+ @SideOnly(Side.SERVER)
+ @SubscribeEvent
+ public void onWorldTickEvent(TickEvent.WorldTickEvent aEvent) {
+ int dim=aEvent.world.provider.dimensionId;
+ clientSyncHandlers.forEach(chunkMetaDataHandler -> {
+ ChunkHashMap data=dimensionWiseMetaChunkData
+ .get(chunkMetaDataHandler.getTagName()).get(dim);
+ int cycle=chunkMetaDataHandler.pushPayloadSpreadPeriod();
+ int epoch=(int)(aEvent.world.getTotalWorldTime()%cycle);
+ ArrayList<ChunkCoordIntPair> work;
+ if(epoch==0){
+ int per=data.dirtyBoys.size()/cycle;
+ int mod=data.dirtyBoys.size()%cycle;
+ Iterator<ChunkCoordIntPair> iter=data.dirtyBoys.iterator();
+ for (int periodWork = 0; periodWork < cycle; periodWork++) {
+ work=data.workLoad.get(periodWork);
+ for (int i = 0; i < per; i++) {
+ work.add(iter.next());
+ }
+ if(periodWork<mod){
+ work.add(iter.next());
+ }
+ }
+ data.dirtyBoys.clear();
+ }
+ work=data.workLoad.get(epoch);
+ chunkMetaDataHandler.pushPayload(dim,work);
+ work.clear();
+ });
+ worldHandlers.forEach(chunkMetaDataHandler ->
+ chunkMetaDataHandler.tickWorld(
+ dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName()), aEvent));
+ }
+
+ @SubscribeEvent
+ public void onPlayerTickEvent(TickEvent.PlayerTickEvent aEvent) {
+ playerHandlers.forEach(chunkMetaDataHandler ->
+ chunkMetaDataHandler.tickPlayer(
+ dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName()), aEvent));
+ }
+
+
+ public void clearData() {
+ dimensionWiseChunkData.clear();
+ dimensionWiseMetaChunkData.forEach((k,v)->v.clear());
+ }
+
+ public IChunkMetaDataHandler getChunkMetaDataHandler(String s){
+ return metaDataHandlerHashMap.get(s);
+ }
+
+ public void registerChunkMetaDataHandler(IChunkMetaDataHandler handler){
+ metaDataHandlerHashMap.put(handler.getTagName(),handler);
+ dimensionWiseMetaChunkData.put(handler.getTagName(),new HashMap<>());
+ Class clazz=handler.getClass();
+ try {
+ if(clazz.getMethod("tickServer", HashMap.class, TickEvent.ServerTickEvent.class).getDeclaringClass()!= IChunkMetaDataHandler.class){
+ serverHandlers.add(handler);
+ }
+ if(clazz.getMethod("tickPlayer", HashMap.class, TickEvent.PlayerTickEvent.class).getDeclaringClass()!= IChunkMetaDataHandler.class){
+ playerHandlers.add(handler);
+ }
+ if (clazz.getMethod("requestData", ChunkEvent.Load.class).getDeclaringClass() != IChunkMetaDataHandler.class) {
+ clientSyncHandlers.add(handler);
+ }
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException("Cannot register common event handlers!");
+ }
+ if(FMLCommonHandler.instance().getEffectiveSide().isServer()) {
+ try {
+ if(clazz.getMethod("tickWorld", HashMap.class, TickEvent.WorldTickEvent.class).getDeclaringClass()!= IChunkMetaDataHandler.class){
+ worldHandlers.add(handler);
+ }
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException("Cannot register client event handlers!");
+ }
+ }
+ if(FMLCommonHandler.instance().getEffectiveSide().isClient()) {
+ try {
+ if (clazz.getMethod("tickClient", HashMap.class, TickEvent.ClientTickEvent.class).getDeclaringClass() != IChunkMetaDataHandler.class) {
+ clientHandlers.add(handler);
+ }
+ if (clazz.getMethod("tickRender", HashMap.class, TickEvent.RenderTickEvent.class).getDeclaringClass() != IChunkMetaDataHandler.class) {
+ renderHandlers.add(handler);
+ }
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException("Cannot register client event handlers!");
+ }
+ }
+ }
+
+ public NBTTagCompound removeChunkData(IChunkMetaDataHandler handler, int world, ChunkCoordIntPair chunk){
+ return dimensionWiseMetaChunkData.get(handler.getTagName()).get(world).remove(chunk);
+ }
+
+ public NBTTagCompound getChunkData(IChunkMetaDataHandler handler, int world, ChunkCoordIntPair chunk){
+ return dimensionWiseMetaChunkData.get(handler.getTagName()).get(world).get(chunk);
+ }
+
+ public NBTTagCompound putChunkData(IChunkMetaDataHandler handler, int world, ChunkCoordIntPair chunk, NBTTagCompound data){
+ return dimensionWiseMetaChunkData.get(handler.getTagName()).get(world).put(chunk,data);
+ }
+
+ public NBTTagCompound createIfAbsentChunkData(IChunkMetaDataHandler handler, int world, ChunkCoordIntPair chunk){
+ return dimensionWiseMetaChunkData.get(handler.getTagName()).get(world)
+ .computeIfAbsent(chunk,chunkCoordIntPair -> handler.createData());
+ }
+
+ public HashMap<Integer,ChunkHashMap> getChunkData(IChunkMetaDataHandler chunkMetaDataHandler){
+ return dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName());
+ }
+
+ public ChunkHashMap getChunkData(IChunkMetaDataHandler chunkMetaDataHandler, int world){
+ return dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName()).get(world);
+ }
+
+ public static final class ChunkHashMap implements Map<ChunkCoordIntPair,NBTTagCompound>{
+ private final HashMap<ChunkCoordIntPair,NBTChunk> storage;
+ private final HashMap<ChunkCoordIntPair,NBTTagCompound> storageMeta=new HashMap<>(1024);
+ private final HashSet<ChunkCoordIntPair> dirtyBoys=new HashSet<>(1024);
+ private final ArrayList<ArrayList<ChunkCoordIntPair>> workLoad=new ArrayList<>();
+ private final String meta;
+
+ private ChunkHashMap(IChunkMetaDataHandler meta, HashMap<ChunkCoordIntPair, NBTChunk> storage) {
+ this.storage =storage;
+ this.meta=meta.getTagName();
+ for (int i = 0; i < meta.pushPayloadSpreadPeriod(); i++) {
+ workLoad.add(new ArrayList<>(128));
+ }
+ }
+
+ public void markForTransmissionToClient(ChunkCoordIntPair chunk){
+ dirtyBoys.add(chunk);
+ }
+
+ private void putLoaded(ChunkCoordIntPair key, NBTTagCompound value) {
+ storageMeta.put(key, value);
+ }
+
+ @Override
+ public NBTTagCompound remove(Object key) {
+ NBTTagCompound compound=storageMeta.remove(key);
+ if(compound!=null) {
+ NBTChunk chunk = storage.get(key);
+ chunk.data.removeTag(meta);
+ if(chunk.data.hasNoTags()){
+ storage.remove(key);
+ }
+ }
+ return compound;
+ }
+
+ @Override
+ public NBTTagCompound put(ChunkCoordIntPair key, NBTTagCompound value) {
+ if(value==null){
+ return remove(key);
+ }
+ NBTChunk chunk = storage.get(key);
+ if(chunk==null){
+ NBTTagCompound base=new NBTTagCompound();
+ base.setTag(meta,value);
+ storage.put(key,new NBTChunk(base,false));
+ }else {
+ chunk.data.setTag(meta,value);
+ }
+ return storageMeta.put(key, value);
+ }
+
+ @Override
+ public int size() {
+ return storageMeta.size();
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return storageMeta.isEmpty();
+ }
+
+ @Override
+ public NBTTagCompound get(Object key) {
+ return storageMeta.get(key);
+ }
+
+ @Override
+ public void clear() {
+ storageMeta.entrySet().forEach(this::remove);
+ }
+
+ @Override
+ public void putAll(Map<? extends ChunkCoordIntPair, ? extends NBTTagCompound> m) {
+ m.forEach(this::put);
+ }
+
+ @Override
+ public boolean containsKey(Object key) {
+ return storageMeta.containsKey(key);
+ }
+
+ @Override
+ public boolean containsValue(Object value) {
+ return storageMeta.containsValue(value);
+ }
+
+ @Override
+ public Set<ChunkCoordIntPair> keySet() {
+ return storageMeta.keySet();
+ }
+
+ @Override
+ public Collection<NBTTagCompound> values() {
+ return storageMeta.values();
+ }
+
+ @Override
+ public Set<Entry<ChunkCoordIntPair, NBTTagCompound>> entrySet() {
+ return storageMeta.entrySet();
+ }
+ }
+
+ private static final class NBTChunk {
+ private final NBTTagCompound data;
+ private boolean isLoaded;
+
+ private NBTChunk(NBTTagCompound data, boolean isLoaded) {
+ if(data==null){
+ data=new NBTTagCompound();
+ }
+ this.data = data;
+ this.isLoaded = isLoaded;
+ }
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/chunkData/IChunkMetaDataHandler.java b/src/main/java/com/github/technus/tectech/chunkData/IChunkMetaDataHandler.java
new file mode 100644
index 0000000000..b904f09f33
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/chunkData/IChunkMetaDataHandler.java
@@ -0,0 +1,37 @@
+package com.github.technus.tectech.chunkData;
+
+import cpw.mods.fml.common.gameevent.TickEvent;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.ChunkCoordIntPair;
+import net.minecraftforge.event.world.ChunkEvent;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+public interface IChunkMetaDataHandler {
+ String getTagName();
+ void mergeData(NBTTagCompound target, NBTTagCompound loadedData);
+ NBTTagCompound createData();
+ @SideOnly(Side.CLIENT)
+ default void requestData(ChunkEvent.Load aEvent){}
+ @SideOnly(Side.SERVER)
+ default void pushData(int world, ChunkCoordIntPair chunk){}
+ @SideOnly(Side.SERVER)
+ default void pushPayload(int world, ArrayList<ChunkCoordIntPair> chunk){
+ chunk.forEach(chunkCoordIntPair -> pushData(world,chunkCoordIntPair));
+ }
+ default int pushPayloadSpreadPeriod(){
+ return 20;
+ }
+ @SideOnly(Side.CLIENT)
+ default void tickRender(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.RenderTickEvent aEvent){}
+ @SideOnly(Side.CLIENT)
+ default void tickClient(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.ClientTickEvent aEvent){}
+ default void tickServer(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.ServerTickEvent event){}
+ @SideOnly(Side.SERVER)
+ default void tickWorld(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.WorldTickEvent aEvent){}
+ default void tickPlayer(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.PlayerTickEvent aEvent){}
+}
+
diff --git a/src/main/java/com/github/technus/tectech/chunkData/WorldData.java b/src/main/java/com/github/technus/tectech/chunkData/WorldData.java
new file mode 100644
index 0000000000..42641a015e
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/chunkData/WorldData.java
@@ -0,0 +1,52 @@
+package com.github.technus.tectech.chunkData;
+
+import net.minecraft.world.ChunkCoordIntPair;
+import net.minecraft.world.World;
+import net.minecraft.world.chunk.Chunk;
+
+import java.util.Objects;
+
+public final class WorldData {
+ private final World world;
+ private final Chunk chunk;
+ private final ChunkCoordIntPair coordIntPair;
+
+ public WorldData(World world, Chunk data) {
+ this.world = world;
+ this.chunk = data;
+ coordIntPair=data.getChunkCoordIntPair();
+ }
+
+ public WorldData(World world, ChunkCoordIntPair data) {
+ this.world = world;
+ this.coordIntPair = data;
+ chunk= world.getChunkFromChunkCoords(data.chunkXPos,data.chunkZPos);
+ }
+
+ public World getWorld() {
+ return world;
+ }
+
+ public Chunk getChunk() {
+ return chunk;
+ }
+
+ public ChunkCoordIntPair getCoordIntPair() {
+ return coordIntPair;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ WorldData worldData = (WorldData) o;
+ return world.provider.dimensionId==worldData.world.provider.dimensionId &&
+ coordIntPair.chunkXPos==worldData.coordIntPair.chunkXPos &&
+ coordIntPair.chunkZPos==worldData.coordIntPair.chunkXPos;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(world.provider.dimensionId, coordIntPair);
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java
index dd3ad339af..16636d67cf 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java
@@ -5,6 +5,7 @@ import com.github.technus.tectech.thing.CustomItemList;
import com.github.technus.tectech.thing.block.QuantumGlassBlock;
import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.Behaviour_Centrifuge;
import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.Behaviour_ElectromagneticSeparator;
+import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.Behaviour_Recycler;
import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine;
import cpw.mods.fml.common.Loader;
import gregtech.api.enums.GT_Values;
@@ -1111,5 +1112,14 @@ public class DreamCraftRecipeLoader implements Runnable {
GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(10),getItemContainer("ElectromagneticSeparatorUEV").get(1));
GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(11),getItemContainer("ElectromagneticSeparatorUIV").get(1));
GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(12),getItemContainer("ElectromagneticSeparatorUMV").get(1));
+
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(5),ItemList.Machine_IV_Recycler.get(1));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(6),getItemContainer("RecyclerLuV").get(1));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(7),getItemContainer("RecyclerZPM").get(1));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(8),getItemContainer("RecyclerUV").get(1));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(9),getItemContainer("RecyclerUHV").get(1));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(10),getItemContainer("RecyclerUEV").get(1));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(11),getItemContainer("RecyclerUIV").get(1));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(12),getItemContainer("RecyclerUMV").get(1));
}
}
diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java
index 6cec48c41f..3d64ceee62 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java
@@ -10,7 +10,7 @@ import com.github.technus.tectech.thing.casing.TT_Container_Casings;
import com.github.technus.tectech.thing.metaTileEntity.IConstructable;
import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -46,7 +46,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_
};
private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMeta = new byte[]{0,0,4,8};
- private final HatchAdder[] addingMethods = new HatchAdder[]{
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{
this::addClassicToMachineList,
this::addElementalInputToMachineList,
this::addElementalMufflerToMachineList};
diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java
index fd56305d5f..9bd16c959b 100644
--- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java
+++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java
@@ -10,7 +10,7 @@ import com.github.technus.tectech.thing.casing.TT_Container_Casings;
import com.github.technus.tectech.thing.metaTileEntity.IConstructable;
import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -46,7 +46,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu
};
private static final Block[] blockType = new Block[]{QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMeta = new byte[]{0,4,0,8};
- private final HatchAdder[] addingMethods = new HatchAdder[]{
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{
this::addClassicToMachineList,
this::addElementalOutputToMachineList,
this::addElementalMufflerToMachineList};
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 425849668d..4df0ad70ed 100644
--- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java
@@ -50,7 +50,7 @@ import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeT
import static gregtech.api.enums.GT_Values.W;
public final class MainLoader {
- public static DamageSource microwaving, elementalPollution;
+ public static DamageSource microwaving, elementalPollution,subspace;
private MainLoader(){}
@@ -107,6 +107,7 @@ public final class MainLoader {
progressBarLoad.step("Add damage types");
microwaving =new DamageSource("microwaving").setDamageBypassesArmor();
elementalPollution =new DamageSource("elementalPollution").setDamageBypassesArmor();
+ subspace =new DamageSource("subspace").setDamageBypassesArmor().setDamageIsAbsolute();
LOGGER.info("Damage types addition Done");
progressBarLoad.step("Register Packet Dispatcher");
diff --git a/src/main/java/com/github/technus/tectech/loader/network/ChunkDataMessage.java b/src/main/java/com/github/technus/tectech/loader/network/ChunkDataMessage.java
new file mode 100644
index 0000000000..15c936191a
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/loader/network/ChunkDataMessage.java
@@ -0,0 +1,101 @@
+package com.github.technus.tectech.loader.network;
+
+import com.github.technus.tectech.TecTech;
+import com.github.technus.tectech.Util;
+import com.github.technus.tectech.chunkData.IChunkMetaDataHandler;
+import cpw.mods.fml.common.network.ByteBufUtils;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import eu.usrv.yamcore.network.client.AbstractClientMessageHandler;
+import eu.usrv.yamcore.network.server.AbstractServerMessageHandler;
+import io.netty.buffer.ByteBuf;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.ChunkCoordIntPair;
+import net.minecraftforge.event.world.ChunkEvent;
+
+public class ChunkDataMessage implements IMessage {
+ int worldId;
+ ChunkCoordIntPair chunk;
+ NBTTagCompound data;
+ IChunkMetaDataHandler handler;
+
+ public ChunkDataMessage(){}
+
+ @Override
+ public void fromBytes(ByteBuf pBuffer) {
+ NBTTagCompound tag = ByteBufUtils.readTag(pBuffer);
+ worldId = tag.getInteger("wId");
+ chunk=new ChunkCoordIntPair(
+ tag.getInteger("posx"),
+ tag.getInteger("posz"));
+ handler = TecTech.chunkDataHandler.getChunkMetaDataHandler(
+ tag.getString("handle"));
+ if(tag.hasKey("data")){
+ data=tag.getCompoundTag("data");
+ }
+ }
+
+ @Override
+ public void toBytes(ByteBuf pBuffer) {
+ NBTTagCompound tag = new NBTTagCompound();
+ tag.setInteger("wId",worldId);
+ tag.setInteger("posx",chunk.chunkXPos);
+ tag.setInteger("posz",chunk.chunkZPos);
+ tag.setString("handle",handler.getTagName());
+ if(data!=null){
+ tag.setTag("data",data);
+ }
+ ByteBufUtils.writeTag(pBuffer, tag);
+ }
+
+ public static class ChunkDataQuery extends ChunkDataMessage {
+ public ChunkDataQuery() {
+ }
+ public ChunkDataQuery(ChunkEvent.Load aEvent, IChunkMetaDataHandler handler) {
+ worldId=aEvent.world.provider.dimensionId;
+ chunk=aEvent.getChunk().getChunkCoordIntPair();
+ this.handler=handler;
+ }
+ }
+
+ public static class ChunkDataData extends ChunkDataMessage {
+ public ChunkDataData() {
+ }
+
+ public ChunkDataData(int worldId, ChunkCoordIntPair chunk, IChunkMetaDataHandler handler){
+ this.worldId=worldId;
+ this.chunk=chunk;
+ this.handler=handler;
+ this.data=TecTech.chunkDataHandler.getChunkData(handler,worldId,chunk);
+ }
+
+ public ChunkDataData(ChunkDataQuery query){
+ worldId=query.worldId;
+ chunk=query.chunk;
+ handler=query.handler;
+ data=TecTech.chunkDataHandler.getChunkData(handler,worldId,chunk);
+ }
+ }
+
+ public static class ClientHandler extends AbstractClientMessageHandler<ChunkDataData> {
+ @Override
+ public IMessage handleClientMessage(EntityPlayer pPlayer, ChunkDataData pMessage, MessageContext pCtx) {
+ if(Util.checkChunkExist(pPlayer.worldObj,pMessage.chunk)){
+ TecTech.chunkDataHandler.putChunkData(pMessage.handler, pMessage.worldId,pMessage.chunk, pMessage.data);
+ }
+ return null;
+ }
+ }
+
+ public static class ServerHandler extends AbstractServerMessageHandler<ChunkDataQuery> {
+ @Override
+ public IMessage handleServerMessage(EntityPlayer pPlayer, ChunkDataQuery pMessage, MessageContext pCtx) {
+ if(pPlayer instanceof EntityPlayerMP){
+ NetworkDispatcher.INSTANCE.sendTo(new ChunkDataData(pMessage),(EntityPlayerMP) pPlayer);
+ }
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/loader/network/NetworkDispatcher.java b/src/main/java/com/github/technus/tectech/loader/network/NetworkDispatcher.java
index 2ee027ddc8..56455a13c4 100644
--- a/src/main/java/com/github/technus/tectech/loader/network/NetworkDispatcher.java
+++ b/src/main/java/com/github/technus/tectech/loader/network/NetworkDispatcher.java
@@ -17,5 +17,7 @@ public class NetworkDispatcher extends eu.usrv.yamcore.network.PacketDispatcher
registerMessage(PipeActivityMessage.ClientHandler.class, PipeActivityMessage.PipeActivityData.class);
registerMessage(RotationMessage.ServerHandler.class, RotationMessage.RotationQuery.class);
registerMessage(RotationMessage.ClientHandler.class, RotationMessage.RotationData.class);
+ registerMessage(ChunkDataMessage.ServerHandler.class, ChunkDataMessage.ChunkDataQuery.class);
+ registerMessage(ChunkDataMessage.ClientHandler.class, ChunkDataMessage.ChunkDataData.class);
}
}
diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java
index c4ab54694c..bfe015749c 100644
--- a/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/recipe/BloodyRecipeLoader.java
@@ -5,6 +5,7 @@ import com.github.technus.tectech.thing.CustomItemList;
import com.github.technus.tectech.thing.block.QuantumGlassBlock;
import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.Behaviour_Centrifuge;
import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.Behaviour_ElectromagneticSeparator;
+import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.Behaviour_Recycler;
import com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList;
@@ -719,38 +720,61 @@ public class BloodyRecipeLoader implements Runnable {
}
private void register_machine_EM_behaviours(){
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(6),ItemList.Machine_IV_Centrifuge.get(1));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(5),ItemList.Machine_IV_Centrifuge.get(1));
try {
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(7),ItemList.valueOf("Machine_LuV_Centrifuge").get(1));
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(8),ItemList.valueOf("Machine_ZPM_Centrifuge").get(1));
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(9),ItemList.valueOf("Machine_UV_Centrifuge").get(1));
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(10),ItemList.valueOf("Machine_UV_Centrifuge").get(4));
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(11),ItemList.valueOf("Machine_UV_Centrifuge").get(16));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(6),ItemList.valueOf("Machine_LuV_Centrifuge").get(1));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(7),ItemList.valueOf("Machine_ZPM_Centrifuge").get(1));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(8),ItemList.valueOf("Machine_UV_Centrifuge").get(1));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(9),ItemList.valueOf("Machine_UV_Centrifuge").get(4));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(10),ItemList.valueOf("Machine_UV_Centrifuge").get(16));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(11),ItemList.valueOf("Machine_UV_Centrifuge").get(40));
GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(12),ItemList.valueOf("Machine_UV_Centrifuge").get(64));
}catch (IllegalArgumentException|NullPointerException e){
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(7),ItemList.Machine_IV_Centrifuge.get(2));
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(8),ItemList.Machine_IV_Centrifuge.get(4));
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(9),ItemList.Machine_IV_Centrifuge.get(8));
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(10),ItemList.Machine_IV_Centrifuge.get(16));
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(11),ItemList.Machine_IV_Centrifuge.get(32));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(6),ItemList.Machine_IV_Centrifuge.get(2));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(7),ItemList.Machine_IV_Centrifuge.get(4));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(8),ItemList.Machine_IV_Centrifuge.get(8));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(9),ItemList.Machine_IV_Centrifuge.get(16));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(10),ItemList.Machine_IV_Centrifuge.get(32));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(11),ItemList.Machine_IV_Centrifuge.get(48));
GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Centrifuge(12),ItemList.Machine_IV_Centrifuge.get(64));
}
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(6),ItemList.Machine_IV_ElectromagneticSeparator.get(1));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(5),ItemList.Machine_IV_ElectromagneticSeparator.get(1));
try {
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(7),ItemList.valueOf("Machine_LuV_ElectromagneticSeparator").get(1));
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(8),ItemList.valueOf("Machine_ZPM_ElectromagneticSeparator").get(1));
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(9),ItemList.valueOf("Machine_UV_ElectromagneticSeparator").get(1));
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(10),ItemList.valueOf("Machine_UV_ElectromagneticSeparator").get(4));
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(11),ItemList.valueOf("Machine_UV_ElectromagneticSeparator").get(16));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(6),ItemList.valueOf("Machine_LuV_ElectromagneticSeparator").get(1));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(7),ItemList.valueOf("Machine_ZPM_ElectromagneticSeparator").get(1));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(8),ItemList.valueOf("Machine_UV_ElectromagneticSeparator").get(1));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(9),ItemList.valueOf("Machine_UV_ElectromagneticSeparator").get(4));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(10),ItemList.valueOf("Machine_UV_ElectromagneticSeparator").get(16));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(11),ItemList.valueOf("Machine_UV_ElectromagneticSeparator").get(40));
GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(12),ItemList.valueOf("Machine_UV_ElectromagneticSeparator").get(64));
}catch (IllegalArgumentException|NullPointerException e){
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(7),ItemList.Machine_IV_ElectromagneticSeparator.get(2));
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(8),ItemList.Machine_IV_ElectromagneticSeparator.get(4));
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(9),ItemList.Machine_IV_ElectromagneticSeparator.get(8));
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(10),ItemList.Machine_IV_ElectromagneticSeparator.get(16));
- GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(11),ItemList.Machine_IV_ElectromagneticSeparator.get(32));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(6),ItemList.Machine_IV_ElectromagneticSeparator.get(2));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(7),ItemList.Machine_IV_ElectromagneticSeparator.get(4));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(8),ItemList.Machine_IV_ElectromagneticSeparator.get(8));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(9),ItemList.Machine_IV_ElectromagneticSeparator.get(16));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(10),ItemList.Machine_IV_ElectromagneticSeparator.get(32));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(11),ItemList.Machine_IV_ElectromagneticSeparator.get(48));
GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_ElectromagneticSeparator(12),ItemList.Machine_IV_ElectromagneticSeparator.get(64));
}
+
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(5),ItemList.Machine_IV_Recycler.get(1));
+ try {
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(6),ItemList.valueOf("Machine_LuV_Recycler").get(1));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(7),ItemList.valueOf("Machine_ZPM_Recycler").get(1));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(8),ItemList.valueOf("Machine_UV_Recycler").get(1));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(9),ItemList.valueOf("Machine_UV_Recycler").get(4));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(10),ItemList.valueOf("Machine_UV_Recycler").get(16));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(11),ItemList.valueOf("Machine_UV_Recycler").get(40));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(12),ItemList.valueOf("Machine_UV_Recycler").get(64));
+ }catch (IllegalArgumentException|NullPointerException e){
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(6),ItemList.Machine_IV_Recycler.get(2));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(7),ItemList.Machine_IV_Recycler.get(4));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(8),ItemList.Machine_IV_Recycler.get(8));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(9),ItemList.Machine_IV_Recycler.get(16));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(10),ItemList.Machine_IV_Recycler.get(32));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(11),ItemList.Machine_IV_Recycler.get(48));
+ GT_MetaTileEntity_EM_machine.registerBehaviour(()->new Behaviour_Recycler(12),ItemList.Machine_IV_Recycler.get(64));
+ }
}
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java
index 29d3ff663a..f45d3a5df5 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java
@@ -1,14 +1,28 @@
package com.github.technus.tectech.mechanics.anomaly;
-import com.github.technus.tectech.mechanics.chunkData.ChunkDataHandler;
-import com.github.technus.tectech.mechanics.chunkData.ChunkMetaDataHandler;
+import com.github.technus.tectech.TecTech;
+import com.github.technus.tectech.chunkData.ChunkDataHandler;
+import com.github.technus.tectech.chunkData.IChunkMetaDataHandler;
+import com.github.technus.tectech.loader.network.ChunkDataMessage;
+import com.github.technus.tectech.loader.network.NetworkDispatcher;
+import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.atom.dAtomDefinition;
import cpw.mods.fml.common.gameevent.TickEvent;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.ChunkCoordIntPair;
+import net.minecraft.world.World;
+import net.minecraft.world.chunk.Chunk;
+import net.minecraftforge.event.world.ChunkEvent;
+import java.util.ArrayList;
import java.util.HashMap;
-public class AnomalyHandler implements ChunkMetaDataHandler {
- private static final String INTENSITY="intensity";
+public class AnomalyHandler implements IChunkMetaDataHandler {
+ private static final double SWAP_THRESHOLD = dAtomDefinition.getSomethingHeavy().getMass() * 10000D;
+ private static final double PER_PARTICLE=SWAP_THRESHOLD/64;
+ private static final String INTENSITY = "intensity";
+ private static final int MEAN_DELAY =50;
@Override
public String getTagName() {
@@ -17,8 +31,8 @@ public class AnomalyHandler implements ChunkMetaDataHandler {
@Override
public void mergeData(NBTTagCompound target, NBTTagCompound loadedData) {
- int intensity=target.getInteger(INTENSITY)+loadedData.getInteger(INTENSITY);
- target.setInteger(INTENSITY,intensity);
+ double intensity = target.getDouble(INTENSITY) + loadedData.getDouble(INTENSITY);
+ target.setDouble(INTENSITY, intensity);
}
@Override
@@ -27,7 +41,120 @@ public class AnomalyHandler implements ChunkMetaDataHandler {
}
@Override
- public void TickData(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.ServerTickEvent event) {
-
+ public void tickWorld(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.WorldTickEvent aEvent) {
+ if(TecTech.RANDOM.nextInt(MEAN_DELAY)==0) {
+ int dim=aEvent.world.provider.dimensionId;
+ ArrayList<Chunk> worldDataArrayList =new ArrayList<>(1024);
+ data.get(dim).forEach((chunkCoordIntPair, compound) -> {
+ if (compound.getDouble(INTENSITY) >= SWAP_THRESHOLD) {
+ Chunk chunk=aEvent.world.getChunkFromChunkCoords(chunkCoordIntPair.chunkXPos,chunkCoordIntPair.chunkZPos);
+ if(chunk.isChunkLoaded){
+ worldDataArrayList.add(chunk);
+ }
+ }
+ });
+ if(worldDataArrayList.size()>=2) {
+ Chunk a = worldDataArrayList.remove(TecTech.RANDOM.nextInt(worldDataArrayList.size()));
+ Chunk b = worldDataArrayList.remove(TecTech.RANDOM.nextInt(worldDataArrayList.size()));
+ data.get(dim).get(a.getChunkCoordIntPair()).setDouble(INTENSITY,SWAP_THRESHOLD*TecTech.RANDOM.nextFloat()*0.25F);
+ data.get(dim).get(b.getChunkCoordIntPair()).setDouble(INTENSITY,SWAP_THRESHOLD*TecTech.RANDOM.nextFloat()*0.25F);
+ data.get(dim).markForTransmissionToClient(a.getChunkCoordIntPair());
+ data.get(dim).markForTransmissionToClient(b.getChunkCoordIntPair());
+ swapSomething(a,b);
+ }
+ }
+ }
+
+ private void swapSomething(Chunk a,Chunk b){
+ for(int i=0;i<128;i++){
+ int x=TecTech.RANDOM.nextInt(16);
+ int y=TecTech.RANDOM.nextInt(a.worldObj.getActualHeight());
+ int z=TecTech.RANDOM.nextInt(16);
+ Block aBlock=a.getBlock(x,y,z);
+ Block bBlock=a.getBlock(x,y,z);
+ int aMeta=a.getBlockMetadata(x,y,z);
+ int bMeta=a.getBlockMetadata(x,y,z);
+ if(a.getTileEntityUnsafe(x,y,z)==null&&b.getTileEntityUnsafe(x,y,z)==null){
+ a.worldObj.setBlock((a.xPosition<<4)+x,y,(a.zPosition<<4)+z,bBlock,bMeta,3);
+ b.worldObj.setBlock((b.xPosition<<4)+x,y,(b.zPosition<<4)+z,aBlock,aMeta,3);
+ }else if(a.getTileEntityUnsafe(x,y,z)==null){
+ a.worldObj.setBlockToAir((a.xPosition<<4)+x,y,(a.zPosition<<4)+z);
+ b.worldObj.setBlock((b.xPosition<<4)+x,y,(b.zPosition<<4)+z,aBlock,aMeta,3);
+ }else if(b.getTileEntityUnsafe(x,y,z)==null){
+ a.worldObj.setBlock((a.xPosition<<4)+x,y,(a.zPosition<<4)+z,bBlock,bMeta,3);
+ b.worldObj.setBlockToAir((b.xPosition<<4)+x,y,(b.zPosition<<4)+z);
+ }else{
+ a.worldObj.setBlockToAir((a.xPosition<<4)+x,y,(a.zPosition<<4)+z);
+ b.worldObj.setBlockToAir((b.xPosition<<4)+x,y,(b.zPosition<<4)+z);
+ }
+ }
+ }
+
+ @Override
+ public void tickServer(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.ServerTickEvent event) {
+
+ }
+
+ @Override
+ public void tickPlayer(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.PlayerTickEvent aEvent) {
+ ChunkCoordIntPair pair=new ChunkCoordIntPair(aEvent.player.chunkCoordX,aEvent.player.chunkCoordZ);
+ NBTTagCompound compound=data.get(aEvent.player.worldObj.provider.dimensionId).get(pair);
+ if(compound!=null) {
+ double intensity = compound.getDouble(INTENSITY);
+ if (aEvent.side.isClient()) {
+ for (int i = 0; i < intensity / PER_PARTICLE; i++) {
+ TecTech.proxy.em_particle(aEvent.player.worldObj,
+ aEvent.player.posX - 32D + TecTech.RANDOM.nextFloat() * 64D,
+ aEvent.player.posY - 32D + TecTech.RANDOM.nextFloat() * 64D,
+ aEvent.player.posZ - 32D + TecTech.RANDOM.nextFloat() * 64D);
+ }
+ }
+ }
+ data.get(aEvent.player.worldObj.provider.dimensionId).forEach((chunkCoordIntPair, dat) -> {
+ for (int i = 0,pow=(int)(dat.getDouble(INTENSITY)/PER_PARTICLE); i < pow; i++) {
+ TecTech.proxy.em_particle(aEvent.player.worldObj,
+ (chunkCoordIntPair.chunkXPos<<4)+TecTech.RANDOM.nextFloat() * 48D-16D,
+ aEvent.player.posY+TecTech.RANDOM.nextFloat() * 128D-64D,
+ (chunkCoordIntPair.chunkZPos<<4)+TecTech.RANDOM.nextFloat() * 48D-16D);
+ }
+ });
+ }
+
+ @Override
+ public void requestData(ChunkEvent.Load aEvent) {
+ NetworkDispatcher.INSTANCE.sendToServer(new ChunkDataMessage.ChunkDataQuery(aEvent, this));
+ }
+
+ @Override
+ public void pushData(int world, ChunkCoordIntPair chunk) {
+ NetworkDispatcher.INSTANCE.sendToDimension(new ChunkDataMessage.ChunkDataData(world, chunk, this), world);
+ }
+
+ @Override
+ public int pushPayloadSpreadPeriod() {
+ return 100;
+ }
+
+ public void addAnomaly(IGregTechTileEntity iGregTechTileEntity, double amount) {
+ if (iGregTechTileEntity.isServerSide()) {
+ World w = iGregTechTileEntity.getWorld();
+ addAnomaly(w.provider.dimensionId,
+ new ChunkCoordIntPair(
+ iGregTechTileEntity.getXCoord() >> 4,
+ iGregTechTileEntity.getZCoord() >> 4),
+ amount);
+ }
+ }
+
+ public void addAnomaly(int world, ChunkCoordIntPair chunk, double amount) {
+ NBTTagCompound old = TecTech.chunkDataHandler.getChunkData(this, world, chunk);
+ if (old == null) {
+ NBTTagCompound data = new NBTTagCompound();
+ data.setDouble(INTENSITY, amount);
+ TecTech.chunkDataHandler.putChunkData(this, world, chunk, data);
+ } else {
+ old.setDouble(INTENSITY, old.getDouble(INTENSITY) + amount);
+ }
+ TecTech.chunkDataHandler.getChunkData(this, world).markForTransmissionToClient(chunk);
}
}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/chunkData/ChunkDataHandler.java b/src/main/java/com/github/technus/tectech/mechanics/chunkData/ChunkDataHandler.java
deleted file mode 100644
index 8dc60248ef..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/chunkData/ChunkDataHandler.java
+++ /dev/null
@@ -1,226 +0,0 @@
-package com.github.technus.tectech.mechanics.chunkData;
-
-import cpw.mods.fml.common.gameevent.TickEvent;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.world.ChunkCoordIntPair;
-import net.minecraft.world.World;
-import net.minecraft.world.chunk.Chunk;
-import net.minecraftforge.event.world.ChunkDataEvent;
-
-import java.util.*;
-
-public class ChunkDataHandler {
- private final String BASE_TAG_NAME ="TecTechData";
- private final HashMap<Integer,HashMap<ChunkCoordIntPair, NBTChunk>> dimensionWiseChunkData=new HashMap<>();
- private final HashMap<String,HashMap<Integer,ChunkHashMap >> dimensionWiseMetaChunkData=new HashMap<>();
- private final HashMap<String,ChunkMetaDataHandler> metaDataHandlerHashMap =new HashMap<>();
-
- public void handleChunkSaveEvent(ChunkDataEvent.Save event) {
- HashMap<ChunkCoordIntPair, NBTChunk> dimensionData=dimensionWiseChunkData.get(event.world.provider.dimensionId);
- NBTChunk chunkData =dimensionData!=null?dimensionData.get(event.getChunk().getChunkCoordIntPair()):null;
- if(chunkData==null) {
- event.getData().removeTag(BASE_TAG_NAME);
- } else {
- chunkData.isLoaded=true;
- event.getData().setTag(BASE_TAG_NAME,chunkData.data);
- }
- }
-
- public void handleChunkLoadEvent(ChunkDataEvent.Load event) {
- NBTTagCompound loadedTag=event.getData().getCompoundTag(BASE_TAG_NAME);
- if(loadedTag.hasNoTags()){
- return;
- }
- int dimId=event.world.provider.dimensionId;
- HashMap<ChunkCoordIntPair, NBTChunk> dimensionMemory=
- dimensionWiseChunkData.computeIfAbsent(dimId, this::createDimensionData);
- ChunkCoordIntPair chunkCoordIntPair=event.getChunk().getChunkCoordIntPair();
- Set<String> loadedKeys=loadedTag.func_150296_c();
- NBTChunk chunkMemory =dimensionMemory.get(chunkCoordIntPair);
- if(chunkMemory==null) {
- chunkMemory=new NBTChunk(loadedTag,true);
- dimensionMemory.put(chunkCoordIntPair,chunkMemory);
- for (String s :loadedKeys) {
- dimensionWiseMetaChunkData.get(s).get(dimId).putLoaded(chunkCoordIntPair, loadedTag.getCompoundTag(s));
- }
- }else if(!chunkMemory.isLoaded) {
- chunkMemory.isLoaded=true;
-
- Set<String> tagsDuplicated=new HashSet(loadedKeys);
- tagsDuplicated.retainAll(chunkMemory.data.func_150296_c());
-
- if (tagsDuplicated.isEmpty()) {
- for (String s:loadedKeys) {
- NBTTagCompound tag=loadedTag.getCompoundTag(s);
- chunkMemory.data.setTag(s,tag);
- dimensionWiseMetaChunkData.get(s).get(dimId).putLoaded(chunkCoordIntPair,tag);
- }
- } else {
- for (String s : loadedKeys) {
- NBTTagCompound memory=chunkMemory.data.getCompoundTag(s);
- if(tagsDuplicated.contains(s)){
- metaDataHandlerHashMap.get(s).mergeData(memory,loadedTag.getCompoundTag(s));
- }else {
- chunkMemory.data.setTag(s,loadedTag.getCompoundTag(s));
- dimensionWiseMetaChunkData.get(s).get(dimId).putLoaded(chunkCoordIntPair,memory);
- }
- }
- }
- }
- }
-
- public void tickData(TickEvent.ServerTickEvent event){
- dimensionWiseMetaChunkData.forEach((k, v) -> metaDataHandlerHashMap.get(k).TickData(v, event));
- }
-
- public void onServerStarting() {
- dimensionWiseChunkData.clear();
- dimensionWiseMetaChunkData.forEach((k,v)->v.clear());
- }
-
- public void registerChunkMetaDataHandler(ChunkMetaDataHandler handler){
- metaDataHandlerHashMap.put(handler.getTagName(),handler);
- dimensionWiseMetaChunkData.put(handler.getTagName(),new HashMap<>());
- }
-
- public NBTTagCompound getChunkData(ChunkMetaDataHandler handler, World world, Chunk chunk){
- return getChunkData(handler,world.provider.dimensionId,chunk.getChunkCoordIntPair());
- }
-
- public NBTTagCompound getChunkData(ChunkMetaDataHandler handler, int world, ChunkCoordIntPair chunk){
- return dimensionWiseMetaChunkData.get(handler.getTagName()).get(world).get(chunk);
- }
-
- public NBTTagCompound computeIfAbsentChunkData(ChunkMetaDataHandler handler, World world, Chunk chunk){
- return computeIfAbsentChunkData(handler,world.provider.dimensionId,chunk.getChunkCoordIntPair());
- }
-
- public NBTTagCompound computeIfAbsentChunkData(ChunkMetaDataHandler handler, int world, ChunkCoordIntPair chunk){
- return dimensionWiseMetaChunkData.get(handler.getTagName()).get(world)
- .computeIfAbsent(chunk,chunkCoordIntPair -> handler.createData());
- }
-
- public HashMap<Integer,ChunkHashMap> getChunkData(ChunkMetaDataHandler chunkMetaDataHandler){
- return dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName());
- }
-
- public ChunkHashMap getChunkData(ChunkMetaDataHandler chunkMetaDataHandler,World world){
- return dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName()).get(world.provider.dimensionId);
- }
-
- public ChunkHashMap getChunkData(ChunkMetaDataHandler chunkMetaDataHandler,int world){
- return dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName()).get(world);
- }
-
- private HashMap<ChunkCoordIntPair, NBTChunk> createDimensionData(Integer dim) {
- HashMap<ChunkCoordIntPair, NBTChunk> map = new HashMap<>();
- for (String meta : metaDataHandlerHashMap.keySet()) {
- dimensionWiseMetaChunkData.get(meta).put(dim, new ChunkHashMap(meta, map));
- }
- return map;
- }
-
- public static final class ChunkHashMap implements Map<ChunkCoordIntPair,NBTTagCompound>{
- private final HashMap<ChunkCoordIntPair,NBTChunk> storage;
- private final HashMap<ChunkCoordIntPair,NBTTagCompound> storageMeta=new HashMap<>(1024);
- private final String meta;
-
- private ChunkHashMap(String meta, HashMap<ChunkCoordIntPair, NBTChunk> storage) {
- this.storage =storage;
- this.meta=meta;
- }
-
- private void putLoaded(ChunkCoordIntPair key, NBTTagCompound value) {
- storageMeta.put(key, value);
- }
-
- @Override
- public NBTTagCompound remove(Object key) {
- NBTTagCompound compound=storageMeta.remove(key);
- if(compound!=null) {
- NBTChunk chunk = storage.get(key);
- chunk.data.removeTag(meta);
- if(chunk.data.hasNoTags()){
- storage.remove(key);
- }
- }
- return compound;
- }
-
- @Override
- public NBTTagCompound put(ChunkCoordIntPair key, NBTTagCompound value) {
- NBTChunk chunk = storage.get(key);
- if(chunk==null){
- NBTTagCompound base=new NBTTagCompound();
- base.setTag(meta,value);
- storage.put(key,new NBTChunk(base,false));
- }else {
- chunk.data.setTag(meta,value);
- }
- return storageMeta.put(key, value);
- }
-
- @Override
- public int size() {
- return storageMeta.size();
- }
-
- @Override
- public boolean isEmpty() {
- return storageMeta.isEmpty();
- }
-
- @Override
- public NBTTagCompound get(Object key) {
- return storageMeta.get(key);
- }
-
- @Override
- public void clear() {
- storageMeta.entrySet().forEach(this::remove);
- }
-
- @Override
- public void putAll(Map<? extends ChunkCoordIntPair, ? extends NBTTagCompound> m) {
- m.forEach(this::put);
- }
-
- @Override
- public boolean containsKey(Object key) {
- return storageMeta.containsKey(key);
- }
-
- @Override
- public boolean containsValue(Object value) {
- return storageMeta.containsValue(value);
- }
-
- @Override
- public Set<ChunkCoordIntPair> keySet() {
- return storageMeta.keySet();
- }
-
- @Override
- public Collection<NBTTagCompound> values() {
- return storageMeta.values();
- }
-
- @Override
- public Set<Entry<ChunkCoordIntPair, NBTTagCompound>> entrySet() {
- return storageMeta.entrySet();
- }
- }
-
- private static final class NBTChunk {
- private final NBTTagCompound data;
- private boolean isLoaded;
-
- private NBTChunk(NBTTagCompound data, boolean isLoaded) {
- if(data==null){
- data=new NBTTagCompound();
- }
- this.data = data;
- this.isLoaded = isLoaded;
- }
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/chunkData/ChunkMetaDataHandler.java b/src/main/java/com/github/technus/tectech/mechanics/chunkData/ChunkMetaDataHandler.java
deleted file mode 100644
index 420f24f46d..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/chunkData/ChunkMetaDataHandler.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.github.technus.tectech.mechanics.chunkData;
-
-import cpw.mods.fml.common.gameevent.TickEvent;
-import net.minecraft.nbt.NBTTagCompound;
-
-import java.util.HashMap;
-
-public interface ChunkMetaDataHandler {
- String getTagName();
- void mergeData(NBTTagCompound target, NBTTagCompound loadedData);
- NBTTagCompound createData();
- void TickData(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.ServerTickEvent event);
-}
-
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalInstanceContainer.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalInstanceContainer.java
index 5244676643..20fe1ffc5b 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalInstanceContainer.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/iElementalInstanceContainer.java
@@ -6,5 +6,5 @@ package com.github.technus.tectech.mechanics.elementalMatter.core;
public interface iElementalInstanceContainer extends Cloneable {
cElementalInstanceStackMap getContainerHandler();
- float purgeOverflow();
+ void purgeOverflow();
}
diff --git a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java
index 8299f815e0..255cf56e96 100644
--- a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java
+++ b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java
@@ -11,8 +11,6 @@ import com.github.technus.tectech.thing.block.QuantumStuffRender;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.Loader;
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import cpw.mods.fml.common.gameevent.TickEvent;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@@ -25,7 +23,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.event.world.ChunkDataEvent;
import org.lwjgl.opengl.GL11;
public class ClientProxy extends CommonProxy {
@@ -141,19 +138,4 @@ public class ClientProxy extends CommonProxy {
public void renderAABB(AxisAlignedBB box) {
renderAABB(Minecraft.getMinecraft().theWorld,box);
}
-
- @SubscribeEvent
- public void handleChunkSaveEvent(ChunkDataEvent.Save event) {
- super.handleChunkSaveEvent(event);
- }
-
- @SubscribeEvent
- public void handleChunkLoadEvent(ChunkDataEvent.Load event) {
- super.handleChunkLoadEvent(event);
- }
-
- @SubscribeEvent
- public void onServerTickEvent(TickEvent.ServerTickEvent aEvent) {
- super.onServerTickEvent(aEvent);
- }
}
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 31b1b1824c..598a8b148f 100644
--- a/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java
+++ b/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java
@@ -1,8 +1,5 @@
package com.github.technus.tectech.proxy;
-import com.github.technus.tectech.TecTech;
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.network.IGuiHandler;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.block.Block;
@@ -12,7 +9,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
-import net.minecraftforge.event.world.ChunkDataEvent;
public class CommonProxy implements IGuiHandler {
public void registerRenderInfo() {}
@@ -85,19 +81,4 @@ public class CommonProxy implements IGuiHandler {
}
return false;
}
-
- @SubscribeEvent
- public void handleChunkSaveEvent(ChunkDataEvent.Save event) {
- TecTech.chunkDataHandler.handleChunkSaveEvent(event);
- }
-
- @SubscribeEvent
- public void handleChunkLoadEvent(ChunkDataEvent.Load event) {
- TecTech.chunkDataHandler.handleChunkLoadEvent(event);
- }
-
- @SubscribeEvent
- public void onServerTickEvent(TickEvent.ServerTickEvent aEvent) {
- TecTech.chunkDataHandler.tickData(aEvent);
- }
}
diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java
index b5b5dd82b9..b4dc5775d7 100644
--- a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java
+++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java
@@ -20,12 +20,12 @@ public class TT_recipe extends GT_Recipe {
public final cElementalDefinitionStackMap[] input;
public final cElementalDefinitionStackMap[] output;
public final cElementalDefinitionStackMap[] eCatalyst;
- public final AdditionalCheck additionalCheck;
+ public final IAdditionalCheck additionalCheck;
public TT_recipe(boolean aOptimize,
ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances,
FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue,
- cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, AdditionalCheck check){
+ cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, IAdditionalCheck check){
super(aOptimize,aInputs,aOutputs,aSpecialItems,aChances,aFluidInputs,aFluidOutputs,aDuration,aEUt,aSpecialValue);
input=in;
output=out;
@@ -127,7 +127,7 @@ public class TT_recipe extends GT_Recipe {
return super.isRecipeInputEqual(consume, doNotCheckStackSizes, fluidStacks, itemStacks);
}
- public interface AdditionalCheck {
+ public interface IAdditionalCheck {
boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap[] in, cElementalInstanceStackMap[] e);
boolean check(TT_recipe thisRecipe, boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap in, cElementalInstanceStackMap[] e);
}
@@ -179,7 +179,7 @@ public class TT_recipe extends GT_Recipe {
public TT_assLineRecipe(boolean aOptimize, ItemStack researchItem,
ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems,
FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue,
- cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, AdditionalCheck check) {
+ cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, IAdditionalCheck check) {
super(aOptimize, aInputs, aOutputs, aSpecialItems, null, aFluidInputs, null, aDuration, aEUt, aSpecialValue, in, out, catalyst, check);
mResearchItem=researchItem;
}
@@ -199,7 +199,7 @@ public class TT_recipe extends GT_Recipe {
public TT_EMRecipe(boolean aOptimize, GT_Recipe scannerRecipe, iElementalDefinition researchEM,
ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems,
FluidStack[] aFluidInputs, int aDuration, int aEUt, int aSpecialValue,
- cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, AdditionalCheck check) {
+ cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, IAdditionalCheck check) {
super(aOptimize, aInputs, aOutputs, aSpecialItems, null, aFluidInputs, null, aDuration, aEUt, aSpecialValue, in, out, catalyst, check);
mResearchEM=researchEM;
this.scannerRecipe=scannerRecipe;
diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java
index 61efea1a0e..6fd4d7edaa 100644
--- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java
+++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java
@@ -124,7 +124,7 @@ public class TT_recipeAdder extends GT_RecipeAdder {
(boolean aOptimize,
ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances,
FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue,
- cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, AdditionalCheck check)
+ cElementalDefinitionStackMap[] in, cElementalDefinitionStackMap[] out, cElementalDefinitionStackMap[] catalyst, IAdditionalCheck check)
*/
public static boolean addResearchableEMmachineRecipe(
@@ -163,7 +163,7 @@ public class TT_recipeAdder extends GT_RecipeAdder {
public static boolean addResearchableEMcrafterRecipe(
ItemStack aResearchItem, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage,
- cElementalDefinitionStackMap[] eInputs, cElementalDefinitionStackMap[] catalyst, TT_recipe.AdditionalCheck check,
+ cElementalDefinitionStackMap[] eInputs, cElementalDefinitionStackMap[] catalyst, TT_recipe.IAdditionalCheck check,
ItemStack aOutput, int crafterDuration, int crafterEUt, int crafterAmperage) {
if (aResearchItem==null || totalComputationRequired<=0 || aOutput == null) {
return false;
@@ -222,7 +222,7 @@ public class TT_recipeAdder extends GT_RecipeAdder {
public static boolean addScannableEMcrafterRecipe(
iElementalDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage,
- cElementalDefinitionStackMap[] eInputs, cElementalDefinitionStackMap[] catalyst, TT_recipe.AdditionalCheck check,
+ cElementalDefinitionStackMap[] eInputs, cElementalDefinitionStackMap[] catalyst, TT_recipe.IAdditionalCheck check,
ItemStack aOutput, int crafterDuration, int crafterEUt, int crafterAmperage) {
if (aResearchEM==null || totalComputationRequired<=0 || aOutput == null) {
return false;
diff --git a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java
index ef903cbf38..1a08bdbeec 100644
--- a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java
+++ b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java
@@ -100,6 +100,7 @@ public final class QuantumGlassBlock extends BlockBase {
if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) {
GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
}
+
}
@Override
diff --git a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java
index efb9e6d644..f63f35e7f8 100644
--- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java
+++ b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java
@@ -33,7 +33,7 @@ import static gregtech.api.GregTech_API.sBlockCasings1;
public final class ConstructableTriggerItem extends Item {
public static ConstructableTriggerItem INSTANCE;
- private static HashMap<String,MultiblockInfoContainer> multiblockMap= new HashMap<>();
+ private static HashMap<String, IMultiblockInfoContainer> multiblockMap= new HashMap<>();
private ConstructableTriggerItem() {
setUnlocalizedName("em.constructable");
@@ -121,7 +121,7 @@ public final class ConstructableTriggerItem extends Item {
INSTANCE = new ConstructableTriggerItem();
GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName());
- registerMetaClass(GT_MetaTileEntity_ElectricBlastFurnace.class, new MultiblockInfoContainer() {
+ registerMetaClass(GT_MetaTileEntity_ElectricBlastFurnace.class, new IMultiblockInfoContainer() {
//region Structure
private final String[][] shape = new String[][]{
{"000","\"\"\"","\"\"\""," . ",},
@@ -150,17 +150,17 @@ public final class ConstructableTriggerItem extends Item {
});
}
- public interface MultiblockInfoContainer {
+ public interface IMultiblockInfoContainer {
void construct(int stackSize, boolean hintsOnly, TileEntity tileEntity, int aSide);
@SideOnly(Side.CLIENT)
String[] getDescription(int stackSize);
}
- public static void registerTileClass(Class<? extends TileEntity> clazz,MultiblockInfoContainer info){
+ public static void registerTileClass(Class<? extends TileEntity> clazz, IMultiblockInfoContainer info){
multiblockMap.put(clazz.getCanonicalName(),info);
}
- public static void registerMetaClass(Class<? extends IMetaTileEntity> clazz,MultiblockInfoContainer info){
+ public static void registerMetaClass(Class<? extends IMetaTileEntity> clazz, IMultiblockInfoContainer info){
multiblockMap.put(clazz.getCanonicalName(),info);
}
}
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 c84057c121..066bcaa166 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
@@ -124,7 +124,8 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta
if (TecTech.configTecTech.BOOM_ENABLE) {
tGTTileEntity.doExplosion(V[14]);
} else {
- TecTech.proxy.broadcast("Container1 BOOM! " + getBaseMetaTileEntity().getXCoord() + ' ' + getBaseMetaTileEntity().getYCoord() + ' ' + getBaseMetaTileEntity().getZCoord());
+ TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity,overflowMatter*32D);
+ TecTech.proxy.broadcast("Container1 BOOM! " +aBaseMetaTileEntity.getXCoord() + ' ' + aBaseMetaTileEntity.getYCoord() + ' ' + aBaseMetaTileEntity.getZCoord());
}
}
deathDelay = 3;//needed in some cases like repetitive failures. Should be 4 since there is -- at end but meh...
@@ -132,11 +133,12 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta
}
} else if (deathDelay < 1) {
if (TecTech.configTecTech.BOOM_ENABLE) {
- getBaseMetaTileEntity().doExplosion(V[14]);
+ aBaseMetaTileEntity.doExplosion(V[14]);
} else {
+ TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity,overflowMatter*32D);
deathDelay=3;
overflowMatter=0;
- TecTech.proxy.broadcast("Container0 BOOM! " + getBaseMetaTileEntity().getXCoord() + ' ' + getBaseMetaTileEntity().getYCoord() + ' ' + getBaseMetaTileEntity().getZCoord());
+ TecTech.proxy.broadcast("Container0 BOOM! " + aBaseMetaTileEntity.getXCoord() + ' ' + aBaseMetaTileEntity.getYCoord() + ' ' + aBaseMetaTileEntity.getZCoord());
}
}
deathDelay--;
@@ -207,8 +209,8 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta
}
@Override
- public float purgeOverflow() {
- return overflowMatter += content.removeOverflow(getMaxStacksCount(), getMaxStackSize());
+ public void purgeOverflow() {
+ overflowMatter += content.removeOverflow(getMaxStacksCount(), getMaxStackSize());
}
@Override
@@ -248,8 +250,8 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta
}
}
- public float updateSlots() {
- return purgeOverflow();
+ public void updateSlots() {
+ purgeOverflow();
}
@Override
@@ -271,10 +273,12 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta
@Override
public void onRemoval() {
if (isValidMetaTileEntity(this) && getBaseMetaTileEntity().isActive()) {
+ TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(),(overflowMatter+content.getMass())*16D);
+ IGregTechTileEntity base=getBaseMetaTileEntity();
if (TecTech.configTecTech.BOOM_ENABLE) {
- getBaseMetaTileEntity().doExplosion(V[15]);
+ base.doExplosion(V[15]);
} else {
- TecTech.proxy.broadcast("BOOM! " + getBaseMetaTileEntity().getXCoord() + ' ' + getBaseMetaTileEntity().getYCoord() + ' ' + getBaseMetaTileEntity().getZCoord());
+ TecTech.proxy.broadcast("BOOM! " +base.getXCoord() + ' ' + base.getYCoord() + ' ' + base.getZCoord());
}
}
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java
index 63321a03a4..e3dc732c99 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java
@@ -142,10 +142,10 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity
if (aBaseMetaTileEntity.isServerSide() && aTick % 20 == DISPERSE_AT) {
if (aBaseMetaTileEntity.isActive()) {
if (overflowMatter > overflowDisperse) {
- //todo add full dose of dispersed pollution (reduced by tier, or make recycler machine only capable of reduction?)
+ TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity,overflowDisperse);
overflowMatter -= overflowDisperse;
} else {
- //todo add partial dose of dispersed pollution (reduced by tier, or make recycler machine only capable of reduction?)
+ TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity,overflowMatter);
overflowMatter = 0;
aBaseMetaTileEntity.setActive(false);
aBaseMetaTileEntity.setLightValue((byte) 0);
@@ -202,6 +202,7 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity
@Override
public void onRemoval() {
if (isValidMetaTileEntity(this) && getBaseMetaTileEntity().isActive()) {
+ TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(),overflowMatter*8D);
if (TecTech.configTecTech.BOOM_ENABLE) {
getBaseMetaTileEntity().doExplosion(V[15]);
} else {
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java
index 2ee110be4c..ece8c6ba82 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java
@@ -4,7 +4,7 @@ import com.github.technus.tectech.CommonValues;
import com.github.technus.tectech.thing.block.QuantumGlassBlock;
import com.github.technus.tectech.thing.metaTileEntity.IConstructable;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -45,7 +45,7 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl
};
private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT ,sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT};
private static final byte[] blockMeta = new byte[]{4, 5, 12, 6, 0, 10};
- private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList};
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList};
private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4};
private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMetaFallback = new byte[]{0, 4};
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java
index 7b662814a6..30ee7c4d64 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java
@@ -4,7 +4,7 @@ import com.github.technus.tectech.CommonValues;
import com.github.technus.tectech.thing.block.QuantumGlassBlock;
import com.github.technus.tectech.thing.metaTileEntity.IConstructable;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -74,7 +74,7 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E
};
private static final Block[] blockType = new Block[]{sBlockCasingsTT,sBlockCasingsTT,sBlockCasingsTT,sBlockCasingsTT,sBlockCasingsTT};
private static final byte[] blockMeta = new byte[]{12, 13, 14, 10, 11};
- private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList};
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList};
private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4};
private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMetaFallback = new byte[]{0, 4};
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java
index b9b589c409..166ab90ff1 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java
@@ -16,10 +16,10 @@ import com.github.technus.tectech.thing.casing.TT_Container_Casings;
import com.github.technus.tectech.thing.metaTileEntity.IConstructable;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.NameFunction;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.StatusFunction;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -64,16 +64,16 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
}
//region collision handlers
- public static final HashMap<Integer, ColliderHandler> FUSE_HANDLERS =new HashMap<>();
- public static final HashMap<String, PrimitiveColliderHandler> PRIMITIVE_FUSE_HANDLERS =new HashMap<>();
- public interface PrimitiveColliderHandler {
+ public static final HashMap<Integer, IColliderHandler> FUSE_HANDLERS =new HashMap<>();
+ public static final HashMap<String, IPrimitiveColliderHandler> PRIMITIVE_FUSE_HANDLERS =new HashMap<>();
+ public interface IPrimitiveColliderHandler {
void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out);
}
- public interface ColliderHandler extends PrimitiveColliderHandler {
+ public interface IColliderHandler extends IPrimitiveColliderHandler {
byte getRequiredTier();
}
static {
- FUSE_HANDLERS.put((dAtomDefinition.getClassTypeStatic() << 16) | dAtomDefinition.getClassTypeStatic(), new ColliderHandler() {
+ FUSE_HANDLERS.put((dAtomDefinition.getClassTypeStatic() << 16) | dAtomDefinition.getClassTypeStatic(), new IColliderHandler() {
@Override
public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) {
try {
@@ -102,7 +102,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
registerSimpleAtomFuse(dComplexAspectDefinition.getClassTypeStatic());
registerSimpleAtomFuse(cElementalPrimitive.getClassTypeStatic());
- FUSE_HANDLERS.put((dHadronDefinition.getClassTypeStatic() << 16) | dHadronDefinition.getClassTypeStatic(), new ColliderHandler() {
+ FUSE_HANDLERS.put((dHadronDefinition.getClassTypeStatic() << 16) | dHadronDefinition.getClassTypeStatic(), new IColliderHandler() {
@Override
public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) {
try {
@@ -127,7 +127,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
return 2;
}
});
- FUSE_HANDLERS.put((dHadronDefinition.getClassTypeStatic() << 16) | cElementalPrimitive.getClassTypeStatic(), new ColliderHandler() {
+ FUSE_HANDLERS.put((dHadronDefinition.getClassTypeStatic() << 16) | cElementalPrimitive.getClassTypeStatic(), new IColliderHandler() {
@Override
public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) {
try {
@@ -156,10 +156,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
registerSimpleAspectFuse(dComplexAspectDefinition.getClassTypeStatic());
registerSimpleAspectFuse(cElementalPrimitive.getClassTypeStatic());
- FUSE_HANDLERS.put((cElementalPrimitive.getClassTypeStatic() << 16) | cElementalPrimitive.getClassTypeStatic(), new ColliderHandler() {
+ FUSE_HANDLERS.put((cElementalPrimitive.getClassTypeStatic() << 16) | cElementalPrimitive.getClassTypeStatic(), new IColliderHandler() {
@Override
public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) {
- PrimitiveColliderHandler collisionHandler= PRIMITIVE_FUSE_HANDLERS.get(in1.definition.getClass().getName()+'\0'+in2.definition.getClass().getName());
+ IPrimitiveColliderHandler collisionHandler= PRIMITIVE_FUSE_HANDLERS.get(in1.definition.getClass().getName()+'\0'+in2.definition.getClass().getName());
if (collisionHandler != null) {
collisionHandler.collide(in2, in1, out);
} else {
@@ -215,7 +215,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
}
private static void registerSimpleAspectFuse(byte classTypeStatic) {
- FUSE_HANDLERS.put((dComplexAspectDefinition.getClassTypeStatic() << 16) | classTypeStatic, new ColliderHandler() {
+ FUSE_HANDLERS.put((dComplexAspectDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() {
@Override
public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) {
if (fuseAspects(in1, in2, out)) return;
@@ -234,7 +234,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
}
private static void registerSimpleAtomFuse(byte classTypeStatic) {
- FUSE_HANDLERS.put((dAtomDefinition.getClassTypeStatic() << 16) | classTypeStatic, new ColliderHandler() {
+ FUSE_HANDLERS.put((dAtomDefinition.getClassTypeStatic() << 16) | classTypeStatic, new IColliderHandler() {
@Override
public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) {
try {
@@ -268,7 +268,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
//region parameters
protected Parameters.Group.ParameterIn mode;
- private static final StatusFunction<GT_MetaTileEntity_EM_collider> MODE_STATUS = (base_EM, p)->{
+ private static final IStatusFunction<GT_MetaTileEntity_EM_collider> MODE_STATUS = (base_EM, p)->{
if(base_EM.isMaster()){
double mode=p.get();
if (mode == FUSE_MODE || mode == COLLIDE_MODE) {
@@ -282,7 +282,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
}
return STATUS_UNUSED;
};
- private static final NameFunction<GT_MetaTileEntity_EM_collider> MODE_NAME = (base_EM, p)->{
+ private static final INameFunction<GT_MetaTileEntity_EM_collider> MODE_NAME = (base_EM, p)->{
if(base_EM.isMaster()){
double mode=p.get();
if(mode==FUSE_MODE){
@@ -333,7 +333,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
};
private static final byte[] blockMeta1 = new byte[]{4, 7, 4, 0, 4, 8};
private static final byte[] blockMeta2 = new byte[]{4, 7, 5, 0, 6, 9};
- private final HatchAdder[] addingMethods = new HatchAdder[]{
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{
this::addClassicToMachineList,
this::addElementalInputToMachineList,
this::addElementalOutputToMachineList,
@@ -534,7 +534,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
//System.out.println("preMass = " + preMass);
cElementalInstanceStackMap map = new cElementalInstanceStackMap();
- ColliderHandler colliderHandler;
+ IColliderHandler colliderHandler;
if (stack2.definition.getClassType() > stack.definition.getClassType()) {//always bigger first
colliderHandler = FUSE_HANDLERS.get((stack2.definition.getClassType() << 16) | stack.definition.getClassType());
if (handleRecipe(stack2, map, colliderHandler)) return 0;
@@ -557,7 +557,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB
return 0;
}
- private boolean handleRecipe(cElementalInstanceStack stack2, cElementalInstanceStackMap map, ColliderHandler colliderHandler) {
+ private boolean handleRecipe(cElementalInstanceStack stack2, cElementalInstanceStackMap map, IColliderHandler colliderHandler) {
if (colliderHandler != null && eTier>= colliderHandler.getRequiredTier()) {
colliderHandler.collide(stack2, stack, map);
} else {
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 e61fc977c1..c39e9e0661 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
@@ -10,11 +10,11 @@ import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_H
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.NameFunction;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.StatusFunction;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -50,17 +50,17 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB
//region parameters
protected Parameters.Group.ParameterIn overclock,overvolt;
protected Parameters.Group.ParameterOut maxCurrentTemp,availableData;
- private static final NameFunction<GT_MetaTileEntity_EM_computer> OC_NAME = (base, p)-> "Overclock ratio";
- private static final NameFunction<GT_MetaTileEntity_EM_computer> OV_NAME = (base,p)-> "Overvoltage ratio";
- private static final NameFunction<GT_MetaTileEntity_EM_computer> MAX_TEMP_NAME = (base,p)-> "Current max. heat";
- private static final NameFunction<GT_MetaTileEntity_EM_computer> COMPUTE_NAME = (base,p)-> "Produced computation";
- private static final StatusFunction<GT_MetaTileEntity_EM_computer> OC_STATUS=
+ private static final INameFunction<GT_MetaTileEntity_EM_computer> OC_NAME = (base, p)-> "Overclock ratio";
+ private static final INameFunction<GT_MetaTileEntity_EM_computer> OV_NAME = (base, p)-> "Overvoltage ratio";
+ private static final INameFunction<GT_MetaTileEntity_EM_computer> MAX_TEMP_NAME = (base, p)-> "Current max. heat";
+ private static final INameFunction<GT_MetaTileEntity_EM_computer> COMPUTE_NAME = (base, p)-> "Produced computation";
+ private static final IStatusFunction<GT_MetaTileEntity_EM_computer> OC_STATUS=
(base,p)->LedStatus.fromLimitsInclusiveOuterBoundary(p.get(),0,1,1,3);
- private static final StatusFunction<GT_MetaTileEntity_EM_computer> OV_STATUS=
+ private static final IStatusFunction<GT_MetaTileEntity_EM_computer> OV_STATUS=
(base,p)->LedStatus.fromLimitsInclusiveOuterBoundary(p.get(),.7,.8,1.2,2);
- private static final StatusFunction<GT_MetaTileEntity_EM_computer> MAX_TEMP_STATUS=
+ private static final IStatusFunction<GT_MetaTileEntity_EM_computer> MAX_TEMP_STATUS=
(base,p)->LedStatus.fromLimitsInclusiveOuterBoundary(p.get(),-10000,0,0,5000);
- private static final StatusFunction<GT_MetaTileEntity_EM_computer> COMPUTE_STATUS=(base,p)->{
+ private static final IStatusFunction<GT_MetaTileEntity_EM_computer> COMPUTE_STATUS=(base, p)->{
if(base.eAvailableData<0){
return STATUS_TOO_LOW;
}
@@ -80,7 +80,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB
private static final String[][] slice = new String[][]{{"-01", "A!2", "A!2", "-01",},};
private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMeta = new byte[]{2, 1, 3};
- private final HatchAdder[] addingMethods = new HatchAdder[]{this::addToMachineList, this::addRackToMachineList};
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addToMachineList, this::addRackToMachineList};
private static final short[] casingTextures = new short[]{textureOffset + 1, textureOffset + 3};
private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMetaFallback = new byte[]{1, 3};
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java
index fc152140fa..a72740e84f 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java
@@ -4,7 +4,7 @@ import com.github.technus.tectech.CommonValues;
import com.github.technus.tectech.thing.block.QuantumGlassBlock;
import com.github.technus.tectech.thing.metaTileEntity.IConstructable;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -46,7 +46,7 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB
};
private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT , QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMeta = new byte[]{4, 10, 5, 0, 6, 9};
- private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList};
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList};
private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4};
private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMetaFallback = new byte[]{0, 4};
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java
index 3a92ae8671..258a8719e8 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java
@@ -9,7 +9,7 @@ import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_H
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -45,7 +45,7 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB
};
private static final Block[] blockType = new Block[]{sBlockCasingsTT,sBlockCasingsTT};
private static final byte[] blockMeta = new byte[]{2,1};
- private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList,this::addDataBankHatchToMachineList};
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList,this::addDataBankHatchToMachineList};
private static final short[] casingTextures = new short[]{textureOffset,textureOffset+1};
private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT,sBlockCasingsTT};
private static final byte[] blockMetaFallback = new byte[]{0,1};
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 14bebc4caa..9a4b8021c1 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
@@ -7,10 +7,10 @@ import com.github.technus.tectech.thing.metaTileEntity.IConstructable;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.NameFunction;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.StatusFunction;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -48,8 +48,8 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase
//region parameters
protected Parameters.Group.ParameterIn ampereFlow;
- private static final NameFunction<GT_MetaTileEntity_EM_decay> FLOW_NAME= (base, p)->"Ampere divider";
- private static final StatusFunction<GT_MetaTileEntity_EM_decay> FLOW_STATUS= (base, p)->{
+ private static final INameFunction<GT_MetaTileEntity_EM_decay> FLOW_NAME= (base, p)->"Ampere divider";
+ private static final IStatusFunction<GT_MetaTileEntity_EM_decay> FLOW_STATUS= (base, p)->{
if(base.eAmpereFlow<=0){
return STATUS_TOO_LOW;
}
@@ -71,7 +71,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase
};
private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT ,sBlockCasingsTT};
private static final byte[] blockMeta = new byte[]{4, 5, 8, 6};
- private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList};
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList};
private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4};
private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMetaFallback = new byte[]{0, 4};
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java
index a837c6a0a2..d379502540 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java
@@ -10,7 +10,7 @@ import com.github.technus.tectech.thing.block.QuantumGlassBlock;
import com.github.technus.tectech.thing.metaTileEntity.IConstructable;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -47,7 +47,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo
};
private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE};
private static final byte[] blockMeta = new byte[]{0, 4, 0};
- private final HatchAdder[] addingMethods = new HatchAdder[]{
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{
this::addClassicToMachineList,
this::addElementalInputToMachineList,
this::addElementalMufflerToMachineList};
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java
index 54d14ded92..d0b5b4ff35 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java
@@ -8,7 +8,7 @@ import com.github.technus.tectech.thing.metaTileEntity.IConstructable;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -40,7 +40,7 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa
};
private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMeta = new byte[]{7, 4};
- private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList};
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList};
private static final short[] casingTextures = new short[]{textureOffset};
private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT};
private static final byte[] blockMetaFallback = new byte[]{0};
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java
index c1248820b3..337afd4f32 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java
@@ -5,10 +5,10 @@ import com.github.technus.tectech.thing.metaTileEntity.IConstructable;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputElemental;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.NameFunction;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.StatusFunction;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_Utility;
@@ -44,7 +44,7 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB
};
private static final Block[] blockType = new Block[]{sBlockCasingsTT,sBlockCasingsTT};
private static final byte[] blockMeta = new byte[]{4,5};
- private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList};
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList};
private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4};
private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMetaFallback = new byte[]{0, 4};
@@ -56,9 +56,9 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB
//endregion
//region parameters
- private static final NameFunction<GT_MetaTileEntity_EM_junction> ROUTE_NAME=
+ private static final INameFunction<GT_MetaTileEntity_EM_junction> ROUTE_NAME=
(base,p)->(p.parameterId()==0?"Source ":"Destination ")+p.hatchId();
- private static final StatusFunction<GT_MetaTileEntity_EM_junction> SRC_STATUS =
+ private static final IStatusFunction<GT_MetaTileEntity_EM_junction> SRC_STATUS =
(base,p)-> {
double v = p.get();
if (Double.isNaN(v)) return STATUS_WRONG;
@@ -68,7 +68,7 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB
if (v >= base.eInputHatches.size()) return STATUS_TOO_HIGH;
return STATUS_OK;
};
- private static final StatusFunction<GT_MetaTileEntity_EM_junction> DST_STATUS =
+ private static final IStatusFunction<GT_MetaTileEntity_EM_junction> DST_STATUS =
(base,p)->{
if(base.src[p.hatchId()].getStatus(false)== STATUS_OK){
double v = p.get();
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java
index d34acd1534..1d3d40666f 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java
@@ -13,7 +13,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations
import com.github.technus.tectech.thing.block.QuantumGlassBlock;
import com.github.technus.tectech.thing.metaTileEntity.IConstructable;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.GregTech_API;
@@ -53,7 +53,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock
};
private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE};
private static final byte[] blockMeta = new byte[]{4, 0, 0};
- private final HatchAdder[] addingMethods = new HatchAdder[]{
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{
this::addClassicToMachineList,
this::addElementalOutputToMachineList,
this::addElementalMufflerToMachineList};
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java
index e74cef7a34..11be32f9a5 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java
@@ -6,7 +6,7 @@ import com.github.technus.tectech.thing.metaTileEntity.IConstructable;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Holder;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.enums.ItemList;
@@ -66,7 +66,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB
};
private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMeta = new byte[]{1, 3, 2};
- private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList, this::addHolderToMachineList};
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addHolderToMachineList};
private static final short[] casingTextures = new short[]{textureOffset + 1, textureOffset + 3};
private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, Blocks.air};
private static final byte[] blockMetaFallback = new byte[]{1, 0};
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java
index 33de4aa1cc..96132a889e 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java
@@ -14,11 +14,11 @@ import com.github.technus.tectech.thing.item.ElementalDefinitionScanStorage_EM;
import com.github.technus.tectech.thing.metaTileEntity.IConstructable;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.NameFunction;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.StatusFunction;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction;
import gregtech.api.enums.ItemList;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -63,9 +63,9 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa
private int[] scanComplexity;
//region parameters
- private static final NameFunction<GT_MetaTileEntity_EM_scanner> CONFIG_NAME=
+ private static final INameFunction<GT_MetaTileEntity_EM_scanner> CONFIG_NAME=
(base,p)->"Config at Depth: "+(p.hatchId()*2+p.parameterId());
- private static final StatusFunction<GT_MetaTileEntity_EM_scanner> CONFIG_STATUS=
+ private static final IStatusFunction<GT_MetaTileEntity_EM_scanner> CONFIG_STATUS=
(base,p)->{
double v=p.get();
if(Double.isNaN(v)){
@@ -93,7 +93,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa
};
private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT};
private static final byte[] blockMeta = new byte[]{4, 0, 0};
- private final HatchAdder[] addingMethods = new HatchAdder[]{
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{
this::addClassicToMachineList,
this::addElementalInputToMachineList,
this::addElementalOutputToMachineList,
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java
index 2386619e7e..30794ca47e 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java
@@ -4,7 +4,7 @@ import com.github.technus.tectech.CommonValues;
import com.github.technus.tectech.thing.block.QuantumGlassBlock;
import com.github.technus.tectech.thing.metaTileEntity.IConstructable;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.block.Block;
@@ -29,7 +29,7 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc
};
private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT ,sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMeta = new byte[]{4, 0, 5, 6, 9};
- private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList};
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList};
private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4};
private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMetaFallback = new byte[]{0, 4};
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java
index 276d0f2f74..1c5d1bccdd 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java
@@ -8,10 +8,10 @@ import com.github.technus.tectech.thing.metaTileEntity.IConstructable;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.NameFunction;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.StatusFunction;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -43,7 +43,7 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas
};
private static final Block[] blockType = new Block[]{sBlockCasingsTT};
private static final byte[] blockMeta = new byte[]{3};
- private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList};
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList};
private static final short[] casingTextures = new short[]{textureOffset+1};
private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT};
private static final byte[] blockMetaFallback = new byte[]{1};
@@ -54,9 +54,9 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas
//endregion
//region parameters
- private static final NameFunction<GT_MetaTileEntity_EM_switch> ROUTE_NAME=
+ private static final INameFunction<GT_MetaTileEntity_EM_switch> ROUTE_NAME=
(base,p)->(p.parameterId()==0?"Destination ":"Weight ")+p.hatchId();
- private static final StatusFunction<GT_MetaTileEntity_EM_switch> WEI_STATUS =
+ private static final IStatusFunction<GT_MetaTileEntity_EM_switch> WEI_STATUS =
(base,p)-> {
double v=p.get();
if (Double.isNaN(v)) return STATUS_WRONG;
@@ -65,7 +65,7 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas
if(Double.isInfinite(v)) return STATUS_HIGH;
return STATUS_OK;
};
- private static final StatusFunction<GT_MetaTileEntity_EM_switch> DST_STATUS =
+ private static final IStatusFunction<GT_MetaTileEntity_EM_switch> DST_STATUS =
(base,p)->{
if(base.weight[p.hatchId()].getStatus(false).isOk) {
double v = p.get();
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java
index 65f2301e41..e384a8d7e2 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java
@@ -6,7 +6,7 @@ import com.github.technus.tectech.thing.metaTileEntity.IConstructable;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -38,7 +38,7 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo
};
private static final Block[] blockType = new Block[]{sBlockCasings1};
private static final byte[] blockMeta = new byte[]{15};
- private final HatchAdder[] addingMethods = new HatchAdder[]{this::addEnergyIOToMachineList};
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addEnergyIOToMachineList};
private static final short[] casingTextures = new short[]{textureOffset};
private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT};
private static final byte[] blockMetaFallback = new byte[]{0};
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java
index 50070972ca..7f69f459f9 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java
@@ -4,7 +4,7 @@ import com.github.technus.tectech.CommonValues;
import com.github.technus.tectech.thing.block.QuantumGlassBlock;
import com.github.technus.tectech.thing.metaTileEntity.IConstructable;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.HatchAdder;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -46,7 +46,7 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB
};
private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE ,sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMeta = new byte[]{12, 10, 0, 5, 11};
- private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList};
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList};
private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4};
private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMetaFallback = new byte[]{0, 4};
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java
index 97a56a94cf..116ee54f8d 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java
@@ -46,7 +46,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock
private static final Block[] blockType = new Block[]{sBlockCasings4};
private static final byte[] blockMeta = new byte[]{1};
- private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList};
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList};
private static final short[] casingTextures = new short[]{49};
private static final Block[] blockTypeFallback = new Block[]{sBlockCasings4};
private static final byte[] blockMetaFallback = new byte[]{1};
@@ -60,13 +60,13 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock
//region parameters
protected Parameters.Group.ParameterIn powerSetting,timerSetting;
protected Parameters.Group.ParameterOut timerValue,remainingTime;
- private static final NameFunction<GT_MetaTileEntity_TM_microwave> POWER_SETTING_NAME = (base, p)-> "Power setting";
- private static final NameFunction<GT_MetaTileEntity_TM_microwave> TIMER_SETTING_NAME = (base, p)-> "Timer setting";
- private static final NameFunction<GT_MetaTileEntity_TM_microwave> TIMER_REMAINING_NAME = (base, p)-> "Timer remaining";
- private static final NameFunction<GT_MetaTileEntity_TM_microwave> TIMER_VALUE_NAME = (base,p)-> "Timer value";
- private static final StatusFunction<GT_MetaTileEntity_TM_microwave> POWER_STATUS=
+ private static final INameFunction<GT_MetaTileEntity_TM_microwave> POWER_SETTING_NAME = (base, p)-> "Power setting";
+ private static final INameFunction<GT_MetaTileEntity_TM_microwave> TIMER_SETTING_NAME = (base, p)-> "Timer setting";
+ private static final INameFunction<GT_MetaTileEntity_TM_microwave> TIMER_REMAINING_NAME = (base, p)-> "Timer remaining";
+ private static final INameFunction<GT_MetaTileEntity_TM_microwave> TIMER_VALUE_NAME = (base, p)-> "Timer value";
+ private static final IStatusFunction<GT_MetaTileEntity_TM_microwave> POWER_STATUS=
(base,p)-> LedStatus.fromLimitsInclusiveOuterBoundary(p.get(),300,1000,1000,Double.POSITIVE_INFINITY);
- private static final StatusFunction<GT_MetaTileEntity_TM_microwave> TIMER_STATUS=(base,p)->{
+ private static final IStatusFunction<GT_MetaTileEntity_TM_microwave> TIMER_STATUS=(base, p)->{
double value=p.get();
if(Double.isNaN(value)) return STATUS_WRONG;
value=(int)value;
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
index da12f6dd96..2e5d944773 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
@@ -34,6 +34,10 @@ import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBloc
import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*;
import static gregtech.api.enums.GT_Values.E;
+/**
+ * Created by danie_000 on 17.12.2016.
+ * edited by Bass on like 2018-02-05
+ */
public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable {
private static Textures.BlockIcons.CustomIcon ScreenOFF;
private static Textures.BlockIcons.CustomIcon ScreenON;
@@ -141,7 +145,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
private static final byte[] blockMetaT4 = new byte[]{7, 4, 6, 8};
private static final byte[] blockMetaT5 = new byte[]{7, 5, 6, 8};
private static final byte[][] blockMetas = new byte[][]{blockMetaT0,blockMetaT1,blockMetaT2,blockMetaT3,blockMetaT4,blockMetaT5};
- private final HatchAdder[] addingMethods = new HatchAdder[]{this::addCapacitorToMachineList, this::addFrameToMachineList};
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addCapacitorToMachineList, this::addFrameToMachineList};
private static final short[] casingTextures = new short[]{(texturePage << 7)+16+6, 0};
private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsBA0, null};
private static final byte[] blockMetaFallback = new byte[]{6, 0};
@@ -155,32 +159,32 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
//region parameters
protected Parameters.Group.ParameterIn histLowSetting,histHighSetting,transferRadiusTowerSetting,transferRadiusTransceiverSetting,transferRadiusCoverUltimateSetting,outputVoltageSetting,outputCurrentSetting,scanTimeMinSetting,overDriveSetting;
//protected Parameters.Group.ParameterOut timerValue,remainingTime;
- private static final NameFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_LOW_SETTING_NAME = (base, p)-> "Hysteresis low setting";
- private static final NameFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_HIGH_SETTING_NAME = (base, p)-> "Hysteresis high setting";
- private static final NameFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TOWER_SETTING_NAME = (base, p)-> "Tesla Towers transfer radius";
- private static final NameFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TRANSCEIVER_SETTING_NAME = (base, p)-> "Tesla Transceiver transfer radius";
- private static final NameFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_COVER_ULTIMATE_SETTING_NAME = (base, p)-> "Tesla Ultimate Cover transfer radius";
- private static final NameFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_VOLTAGE_SETTING_NAME = (base, p)-> "Output voltage setting";
- private static final NameFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_CURRENT_SETTING_NAME = (base, p)-> "Output current setting";
- private static final NameFunction<GT_MetaTileEntity_TM_teslaCoil> SCAN_TIME_MIN_SETTING_NAME = (base, p)-> "Scan time Min setting";
- private static final NameFunction<GT_MetaTileEntity_TM_teslaCoil> OVERDRIVE_SETTING_NAME = (base, p)-> "Overdrive setting";
- private static final NameFunction<GT_MetaTileEntity_TM_teslaCoil> POPOGA_NAME = (base, p)-> "POPOGA";
-
- private static final StatusFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_LOW_STATUS=(base, p)->{
+ private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_LOW_SETTING_NAME = (base, p)-> "Hysteresis low setting";
+ private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_HIGH_SETTING_NAME = (base, p)-> "Hysteresis high setting";
+ private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TOWER_SETTING_NAME = (base, p)-> "Tesla Towers transfer radius";
+ private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TRANSCEIVER_SETTING_NAME = (base, p)-> "Tesla Transceiver transfer radius";
+ private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_COVER_ULTIMATE_SETTING_NAME = (base, p)-> "Tesla Ultimate Cover transfer radius";
+ private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_VOLTAGE_SETTING_NAME = (base, p)-> "Output voltage setting";
+ private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_CURRENT_SETTING_NAME = (base, p)-> "Output current setting";
+ private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> SCAN_TIME_MIN_SETTING_NAME = (base, p)-> "Scan time Min setting";
+ private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> OVERDRIVE_SETTING_NAME = (base, p)-> "Overdrive setting";
+ private static final INameFunction<GT_MetaTileEntity_TM_teslaCoil> POPOGA_NAME = (base, p)-> "POPOGA";
+
+ private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_LOW_STATUS=(base, p)->{
double value=p.get();
if(Double.isNaN(value)){return STATUS_WRONG;}
if(value<=0.05) return STATUS_TOO_LOW;
if(value>base.histHighSetting.get()) return STATUS_TOO_HIGH;
return STATUS_OK;
};
- private static final StatusFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_HIGH_STATUS=(base, p)->{
+ private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> HYSTERESIS_HIGH_STATUS=(base, p)->{
double value=p.get();
if(Double.isNaN(value)) return STATUS_WRONG;
if(value<=base.histLowSetting.get()) return STATUS_TOO_LOW;
if(value>0.95) return STATUS_TOO_HIGH;
return STATUS_OK;
};
- private static final StatusFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TOWER_STATUS=(base, p)->{
+ private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TOWER_STATUS=(base, p)->{
double value=p.get();
if(Double.isNaN(value)) return STATUS_WRONG;
value=(int)value;
@@ -189,7 +193,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
if(value<32) return STATUS_LOW;
return STATUS_OK;
};
- private static final StatusFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TRANSCEIVER_STATUS=(base, p)->{
+ private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_TRANSCEIVER_STATUS=(base, p)->{
double value=p.get();
if(Double.isNaN(value)) return STATUS_WRONG;
value=(int)value;
@@ -198,7 +202,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
if(value<16) return STATUS_LOW;
return STATUS_OK;
};
- private static final StatusFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_COVER_ULTIMATE_STATUS=(base, p)->{
+ private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> TRANSFER_RADIUS_COVER_ULTIMATE_STATUS=(base, p)->{
double value=p.get();
if(Double.isNaN(value)) return STATUS_WRONG;
value=(int)value;
@@ -207,7 +211,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
if(value<16) return STATUS_LOW;
return STATUS_OK;
};
- private static final StatusFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_VOLTAGE_STATUS=(base, p)->{
+ private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_VOLTAGE_STATUS=(base, p)->{
double value=p.get();
if(Double.isNaN(value)) return STATUS_WRONG;
value=(long)value;
@@ -215,7 +219,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
if(value<=0) return STATUS_TOO_LOW;
return STATUS_OK;
};
- private static final StatusFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_CURRENT_STATUS=(base, p)->{
+ private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> OUTPUT_CURRENT_STATUS=(base, p)->{
double value=p.get();
if(Double.isNaN(value)) return STATUS_WRONG;
value=(long)value;
@@ -223,7 +227,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
if(value<=0) return STATUS_TOO_LOW;
return STATUS_LOW;
};
- private static final StatusFunction<GT_MetaTileEntity_TM_teslaCoil> SCAN_TIME_MIN_STATUS=(base, p)->{
+ private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> SCAN_TIME_MIN_STATUS=(base, p)->{
double value=p.get();
if(Double.isNaN(value)) return STATUS_WRONG;
value=(int)value;
@@ -231,7 +235,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
if(value==100) return STATUS_OK;
return STATUS_HIGH;
};
- private static final StatusFunction<GT_MetaTileEntity_TM_teslaCoil> OVERDRIVE_STATUS=(base, p)->{
+ private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> OVERDRIVE_STATUS=(base, p)->{
double value=p.get();
if(Double.isNaN(value)) return STATUS_WRONG;
value=(int)value;
@@ -239,7 +243,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
if(value==0) return STATUS_LOW;
return STATUS_HIGH;
};
- private static final StatusFunction<GT_MetaTileEntity_TM_teslaCoil> POPOGA_STATUS=(base, p)-> STATUS_WTF;
+ private static final IStatusFunction<GT_MetaTileEntity_TM_teslaCoil> POPOGA_STATUS=(base, p)-> STATUS_WTF;
//endregion
public GT_MetaTileEntity_TM_teslaCoil(int aID, String aName, String aNameRegional) {
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java
index c2d3ffcf06..2ba49d0849 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java
@@ -39,8 +39,7 @@ import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
import static com.github.technus.tectech.CommonValues.*;
-import static com.github.technus.tectech.Util.StructureCheckerExtreme;
-import static com.github.technus.tectech.Util.getTier;
+import static com.github.technus.tectech.Util.*;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage;
@@ -364,7 +363,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
String[][] structure,//0-9 casing, +- air no air, a-z ignore
Block[] blockType,//use numbers 0-9 for casing types
byte[] blockMeta,//use numbers 0-9 for casing types
- HatchAdder[] addingMethods,
+ IHatchAdder[] addingMethods,
short[] casingTextures,
Block[] blockTypeFallback,//use numbers 0-9 for casing types
byte[] blockMetaFallback,//use numbers 0-9 for casing types
@@ -675,16 +674,10 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
hatch.getBaseMetaTileEntity().setActive(false);
}
}
+ cleanOutputEM_EM();
if (ePowerPass && getEUVar()>V[3] || eDismantleBoom && mMaxProgresstime > 0 && areChunksAroundLoaded_EM()) {
explodeMultiblock();
}
- if (outputEM != null) {
- for (cElementalInstanceStackMap output : outputEM) {
- if (output != null && output.hasStacks()) {
- explodeMultiblock();
- }
- }
- }
} catch (Exception e) {
if (DEBUG_MODE) {
e.printStackTrace();
@@ -1985,35 +1978,14 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
mass += tHatch.overflowMatter;
tHatch.overflowMatter = 0;
}
- if (mass > 0) {
- if (eMufflerHatches.size() < 1) {
- explodeMultiblock();
- }
- mass /= eMufflerHatches.size();
- for (GT_MetaTileEntity_Hatch_OverflowElemental dump : eMufflerHatches) {
- if (dump.addOverflowMatter(mass)) {
- explodeMultiblock();
- }
- }
- }
+ cleanMassEM_EM(mass);
}
public void cleanHatchContentEM_EM(GT_MetaTileEntity_Hatch_ElementalContainer target) {
if (target == null) {
return;
}
- float mass = target.getContainerHandler().getMass();
- if (mass > 0) {
- if (eMufflerHatches.size() < 1) {
- explodeMultiblock();
- }
- mass /= eMufflerHatches.size();
- for (GT_MetaTileEntity_Hatch_OverflowElemental dump : eMufflerHatches) {
- if (dump.addOverflowMatter(mass)) {
- explodeMultiblock();
- }
- }
- }
+ cleanMassEM_EM(target.getContainerHandler().getMass());
}
public void cleanStackEM_EM(cElementalInstanceStack target) {
@@ -2026,14 +1998,20 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
public void cleanMassEM_EM(float mass) {
if (mass > 0) {
if (eMufflerHatches.size() < 1) {
+ TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(),mass);
explodeMultiblock();
+ return;
}
mass /= eMufflerHatches.size();
+ boolean shouldExplode=false;
for (GT_MetaTileEntity_Hatch_OverflowElemental dump : eMufflerHatches) {
if (dump.addOverflowMatter(mass)) {
- explodeMultiblock();
+ shouldExplode=true;
}
}
+ if(shouldExplode){
+ explodeMultiblock();
+ }
}
}
@@ -2047,19 +2025,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
mass += map.getMass();
}
}
-
- if (mass > 0) {
- if (eMufflerHatches.size() < 1) {
- explodeMultiblock();
- }
- mass /= eMufflerHatches.size();
- for (GT_MetaTileEntity_Hatch_OverflowElemental dump : eMufflerHatches) {
- if (dump.addOverflowMatter(mass)) {
- explodeMultiblock();
- }
- }
- }
outputEM = null;
+ cleanMassEM_EM(mass);
}
//endregion
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/HatchAdder.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IHatchAdder.java
index 177f8b2cfb..b695472012 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/HatchAdder.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IHatchAdder.java
@@ -3,6 +3,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-public interface HatchAdder{
+public interface IHatchAdder {
Boolean apply(IGregTechTileEntity iGregTechTileEntity, Short aShort);
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/NameFunction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/INameFunction.java
index a296600abf..1c2a8bd477 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/NameFunction.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/INameFunction.java
@@ -1,5 +1,5 @@
package com.github.technus.tectech.thing.metaTileEntity.multi.base;
-public interface NameFunction<T extends GT_MetaTileEntity_MultiblockBase_EM>{
+public interface INameFunction<T extends GT_MetaTileEntity_MultiblockBase_EM>{
String apply(T t, Parameters.IParameter iParameter);
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/StatusFunction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IStatusFunction.java
index e285c75344..0c7616093a 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/StatusFunction.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/IStatusFunction.java
@@ -1,5 +1,5 @@
package com.github.technus.tectech.thing.metaTileEntity.multi.base;
-public interface StatusFunction<T extends GT_MetaTileEntity_MultiblockBase_EM>{
+public interface IStatusFunction<T extends GT_MetaTileEntity_MultiblockBase_EM>{
LedStatus apply(T t, Parameters.IParameter iParameter);
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java
index 1ecb17891e..23250a5b02 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java
@@ -6,8 +6,8 @@ import java.util.ArrayList;
* Instantiate parameters as field in parametersInstantiation_EM();
*/
public class Parameters {
- private static final StatusFunction LED_STATUS_FUNCTION_DEFAULT = (b,p)->LedStatus.STATUS_UNDEFINED;
- private static final NameFunction NAME_FUNCTION_DEFAULT= (b,p)->"Undefined";
+ private static final IStatusFunction LED_STATUS_FUNCTION_DEFAULT = (b, p)->LedStatus.STATUS_UNDEFINED;
+ private static final INameFunction NAME_FUNCTION_DEFAULT= (b, p)->"Undefined";
final Group[] groups = new Group[10];
@@ -140,11 +140,11 @@ public class Parameters {
groups[hatchNo]=this;
}
- public ParameterIn makeInParameter(int paramID, double defaultValue, NameFunction name, StatusFunction status){
+ public ParameterIn makeInParameter(int paramID, double defaultValue, INameFunction name, IStatusFunction status){
return new ParameterIn(paramID, defaultValue,name, status);
}
- public ParameterOut makeOutParameter(int paramID, double defaultValue, NameFunction name, StatusFunction status){
+ public ParameterOut makeOutParameter(int paramID, double defaultValue, INameFunction name, IStatusFunction status){
return new ParameterOut(paramID, defaultValue, name, status);
}
@@ -181,10 +181,10 @@ public class Parameters {
public class ParameterOut implements IParameter {
public final int id;
public final double defaultValue;
- StatusFunction status;
- NameFunction name;
+ IStatusFunction status;
+ INameFunction name;
- private ParameterOut(int paramID, double defaultValue, NameFunction name, StatusFunction status){
+ private ParameterOut(int paramID, double defaultValue, INameFunction name, IStatusFunction status){
this.name= name==null?NAME_FUNCTION_DEFAULT:name;
if(paramID<0 || paramID>2){
throw new IllegalArgumentException("Parameter id must be in 0 to 1 range");
@@ -258,10 +258,10 @@ public class Parameters {
public class ParameterIn implements IParameter {
public final int id;
public final double defaultValue;
- StatusFunction status;
- NameFunction name;
+ IStatusFunction status;
+ INameFunction name;
- private ParameterIn(int paramID, double defaultValue, NameFunction name, StatusFunction status){
+ private ParameterIn(int paramID, double defaultValue, INameFunction name, IStatusFunction status){
this.name= name==null?NAME_FUNCTION_DEFAULT:name;
this.id=hatchNo+10*paramID;
if(paramID<0 || paramID>2){
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java
index 5f072b3196..56f535f32a 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Centrifuge.java
@@ -5,9 +5,9 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInsta
import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack;
import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.atom.dAtomDefinition;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.NameFunction;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.StatusFunction;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction;
import java.util.Arrays;
@@ -18,12 +18,12 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStat
/**
* Created by danie_000 on 24.12.2017.
*/
-public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.Behaviour {
+public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.IBehaviour {
private final byte tier;
private float radius, maxRPM, maxRCF, maxForce, maxCapacity;
private Parameters.Group.ParameterIn settingRPM, settingFraction;
- private final static NameFunction<GT_MetaTileEntity_EM_machine> rpmName= (gt_metaTileEntity_em_machine, iParameter) -> "RPM Setting";
- private final StatusFunction<GT_MetaTileEntity_EM_machine> rpmStatus= (gt_metaTileEntity_em_machine, iParameter) -> {
+ private final static INameFunction<GT_MetaTileEntity_EM_machine> rpmName= (gt_metaTileEntity_em_machine, iParameter) -> "RPM Setting";
+ private final IStatusFunction<GT_MetaTileEntity_EM_machine> rpmStatus= (gt_metaTileEntity_em_machine, iParameter) -> {
double v=iParameter.get();
if(Double.isNaN(v)){
return STATUS_WRONG;
@@ -35,8 +35,8 @@ public class Behaviour_Centrifuge implements GT_MetaTileEntity_EM_machine.Behavi
}
return STATUS_OK;
};
- private final static NameFunction<GT_MetaTileEntity_EM_machine> fractionName= (gt_metaTileEntity_em_machine, iParameter) -> "Fraction Count";
- private static final StatusFunction<GT_MetaTileEntity_EM_machine> fractionStatus= (gt_metaTileEntity_em_machine, iParameter) -> {
+ private final static INameFunction<GT_MetaTileEntity_EM_machine> fractionName= (gt_metaTileEntity_em_machine, iParameter) -> "Fraction Count";
+ private static final IStatusFunction<GT_MetaTileEntity_EM_machine> fractionStatus= (gt_metaTileEntity_em_machine, iParameter) -> {
double v=iParameter.get();
if(Double.isNaN(v)){
return STATUS_WRONG;
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java
index 42b41a5ae3..df21feb9f2 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Electrolyzer.java
@@ -7,7 +7,7 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
/**
* Created by danie_000 on 24.12.2017.
*/
-public class Behaviour_Electrolyzer implements GT_MetaTileEntity_EM_machine.Behaviour {
+public class Behaviour_Electrolyzer implements GT_MetaTileEntity_EM_machine.IBehaviour {
final int tier;
public Behaviour_Electrolyzer(int tier){
this.tier=tier;
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java
index d2b08f0960..6d95900af0 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_ElectromagneticSeparator.java
@@ -5,9 +5,9 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInsta
import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack;
import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.atom.dAtomDefinition;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.NameFunction;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
-import com.github.technus.tectech.thing.metaTileEntity.multi.base.StatusFunction;
+import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction;
import static com.github.technus.tectech.CommonValues.V;
import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*;
@@ -15,7 +15,7 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStat
/**
* Created by danie_000 on 24.12.2017.
*/
-public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_machine.Behaviour {
+public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_machine.IBehaviour {
private final byte tier;
private int ticks;
private byte precisionFull,precisionMinimal;
@@ -23,8 +23,8 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_
private long maxCharge;
private int offsetMax;
private Parameters.Group.ParameterIn fullSetting,minimalSetting,offsetSetting;
- private final static NameFunction<GT_MetaTileEntity_EM_machine> fullName= (gt_metaTileEntity_em_machine, iParameter) -> "Full Precision Input [e/3]";
- private final StatusFunction<GT_MetaTileEntity_EM_machine> fullStatus= (gt_metaTileEntity_em_machine, iParameter) -> {
+ private final static INameFunction<GT_MetaTileEntity_EM_machine> fullName= (gt_metaTileEntity_em_machine, iParameter) -> "Full Precision Input [e/3]";
+ private final IStatusFunction<GT_MetaTileEntity_EM_machine> fullStatus= (gt_metaTileEntity_em_machine, iParameter) -> {
double v=iParameter.get();
if(Double.isNaN(v)){
return STATUS_WRONG;
@@ -39,8 +39,8 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_
}
return STATUS_OK;
};
- private final static NameFunction<GT_MetaTileEntity_EM_machine> minimalName= (gt_metaTileEntity_em_machine, iParameter) -> "Minimal Precision Input [e/3]";
- private final StatusFunction<GT_MetaTileEntity_EM_machine> minimalStatus= (gt_metaTileEntity_em_machine, iParameter) -> {
+ private final static INameFunction<GT_MetaTileEntity_EM_machine> minimalName= (gt_metaTileEntity_em_machine, iParameter) -> "Minimal Precision Input [e/3]";
+ private final IStatusFunction<GT_MetaTileEntity_EM_machine> minimalStatus= (gt_metaTileEntity_em_machine, iParameter) -> {
double minimal=iParameter.get();
double full=fullSetting.get();
if(Double.isInfinite(minimal) && minimal>0) {
@@ -63,8 +63,8 @@ public class Behaviour_ElectromagneticSeparator implements GT_MetaTileEntity_EM_
return STATUS_WRONG;
}
};
- private final static NameFunction<GT_MetaTileEntity_EM_machine> offsetName= (gt_metaTileEntity_em_machine, iParameter) -> "Offset Input [e/3]";
- private final StatusFunction<GT_MetaTileEntity_EM_machine> offsetStatus= (gt_metaTileEntity_em_machine, iParameter) -> {
+ private final static INameFunction<GT_MetaTileEntity_EM_machine> offsetName= (gt_metaTileEntity_em_machine, iParameter) -> "Offset Input [e/3]";
+ private final IStatusFunction<GT_MetaTileEntity_EM_machine> offsetStatus= (gt_metaTileEntity_em_machine, iParameter) -> {
double offset=iParameter.get();
if(offset>offsetMax){
return STATUS_TOO_HIGH;
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java
index 02ddecbdc6..cd6f637d61 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_PrecisionLaser.java
@@ -7,7 +7,7 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
/**
* Created by danie_000 on 24.12.2017.
*/
-public class Behaviour_PrecisionLaser implements GT_MetaTileEntity_EM_machine.Behaviour {
+public class Behaviour_PrecisionLaser implements GT_MetaTileEntity_EM_machine.IBehaviour {
final int tier;
public Behaviour_PrecisionLaser(int tier){
this.tier=tier;
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java
index e30fdf111b..6742f99e99 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java
@@ -4,27 +4,36 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInsta
import com.github.technus.tectech.thing.metaTileEntity.multi.base.MultiblockControl;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
+import static com.github.technus.tectech.CommonValues.V;
+
/**
* Created by danie_000 on 24.12.2017.
*/
-public class Behaviour_Recycler implements GT_MetaTileEntity_EM_machine.Behaviour {
- final int tier;
+public class Behaviour_Recycler implements GT_MetaTileEntity_EM_machine.IBehaviour {
+ private final int tier;
+ private final float coeff;
public Behaviour_Recycler(int tier){
this.tier=tier;
+ coeff=(float)(1/Math.pow(2,tier-4));
}
@Override
- public void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters) {
-
- }
+ public void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters) {}
@Override
public boolean checkParametersInAndSetStatuses(GT_MetaTileEntity_EM_machine te, Parameters parameters) {
- return false;
+ return true;
}
@Override
public MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters) {
- return null;
+ float mass=0;
+ for (int i = 0; i < inputs.length; i++) {
+ if(inputs[i]!=null) {
+ mass+=inputs[i].getMass();
+ }
+ }
+ return new MultiblockControl<>(null,(int)V[tier], 4,
+ 0,10000,20, 0,mass*coeff);
}
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java
index 627f713a22..95bb8dce40 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Scanner.java
@@ -7,7 +7,7 @@ import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;
/**
* Created by danie_000 on 24.12.2017.
*/
-public class Behaviour_Scanner implements GT_MetaTileEntity_EM_machine.Behaviour {
+public class Behaviour_Scanner implements GT_MetaTileEntity_EM_machine.IBehaviour {
final int tier;
public Behaviour_Scanner(int tier){
this.tier=tier;
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java
index fc8a6c914e..39871910d9 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java
@@ -33,7 +33,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa
public static final String machine = "EM Machinery";
private ItemStack loadedMachine;
- private Behaviour currentBehaviour;
+ private IBehaviour currentBehaviour;
//region structure
private static final String[][] shape = new String[][]{
@@ -46,7 +46,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa
{"B0", "A!!!", "0!!!0", "A!!!", "B0",},};
private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMeta = new byte[]{4, 0, 5, 6};
- private final HatchAdder[] addingMethods = new HatchAdder[]{this::addClassicToMachineList,this::addElementalToMachineList};
+ private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList,this::addElementalToMachineList};
private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4};
private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT};
private static final byte[] blockMetaFallback = new byte[]{0, 4};
@@ -59,7 +59,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa
//region parameters
protected Parameters.Group.ParameterIn[] inputMux;
protected Parameters.Group.ParameterIn[] outputMux;
- private static final StatusFunction<GT_MetaTileEntity_EM_machine> SRC_STATUS =
+ private static final IStatusFunction<GT_MetaTileEntity_EM_machine> SRC_STATUS =
(base,p)-> {
double v = p.get();
if (Double.isNaN(v)) return STATUS_WRONG;
@@ -69,7 +69,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa
if (v >= base.eInputHatches.size()) return STATUS_TOO_HIGH;
return STATUS_OK;
};
- private static final StatusFunction<GT_MetaTileEntity_EM_machine> DST_STATUS =
+ private static final IStatusFunction<GT_MetaTileEntity_EM_machine> DST_STATUS =
(base,p)->{
if(base.inputMux[p.hatchId()].getStatus(false)== STATUS_OK){
double v = p.get();
@@ -82,7 +82,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa
}
return STATUS_NEUTRAL;
};
- private static final NameFunction<GT_MetaTileEntity_EM_machine> ROUTE_NAME=
+ private static final INameFunction<GT_MetaTileEntity_EM_machine> ROUTE_NAME=
(base,p)->(p.parameterId()==0?"Source ":"Destination ")+p.hatchId();
//endregion
@@ -275,7 +275,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa
return false;
}
loadedMachine=newMachine;
- Supplier<Behaviour> behaviourSupplier=GT_MetaTileEntity_EM_machine.BEHAVIOUR_MAP.get(new Util.ItemStack_NoNBT(newMachine));
+ Supplier<IBehaviour> behaviourSupplier=GT_MetaTileEntity_EM_machine.BEHAVIOUR_MAP.get(new Util.ItemStack_NoNBT(newMachine));
if(currentBehaviour==null && behaviourSupplier==null) {
return false;
}
@@ -293,17 +293,18 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa
} else {
currentBehaviour=null;
}
+
return true;
}
- private static final HashMap<Util.ItemStack_NoNBT, Supplier<Behaviour>> BEHAVIOUR_MAP = new HashMap<>();
+ private static final HashMap<Util.ItemStack_NoNBT, Supplier<IBehaviour>> BEHAVIOUR_MAP = new HashMap<>();
- public static void registerBehaviour(Supplier<Behaviour> behaviour, ItemStack is) {
+ public static void registerBehaviour(Supplier<IBehaviour> behaviour, ItemStack is) {
BEHAVIOUR_MAP.put(new Util.ItemStack_NoNBT(is), behaviour);
TecTech.LOGGER.info("Registered EM machine behaviour "+behaviour.get().getClass().getSimpleName()+' '+new Util.ItemStack_NoNBT(is).toString());
}
- public interface Behaviour {
+ public interface IBehaviour {
/**
* instantiate parameters, u can also check machine tier here
* @param te
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java
index f6c0724546..caccee07c4 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java
@@ -249,4 +249,11 @@ public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements IConnec
public boolean getActive() {
return active;
}
+
+ @Override
+ public void onRemoval() {
+ if(getActive()){
+ TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(),1e10f);
+ }
+ }
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java
index 6aa742846b..86dd48a877 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DataReader.java
@@ -37,7 +37,7 @@ import static com.github.technus.tectech.Reference.MODID;
* Created by Tec on 23.03.2017.
*/
public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine {
- private static final HashMap<Util.ItemStack_NoNBT,ArrayList<DataRender>> RENDER_REGISTRY =new HashMap<>();
+ private static final HashMap<Util.ItemStack_NoNBT,ArrayList<IDataRender>> RENDER_REGISTRY =new HashMap<>();
private static GT_RenderedTexture READER_ONLINE, READER_OFFLINE;
public GT_MetaTileEntity_DataReader(int aID, String aName, String aNameRegional, int aTier) {
@@ -90,8 +90,8 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine
return DID_NOT_FIND_RECIPE;
}
ItemStack input=getInputAt(0);
- ArrayList<DataRender> renders=getRenders(new Util.ItemStack_NoNBT(input));
- for(DataRender render:renders){
+ ArrayList<IDataRender> renders=getRenders(new Util.ItemStack_NoNBT(input));
+ for(IDataRender render:renders){
if(render.canRender(input,mTier)){
mOutputItems[0]=input.copy();
input.stackSize-=1;
@@ -174,19 +174,19 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine
return maxEUInput()*4L;
}
- public static void addDataRender(Util.ItemStack_NoNBT stack, DataRender render){
- ArrayList<DataRender> renders = RENDER_REGISTRY.computeIfAbsent(stack, k -> new ArrayList<>());
+ public static void addDataRender(Util.ItemStack_NoNBT stack, IDataRender render){
+ ArrayList<IDataRender> renders = RENDER_REGISTRY.computeIfAbsent(stack, k -> new ArrayList<>());
if(FMLCommonHandler.instance().getEffectiveSide().isClient()) {
render.loadResources();
}
renders.add(render);
}
- public static ArrayList<DataRender> getRenders(Util.ItemStack_NoNBT stack){
+ public static ArrayList<IDataRender> getRenders(Util.ItemStack_NoNBT stack){
return RENDER_REGISTRY.get(stack);
}
- public interface DataRender{
+ public interface IDataRender {
@SideOnly(Side.CLIENT)
void loadResources();
@SideOnly(Side.CLIENT)
@@ -203,7 +203,7 @@ public class GT_MetaTileEntity_DataReader extends GT_MetaTileEntity_BasicMachine
}
public static void run(){
- addDataRender(new Util.ItemStack_NoNBT(ItemList.Tool_DataStick.get(1)),new DataRender() {
+ addDataRender(new Util.ItemStack_NoNBT(ItemList.Tool_DataStick.get(1)),new IDataRender() {
@SideOnly(Side.CLIENT)
private ResourceLocation bg;
@SideOnly(Side.CLIENT)
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java
index 022247b541..eb2c2e4112 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DataReader.java
@@ -115,8 +115,8 @@ public class GT_GUIContainer_DataReader extends GT_GUIContainerMetaTile_Machine
private void renderDataBG(ItemStack thing, int mouseX, int mouseY, int x, int y, byte mTier) {
if (thing != null) {
- ArrayList<GT_MetaTileEntity_DataReader.DataRender> renders = GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(thing));
- for (GT_MetaTileEntity_DataReader.DataRender render : renders) {
+ ArrayList<GT_MetaTileEntity_DataReader.IDataRender> renders = GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(thing));
+ for (GT_MetaTileEntity_DataReader.IDataRender render : renders) {
if (render.canRender(thing, mTier)) {
if (!GT_Utility.areStacksEqual(stack, thing, false)) {
render.initRender(thing);
@@ -133,8 +133,8 @@ public class GT_GUIContainer_DataReader extends GT_GUIContainerMetaTile_Machine
if(stack==null){
return false;
}
- ArrayList<GT_MetaTileEntity_DataReader.DataRender> renders = GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(stack));
- for (GT_MetaTileEntity_DataReader.DataRender render : renders) {
+ ArrayList<GT_MetaTileEntity_DataReader.IDataRender> renders = GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(stack));
+ for (GT_MetaTileEntity_DataReader.IDataRender render : renders) {
if (render.canRender(stack, mTier)) {
render.renderForeground(stack, mouseX, mouseY, this, fontRendererObj);
return true;
@@ -147,8 +147,8 @@ public class GT_GUIContainer_DataReader extends GT_GUIContainerMetaTile_Machine
if(stack==null){
return false;
}
- ArrayList<GT_MetaTileEntity_DataReader.DataRender> renders = GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(stack));
- for (GT_MetaTileEntity_DataReader.DataRender render : renders) {
+ ArrayList<GT_MetaTileEntity_DataReader.IDataRender> renders = GT_MetaTileEntity_DataReader.getRenders(new Util.ItemStack_NoNBT(stack));
+ for (GT_MetaTileEntity_DataReader.IDataRender render : renders) {
if (render.canRender(stack, mTier)) {
render.renderTooltips(stack, mouseX, mouseY, this);
return true;