From 566e04e2414cddf40696c6cc848c5b16af560851 Mon Sep 17 00:00:00 2001 From: Technus Date: Wed, 20 Sep 2017 06:36:18 +0200 Subject: Add update code in quantum glass --- .../technus/tectech/thing/block/QuantumGlassBlock.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 81b6787435..88ad7cfbcb 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 @@ -10,6 +10,7 @@ import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; import static com.github.technus.tectech.auxiliary.Reference.MODID; @@ -91,4 +92,18 @@ public final class QuantumGlassBlock extends BlockBase { GameRegistry.registerBlock(INSTANCE, QuantumGlassItem.class, INSTANCE.getUnlocalizedName()); GregTech_API.registerMachineBlock(INSTANCE, -1); } + + @Override + public void breakBlock(World aWorld, int aX, int aY, int aZ, Block aBlock, int aMeta) { + if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) { + GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); + } + } + + @Override + public void onBlockAdded(World aWorld, int aX, int aY, int aZ) { + if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) { + GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); + } + } } -- cgit From 8d0573c1255e2efa9063afcfbe9f1fa87b69ff45 Mon Sep 17 00:00:00 2001 From: Technus Date: Thu, 21 Sep 2017 21:14:49 +0200 Subject: Refactor --- .../metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java index 3202a17659..fc1865aeb0 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java @@ -202,7 +202,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } //RATHER LEAVE ALONE Section - protected boolean EM_areChunksAroundLoaded(){ + protected boolean areChunksAroundLoaded_EM(){ if(isValidMetaTileEntity(this) && getBaseMetaTileEntity().isServerSide()){ IGregTechTileEntity base=getBaseMetaTileEntity(); final int x=base.getXCoord(); @@ -474,7 +474,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt mMachine = checkMachine(aBaseMetaTileEntity, mInventory[1]); if (!mMachine) { - if ((ePowerPass && getEUVar() > V[3]) || (eDismantleBoom && mMaxProgresstime > 0 && EM_areChunksAroundLoaded())) + if ((ePowerPass && getEUVar() > V[3]) || (eDismantleBoom && mMaxProgresstime > 0 && areChunksAroundLoaded_EM())) explodeMultiblock(); if (outputEM != null) for (cElementalInstanceStackMap tree : outputEM) @@ -1094,7 +1094,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) hatch.getBaseMetaTileEntity().setActive(false); } - if ((ePowerPass && getEUVar()>V[3]) || (eDismantleBoom && mMaxProgresstime > 0 && EM_areChunksAroundLoaded())) explodeMultiblock(); + if ((ePowerPass && getEUVar()>V[3]) || (eDismantleBoom && mMaxProgresstime > 0 && areChunksAroundLoaded_EM())) explodeMultiblock(); if (outputEM != null) for (cElementalInstanceStackMap output : outputEM) if (output.hasStacks()) explodeMultiblock(); -- cgit From f623799680a857560fb8e6f4db7338b3e411f268 Mon Sep 17 00:00:00 2001 From: Technus Date: Tue, 26 Sep 2017 18:32:59 +0200 Subject: add cleanup --- .../tectech/elementalMatter/core/cElementalInstanceStackMap.java | 6 ++++++ .../technus/tectech/elementalMatter/core/cElementalStackMap.java | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java index 79c7d30bca..b0edc510b6 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java @@ -429,4 +429,10 @@ public final class cElementalInstanceStackMap implements Comparable entry:map.entrySet()){ + if(entry.getValue().amount<=0) map.remove(entry.getKey()); + } + } } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java index 2a11e908f7..3be0889671 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java @@ -5,6 +5,7 @@ import com.github.technus.tectech.elementalMatter.core.interfaces.iElementalDefi import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import java.util.Map; import java.util.TreeMap; /** @@ -27,6 +28,7 @@ abstract class cElementalStackMap implements Comparable { public final cElementalDefinitionStack getLast(){ return map.lastEntry().getValue(); } + public final cElementalDefinitionStack getDefinitionStack(iElementalDefinition def) { return map.get(def); } @@ -123,4 +125,10 @@ abstract class cElementalStackMap implements Comparable { } return hash; } + + public void cleanUp(){ + for(Map.Entry entry:map.entrySet()){ + if(entry.getValue().amount<=0) map.remove(entry.getKey()); + } + } } -- cgit