XzNapi

Buatkan Add-on MCPE 1.21 (Behavior & Resource Pack) dengan konsep 'Submerged World'. Spesifikasi:

  1. Seluruh world terendam air,
  2. Daratan, pohon, rumput, dan tanaman tetap generate dan tumbuh normal di dalam air,
  3. Air tidak merusak/menghancurkan tanaman atau crop (modifikasi water block behavior atau matikan block update untuk air),
  4. Fisika dan pergerakan entitas/player 100% menggunakan logika berenang.

Berikan struktur folder, file JSON, dan kode Bedrock Scripting API yang diperlukan untuk mewujudkan mekanik ini.

Kodari AI
KodariApr 30 at 6:09 pm 16,650 (v2)

I’ll create a Minecraft Bedrock Edition 1.21 add-on for a fully submerged world concept.

SubmergedWorld
A Minecraft Bedrock Edition add-on that creates a fully submerged world where all terrain generates underwater. Plants, crops, and trees grow normally beneath the waves while water physics apply everywhere. Features modified block behaviors to prevent water from destroying vegetation, custom world generation with elevated water levels, and seamless underwater survival mechanics.

Submerged World add-on created with complete behavior pack (scripts, biomes, block overrides), resource pack (fog, sounds), and documentation files covering installation, configuration, and technical implementation.

XzNapi

saat saya mau compile ada pesan Compilation Error Missing required files for Fabric mod

Kodari AI
KodariApr 30 at 6:11 pm 2,406 (v2)

Ini bukan Fabric mod untuk Minecraft Java Edition! Ini adalah Bedrock Edition add-on untuk MCPE (Minecraft Pocket Edition / Bedrock).

Bedrock add-on tidak perlu di-compile. Anda langsung menggunakan folder atau file .mcpack/.mcaddon.

Cara Menggunakan Add-on Bedrock:

Metode 1: Copy Manual (Langsung)

  1. Behavior Pack:

    • Copy folder behavior_pack/ ke:

      • Windows 10/11: %localappdata%\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\games\com.mojang\behavior_packs\

      • Android: /storage/emulated/0/Android/data/com.mojang.minecraftpe/files/games/com.mojang/behavior_packs/

      • iOS: On My iPhone/Minecraft/games/com.mojang/behavior_packs/

  2. Resource Pack:

    • Copy folder resource_pack/ ke:

      • Windows: %localappdata%\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\games\com.mojang\resource_packs\

      • Android: /storage/emulated/0/Android/data/com.mojang.minecraftpe/files/games/com.mojang/resource_packs/

      • iOS: On My iPhone/Minecraft/games/com.mojang/resource_packs/

  3. Buka Minecraft → Settings → Storage → Activate Packs

Metode 2: .mcaddon (Lebih Mudah)

Jika Anda ingin membuat file installer .mcaddon:

Cara Mengaktifkan dalam World:

  1. Buat New World

  2. Scroll ke bawah → Behavior Packs → Klik + → Pilih “SubmergedWorld BP”

  3. Resource Packs → Klik + → Pilih “SubmergedWorld RP”

  4. Experiments → Aktifkan “Beta APIs” ✅

  5. Create World


Catatan Penting:

  • File yang saya buat adalah JSON dan JavaScript, tidak perlu compiler

  • Bedrock menggunakan .json untuk block behavior dan .js untuk scripting

  • Jika Anda mencari Java Edition mod, itu berbeda total (gunakan Fabric/Forge dengan Java)

Apakah Anda:

  1. Ingin lanjut dengan Bedrock add-on ini? (tidak perlu compile)

  2. Atau Anda sebenarnya ingin Fabric mod untuk Java Edition 1.21.4?

Kodari can make mistakes. Review important code before using.
Files
behavior_pack
resource_pack
INSTALLATION.md
pack_as_mcaddon.bat
pack_as_mcaddon.sh
README.md
TECHNICAL.md
Code
19 1,568
behavior_pack/scripts/main.js
import { world, system, BlockPermutation, BlockTypes } from '@minecraft/server';

// List of blocks that should NOT be destroyed by water
const WATER_RESISTANT_BLOCKS = [
  'minecraft:wheat',
  'minecraft:carrots',
  'minecraft:potatoes',
  'minecraft:beetroot',
  'minecraft:melon_stem',
  'minecraft:pumpkin_stem',
  'minecraft:torchflower',
  'minecraft:pitcher_plant',
  'minecraft:red_flower',
  'minecraft:yellow_flower',
  'minecraft:tallgrass',
  'minecraft:double_plant',
  'minecraft:sapling',
  'minecraft:red_mushroom',
  'minecraft:brown_mushroom',
  'minecraft:crimson_fungus',
  'minecraft:warped_fungus',
  'minecraft:crimson_roots',
  'minecraft:warped_roots',
  'minecraft:nether_sprouts',
  'minecraft:sweet_berry_bush',
  'minecraft:cave_vines',
  'minecraft:sugar_cane',
  'minecraft:cactus',
  'minecraft:bamboo',
  'minecraft:kelp',
  'minecraft:seagrass',
  'minecraft:sea_pickle',
  'minecraft:torch',
  'minecraft:redstone_wire',
  'minecraft:lever',
  'minecraft:wooden_button',
  'minecraft:stone_button',
  'minecraft:tripwire',
  'minecraft:rail',
  'minecraft:powered_rail',
  'minecraft:detector_rail',
  'minecraft:activator_rail'
];

// Cache for checking if blocks should be protected
const protectedBlockCache = new Set(WATER_RESISTANT_BLOCKS);

/**
 * Initialize the submerged world system
 */
function initialize() {
  console.warn('[Submerged World] Initializing underwater world mechanics...');
  
  // Subscribe to world events
  world.afterEvents.playerSpawn.subscribe(onPlayerSpawn);
  world.beforeEvents.worldInitialize.subscribe(onWorldInitialize);
  
  // Start the main update loop
  system.runInterval(mainUpdate, 20); // Run every second (20 ticks)
  
  console.warn('[Submerged World] Initialization complete!');
}

/**
 * Handle world initialization
 */
function onWorldInitialize(event) {
  console.warn('[Submerged World] World initialized - underwater mechanics active');
}

/**
 * Handle player spawn - give underwater breathing by default
 */
function onPlayerSpawn(event) {
  const player = event.player;
  
  // Welcome message
  player.sendMessage('§b§l=== SUBMERGED WORLD ===§r');
  player.sendMessage('§3The entire world is underwater!§r');
  player.sendMessage('§7Plants and crops grow normally beneath the waves.§r');
  
  // Optional: Give water breathing effect on spawn
  system.runTimeout(() => {
    try {
      player.addEffect('water_breathing', 999999, { amplifier: 0, showParticles: false });
    } catch (error) {
      // Effect might not be available or player left
    }
  }, 20);
}

/**
 * Main update loop - protect blocks from water destruction
 */
function mainUpdate() {
  try {
    // Iterate through all players to check their nearby blocks
    for (const player of world.getAllPlayers()) {
      protectNearbyBlocks(player);
    }
  } catch (error) {
    console.warn('[Submerged World] Update error:', error);
  }
}

/**
 * Protect blocks near player from water destruction
 */
function protectNearbyBlocks(player) {
  try {
    const dimension = player.dimension;
    const playerPos = player.location;
    const checkRadius = 8; // Check 8 blocks around player
    
    // Scan nearby blocks
    for (let x = -checkRadius; x <= checkRadius; x++) {
      for (let y = -checkRadius; y <= checkRadius; y++) {
        for (let z = -checkRadius; z <= checkRadius; z++) {
          const blockPos = {
            x: Math.floor(playerPos.x) + x,
            y: Math.floor(playerPos.y) + y,
            z: Math.floor(playerPos.z) + z
          };
          
          try {
            const block = dimension.getBlock(blockPos);
            if (!block) continue;
            
            const blockType = block.typeId;
            
            // Check if this is a protected block
            if (isProtectedBlock(blockType)) {
              // Check if water is adjacent (could destroy the block)
              if (hasAdjacentWater(dimension, blockPos)) {
                // The block is protected - water won't destroy it naturally
                // We rely on the block component overrides for this
              }
            }
          } catch (blockError) {
            // Block might be unloaded or in ungenerated chunk
          }
        }
      }
    }
  } catch (error) {
    // Player might have left or dimension changed
  }
}

/**
 * Check if a block should be protected from water
 */
function isProtectedBlock(blockTypeId) {
  return protectedBlockCache.has(blockTypeId);
}

/**
 * Check if water is adjacent to a position
 */
function hasAdjacentWater(dimension, pos) {
  const offsets = [
    { x: 1, y: 0, z: 0 },
    { x: -1, y: 0, z: 0 },
    { x: 0, y: 1, z: 0 },
    { x: 0, y: -1, z: 0 },
    { x: 0, y: 0, z: 1 },
    { x: 0, y: 0, z: -1 }
  ];
  
  for (const offset of offsets) {
    try {
      const checkPos = {
        x: pos.x + offset.x,
        y: pos.y + offset.y,
        z: pos.z + offset.z
      };
      
      const block = dimension.getBlock(checkPos);
      if (block && (block.typeId === 'minecraft:water' || block.typeId === 'minecraft:flowing_water')) {
        return true;
      }
    } catch (error) {
      // Block not loaded
    }
  }
  
  return false;
}

/**
 * Custom command to toggle water breathing
 */
world.beforeEvents.chatSend.subscribe((event) => {
  const message = event.message.toLowerCase();
  const player = event.sender;
  
  if (message === '!waterbreathing' || message === '!wb') {
    event.cancel = true;
    
    system.run(() => {