diff options
Diffstat (limited to 'src')
14 files changed, 145 insertions, 105 deletions
diff --git a/src/main/java/com/github/technus/tectech/chunkData/ChunkDataHandler.java b/src/main/java/com/github/technus/tectech/chunkData/ChunkDataHandler.java index cd6002e7fc..157a1a7057 100644 --- a/src/main/java/com/github/technus/tectech/chunkData/ChunkDataHandler.java +++ b/src/main/java/com/github/technus/tectech/chunkData/ChunkDataHandler.java @@ -9,6 +9,7 @@ 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.*; @@ -27,6 +28,24 @@ public class ChunkDataHandler { @SideOnly(Side.CLIENT) private final ArrayList<ChunkMetaDataHandler> clientSyncHandlers =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 (String meta : metaDataHandlerHashMap.keySet()) { + dimensionWiseMetaChunkData.get(meta).put(dim, new ChunkHashMap(meta, map)); + } + return map; + }); + } + + @SubscribeEvent + public void onWorldUnload(WorldEvent.Unload event){ + dimensionWiseChunkData.remove(event.world.provider.dimensionId); + dimensionWiseMetaChunkData.forEach((k,v)->v.remove(event.world.provider.dimensionId)); + } + @SideOnly(Side.SERVER) @SubscribeEvent public void handleChunkSaveEvent(ChunkDataEvent.Save event) { @@ -48,8 +67,7 @@ public class ChunkDataHandler { return; } int dimId = event.world.provider.dimensionId; - HashMap<ChunkCoordIntPair, NBTChunk> dimensionMemory = - dimensionWiseChunkData.computeIfAbsent(dimId, this::createDimensionData); + HashMap<ChunkCoordIntPair, NBTChunk> dimensionMemory = dimensionWiseChunkData.get(dimId); ChunkCoordIntPair chunkCoordIntPair = event.getChunk().getChunkCoordIntPair(); Set<String> loadedKeys = loadedTag.func_150296_c(); NBTChunk chunkMemory = dimensionMemory.get(chunkCoordIntPair); @@ -172,7 +190,7 @@ public class ChunkDataHandler { if (clazz.getMethod("tickRender", HashMap.class, TickEvent.RenderTickEvent.class).getDeclaringClass() != ChunkMetaDataHandler.class) { renderHandlers.add(handler); } - if (clazz.getMethod("requestData", int.class, ChunkCoordIntPair.class).getDeclaringClass() != ChunkMetaDataHandler.class) { + if (clazz.getMethod("requestData", ChunkEvent.Load.class).getDeclaringClass() != ChunkMetaDataHandler.class) { clientSyncHandlers.add(handler); } } catch (NoSuchMethodException e) { @@ -201,14 +219,6 @@ public class ChunkDataHandler { 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); 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/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index 473045d665..2272733d5a 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -49,7 +49,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(){} @@ -102,6 +102,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/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 b69fa5f76e..69585e29b0 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 @@ -54,13 +54,15 @@ public class AnomalyHandler implements ChunkMetaDataHandler { } public void addAnomaly(IGregTechTileEntity iGregTechTileEntity, double amount) { - World w=iGregTechTileEntity.getWorld(); - addAnomaly(w.provider.dimensionId, - w.getChunkFromBlockCoords( - iGregTechTileEntity.getXCoord(), - iGregTechTileEntity.getZCoord()) - .getChunkCoordIntPair(), - amount); + if(iGregTechTileEntity.isServerSide()) { + World w = iGregTechTileEntity.getWorld(); + addAnomaly(w.provider.dimensionId, + w.getChunkFromBlockCoords( + iGregTechTileEntity.getXCoord(), + iGregTechTileEntity.getZCoord()) + .getChunkCoordIntPair(), + amount); + } } public void addAnomaly(int world, ChunkCoordIntPair chunk,double amount) { 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/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/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/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..10bad33830 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; @@ -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/em_machine/Behaviour_Recycler.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/Behaviour_Recycler.java index e30fdf111b..f94ff3f326 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; + 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/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..197347f891 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 @@ -293,6 +293,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa } else { currentBehaviour=null; } + return true; } 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/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index ccb17a8a0c..59a0d720de 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -13,4 +13,7 @@ death.attack.microwaving=%1$s was dehydrated by radiation. death.attack.microwaving.player=%1$s was dehydrated by radiation while fighting %2$s. death.attack.elementalPollution=%1$s was vaping from the wrong hole. -death.attack.elementalPollution.player=%1$s was vaping from the wrong hole while fighting %2$s.
\ No newline at end of file +death.attack.elementalPollution.player=%1$s was vaping from the wrong hole while fighting %2$s. + +death.attack.subspace=%1$s was N-th dimensionally displeased. +death.attack.subspace.player=%1$s N-th dimensionally displeased while fighting %2$s.
\ No newline at end of file |