Skip to content

Commit

Permalink
feat: new loot entity, mineshaft bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
leaftail1880 committed Jul 26, 2024
1 parent 3afdeed commit feb1eb9
Show file tree
Hide file tree
Showing 28 changed files with 500 additions and 354 deletions.
100 changes: 0 additions & 100 deletions entities/hopper_minecart.json

This file was deleted.

72 changes: 72 additions & 0 deletions entities/lw.loot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"format_version": "1.16.0",
"minecraft:entity": {
"description": {
"identifier": "lw:loot",
"is_spawnable": false,
"is_summonable": true,
"is_experimental": false
},

"component_groups": {
"small": {
"minecraft:inventory": {
"container_type": "inventory",
"inventory_size": 27
}
},
"kill": {
"minecraft:instant_despawn": {}
}
},
"components": {
"minecraft:inventory": {
"container_type": "inventory",
"inventory_size": 54
},
"minecraft:nameable": {
"allow_name_tag_renaming": true,
"always_show": true
},

"minecraft:type_family": {
"family": ["minecart", "inanimate"]
},
"minecraft:collision_box": {
"width": 0.8,
"height": 0.8
},

"minecraft:pushable": {
"is_pushable": false,
"is_pushable_by_piston": false
},
"minecraft:health": {
"value": 1,
"max": 1,
"min": 1
},

"minecraft:knockback_resistance": {
"value": 100,
"max": 100
},

"minecraft:is_stackable": {},
"minecraft:physics": {}
},

"events": {
"loot:small": {
"add": {
"component_groups": ["small"]
}
},
"loot:kill": {
"add": {
"component_groups": ["kill"]
}
}
}
}
}
32 changes: 32 additions & 0 deletions entities/player.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,33 @@
]
}
},
"safezone": {
"minecraft:spell_effects": {
"add_effects": [
{
"effect": "weakness",
"duration": 2,
"amplifier": 255,
"visible": false,
"display_on_screen_animation": false
},
{
"effect": "resistance",
"duration": 2,
"amplifier": 255,
"visible": false,
"display_on_screen_animation": true
},
{
"effect": "fire_resistance",
"duration": 2,
"amplifier": 255,
"visible": false,
"display_on_screen_animation": false
}
]
}
},
"warn": {
"minecraft:spell_effects": {
"add_effects": [
Expand Down Expand Up @@ -330,6 +357,11 @@
"component_groups": ["spawn"]
}
},
"player:safezone": {
"add": {
"component_groups": ["safezone"]
}
},
"player:not_in_spawn": {
"add": {
"component_groups": ["notspawn"]
Expand Down
1 change: 1 addition & 0 deletions src/lib/assets/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export enum CustomEntityTypes {
Database = 'rubedo:database',
Sit = 'sm:sit',
FloatingText = 'f:t',
Loot = 'lw:loot',
}

export enum CustomStructures {
Expand Down
32 changes: 32 additions & 0 deletions src/lib/assets/player-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,33 @@ export const playerJson = {
]
}
},
"safezone": {
"minecraft:spell_effects": {
"add_effects": [
{
"effect": "weakness",
"duration": 2,
"amplifier": 255,
"visible": false,
"display_on_screen_animation": false
},
{
"effect": "resistance",
"duration": 2,
"amplifier": 255,
"visible": false,
"display_on_screen_animation": true
},
{
"effect": "fire_resistance",
"duration": 2,
"amplifier": 255,
"visible": false,
"display_on_screen_animation": false
}
]
}
},
"warn": {
"minecraft:spell_effects": {
"add_effects": [
Expand Down Expand Up @@ -335,6 +362,11 @@ export const playerJson = {
"component_groups": ["spawn"]
}
},
"player:safezone": {
"add": {
"component_groups": ["safezone"]
}
},
"player:not_in_spawn": {
"add": {
"component_groups": ["notspawn"]
Expand Down
2 changes: 2 additions & 0 deletions src/lib/assets/player-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ import { playerJson } from './player-json'
export const PlayerProperties = Object.fromEntries(
Object.keys(playerJson['minecraft:entity'].description.properties).map(e => [e, e]),
)

export const PlayerEvents = Object.fromEntries(Object.keys(playerJson['minecraft:entity'].events).map(e => [e, e]))
2 changes: 1 addition & 1 deletion src/lib/assets/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ export const text: Record<string, (...args: (string | number)[]) => string> = {
§8-----------------------------`,
}

export const developerKnow = `Разработчики уже оповещены о проблеме и работают над ее исправлением.`
export const developersAreWarned = `Разработчики уже оповещены о проблеме и работают над ее исправлением.`
4 changes: 2 additions & 2 deletions src/lib/command/utils.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ChatSendAfterEvent, Player } from '@minecraft/server'
import { Sounds } from 'lib/assets/config'
import { developersAreWarned } from 'lib/assets/text'
import { ROLES } from 'lib/roles'
import { t } from 'lib/text'
import { inaccurateSearch } from '../search'
import { LiteralArgumentType, LocationArgumentType } from './argument-types'
import { CommandContext } from './context'
import { developerKnow } from 'lib/assets/text'

export function parseCommand(message: string, prefixSize = 1) {
const command = message.slice(prefixSize).trim()
Expand Down Expand Up @@ -199,7 +199,7 @@ export function sendCallback(
...argsToReturn,
) as Promise<void> | void)
} catch (e) {
event.sender.warn(`При выполнении команды произошла ошибка. ${developerKnow}`)
event.sender.warn(`При выполнении команды произошла ошибка. ${developersAreWarned}`)
console.error(e)
}
})()
Expand Down
10 changes: 8 additions & 2 deletions src/lib/quest/step.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Player } from '@minecraft/server'
import { EventSignal, Vector } from 'lib'
import { developersAreWarned } from 'lib/assets/text'
import { Compass } from 'lib/rpg/menu'
import { Temporary } from 'lib/temporary'
import { PlayerQuest } from './player'
Expand Down Expand Up @@ -99,8 +100,13 @@ export abstract class QS<DB = any> extends Temporary {
if (cleanup) this.cleaners.push(cleanup.cleanup)

this.activators.forEach(activate => {
const result = activate(this, firstTime)
if (result) this.cleaners.push(result.cleanup)
try {
const result = activate(this, firstTime)
if (result) this.cleaners.push(result.cleanup)
} catch (e) {
this.error(`При активации шага произошла ошибка. ${developersAreWarned}`)
throw e
}
})
}

Expand Down
Loading

0 comments on commit feb1eb9

Please sign in to comment.