{0}
{1}
dialog.preferences.entry_description={0}\:
{1}
@@ -533,14 +533,14 @@ dialog.update_notify.more_recent_build=有一個針對 {0}
dialog.update_notify.error_failed_check_internet_message=無法檢查更新。 原因\:沒有網路
dialog.update_notify.error_failed_check_internet_title=沒有網路連線
dialog.update_notify.no_update_message=你已安裝了最新版 MCreator!
-dialog.update_notify.no_pluin_update_message=目前沒有可用的插件更新!
+dialog.update_notify.no_pluin_update_message=目前沒有可用的外掛程式更新!
dialog.update_notify.no_update_title=沒有更新
dialog.update_notify.open_download_page=開啟下載頁面
dialog.update_notify.remind_later=稍後提醒我
-dialog.plugin_update_notify.message=MCreator 檢測到以下插件可更新\:
-dialog.plugin_update_notify.update=更新插件
+dialog.plugin_update_notify.message=MCreator 檢測到以下外掛程式可更新\:
+dialog.plugin_update_notify.update=更新外掛程式
dialog.plugin_update_notify.close=關閉此視窗
-dialog.plugin_update_notify.update_title=插件更新
+dialog.plugin_update_notify.update_title=外掛程式更新
dialog.plugin_update_notify.version_message={0}
目前安裝的版本\:{1},新版本\:{2}
dialog.plugin_update_notify.changes_message=最新版本中的變更\:
dialog.setup_workspace.title=對選定的生成器設定工作空間
@@ -786,6 +786,8 @@ blockly.category.heightplacements=高度位置
blockly.category.orefeatures=礦石地物
blockly.category.placements=常見位置
blockly.category.treefeatures=树木地物
+blockly.category.trees=樹
+blockly.category.treedecorators=根與裝飾
blockly.category.arg_types=引數
blockly.category.actions=操作
blockly.block.action_result_type=類型 %1 的操作結果
@@ -905,7 +907,6 @@ blockly.block.entity_data_integer_get=對於類型 %2 的自訂實體 %1 取得
blockly.block.entity_data_integer_set=對於類型 %2 的自訂實體 %1 將對應整數資料 %3 的值設為 %4
blockly.block.entity_data_string_get=對於類型 %2 的自訂實體 %1 取得對應字串資料 %3 的值
blockly.block.entity_data_string_set=對於類型 %2 的自訂實體 %1 將對應字串資料 %3 的值設為 %4
-blockly.block.entity_deal_custom_damage=對 %2 造成 %1 點傷害,其鍵名為 death.attack.%3(.player/.item)
blockly.block.entity_despawn=清除 %1 %2
blockly.block.entity_dimension_id=所在的維度 %1 的 ID
blockly.block.entity_direction=以 %1 的南方向(yaw)為準的角度大小
@@ -1512,7 +1513,7 @@ dialog.workspace.export_deobf.title=匯出反混淆的模組
dialog.workspace.export_deobf.message=反混淆後的模組不能在標準安裝下的Minecraft中使用。
僅在有充分理由使用此選項時才使用此選項。
確定要使用此選項嗎?
dialog.workspace.export.option.donate_and_export=捐贈並匯出模組
dialog.workspace.export.option.just_export=匯出模組而不捐贈
-dialog.workspace.export.error.message=你的工作空間包含無法編譯且無法匯出的模組元素。
未生成任何模組檔案。
+dialog.workspace.export.error.message=無法匯出工作空間。
沒有模組檔案生成。
dialog.workspace.export.error.title=匯出失敗
action.workspace.import_from_zip=將工作空間ZIP檔案匯入此工作空間...
action.workspace.new=新增工作空間…
@@ -1710,8 +1711,8 @@ preferences.notifications.checkAndNotifyForPatches=在 MCreator 啟動時通知
preferences.notifications.checkAndNotifyForPatches.description=如果你不希望收到修補程式(小更新) 更新的通知,請取消勾選此框。
注意\: 即使你取消勾選該核取方塊,如果發現了可用的更新,在 MCreator 啟動時仍會有小通知。
preferences.notifications.showWebsiteNewsNotifications=啟動時顯示官網新聞通知
preferences.notifications.showWebsiteNewsNotifications.description=啟用該項時,工作空間選擇器將在 MCreator 啟動時顯示官網新聞的通知。
-preferences.notifications.checkAndNotifyForPluginUpdates=通知社群插件更新
-preferences.notifications.checkAndNotifyForPluginUpdates.description=如果你不想收到第三方插件更新的通知,請取消勾選此项。
注意\:如果第三方插件更新伺服器出現故障或速度緩慢,此選項可能會減慢 MCreator 的啟動速度,而且此選項允許
我們無法控制的第三方插件在 MCreator 啟動期間訪問其更新伺服器。
+preferences.notifications.checkAndNotifyForPluginUpdates=通知社群外掛程式更新
+preferences.notifications.checkAndNotifyForPluginUpdates.description=如果你不想收到第三方外掛程式更新的通知,請取消勾選此项。
注意\:如果第三方外掛程式更新伺服器出現故障或速度緩慢,此選項可能會減慢 MCreator 的啟動速度,而且此選項允許
我們無法控制的第三方外掛程式在 MCreator 啟動期間訪問其更新伺服器。
preferences.themes.select_theme=選擇要使用的主題
preferences.themes.select_theme.description=該主題包含 MCreator 所使用的資源。
dialog.workspace.regenerate_and_build.title=重新生成程式碼並建置
@@ -1782,8 +1783,9 @@ dialog.workspace.is_not_valid_message=工作空間開啟失敗!該工作空間使用不支援的生成器類型\:{0}
為該工作空間選擇一個支援的生成器。
dialog.workspace.unknown_generator_title=不支援的生成器
+dialog.workspace.missing_plugins_title=缺少外掛程式
action.check_for_updates=檢查更新
-action.check_for_plugin_updates=檢查插件更新
+action.check_for_plugin_updates=檢查外掛程式更新
action.open_java_edition_dir=開啟Java版安裝路徑
dialog.open_java_edition_dir.fail.message=無法開啟Java版安裝路徑!
dialog.open_java_edition_dir.fail.title=路徑開啟失敗
@@ -2795,8 +2797,8 @@ dialog.workspace_settings.picture=模組圖示/圖片\:
在“
dialog.workspace_settings.credits.error=鳴謝不能以包含引號
dialog.workspace_settings.section.external_apis=外部 API 支援
dialog.workspace_settings.section.external_apis.tooltip=勾選此核取方塊以添加對所支援的第三方 API 的支援和依賴項
警告\: 如果你的模組使用了第三方 API,一旦你匯出它,沒有它們就無法執行。
-dialog.workspace_settings.explore_plugins=探索插件
-dialog.workspace_settings.plugins_tip=尋找更多 API?請看看 MCreator 插件。
+dialog.workspace_settings.explore_plugins=探索外掛程式
+dialog.workspace_settings.plugins_tip=尋找更多 API?請看看 MCreator 外掛程式。
dialog.workspace_settings.version_check=Forge 版本檢查
dialog.workspace_settings.section.version_check=是否停用 Minecraft Forge 版本檢查?
如果要確保用戶使用正確的 Minecraft Forge 版本,請
取消勾選並啟用 Minecraft Forge 版本檢查。
dialog.workspace_settings.section.advanced=進階設定
@@ -2809,13 +2811,13 @@ dialog.workspace_settings.dependants=其它依賴项\:
使用逗
dialog.workspace_settings.error_list=工作空間設定存在以下問題\:
dialog.workspace_settings.dialog.error.title=無效的工作空間設定
dialog.workspace_settings.dialog.error=錯誤在窗口上用紅色和錯誤圖示標記,因此你可以根據此處的註釋找到它們並進行修復。
-dialog.new_workspace.spigot.display_name=插件顯示名稱\:
僅用於MCreator
-dialog.new_workspace.spigot.plugin_name=插件名稱\:
用於插件識別
+dialog.new_workspace.spigot.display_name=外掛程式顯示名稱\:
僅用於MCreator
+dialog.new_workspace.spigot.plugin_name=外掛程式名稱\:
用於外掛程式識別
dialog.new_workspace.spigot.generator=Minecraft版本(生成器)\:
目標Java版版本
-dialog.new_workspace.spigot.package=插件 Java 包名稱\:
用於程式碼生成器的根
+dialog.new_workspace.spigot.package=外掛程式 Java 包名稱\:
用於程式碼生成器的根
dialog.new_workspace.spigot.folder=工作空間檔案夾\:
-dialog.new_workspace.spigot.notice=Spigot插件是基於Java伺服器端的插件,可在Minecraft Java版本上執行,
並且需要安裝Spigot伺服器API,但不需要對客戶端進行任何特殊修改。
-dialog.new_workspace.spigot.toggle=\ Spigot 伺服器插件
+dialog.new_workspace.spigot.notice=Spigot外掛程式是基於Java伺服器端的外掛程式,可在Minecraft Java版本上執行,
並且需要安裝Spigot伺服器API,但不需要對客戶端進行任何特殊修改。
+dialog.new_workspace.spigot.toggle=\ Spigot 伺服器外掛程式
dialog.new_workspace.forge.display_name=模組顯示名稱\:
此名稱顯示在遊戲中
dialog.new_workspace.forge.modid=模組 ID / 名稱空間\:
用於模組識別
dialog.new_workspace.forge.generator=Minecraft 版本(生成器)\:
目標 Java 版版本
@@ -2857,9 +2859,9 @@ dialog.new_workspace.datapack.generator=Minecraft版本 (生成器)\:<
dialog.new_workspace.datapack.folder=工作空間檔案夾\:
dialog.new_workspace.datapack.notice=Minecraft資料包是可在Minecraft Java 版上執行且無需安裝任何
附加軟體或模組載入器(modloader),但功能有限。
dialog.new_workspace.datapack.toggle=\ Minecraft 資料包
-dialog.new_workspace.disabled.tooltip=你需要安裝至少一個支援此生成器類型的插件。
-dialog.new_workspace.dialog_plugin_needed.title=需要插件
-dialog.new_workspace.dialog_plugin_needed.text=當前未安裝支援此生成器類型的插件。
你是否要瀏覽 MCreator 的插件庫以取得插件?
+dialog.new_workspace.disabled.tooltip=你需要安裝至少一個支援此生成器類型的外掛程式。
+dialog.new_workspace.dialog_plugin_needed.title=需要外掛程式
+dialog.new_workspace.dialog_plugin_needed.text=當前未安裝支援此生成器類型的外掛程式。
你是否要瀏覽 MCreator 的外掛程式庫以取得外掛程式?
dialog.new_workspace.error_list=你的工作空間設定存在以下問題\:
dialog.new_workspace.main_title_html=建立新的工作空間
再下方輸入工作空間詳細資訊
elementgui.particle.animated_frame_duration=動態紋理幀持續時間(以遊戲刻為單位)\:
@@ -3274,14 +3276,14 @@ dialog.bedrock.failed.title=執行客戶端失敗
dialog.bedrock.unsupported=你似乎未从商店安裝基岩版。
dialog.bedrock.unsupported.windows=基岩版目前僅在 Windows 10+ 上支援
dialog.bedrock.unsupported.title=不支援執行客戶端
-dialog.plugin_load_failed.msg1=一些插件載入失敗\:
-dialog.plugin_load_failed.msg2=部分功能可能無法正常工作。請檢查 MCreator 日志檔案以取得詳細訊息。
我們建議聯係插件作者以取得更多訊息和支援。
-dialog.plugin_load_failed.title=一些插件載入失敗
-notification.plugin_load_failed.msg=下列插件載入失敗\:
+dialog.plugin_load_failed.msg1=一些外掛程式載入失敗\:
+dialog.plugin_load_failed.msg2=部分功能可能無法正常工作。請檢查 MCreator 日志檔案以取得詳細訊息。
我們建議聯係外掛程式作者以取得更多訊息和支援。
+dialog.plugin_load_failed.title=一些外掛程式載入失敗
+notification.plugin_load_failed.msg=下列外掛程式載入失敗\:
notification.common.more_info=更多資訊
notification.update_available.msg=MCreator 有新版本可用。
已安裝版本\: {0}
新版本\: {1}
notification.patch_available.msg=有新版本 {0} 可用。
已安裝版本\: {0}.{1}
新版本\: {0}.{2}
-notification.plugin_updates.msg=有可用的插件更新
+notification.plugin_updates.msg=有可用的外掛程式更新
notification.news.title=來自官網的新聞\:{0}
notification.news.read_more=瞭解更多
notification.news.hide=隱藏此通知
diff --git a/src/main/java/net/mcreator/blockly/datapack/BlocklyToJSONTrigger.java b/src/main/java/net/mcreator/blockly/datapack/BlocklyToJSONTrigger.java
index 80615290853..7b88caaf621 100644
--- a/src/main/java/net/mcreator/blockly/datapack/BlocklyToJSONTrigger.java
+++ b/src/main/java/net/mcreator/blockly/datapack/BlocklyToJSONTrigger.java
@@ -34,23 +34,19 @@
import org.apache.logging.log4j.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathFactory;
import java.io.StringReader;
-import java.util.Collections;
+import java.text.ParseException;
import java.util.List;
public class BlocklyToJSONTrigger extends BlocklyToCode {
private static final Logger LOG = LogManager.getLogger("Blockly2JSONTrigger");
- private boolean hasTrigger;
+ private boolean hasTrigger = false;
public BlocklyToJSONTrigger(Workspace workspace, ModElement parent, String sourceXML,
TemplateGenerator templateGenerator, IBlockGenerator... externalGenerators)
@@ -67,32 +63,15 @@ public BlocklyToJSONTrigger(Workspace workspace, ModElement parent, String sourc
Document doc = dBuilder.parse(new InputSource(new StringReader(sourceXML)));
doc.getDocumentElement().normalize();
- XPathFactory xpathFactory = XPathFactory.newInstance();
- XPath xpath = xpathFactory.newXPath();
+ Element start_block = BlocklyBlockUtil.getStartBlock(doc, editorType.startBlockName());
- NodeList blocks = (NodeList) xpath.evaluate("block", doc.getDocumentElement(), XPathConstants.NODESET);
+ // if there is no start block, we return empty string
+ if (start_block == null)
+ throw new ParseException("Could not find start block!", -1);
- hasTrigger = false;
-
- Element start_block = null;
- for (int i = 0; i < blocks.getLength(); i++) {
- Element start_block_candidate = (Element) blocks.item(i);
-
- List children = BlocklyBlockUtil.getBlockProcedureStartingWithNext(start_block_candidate);
- if (children.size() == 1) {
- if (children.get(0).getAttribute("type").equals(editorType.startBlockName())) {
- start_block = start_block_candidate;
- }
- }
- }
-
- if (start_block != null) {
- String type = start_block.getAttribute("type");
- if (!type.equals(editorType.startBlockName())) {
- hasTrigger = true;
- processBlockProcedure(Collections.singletonList(start_block));
- }
- }
+ List base_blocks = BlocklyBlockUtil.getBlockProcedureStartingWithNext(start_block);
+ hasTrigger = !base_blocks.isEmpty();
+ processBlockProcedure(base_blocks);
} catch (TemplateGeneratorException e) {
throw e;
} catch (Exception e) {
diff --git a/src/main/java/net/mcreator/element/GeneratableElement.java b/src/main/java/net/mcreator/element/GeneratableElement.java
index bbd61efee8c..d98de237dc0 100644
--- a/src/main/java/net/mcreator/element/GeneratableElement.java
+++ b/src/main/java/net/mcreator/element/GeneratableElement.java
@@ -42,7 +42,7 @@
public abstract class GeneratableElement {
- public static final int formatVersion = 58;
+ public static final int formatVersion = 59;
private static final Logger LOG = LogManager.getLogger("Generatable Element");
diff --git a/src/main/java/net/mcreator/element/converter/ConverterRegistry.java b/src/main/java/net/mcreator/element/converter/ConverterRegistry.java
index 98a7f01e838..2ebcb72768a 100644
--- a/src/main/java/net/mcreator/element/converter/ConverterRegistry.java
+++ b/src/main/java/net/mcreator/element/converter/ConverterRegistry.java
@@ -47,6 +47,7 @@
import net.mcreator.element.converter.v2023_2.PaintingFieldsFixer;
import net.mcreator.element.converter.v2023_3.*;
import net.mcreator.element.converter.v2023_4.*;
+import net.mcreator.element.converter.v2024_1.AdvancementTriggerInverter;
import net.mcreator.element.converter.v2024_1.ProcedureCustomDamageRemover;
import java.util.HashMap;
@@ -60,7 +61,8 @@ public class ConverterRegistry {
private static final Map, List> converters = new HashMap<>() {{
put(ModElementType.ADVANCEMENT, List.of(
new AchievementFixer(),
- new AdvancementTextureConverter()
+ new AdvancementTextureConverter(),
+ new AdvancementTriggerInverter()
));
put(ModElementType.ARMOR, List.of(
new ArmorTexturesConverter(),
diff --git a/src/main/java/net/mcreator/element/converter/v2020_1/AchievementFixer.java b/src/main/java/net/mcreator/element/converter/v2020_1/AchievementFixer.java
index 1b04d6beb07..29a4c4f58eb 100644
--- a/src/main/java/net/mcreator/element/converter/v2020_1/AchievementFixer.java
+++ b/src/main/java/net/mcreator/element/converter/v2020_1/AchievementFixer.java
@@ -32,8 +32,8 @@ public GeneratableElement convert(Workspace workspace, GeneratableElement input,
Achievement achievement = (Achievement) input;
achievement.showPopup = true;
achievement.announceToChat = true;
- achievement.triggerxml = ""
- + "";
+ achievement.triggerxml = ""
+ + "";
return achievement;
}
diff --git a/src/main/java/net/mcreator/element/converter/v2024_1/AdvancementTriggerInverter.java b/src/main/java/net/mcreator/element/converter/v2024_1/AdvancementTriggerInverter.java
new file mode 100644
index 00000000000..252d17008d7
--- /dev/null
+++ b/src/main/java/net/mcreator/element/converter/v2024_1/AdvancementTriggerInverter.java
@@ -0,0 +1,112 @@
+/*
+ * MCreator (https://mcreator.net/)
+ * Copyright (C) 2012-2020, Pylo
+ * Copyright (C) 2020-2023, Pylo, opensource contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package net.mcreator.element.converter.v2024_1;
+
+import com.google.gson.JsonElement;
+import net.mcreator.blockly.BlocklyBlockUtil;
+import net.mcreator.element.GeneratableElement;
+import net.mcreator.element.converter.IConverter;
+import net.mcreator.element.types.Achievement;
+import net.mcreator.ui.blockly.BlocklyEditorType;
+import net.mcreator.util.BlocklyHelper;
+import net.mcreator.util.XMLUtil;
+import net.mcreator.workspace.Workspace;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.List;
+
+public class AdvancementTriggerInverter implements IConverter {
+ private static final Logger LOG = LogManager.getLogger("AdvancementTriggerInverter");
+
+ @Override
+ public GeneratableElement convert(Workspace workspace, GeneratableElement input, JsonElement jsonElementInput) {
+ Achievement advancement = (Achievement) input;
+ try {
+ advancement.triggerxml = fixXML(advancement.triggerxml);
+ } catch (Exception e) {
+ LOG.warn("Failed to convert advancement " + input.getModElement().getName(), e);
+ }
+ return advancement;
+ }
+
+ @Override public int getVersionConvertingTo() {
+ return 59;
+ }
+
+ private String fixXML(String xml) throws Exception {
+ DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
+ Document doc = dBuilder.parse(new InputSource(new StringReader(xml)));
+ doc.getDocumentElement().normalize();
+ BlocklyHelper bh = new BlocklyHelper(doc);
+
+ XPathFactory xpathFactory = XPathFactory.newInstance();
+ XPath xpath = xpathFactory.newXPath();
+ NodeList blocks = (NodeList) xpath.evaluate("block", doc.getDocumentElement(), XPathConstants.NODESET);
+
+ Element trigger = null;
+ for (int i = 0; i < blocks.getLength(); i++) {
+ Element candidate = (Element) blocks.item(i);
+
+ List children = BlocklyBlockUtil.getBlockProcedureStartingWithNext(candidate);
+ if (children.size() == 1 && children.get(0).getAttribute("type")
+ .equals(BlocklyEditorType.JSON_TRIGGER.startBlockName())) {
+ trigger = candidate;
+ break;
+ }
+ }
+
+ Element start_block = bh.createBlock(BlocklyEditorType.JSON_TRIGGER.startBlockName());
+ start_block.setAttribute("deletable", "false");
+ start_block.setAttribute("x", "40");
+ start_block.setAttribute("y", "80");
+ Element next = doc.createElement("next");
+ if (trigger != null)
+ trigger.removeChild(XMLUtil.getFirstChildrenWithName(trigger, "next"));
+ else
+ trigger = bh.createBlock("custom_trigger");
+ next.appendChild(trigger);
+ start_block.appendChild(next);
+ doc.getDocumentElement().appendChild(start_block);
+
+ TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ Transformer transformer = transformerFactory.newTransformer();
+ StringWriter writer = new StringWriter();
+ transformer.transform(new DOMSource(doc), new StreamResult(writer));
+
+ return writer.getBuffer().toString();
+ }
+}
diff --git a/src/main/java/net/mcreator/element/types/Achievement.java b/src/main/java/net/mcreator/element/types/Achievement.java
index f49f6aa82af..cd6b3055677 100644
--- a/src/main/java/net/mcreator/element/types/Achievement.java
+++ b/src/main/java/net/mcreator/element/types/Achievement.java
@@ -102,7 +102,8 @@ public boolean hasRewards() {
String triggerCode = blocklyToJSONTrigger.getGeneratedCode();
if (triggerCode.isEmpty())
- triggerCode = "{\"trigger\": \"minecraft:impossible\"}";
+ triggerCode = "\"%s\": {\"trigger\": \"minecraft:impossible\"}".formatted(
+ getModElement().getRegistryName());
additionalData.put("triggercode", triggerCode);
additionalData.put("triggerblocks", blocklyToJSONTrigger.getUsedBlocks());
diff --git a/src/main/java/net/mcreator/generator/template/base/BaseDataModelProvider.java b/src/main/java/net/mcreator/generator/template/base/BaseDataModelProvider.java
index e445cd1efeb..64025a3b766 100644
--- a/src/main/java/net/mcreator/generator/template/base/BaseDataModelProvider.java
+++ b/src/main/java/net/mcreator/generator/template/base/BaseDataModelProvider.java
@@ -34,27 +34,32 @@ public class BaseDataModelProvider {
private static final Logger TEMPLATE_LOG = LogManager.getLogger("Template Generator LOG");
- private final Map providedData;
+ private final Map providedData = new HashMap<>();
+
+ private final Generator generator;
@SuppressWarnings("InstantiationOfUtilityClass") public BaseDataModelProvider(Generator generator) {
- Map providedDataBuilder = new HashMap<>();
- providedDataBuilder.put("generator", new GeneratorWrapper(generator));
- providedDataBuilder.put("w", generator.getWorkspace().getWorkspaceInfo());
- providedDataBuilder.put("modid", generator.getWorkspaceSettings().getModID());
- providedDataBuilder.put("JavaModName", generator.getWorkspaceSettings().getJavaModName());
- providedDataBuilder.put("package", generator.getWorkspaceSettings().getModElementsPackage());
- providedDataBuilder.put("settings", generator.getWorkspaceSettings());
- providedDataBuilder.put("fp", new FileProvider(generator));
- providedDataBuilder.put("mcc", generator.getMinecraftCodeProvider());
- providedDataBuilder.put("JavaConventions", new JavaConventions());
- providedDataBuilder.put("thelper", new TemplateHelper());
- providedDataBuilder.put("Log", TEMPLATE_LOG);
- providedDataBuilder.put("opt", new ProcedureCodeOptimizer());
- this.providedData = Collections.unmodifiableMap(providedDataBuilder);
+ this.generator = generator;
+
+ // Static helpers
+ providedData.put("Log", TEMPLATE_LOG);
+ providedData.put("thelper", new TemplateHelper());
+ providedData.put("opt", new ProcedureCodeOptimizer());
+ providedData.put("JavaConventions", new JavaConventions());
+
+ // Data that does not change for the current generator (BaseDataModelProvider is generator specific)
+ providedData.put("generator", new GeneratorWrapper(generator));
+ providedData.put("w", generator.getWorkspace().getWorkspaceInfo());
+ providedData.put("fp", new FileProvider(generator));
+ providedData.put("mcc", generator.getMinecraftCodeProvider());
}
public Map provide() {
- return providedData;
+ providedData.put("settings", generator.getWorkspaceSettings()); // workspaceSettings is not final!
+ providedData.put("modid", generator.getWorkspaceSettings().getModID());
+ providedData.put("JavaModName", generator.getWorkspaceSettings().getJavaModName());
+ providedData.put("package", generator.getWorkspaceSettings().getModElementsPackage());
+ return Collections.unmodifiableMap(providedData);
}
}
diff --git a/src/main/java/net/mcreator/ui/dialogs/workspace/AbstractWorkspacePanel.java b/src/main/java/net/mcreator/ui/dialogs/workspace/AbstractWorkspacePanel.java
index f4a4a821860..bd8842bb199 100644
--- a/src/main/java/net/mcreator/ui/dialogs/workspace/AbstractWorkspacePanel.java
+++ b/src/main/java/net/mcreator/ui/dialogs/workspace/AbstractWorkspacePanel.java
@@ -40,10 +40,10 @@
public abstract class AbstractWorkspacePanel extends JPanel {
- protected final WorkspaceDialogs.WorkspaceDialogPanel workspaceDialogPanel;
- protected final ValidationGroup validationGroup = new ValidationGroup();
- protected final VTextField workspaceFolder = new VTextField();
- protected final JButton selectWorkspaceFolder = new JButton("...");
+ final WorkspaceDialogs.WorkspaceDialogPanel workspaceDialogPanel;
+ final ValidationGroup validationGroup = new ValidationGroup();
+ final VTextField workspaceFolder = new VTextField();
+ final JButton selectWorkspaceFolder = new JButton("...");
private boolean workspaceFolderAltered = false;
diff --git a/src/main/java/net/mcreator/ui/dialogs/workspace/WorkspaceDialogs.java b/src/main/java/net/mcreator/ui/dialogs/workspace/WorkspaceDialogs.java
index 228887b8ac3..40507224522 100644
--- a/src/main/java/net/mcreator/ui/dialogs/workspace/WorkspaceDialogs.java
+++ b/src/main/java/net/mcreator/ui/dialogs/workspace/WorkspaceDialogs.java
@@ -152,7 +152,6 @@ static class WorkspaceDialogPanel extends JPanel {
JComboBox modPicture = new JComboBox<>();
JCheckBox lockBaseModFiles = L10N.checkbox("dialog.workspace_settings.lock_base_files");
JCheckBox serverSideOnly = L10N.checkbox("dialog.workspace_settings.server_side_mod");
- JCheckBox disableForgeVersionCheck = new JCheckBox();
JTextField updateJSON = new JTextField(24);
JStringListField requiredMods, dependencies, dependants;
@@ -350,8 +349,6 @@ public void replace(DocumentFilter.FilterBypass fb, int offset, int length, Stri
author.setText(System.getProperty("user.name") + ", MCreator");
version.setText("1.0.0");
- disableForgeVersionCheck.setSelected(true);
-
generator.setUI(new BasicComboBoxUI() {
@Override protected JButton createArrowButton() {
return new JButton() {
@@ -522,14 +519,6 @@ public void replace(DocumentFilter.FilterBypass fb, int offset, int length, Stri
_external_apis.add(apiSettings);
}
- JComponent forgeVersionCheckPan = PanelUtils.westAndEastElement(
- L10N.label("dialog.workspace_settings.section.version_check"), disableForgeVersionCheck);
- forgeVersionCheckPan.setBorder(
- BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.gray, 1),
- L10N.t("dialog.workspace_settings.version_check")));
- _advancedSettings.add(forgeVersionCheckPan);
- _advancedSettings.add(new JEmptyBox(5, 5));
-
JPanel advancedSettings = new JPanel(new GridLayout(3, 2, 5, 2));
advancedSettings.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.gray, 1),
L10N.t("dialog.workspace_settings.section.advanced")));
@@ -571,7 +560,6 @@ public void replace(DocumentFilter.FilterBypass fb, int offset, int length, Stri
workspace.getWorkspaceSettings().getModPicture());
serverSideOnly.setSelected(workspace.getWorkspaceSettings().isServerSideOnly());
lockBaseModFiles.setSelected(workspace.getWorkspaceSettings().isLockBaseModFiles());
- disableForgeVersionCheck.setSelected(workspace.getWorkspaceSettings().isDisableForgeVersionCheck());
updateJSON.setText(workspace.getWorkspaceSettings().getUpdateURL());
credits.setText(workspace.getWorkspaceSettings().getCredits());
packageName.setText(workspace.getWorkspaceSettings().getModElementsPackage());
@@ -608,7 +596,6 @@ public WorkspaceSettings getWorkspaceSettings(@Nullable Workspace workspace) {
retVal.setModElementsPackage(packageName.getText().isEmpty() ? null : packageName.getText());
retVal.setServerSideOnly(serverSideOnly.isSelected());
retVal.setLockBaseModFiles(lockBaseModFiles.isSelected());
- retVal.setDisableForgeVersionCheck(disableForgeVersionCheck.isSelected());
retVal.setUpdateURL(updateJSON.getText().isEmpty() ? null : updateJSON.getText());
retVal.setCurrentGenerator(
((GeneratorConfiguration) Objects.requireNonNull(generator.getSelectedItem())).getGeneratorName());
diff --git a/src/main/java/net/mcreator/ui/validation/validators/JavaMemberNameValidator.java b/src/main/java/net/mcreator/ui/validation/validators/JavaMemberNameValidator.java
index d973aa69098..338718f8bb9 100644
--- a/src/main/java/net/mcreator/ui/validation/validators/JavaMemberNameValidator.java
+++ b/src/main/java/net/mcreator/ui/validation/validators/JavaMemberNameValidator.java
@@ -91,7 +91,7 @@ public JavaMemberNameValidator(VTextField textField, boolean requireFirstLetterU
"Clock", "Shield", "Overworld", "Nether", "World", "Living", "Mob", "Monster", "Animal", "End",
"Stairs", "Slab", "Fence", "Wall", "Leaves", "TrapDoor", "Pane", "Door", "FenceGate", "Creature",
"Item", "Block", "BoneMeal", "Diamond", "Ore", "Gem", "Gold", "Iron", "Stack", "Emerald", "Entity",
- "Surface", "WoodButton", "StoneButton", "Flower", "Falling", "Furnace", "Bush", "Crop",
- "Structure"));
+ "Surface", "WoodButton", "StoneButton", "Flower", "Falling", "Furnace", "Bush", "Crop", "Structure",
+ "Blocks", "Items", "Biomes"));
}
diff --git a/src/main/java/net/mcreator/workspace/settings/WorkspaceSettings.java b/src/main/java/net/mcreator/workspace/settings/WorkspaceSettings.java
index 2b29f0d49ae..0cb57379cb0 100644
--- a/src/main/java/net/mcreator/workspace/settings/WorkspaceSettings.java
+++ b/src/main/java/net/mcreator/workspace/settings/WorkspaceSettings.java
@@ -43,7 +43,6 @@
private String websiteURL;
private String license;
- private boolean disableForgeVersionCheck = true;
private boolean serverSideOnly = false;
private String updateURL;
@@ -74,7 +73,6 @@ public WorkspaceSettings(WorkspaceSettings other) {
this.author = other.author;
this.license = other.license;
this.websiteURL = other.websiteURL;
- this.disableForgeVersionCheck = other.disableForgeVersionCheck;
this.serverSideOnly = other.serverSideOnly;
this.updateURL = other.updateURL;
this.modPicture = other.modPicture;
@@ -118,10 +116,6 @@ public void setWebsiteURL(String websiteURL) {
this.websiteURL = websiteURL;
}
- public void setDisableForgeVersionCheck(boolean disableForgeVersionCheck) {
- this.disableForgeVersionCheck = disableForgeVersionCheck;
- }
-
public void setServerSideOnly(boolean serverSideOnly) {
this.serverSideOnly = serverSideOnly;
}
@@ -232,10 +226,6 @@ public boolean isServerSideOnly() {
return serverSideOnly;
}
- public boolean isDisableForgeVersionCheck() {
- return disableForgeVersionCheck;
- }
-
public String getUpdateURL() {
return updateURL;
}
diff --git a/src/test/java/net/mcreator/integration/TestWorkspaceDataProvider.java b/src/test/java/net/mcreator/integration/TestWorkspaceDataProvider.java
index 0c81c8be590..7900cd641db 100644
--- a/src/test/java/net/mcreator/integration/TestWorkspaceDataProvider.java
+++ b/src/test/java/net/mcreator/integration/TestWorkspaceDataProvider.java
@@ -322,9 +322,9 @@ private static GeneratableElement getExampleFor(ModElement modElement, boolean u
achievement.rewardRecipes.add("ExampleRecipe1");
achievement.rewardRecipes.add("ExampleRecipe2");
}
- achievement.triggerxml =
- ""
- + "";
+ achievement.triggerxml = ""
+ + ""
+ + "";
return achievement;
} else if (ModElementType.BIOME.equals(modElement.getType())) {
Biome biome = new Biome(modElement);