Skip to content

Commit

Permalink
Merge pull request #37 from ModMaker101/development
Browse files Browse the repository at this point in the history
fixing the kunai bug an working on a ui
  • Loading branch information
ModMaker101 authored Jul 31, 2024
2 parents 02d44e2 + f24720c commit 844c239
Show file tree
Hide file tree
Showing 61 changed files with 959 additions and 66 deletions.
2 changes: 1 addition & 1 deletion .mcattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
diagnostic.disable.minecraft.animation.unused=true
diagnostic.disable.minecraft.animation.unused=true
42 changes: 38 additions & 4 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,55 @@
{
"$schema": "https://raw.githubusercontent.com/Bedrock-OSS/regolith-schemas/main/config/v1.2.json",
"author": "Your name",
"name": "Project name",
"author": "ModMaker101",
"name": "Naruto",
"packs": {
"behaviorPack": "./packs/BP",
"resourcePack": "./packs/RP"
},
"regolith": {
"dataPath": "./packs/data",
"filterDefinitions": {},
"filterDefinitions": {
"JSon-cleaner": {
"url": "github.com/llgava/regolith-filters",
"version": "1.0.1"
},
"bump_manifest": {
"url": "github.com/Bedrock-OSS/regolith-filters",
"version": "1.0.0"
},
"js_formatter": {
"url": "github.com/MajestikButter/Regolith-Filters",
"version": "6fa6a6a9298f7d033d0f2e421edfb33292807aae"
},
"minimize": {
"url": "github.com/cda94581/regolith-filters",
"version": "0.0.4"
},
"run_counter": {
"url": "github.com/Nusiq/regolith-filters",
"version": "1.0.2"
}
},
"profiles": {
"default": {
"export": {
"readOnly": false,
"target": "development"
},
"filters": []
"filters": [
{
"filter": "js_formatter"
},
{
"filter": "run_counter"
},
{
"filter": "minimize"
},
{
"filter": "bump_manifest"
}
]
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions packs/BP/nBehavior/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
{
"module_name": "@minecraft/server",
"version": "1.12.0-beta"
},
{
"module_name": "@minecraft/server-ui",
"version": "1.2.0-beta"
}
]
}
12 changes: 6 additions & 6 deletions packs/BP/nBehavior/scripts/chakra/chakraAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ const ChakraAPI = {
if (!objective) {
world.scoreboard.addObjective("chakra", "dummy", "Chakra");
}
player.runCommand(`scoreboard players set @s chakra ${initialChakra}`);
player.runCommandAsync(`scoreboard players set @s chakra ${initialChakra}`);
this.updateChakraVisual(player);
console.log(`Initialized chakra for ${player.name}`);
},

getPlayerChakra(player) {
const objective = world.scoreboard.getObjective("chakra");
if (objective) {
return objective.getScore(player.scoreboard);
return objective.getScore(player);
}
return 0;
},

setPlayerChakra(player, amount) {
const objective = world.scoreboard.getObjective("chakra");
if (objective) {
player.runCommand(`scoreboard players set @s chakra ${amount}`);
player.runCommandAsync(`scoreboard players set @s chakra ${amount}`);
this.updateChakraVisual(player);
console.log(`Set chakra for ${player.name} to ${amount}`);
}
Expand All @@ -39,20 +39,20 @@ const ChakraAPI = {
this.setPlayerChakra(player, currentChakra - amount);
return true;
} else {
player.runCommand(`tellraw @s {"rawtext":[{"text":"Not enough chakra!"}]}`);
player.runCommandAsync(`tellraw @s {"rawtext":[{"text":"Not enough chakra!"}]}`);
console.log(`Not enough chakra for ${player.name}`);
return false;
}
},

updateChakraVisual(player) {
const currentChakra = this.getPlayerChakra(player);
player.runCommand(`title @s actionbar {"rawtext":[{"text":"Chakra: ${currentChakra}"}]}`);
player.runCommandAsync(`title @s actionbar {"rawtext":[{"text":"Chakra: ${currentChakra}"}]}`);
console.log(`Updated chakra visual for ${player.name} to ${currentChakra}`);
}
};

world.afterEvents.playerSpawn.subscribe(event => {
world.events.playerJoin.subscribe(event => {
const player = event.player;
system.run(() => {
ChakraAPI.initializePlayerChakra(player);
Expand Down
8 changes: 3 additions & 5 deletions packs/BP/nBehavior/scripts/main.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
//js files
import "./server.say"
import "./ui/test1"

//chakra
import { ChakraAPI } from "./chakra/chakraAPI.js";
import "./chakra/chakraVisuals.js";

//animations

//init
ChakraAPI.initialize();
//animations
60 changes: 60 additions & 0 deletions packs/BP/nBehavior/scripts/ui/test1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { world } from "@minecraft/server";
import { ActionFormData } from "@minecraft/server-ui";

// Define the Naruto-themed UI
const narutoUi = new ActionFormData()
.title("Naruto Themed UI")
.body("Select an option:")
.button("Jutsu", "textures/items/weapons/katana")
.button("Ninja Tools", "textures/items/weapons/kunai")
.button("Summons", "textures/ui/naruto_summons")
.button("Clans", "textures/ui/naruto_clans");

// Define the custom UI
const customUi = new ActionFormData()
.title("Custom Form")
.body("Select an option:")
.button("Rewards", "textures/ui/promo_holiday_gift_small")
.button("Shop", "textures//icon_deals")
.button("Ban Tool", "textures/ui/hammer_l")
.button("Naruto UI", "textures/ui/icon_hangar"); // This button will open the Naruto-themed UI

world.afterEvents.itemUse.subscribe((event) => {
const { source, itemStack } = event;
switch (itemStack.typeId) {
case "minecraft:compass":
narutoUi.show(source).then((response) => {
// Handle the Naruto UI button selections here
if (response.selection !== undefined) {
// Process the selection, you can add specific actions for each button
switch (response.selection) {
case 0:
// Jutsu button pressed
source.runCommand('say You selected Jutsu');
break;
case 1:
// Ninja Tools button pressed
source.runCommand('say You selected Ninja Tools');
break;
case 2:
// Summons button pressed
source.runCommand('say You selected Summons');
break;
case 3:
// Clans button pressed
source.runCommand('say You selected Clans');
break;
}
}
});
break;
case "minecraft:clock":
customUi.show(source).then((response) => {
// Check if the "Naruto UI" button was pressed
if (response.selection === 3) { // Index starts from 0, so the 4th button is index 3
narutoUi.show(source);
}
});
break;
}
});
18 changes: 9 additions & 9 deletions packs/RP/nResource/models/entity/weapons/kunai.geo.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"format_version": "1.12.0",
"format_version": "1.21.0",
"minecraft:geometry": [
{
"description": {
"identifier": "geometry.kunai",
"texture_width": 32,
"texture_height": 32,
"texture_width": 16,
"texture_height": 16,
"visible_bounds_width": 2,
"visible_bounds_height": 1.5,
"visible_bounds_offset": [0, 0.25, 0]
},
"bones": [
{
"name": "bb_main",
"pivot": [0, 0, 0],
"name": "body",
"pivot": [0, 2, 0],
"rotation": [-90, 0, 0],
"cubes": [
{"origin": [-1, 1, -2], "size": [1, 1, 5], "uv": [0, 0]},
{"origin": [-1, -3, -10], "size": [0, 8, 8], "pivot": [-1, 1.5, -6], "rotation": [0, 0, -90], "uv": [0, 8]},
{"origin": [-0.5, -2, -10], "size": [0, 8, 8], "uv": [0, 0]},
{"origin": [-0.5, 0.5, 3], "size": [0, 2, 2], "uv": [0, 0]}
{"origin": [-3.5, -6, 0], "size": [7, 8, 0], "pivot": [0, -3, 0], "rotation": [0, 90, 0], "uv": [0, 0]},
{"origin": [-0.5, 2, -0.5], "size": [1, 4, 1], "uv": [0, 8]},
{"origin": [-1, 6, 0], "size": [2, 2, 0], "pivot": [0, -3, 0], "rotation": [0, -90, 0], "uv": [4, 8]}
]
}
]
Expand Down
Binary file modified packs/RP/nResource/textures/models/weapons/kunai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 844c239

Please sign in to comment.