Replacing a percentage of Block around me

Started by squee2121 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Nov 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Replacing a percentage of Block around me
Sun, 03/23/2025 - 16:09 (edited)

So I have my mod wich is working.
It s an horror mod so here i m trying to change a random Spruce log in a scarred spruce log wich is a block from the mod.
here is the procedure for now.




Here is a clear transcription of each procedure block used in your MCreator code:

  1. Event Trigger:
    • "Event trigger - triggered by external call or when (global trigger): On entity tick update"
  2. Initializing Variables:
    • "Set number Local: sx to -3"
  3. Creating and Storing Coordinates:
    • "Set text Local: coordonnees to create text with Get number Local: sx, Get number Local: sy, Get number Local: sz"
    • "Set text Local: Spruce_Blocks to create text with Get text Local: Spruce_Blocks, Get text Local: coordonnees"
  4. Loop for Scanning Blocks:
    • "Repeat 5 times:
      • Set number Local: sy to -3
      • Repeat 20 times:
        • Set number Local: sz to -3
        • Repeat 20 times:
          • Set number Local: sx to -3
          • If Get block at (x: Get number Local: sx, y: Get number Local: sy, z: Get number Local: sz) is the same block as Spruce_Wood:
            • Set logic Local: found to: true
            • Store coordinates in Spruce_Blocks
          • Set number Local: sx to Get number Local: sx + 1
        • Set number Local: sz to Get number Local: sz + 1
      • Set number Local: sy to Get number Local: sy + 1"
  5. Checking if the List is Not Empty:
    • "If Is text empty (Get text Local: Spruce_Blocks) = false:
      • Set number Local: random_index to Random number between min: 0 and max: length of (Get text Local: Spruce_Blocks)
      • Set text Local: selected_coord to Get text (Spruce_Blocks, random_index)"

         

         

         

        So the code is meant to find spruce_wood in a cube of 20*5*20 and write on a list ( Spruce_Block ) all the coord of Spruce_wood blocks detected. Then the goal is to pick 1 to 5 randomly and change the blocks in the scarred spruce wood block ... 

         


        Thx for the help hope i was clear .
         

        https://drive.google.com/file/d/14wYAuNiA3JuTprFIlXV-NNAgnt6ipeTF/view?usp=sharing

Edited by squee2121 on Sun, 03/23/2025 - 16:09
Joined Nov 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
help plz :,(
Tue, 03/25/2025 - 18:44

help plz :,(