From 1855a3ed752137ba47c92b68b367472b120b2b29 Mon Sep 17 00:00:00 2001 From: paul Date: Fri, 22 Sep 2023 15:21:56 +0800 Subject: [PATCH] V4: Bug Fixes & Improvements Fixed: Custom blocks can't be opened in caves. Improved: Dropped-type custom blocks can be created when there are no other items dropped within a 1-block range, instead of 5. Simplified: Removed the credit link display. --- easy_gui/__init__.py | 0 easy_gui/__main__.py | 4 +--- easy_gui/template/game/load.mcfunction | 2 +- easy_gui/template/game/made_by.mcfunction | 2 +- .../template/tile_dropped_item/try_spawn/check.mcfunction | 4 ++-- tutorial.md | 3 --- 6 files changed, 5 insertions(+), 10 deletions(-) create mode 100644 easy_gui/__init__.py diff --git a/easy_gui/__init__.py b/easy_gui/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/easy_gui/__main__.py b/easy_gui/__main__.py index ada9660..60c5a86 100644 --- a/easy_gui/__main__.py +++ b/easy_gui/__main__.py @@ -5,7 +5,7 @@ import json from zipfile import ZipFile from os import path -from . import Tag,Display +import Tag,Display def template(code: str, pattern: dict[str, int | str]) -> str: @@ -182,7 +182,6 @@ def codeGen(tile_id: str, slot: str | int, object: dict) -> tuple[str, str]: load_func = data.get('load', '') destroy_func = data.get('destroy', '') tick_func = data.get('tick', '') -website = data.get('website','') for slots, object in data['slot'].items(): slots = str(slots).split(',') for slot in slots: @@ -215,7 +214,6 @@ def codeGen(tile_id: str, slot: str | int, object: dict) -> tuple[str, str]: "id": tile_id, 'text': container_item.Name, 'itemtype': 'dropped_item' if itemtype=='drop' else 'spawn_egg', - 'website': website }), f'data/eg/functions/tile/{tile_id}/made_by.mcfunction') diff --git a/easy_gui/template/game/load.mcfunction b/easy_gui/template/game/load.mcfunction index a33dcd1..1848b66 100644 --- a/easy_gui/template/game/load.mcfunction +++ b/easy_gui/template/game/load.mcfunction @@ -1,4 +1,4 @@ scoreboard objectives add eg.n dummy scoreboard objectives add eg.temp dummy -tellraw @a ["The following blocks is made by ",{"text": "Easy GUI V3","color": "light_purple","clickEvent": {"action": "open_url","value": "https://github.com/paul90317/Minecraft-Easy-GUI"},"bold": true,"hoverEvent": {"action": "show_text","value": "GitHub"}}] +tellraw @a ["The following blocks is made by ",{"text": "Easy GUI","color": "light_purple","clickEvent": {"action": "open_url","value": "https://github.com/paul90317/Minecraft-Easy-GUI"},"bold": true,"hoverEvent": {"action": "show_text","value": "GitHub"}}] function #eg:made_by \ No newline at end of file diff --git a/easy_gui/template/game/made_by.mcfunction b/easy_gui/template/game/made_by.mcfunction index 7815df1..db37813 100644 --- a/easy_gui/template/game/made_by.mcfunction +++ b/easy_gui/template/game/made_by.mcfunction @@ -1 +1 @@ -tellraw @a [" - ",,{"text": " () ","color": "white"},{"text": "website","color": "blue","clickEvent": {"action": "open_url","value": ""},"hoverEvent": {"action": "show_text","value": "click"}}," ",{"text": "give","color": "yellow","hoverEvent": {"action": "show_text","value": "click"},"clickEvent": {"action": "run_command","value": "/function eg:tile//"}}] \ No newline at end of file +tellraw @a [" - ",,{"text": " () ","color": "white"}," ",{"text": "give","color": "yellow","hoverEvent": {"action": "show_text","value": "click"},"clickEvent": {"action": "run_command","value": "/function eg:tile//"}}] \ No newline at end of file diff --git a/easy_gui/template/tile_dropped_item/try_spawn/check.mcfunction b/easy_gui/template/tile_dropped_item/try_spawn/check.mcfunction index 02eaf1f..18d9f85 100644 --- a/easy_gui/template/tile_dropped_item/try_spawn/check.mcfunction +++ b/easy_gui/template/tile_dropped_item/try_spawn/check.mcfunction @@ -1,7 +1,7 @@ scoreboard players set @s eg.temp 0 -execute unless block ~ ~ ~ air run scoreboard players set @s eg.temp 1 +execute unless block ~ ~ ~ #eg:air run scoreboard players set @s eg.temp 1 scoreboard players set @s eg.n 0 -execute at @e[type=item, distance=..5] run scoreboard players add @s eg.n 1 +execute at @e[type=item, distance=..1] run scoreboard players add @s eg.n 1 scoreboard players set @s[scores={eg.n=2..}] eg.temp 1 execute if score @s eg.temp matches 1 run tag @s add egno execute if score @s eg.temp matches 0 run function eg:tile//try_spawn/load \ No newline at end of file diff --git a/tutorial.md b/tutorial.md index f9fc3f8..ad2d45e 100644 --- a/tutorial.md +++ b/tutorial.md @@ -14,13 +14,10 @@ item: HideFlags: 127 AttributeModifiers: [] CustomModelData: 54621503 - -website: https://modrinth.com/datapack/upgradable-backpack ``` * `id` is for tikc mcfunction to recongnize what GUI block it is. * `type` is `drop` or `spawn_egg`. `drop` means that it summon GUI item when you drop the block on the ground; `spawn_egg` means the item is a spawn_egg. * `item` is the item of the GUI block, it's in Minecraft item NBT format. The item also show at the buttom of the GUI block when it turn into the GUI block. You can make texture of it by adding `CustomModelData` tag. -* `website` is a link, it shows when the game loads. It very useful for users to credit on you. ## Events ```yaml load: 'say load'