From f5053d9bd71c1b5981d10a59a724d278f5e66b25 Mon Sep 17 00:00:00 2001
From: Adubbz <Adubbz@users.noreply.github.com>
Date: Mon, 8 Jan 2024 12:52:39 +1100
Subject: [PATCH] Added tags for passable blocks

---
 .../.cache/d6a68f98580d9908a43dbfe9cc754bc0c1ac14b0         | 3 ++-
 .../data/toughasnails/tags/blocks/passable_blocks.json      | 6 ++++++
 .../block/entity/ThermoregulatorBlockEntity.java            | 2 +-
 common/src/main/java/toughasnails/init/ModTags.java         | 1 +
 common/src/main/java/toughasnails/temperature/AreaFill.java | 3 ++-
 .../forge/datagen/provider/TANBlockTagsProvider.java        | 1 +
 6 files changed, 13 insertions(+), 3 deletions(-)
 create mode 100644 common/src/generated/resources/data/toughasnails/tags/blocks/passable_blocks.json

diff --git a/common/src/generated/resources/.cache/d6a68f98580d9908a43dbfe9cc754bc0c1ac14b0 b/common/src/generated/resources/.cache/d6a68f98580d9908a43dbfe9cc754bc0c1ac14b0
index 78b76364..f935df15 100644
--- a/common/src/generated/resources/.cache/d6a68f98580d9908a43dbfe9cc754bc0c1ac14b0
+++ b/common/src/generated/resources/.cache/d6a68f98580d9908a43dbfe9cc754bc0c1ac14b0
@@ -1,5 +1,6 @@
-// 1.20.4	2024-01-06T06:37:23.910005	Tags for minecraft:block mod id toughasnails
+// 1.20.4	2024-01-08T12:48:48.1761072	Tags for minecraft:block mod id toughasnails
 bffb0fdf09ac6cfbed64666a723e8a78cb784bbd data/minecraft/tags/blocks/mineable/axe.json
 0342cd45a4d6f790afda91090de45871d9b0ef63 data/minecraft/tags/blocks/mineable/pickaxe.json
 eed9ca8217c04724f67008aba1a0a5edde5697c2 data/toughasnails/tags/blocks/cooling_blocks.json
 658fab0118eb1ac9896e1b9ab89f2d5ed055a967 data/toughasnails/tags/blocks/heating_blocks.json
+4e9fc3338709900bd37b9707629283ff25f3234a data/toughasnails/tags/blocks/passable_blocks.json
diff --git a/common/src/generated/resources/data/toughasnails/tags/blocks/passable_blocks.json b/common/src/generated/resources/data/toughasnails/tags/blocks/passable_blocks.json
new file mode 100644
index 00000000..556bab29
--- /dev/null
+++ b/common/src/generated/resources/data/toughasnails/tags/blocks/passable_blocks.json
@@ -0,0 +1,6 @@
+{
+  "values": [
+    "#minecraft:doors",
+    "#minecraft:trapdoors"
+  ]
+}
\ No newline at end of file
diff --git a/common/src/main/java/toughasnails/block/entity/ThermoregulatorBlockEntity.java b/common/src/main/java/toughasnails/block/entity/ThermoregulatorBlockEntity.java
index f09d63a5..5a5b0ed8 100644
--- a/common/src/main/java/toughasnails/block/entity/ThermoregulatorBlockEntity.java
+++ b/common/src/main/java/toughasnails/block/entity/ThermoregulatorBlockEntity.java
@@ -235,7 +235,7 @@ public void onPassable(Level level, AreaFill.FillPos pos)
                 public boolean isPassable(Level level, AreaFill.FillPos pos)
                 {
                     BlockState state = level.getBlockState(pos.pos());
-                    return isConfined(level, pos.pos()) && (state.isAir() || !isFlowBlocking(level, pos, state));
+                    return isConfined(level, pos.pos()) && (state.isAir() || state.is(ModTags.Blocks.PASSABLE_BLOCKS) || !isFlowBlocking(level, pos, state));
                 }
             }, SPREAD_RADIUS);
 
diff --git a/common/src/main/java/toughasnails/init/ModTags.java b/common/src/main/java/toughasnails/init/ModTags.java
index 47a50095..3bc3753b 100644
--- a/common/src/main/java/toughasnails/init/ModTags.java
+++ b/common/src/main/java/toughasnails/init/ModTags.java
@@ -30,6 +30,7 @@ private static void init() {}
 
         public static final TagKey<Block> COOLING_BLOCKS = create(new ResourceLocation(TANAPI.MOD_ID, "cooling_blocks"));
         public static final TagKey<Block> HEATING_BLOCKS = create(new ResourceLocation(TANAPI.MOD_ID, "heating_blocks"));
+        public static final TagKey<Block> PASSABLE_BLOCKS = create(new ResourceLocation(TANAPI.MOD_ID, "passable_blocks"));
 
         public static TagKey<Block> create(ResourceLocation name) 
         {
diff --git a/common/src/main/java/toughasnails/temperature/AreaFill.java b/common/src/main/java/toughasnails/temperature/AreaFill.java
index 2857c5b8..6a1d23b3 100644
--- a/common/src/main/java/toughasnails/temperature/AreaFill.java
+++ b/common/src/main/java/toughasnails/temperature/AreaFill.java
@@ -13,6 +13,7 @@
 import toughasnails.api.temperature.TemperatureHelper;
 import toughasnails.core.ToughAsNails;
 import toughasnails.init.ModConfig;
+import toughasnails.init.ModTags;
 
 import java.util.LinkedList;
 import java.util.Queue;
@@ -117,7 +118,7 @@ default void onPassable(Level level, FillPos pos) {
         default boolean isPassable(Level level, FillPos pos)
         {
             BlockState state = level.getBlockState(pos.pos());
-            return state.isAir() || (!isFlowBlocking(level, pos, state) && !TemperatureHelper.isHeatingBlock(state) && !TemperatureHelper.isCoolingBlock(state));
+            return state.isAir() || state.is(ModTags.Blocks.PASSABLE_BLOCKS) || (!isFlowBlocking(level, pos, state) && !TemperatureHelper.isHeatingBlock(state) && !TemperatureHelper.isCoolingBlock(state));
         }
 
         default boolean isConfined(Level level, BlockPos pos)
diff --git a/forge/src/main/java/toughasnails/forge/datagen/provider/TANBlockTagsProvider.java b/forge/src/main/java/toughasnails/forge/datagen/provider/TANBlockTagsProvider.java
index 4bf118ba..fa117c10 100644
--- a/forge/src/main/java/toughasnails/forge/datagen/provider/TANBlockTagsProvider.java
+++ b/forge/src/main/java/toughasnails/forge/datagen/provider/TANBlockTagsProvider.java
@@ -34,5 +34,6 @@ protected void addTags(HolderLookup.Provider provider)
         // TAN tags
         this.tag(ModTags.Blocks.COOLING_BLOCKS).add(Blocks.SOUL_FIRE, Blocks.SOUL_CAMPFIRE, Blocks.SOUL_LANTERN, Blocks.PACKED_ICE, Blocks.BLUE_ICE, Blocks.POWDER_SNOW_CAULDRON);
         this.tag(ModTags.Blocks.HEATING_BLOCKS).add(Blocks.FIRE, Blocks.CAMPFIRE, Blocks.LANTERN, Blocks.LAVA, Blocks.MAGMA_BLOCK, Blocks.LAVA_CAULDRON);
+        this.tag(ModTags.Blocks.PASSABLE_BLOCKS).addTags(BlockTags.DOORS, BlockTags.TRAPDOORS);
     }
 }