From b5d4df8f6a7f89b0cace96413312d49d3637ac9d Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Sat, 7 Sep 2013 21:35:15 -0400 Subject: [PATCH] Updated LimboDecay Updated LimboDecay to not affect certain blocks from DD. This matters in case we decide to start placing gateways in Limbo again. --- .../mod_pocketDim/ticking/LimboDecay.java | 37 +++++++++++++++---- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/ticking/LimboDecay.java b/StevenDimDoors/mod_pocketDim/ticking/LimboDecay.java index 999c813..31fc1fe 100644 --- a/StevenDimDoors/mod_pocketDim/ticking/LimboDecay.java +++ b/StevenDimDoors/mod_pocketDim/ticking/LimboDecay.java @@ -24,16 +24,27 @@ public class LimboDecay implements IRegularTickReceiver { //Provides a reversed list of the block IDs that blocks cycle through during decay. private final int[] decaySequence; - private Random random; - private DDProperties properties = null; + private final Random random; + private final DDProperties properties; + private final int[] blocksImmuneToDecay; public LimboDecay(IRegularTickSender tickSender, DDProperties properties) { decaySequence = new int[] { - properties.LimboBlockID, - Block.gravel.blockID, - Block.cobblestone.blockID, - Block.stone.blockID + properties.LimboBlockID, + Block.gravel.blockID, + Block.cobblestone.blockID, + Block.stone.blockID + }; + + blocksImmuneToDecay = new int[] { + properties.LimboBlockID, + properties.PermaFabricBlockID, + properties.TransientDoorID, + properties.DimensionalDoorID, + properties.WarpDoorID, + properties.RiftBlockID, + properties.UnstableDoorID }; this.properties = properties; @@ -151,12 +162,22 @@ public class LimboDecay implements IRegularTickReceiver { } /** - * Checks if a block can decay. We will not decay air, Unraveled Fabric, Eternal Fabric, or containers. + * Checks if a block can decay. We will not decay air, certain DD blocks, or containers. */ private boolean canDecayBlock(int blockID) { - if (blockID == 0 || blockID == properties.LimboBlockID || blockID == properties.PermaFabricBlockID) + if (blockID == 0) + { return false; + } + + for (int k = 0; k < blocksImmuneToDecay.length; k++) + { + if (blockID == blocksImmuneToDecay[k]) + { + return false; + } + } Block block = Block.blocksList[blockID]; return (block == null || !(block instanceof BlockContainer));