Skip to content

Commit

Permalink
Update 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelDobCZ23 committed Jun 14, 2023
1 parent 59dbbdc commit 3bf525c
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 58 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/exports
/exports/*
/scripts/
/scripts/*
mcproject.json
106 changes: 53 additions & 53 deletions manifest.json → src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
{
"metadata": {
"authors": ["PavelDobCZ23"],
"license": "GNU GPL v3 + The Commons Clause",
"url": "https://www.icecraftstudio.repl.co"
},
"format_version": 2,
"header": {
"description": "Any block you break will now spawn a random mob! Good luck. §9Made by PavelDobCZ23",
"name": "Broken Blocks Spawn Mobs",
"uuid": "8186a5c4-2ff6-4ae3-851d-cc064b3ebf15",
"version": [ 1, 5, 0 ],
"min_engine_version": [ 1, 19, 80 ]
},
"modules": [
{
"description": "Broken Blocks Spawn Mobs [BP] - data module",
"type": "data",
"uuid": "02f9fff8-b396-4b0e-8dc8-8f4248720e95",
"version": [1, 5, 0]
},
{
"description": "Broken Blocks Spawn Mobs [BP] - script module",
"type": "script",
"language": "javascript",
"uuid": "dba56e9e-7496-4366-a01e-8ed733aeaa59",
"version": [1, 5, 0],
"entry": "scripts/main.js"
}
],
"dependencies": [
{
"module_name": "@minecraft/server",
"version": "1.2.0-beta"
}
],
"subpacks": [
{
"folder_name": "easy",
"name": "§aEasy Mode",
"memory_tier": 0
},
{
"folder_name": "hard",
"name": "§4Hard Mode",
"memory_tier": 0
},
{
"folder_name": "normal",
"name": "Normal Mode",
"memory_tier": 0
}
]
{
"metadata": {
"authors": ["PavelDobCZ23"],
"license": "GNU GPL v3 + The Commons Clause",
"url": "https://www.icecraftstudio.repl.co"
},
"format_version": 2,
"header": {
"description": "Any block you break will now spawn a random mob! Good luck. §9Made by PavelDobCZ23",
"name": "Broken Blocks Spawn Mobs",
"uuid": "8186a5c4-2ff6-4ae3-851d-cc064b3ebf15",
"version": [ 1, 6, 0 ],
"min_engine_version": [ 1, 20, 0 ]
},
"modules": [
{
"description": "Broken Blocks Spawn Mobs [BP] - data module",
"type": "data",
"uuid": "02f9fff8-b396-4b0e-8dc8-8f4248720e95",
"version": [1, 6, 0]
},
{
"description": "Broken Blocks Spawn Mobs [BP] - script module",
"type": "script",
"language": "javascript",
"uuid": "dba56e9e-7496-4366-a01e-8ed733aeaa59",
"version": [1, 6, 0],
"entry": "scripts/main.js"
}
],
"dependencies": [
{
"module_name": "@minecraft/server",
"version": "1.3.0-beta"
}
],
"subpacks": [
{
"folder_name": "easy",
"name": "§aEasy Mode",
"memory_tier": 0
},
{
"folder_name": "hard",
"name": "§4Hard Mode",
"memory_tier": 0
},
{
"folder_name": "normal",
"name": "Normal Mode",
"memory_tier": 0
}
]
}
File renamed without changes
27 changes: 27 additions & 0 deletions src/scripts/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { world } from "@minecraft/server";
import { mobList } from "./mob_list.js";

world.afterEvents.blockBreak.subscribe(async (eventData) => {
const locX = eventData.block.location.x;
const locY = eventData.block.location.y;
const locZ = eventData.block.location.z;
await eventData.player.runCommandAsync(`summon ${randChoice(mobList)} ${locX} ${locY} ${locZ}`);
});

function randInt(min, max) {
max++;
return Math.floor(Math.random() * (max - min)) + min;
}

function randChoice(array, num) {
if (num) {
const choice = [];
while (num > 0) {
num--;
choice.push(array[randInt(0, array.length - 1)]);
}
return choice;
} else {
return array[randInt(0, array.length - 1)];
}
}
2 changes: 2 additions & 0 deletions src/subpacks/easy/scripts/mob_list.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/subpacks/normal/scripts/mob_list.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions subpacks/easy/scripts/modules/mob_list.js

This file was deleted.

2 changes: 0 additions & 2 deletions subpacks/normal/scripts/modules/mob_list.js

This file was deleted.

0 comments on commit 3bf525c

Please sign in to comment.