aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/StructureFeature.h
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
commitb691c43c44ff180d10e7d4a9afc83b98551ff586 (patch)
tree3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.World/StructureFeature.h
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.World/StructureFeature.h')
-rw-r--r--Minecraft.World/StructureFeature.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/Minecraft.World/StructureFeature.h b/Minecraft.World/StructureFeature.h
new file mode 100644
index 00000000..642e6aad
--- /dev/null
+++ b/Minecraft.World/StructureFeature.h
@@ -0,0 +1,58 @@
+#pragma once
+#include "LargeFeature.h"
+class StructureStart;
+
+class StructureFeature : public LargeFeature
+{
+public:
+ // 4J added - Maps to values in the game rules xml
+ enum EFeatureTypes
+ {
+ eFeature_Mineshaft,
+ eFeature_NetherBridge,
+ eFeature_Temples,
+ eFeature_Stronghold,
+ eFeature_Village,
+ };
+
+protected:
+ unordered_map<__int64, StructureStart *> cachedStructures;
+
+public:
+ ~StructureFeature();
+
+ virtual void addFeature(Level *level, int x, int z, int xOffs, int zOffs, byteArray blocks);
+
+ bool postProcess(Level *level, Random *random, int chunkX, int chunkZ);
+ bool isIntersection(int cellX, int cellZ);
+
+ bool isInsideFeature(int cellX, int cellY, int cellZ);
+ TilePos *getNearestGeneratedFeature(Level *level, int cellX, int cellY, int cellZ);
+protected:
+ vector<TilePos> *getGuesstimatedFeaturePositions();
+
+ /**
+ * Returns true if the given chunk coordinates should hold a structure
+ * source.
+ *
+ * @param x
+ * chunk x
+ * @param z
+ * chunk z
+ * @return
+ */
+protected:
+ virtual bool isFeatureChunk(int x, int z, bool bIsSuperflat=false) = 0;
+
+ /**
+ * Creates a new instance of a structure source at the given chunk
+ * coordinates.
+ *
+ * @param x
+ * chunk x
+ * @param z
+ * chunk z
+ * @return
+ */
+ virtual StructureStart *createStructureStart(int x, int z) = 0;
+};