-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
59dbbdc
commit 3bf525c
Showing
9 changed files
with
90 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/exports | ||
/exports/* | ||
/scripts/ | ||
/scripts/* | ||
mcproject.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)]; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
subpacks/hard/scripts/modules/mob_list.js → src/subpacks/hard/scripts/mob_list.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.