Преглед изворни кода

fix crash while generating plants

Kolja Strohm пре 3 недеља
родитељ
комит
705825e383

+ 4 - 4
FactoryCraft/JsonExpression.cpp

@@ -1619,6 +1619,10 @@ Framework::Assembly::AssemblyBlock& JNaighborBlockBoolExpression::buildAssembly(
                         Framework::Assembly::R8,
                         Framework::Assembly::R9},
                     {});
+                codeBlock.addPop(
+                    Framework::Assembly::R8, Framework::Assembly::LOWER32);
+                codeBlock.addPop(
+                    Framework::Assembly::RDX, Framework::Assembly::LOWER32);
                 // abort if position is not valid
                 codeBlock.addTest(Framework::Assembly::RAX,
                     Framework::Assembly::RAX,
@@ -1628,10 +1632,6 @@ Framework::Assembly::AssemblyBlock& JNaighborBlockBoolExpression::buildAssembly(
                 codeBlock.addJump(Framework::Assembly::JZ, jumpLabel);
 
                 // restore parameters for block access
-                codeBlock.addPop(
-                    Framework::Assembly::R8, Framework::Assembly::LOWER32);
-                codeBlock.addPop(
-                    Framework::Assembly::RDX, Framework::Assembly::LOWER32);
                 codeBlock.addMoveValue(
                     Framework::Assembly::R9, Framework::Assembly::R14);
                 addEvaluation(codeBlock, zMemory);

+ 2 - 2
FactoryCraft/PlantConfig.cpp

@@ -94,7 +94,7 @@ void PlantConfig::generatePlantAt(
     {
         if (direction == PlantDirection::UP)
         {
-            int currentType = zChunk->getBlockTypeAt({x, y, z + i});
+            int currentType = zChunk->getBlockTypeAtWC(x, y, z + i);
             if (currentType != BlockTypeEnum::AIR
                 && currentType != BlockTypeEnum::NO_BLOCK)
             {
@@ -105,7 +105,7 @@ void PlantConfig::generatePlantAt(
         }
         else if (direction == PlantDirection::DOWN)
         {
-            int currentType = zChunk->getBlockTypeAt({x, y, z - i});
+            int currentType = zChunk->getBlockTypeAtWC(x, y, z - i);
             if (currentType != BlockTypeEnum::AIR
                 && currentType != BlockTypeEnum::NO_BLOCK)
             {

+ 4 - 0
Windows Version/data/blocks/plants.json

@@ -313,6 +313,10 @@
             ]
         },
         "mapColor": "0xA033A033",
+        "transparent": true,
+        "damagableByHand": true,
+        "speedModifier": 0.4,
+        "passable": true,
         "drops": [
             {
                 "type": "specificItem",