Skip to content

Commit

Permalink
fix: reload, and update functions now added, and fixed. Now it gives …
Browse files Browse the repository at this point in the history
…you the configuration item once only, on your first join to the world loaded with this addon, added tacosfish entityTypes
  • Loading branch information
Adr-hyng committed Sep 15, 2024
1 parent b5bad80 commit 34d1d50
Show file tree
Hide file tree
Showing 45 changed files with 709 additions and 330 deletions.
33 changes: 33 additions & 0 deletions BP/entities/fishing_hook.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"client_sync": true,
"range": [0, 16],
"default": 0
},
"yn:current_weather_bit": {
"type": "int",
"client_sync": true,
"range": [0, 2],
"default": 0
}
}
},
Expand Down Expand Up @@ -53,6 +59,33 @@
"events": {
"minecraft:entity_spawned": {
"sequence": [
{
"filters": {
"test": "weather_at_position",
"value": "clear"
},
"set_property": {
"yn:current_weather_bit": 0
}
},
{
"filters": {
"test": "weather_at_position",
"value": "rain"
},
"set_property": {
"yn:current_weather_bit": 1
}
},
{
"filters": {
"test": "weather_at_position",
"value": "thunderstorm"
},
"set_property": {
"yn:current_weather_bit": 2
}
},
{
"filters": {
"test": "is_biome",
Expand Down
2 changes: 1 addition & 1 deletion BP/functions/AnglersDesire/reload.mcfunction
Original file line number Diff line number Diff line change
@@ -1 +1 @@
execute as @s[hasitem={item=minecraft:fishing_rod}] run function AnglersDesire/reload
execute as @s[hasitem={item=minecraft:fishing_rod}] run scriptevent yn:anglers dev_helper reload
1 change: 1 addition & 0 deletions BP/functions/AnglersDesire/update.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
scriptevent yn:anglers dev_helper update
14 changes: 7 additions & 7 deletions BP/manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"format_version": 2,
"header": {
"name": "Angler's Desire BP §8(1.0.1)",
"name": "Angler's Desire BP §8(1.1.0) [DEBUG]",
"description": "Adding immersion to vanilla fishing mechanics in Minecraft \n @Made By: https://twitter.com/h_YanG_0A",
"uuid": "f36713ae-a50d-4eae-ab09-14bef4e580ec",
"version": [
1,
0,
1
1,
0
],
"min_engine_version": [
1,
Expand All @@ -33,8 +33,8 @@
"uuid": "02a44d23-5962-4bb5-8a78-ef87d1eb0726",
"version": [
1,
0,
1
1,
0
],
"entry": "scripts/main.js"
}
Expand All @@ -55,8 +55,8 @@
"uuid": "54ee84f3-7b81-421c-8602-2d399940fd59",
"version": [
1,
0,
1
1,
0
]
}
],
Expand Down
49 changes: 43 additions & 6 deletions BP/scripts/commands/dev_helper.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import { BlockTypes, EnchantmentTypes, EntityComponentTypes, EquipmentSlot, ItemComponentTypes, ItemEnchantableComponent, ItemStack, MolangVariableMap, system } from "@minecraft/server";
import { BlockTypes, EnchantmentTypes, EntityComponentTypes, EquipmentSlot, ItemComponentTypes, ItemEnchantableComponent, ItemStack, MolangVariableMap, system, world } from "@minecraft/server";
import { CommandHandler } from "commands/command_handler";
import { SendMessageTo, sleep } from "utils/utilities";
import { overrideEverything } from "overrides/index";
import { MinecraftBlockTypes, MinecraftEnchantmentTypes, MinecraftItemTypes } from "vanilla-types/index";
import { FishingCustomEnchantmentType } from "custom_enchantment/custom_enchantment_types";
import { AStarOptions } from "utils/NoxUtils/Pathfinder/AStarOptions";
import { BidirectionalAStar } from "utils/NoxUtils/Pathfinder/BidirectionalAStar";
import { FishingCustomEnchantmentType } from "custom_enchantment/available_custom_enchantments";
import { TacosFishEntityTypes } from "fishing_system/entities/compatibility/tacos_fish_mobs";
import { db } from "constant";
overrideEverything();
var REQUIRED_PARAMETER;
(function (REQUIRED_PARAMETER) {
REQUIRED_PARAMETER["GET"] = "get";
REQUIRED_PARAMETER["TEST"] = "test";
REQUIRED_PARAMETER["RELOAD_INVENTORY"] = "reload";
REQUIRED_PARAMETER["LOAD_OLD"] = "load_old";
REQUIRED_PARAMETER["RELOAD_INVENTORY"] = "reload";
REQUIRED_PARAMETER["UPDATE_ADDON"] = "update";
REQUIRED_PARAMETER["TEST"] = "test";
REQUIRED_PARAMETER["PATHFIND_TEST"] = "pathfind";
REQUIRED_PARAMETER["DAMAGE_TEST"] = "damage";
REQUIRED_PARAMETER["PARTICLE_TEST"] = "particle";
REQUIRED_PARAMETER["TACO_FISH_TEST"] = "test_tacofish";
})(REQUIRED_PARAMETER || (REQUIRED_PARAMETER = {}));
const command = {
name: 'dev_helper',
Expand All @@ -28,8 +32,8 @@ const command = {
Usage:
> ${CommandHandler.prefix}${this.name} ${REQUIRED_PARAMETER.GET} = GETS an enchanted fishing rod for development.
> ${CommandHandler.prefix}${this.name} ${REQUIRED_PARAMETER.RELOAD_INVENTORY} = Reload the fishing rod's hook bug.
> ${CommandHandler.prefix}${this.name} ${REQUIRED_PARAMETER.DAMAGE_TEST} = Damages fishing rod hook usage.
> ${CommandHandler.prefix}${this.name} ${REQUIRED_PARAMETER.PARTICLE_TEST} = TEST a Working-in-progress particle.
> ${CommandHandler.prefix}${this.name} ${REQUIRED_PARAMETER.LOAD_OLD} = Loads the old custom dynamic property for fishing rod. For bug fixing purposes. It's chained with reload command after.
> ${CommandHandler.prefix}${this.name} ${REQUIRED_PARAMETER.UPDATE_ADDON} = Updates the addon to the latest, after deleting the old addon, and installing the new one.
`).replaceAll(" ", "");
},
execute(player, args) {
Expand Down Expand Up @@ -63,6 +67,32 @@ const command = {
break;
case REQUIRED_PARAMETER.TEST:
break;
case REQUIRED_PARAMETER.UPDATE_ADDON:
if (db.has("WorldIsRaining"))
db.delete("WorldIsRaining");
world.sendMessage("§a§lAngler's Desire Addon's Scripts§r §ahas been updated successfully.");
break;
case REQUIRED_PARAMETER.TACO_FISH_TEST:
let successCount = 0;
system.run(async () => {
for (const tacoFishType of Object.values(TacosFishEntityTypes)) {
try {
const t = player.dimension.spawnEntity(tacoFishType, player.location);
await system.waitTicks(3);
t.kill();
successCount++;
}
catch (e) {
continue;
}
}
SendMessageTo(player, {
rawtext: [
{ text: `Success: ${successCount}\nTotal: ${(Object.values(TacosFishEntityTypes).length)}` }
]
});
});
break;
case REQUIRED_PARAMETER.DAMAGE_TEST:
if (!args[1].length)
return;
Expand Down Expand Up @@ -92,6 +122,13 @@ const command = {
}
inventory.setItem(slot, fishingRod);
}
SendMessageTo(player, {
rawtext: [
{
text: "§a§lAngler's Desire§r §afishing hook enhancement bug located in your current inventory has been fully reloaded."
}
]
});
break;
case REQUIRED_PARAMETER.LOAD_OLD:
fishingRod = player.equippedTool(EquipmentSlot.Mainhand);
Expand Down
2 changes: 1 addition & 1 deletion BP/scripts/constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const ADDON_NAME = "Anglers_Desire";
export const ADDON_IDENTIFIER = `${ADDON_NAMESPACE}:anglers`;
export const db = new JsonDatabase(ADDON_NAME);
export const localFishersCache = new Map();
export const spawnedLogMap = new Map();
export const onSpawnHookLogMap = new Map();
export const onCaughtParticleLogMap = new Map();
export const onLostParticleLogMap = new Map();
export const onHookLandedCallingLogMap = new Map();
Expand Down
67 changes: 67 additions & 0 deletions BP/scripts/custom_enchantment/available_custom_enchantments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { MyCustomItemTypes } from "fishing_system/items/custom_items";
import { CustomEnchantment } from "./custom_enchantment";
export class FishingCustomEnchantmentType {
static get Nautilus() {
return new CustomEnchantment({
icon: "textures/items/nautilus_hook",
id: "Nautilus",
itemID: MyCustomItemTypes.NautilusHook,
name: "Nautilus Hook",
description: "yn:fishing_got_reel.enchantments.nautilus.description",
lore: "yn:fishing_got_reel.enchantments.nautilus.lore",
level: 1,
maxUsage: 75,
conflicts: ["Pyroclasm Hook", "Fermented Hook"],
});
}
static get Luminous() {
return new CustomEnchantment({
icon: "textures/items/luminous_siren_hook",
id: "Luminous",
itemID: MyCustomItemTypes.LuminousHook,
name: "Luminous Hook",
description: "yn:fishing_got_reel.enchantments.luminous.description",
lore: "yn:fishing_got_reel.enchantments.luminous.lore",
level: 1,
maxUsage: 54,
});
}
static get Pyroclasm() {
return new CustomEnchantment({
icon: "textures/items/pyroclasm_hook",
id: "Pyroclasm",
itemID: MyCustomItemTypes.PyroclasmHook,
name: "Pyroclasm Hook",
description: "yn:fishing_got_reel.enchantments.pyroclasm.description",
lore: "yn:fishing_got_reel.enchantments.pyroclasm.lore",
level: 1,
maxUsage: 45,
conflicts: ["Nautilus Hook"],
});
}
static get Tempus() {
return new CustomEnchantment({
icon: "textures/items/tempus_hook",
id: "Tempus",
itemID: MyCustomItemTypes.TempusHook,
name: "Tempus Hook",
description: "yn:fishing_got_reel.enchantments.tempus.description",
lore: "yn:fishing_got_reel.enchantments.tempus.lore",
level: 1,
maxUsage: 92,
});
}
static get FermentedEye() {
return new CustomEnchantment({
icon: "textures/items/fermented_spider_eye_hook",
id: "FermentedEye",
itemID: MyCustomItemTypes.FermentedSpiderEyeHook,
name: "Fermented Hook",
description: "yn:fishing_got_reel.enchantments.fermentedeye.description",
lore: "yn:fishing_got_reel.enchantments.fermentedeye.lore",
level: 1,
maxUsage: 60,
conflicts: ["Nautilus Hook"],
});
}
}
68 changes: 1 addition & 67 deletions BP/scripts/custom_enchantment/custom_enchantment_types.js
Original file line number Diff line number Diff line change
@@ -1,70 +1,4 @@
import { MyCustomItemTypes } from "fishing_system/items/custom_items";
import { CustomEnchantment } from "./custom_enchantment";
export class FishingCustomEnchantmentType {
static get Nautilus() {
return new CustomEnchantment({
icon: "textures/items/nautilus_hook",
id: "Nautilus",
itemID: MyCustomItemTypes.NautilusHook,
name: "Nautilus Hook",
description: "yn:fishing_got_reel.enchantments.nautilus.description",
lore: "yn:fishing_got_reel.enchantments.nautilus.lore",
level: 1,
maxUsage: 75,
conflicts: ["Pyroclasm Hook", "Fermented Hook"],
});
}
static get Luminous() {
return new CustomEnchantment({
icon: "textures/items/luminous_siren_hook",
id: "Luminous",
itemID: MyCustomItemTypes.LuminousHook,
name: "Luminous Hook",
description: "yn:fishing_got_reel.enchantments.luminous.description",
lore: "yn:fishing_got_reel.enchantments.luminous.lore",
level: 1,
maxUsage: 54,
});
}
static get Pyroclasm() {
return new CustomEnchantment({
icon: "textures/items/pyroclasm_hook",
id: "Pyroclasm",
itemID: MyCustomItemTypes.PyroclasmHook,
name: "Pyroclasm Hook",
description: "yn:fishing_got_reel.enchantments.pyroclasm.description",
lore: "yn:fishing_got_reel.enchantments.pyroclasm.lore",
level: 1,
maxUsage: 45,
conflicts: ["Nautilus Hook"],
});
}
static get Tempus() {
return new CustomEnchantment({
icon: "textures/items/tempus_hook",
id: "Tempus",
itemID: MyCustomItemTypes.TempusHook,
name: "Tempus Hook",
description: "yn:fishing_got_reel.enchantments.tempus.description",
lore: "yn:fishing_got_reel.enchantments.tempus.lore",
level: 1,
maxUsage: 92,
});
}
static get FermentedEye() {
return new CustomEnchantment({
icon: "textures/items/fermented_spider_eye_hook",
id: "FermentedEye",
itemID: MyCustomItemTypes.FermentedSpiderEyeHook,
name: "Fermented Hook",
description: "yn:fishing_got_reel.enchantments.fermentedeye.description",
lore: "yn:fishing_got_reel.enchantments.fermentedeye.lore",
level: 1,
maxUsage: 60,
conflicts: ["Nautilus Hook"],
});
}
}
import { FishingCustomEnchantmentType } from "./available_custom_enchantments";
export class CustomEnchantmentTypes {
static get(customEnchantmentType) {
const allAvailableCustomEnchantments = this.CachedAvailableEnchantments.length ? this.CachedAvailableEnchantments : this.getAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import { clientConfiguration } from "./client_configuration";
import { FishingOutputBuilder } from "fishing_system/outputs/output_builder";
import { SendMessageTo } from "utils/index";
import { resetServerConfiguration, serverConfigurationCopy, setServerConfiguration } from "./server_configuration";
import { CustomEnchantmentTypes, FishingCustomEnchantmentType } from "custom_enchantment/custom_enchantment_types";
import { CustomEnchantmentTypes } from "custom_enchantment/custom_enchantment_types";
import { CustomEnchantment } from "custom_enchantment/custom_enchantment";
import { MinecraftItemTypes } from "vanilla-types/index";
import { MyCustomItemTypes } from "fishing_system/items/custom_items";
import { FishingCustomEnchantmentType } from "custom_enchantment/available_custom_enchantments";
export class Configuration {
constructor(player) {
this.player = player;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ export const serverConfiguration = {
/**
* Enables debug messages to content logs.
*/
debug: new FormBuilder("Debug Mode").createToggle(false),
debug: new FormBuilder("Debug Mode").createToggle(true),
};

export let serverConfigurationCopy = cloneConfiguration(serverConfiguration);
export let setServerConfiguration = (newServerConfig) => serverConfigurationCopy = newServerConfig;
export let resetServerConfiguration = () => serverConfigurationCopy = cloneConfiguration(serverConfiguration);

// version (do not change)
export const VERSION = "1.0.1";
export const VERSION = "1.1.0";
Loading

0 comments on commit 34d1d50

Please sign in to comment.