diff --git a/README.md b/README.md
index 419aac0..2568325 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,6 @@
# Worlds Colliding - Core Mod
+[](https://www.curseforge.com/minecraft/mc-mods/worlds-colliding-mod)
+
Worlds Colliding is the core foundation of the modpack of the same name. This mod serves as the technical engine, adding specific mechanics essential to the modpack’s narrative and progression system.
__Key Features__ :
@@ -20,97 +22,8 @@ https://github.com/GCJOJO/WorldsColliding/issues
```./gradlew build```
3) Enjoy !
-__How to use the dialogue system__ :
-First create a resource pack using this folder structure
-```
- resourcepacks/
- my_resourcepack/
- assets/
- lang/
- en_us.json
- any other language files...
- dialogues.json
- pack.mcmeta
-```
-
-Inside dialogues.json define the different speakers that may speak in your dialogues.
-
-```jsonc
-{
- "speakers" : [
- // The speaker with id 0 is named Speaker 1 and its display color is white, this speaker doesn't play any sound when talking
- { "id" : 0, "name": "Speaker 1", "color": "FFFFFFFF", "sounds" : [] },
- // The speaker with id 1 is named Speaker 2 and its display color is red, this speaker plays the note block banjo sound when talking
- { "id" : 1, "name": "Speaker 2", "color": "FFFF0000", "sounds" : ["block.note_block.banjo"] },
- // The speaker with id 2 is named Speaker 3 and randomly plays the sounds of the xylophone, the flute, the basedrum and the sound of falling on a mud block
- { "id" : 2, "name": "Speaker 3", "color": "FFFFFFFF", "sounds" : ["block.note_block.xylophone", "block.note_block.flute", "block.note_block.basedrum", "block.mud.fall"] },
- //...
- ]
-}
-```
-
-Here is how you define a dialogue, there are multiple actions that can be defined as follows:
-```jsonc
-{
- "speakers" : [
- //...
- ],
- "dialogue_1" : [
- { "action" : "message", "speaker" : 0, "text" : "this action displays a message with speaker id 0"},
-
- { "action": "change_set", "set": "dialogue_2" },
-
- { "action": "choice", "option1": "Choose option 1 !", "action1": "action1_choosen", "save1": "option1", "option2": "Choose option 2 !", "action2": "action2_choosen", "save2": "option2" },
-
- // this actions displays a fading animation that takes 20 ticks and fades the screen from being visible to a white screen
- { "action": "fade", "from": "00000000", "to": "FFFFFFFF", "time": 20 },
-
- { "action": "wait", "time": 20 },
-
- // clears every actions,
- { "action": "clear" },
- //you may specify which action type to clear
- { "action": "clear", "cleared_action": "fade" },
-
- // displays an image on the screen, the width and height are the original size of the image, the image should be properly resized once shown to the player
- { "action": "image", "id": 0, "image": "my_resourcepack:textures/gui/my_cool_texture.png", "width": 64, "height": 64},
-
- // This actions move the image with id 0 with a duration of 80 ticks.
- // The image starts at a position of 10% of the screen and ends at 90% of the screen and blends from 0% transparency to 100%
- { "action": "move_image", "id": 0, "start_x": 10, "start_y": 10, "end_x": 90, "end_y": 90, "alpha_start": 0, "alpha_end": 255, "time": 80 }
-
- // This actions executes a command as the player reading the dialogue.
- // The text will be replaced by the player's name.
- { "action": "command", "command": "say hello from !" }
-
- // The command is execute as if the player typed it without needing permisions, you don't need to do /execute positioned as ... for any positioned command
- // You can simply do :
- { "action": "command", "command": "tp @s ~ ~10 ~" }
- ]
-}
-```
-When defining text such as message or speaker names, you may use localized keys and translate them inside of `en_us.json` or any other language files.
-
-You may display you dialogues using the following commands :
-``/dialogue set my_resourcepack:dialogue_1``
-``/dialogue play``
-
-__What are blocking and non-blocking actions ?__
-Blocking actions are considered as actions that blocks the current dialogue, when they end, they wait for user input instead of directly going to the next action.
-There can be only one Blocking Action at any point.
-
-Non-blocking actions do not wait user input before going to the next action.
-Non-blocking actions can be stacked on top of each others and stack on top of one Blocking Action and need to be cleared manually using the clear action.
-
-Here is a table of Blocking and Non-Blocking Actions
-
-| Blocking | Non-Blocking |
-|:---------------------:|:---------------------:|
-| MessageAction | FadeAction |
-| ChoiceAction | ImageAction |
-| WaitAction | NextAction |
-| ExecuteCommandAction | CreditAction |
-| | ClearAction |
-| | MoveImageAction |
-
+## Dialogue System
+The dialogue system has been moved to its own library [BlablaLib](https://github.com/GCJOJO/BlablaLib).
+
+-------------------------------------------------
_This project is currently in active development_
diff --git a/build.gradle b/build.gradle
index 2b96242..07164b4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -4,6 +4,11 @@ plugins {
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'org.spongepowered.mixin' version '0.7.+'
+ id 'architectury-plugin' version '3.4-SNAPSHOT'
+}
+
+architectury {
+ minecraft = project.minecraft_version
}
version = mod_version
@@ -115,17 +120,7 @@ sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
// Put repositories for dependencies here
// ForgeGradle automatically adds the Forge maven and Maven Central for you
-
- // If you have mod jar dependencies in ./libs, you can declare them as a repository like so.
- // See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
- flatDir {
- dir 'libs'
- }
- maven
- {
- url = uri("https://maven.bai.lol")
- }
-
+ mavenLocal()
maven {
name = 'GeckoLib'
@@ -136,11 +131,7 @@ repositories {
}
}
- dependencies {
- implementation fg.deobf("software.bernie.geckolib:geckolib-forge-${minecraft_version}:${geckolib_version}")
- implementation("com.eliotlash.mclib:mclib:20")
- }
-
+ maven { url 'https://jitpack.io' }
}
dependencies {
@@ -151,16 +142,12 @@ dependencies {
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
- // Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings
- // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
- // compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}")
- // compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}")
- // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")
+ implementation fg.deobf("software.bernie.geckolib:geckolib-forge-${minecraft_version}:${geckolib_version}")
+ implementation("com.eliotlash.mclib:mclib:20")
- // Example mod dependency using a mod jar from ./libs with a flat dir repository
- // This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
- // The group id is ignored when searching -- in this case, it is "blank"
- //implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
+ implementation fg.deobf("dev.architectury:architectury-forge:${architectury_api_version}")
+ implementation fg.deobf("com.github.GCJOJO.BlablaLib:blablalib-forge:${blablalib_version}")
+ //implementation fg.deobf("io.github.gcjojo.blablalib:blablalib-forge:${blablalib_version}")
// For more info:
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
@@ -178,6 +165,7 @@ tasks.named('processResources', ProcessResources).configure {
loader_version_range: loader_version_range,
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_authors: mod_authors, mod_description: mod_description,
+ blablalib_version_range: blablalib_version_range
]
inputs.properties replaceProperties
@@ -211,16 +199,7 @@ tasks.named('jar', Jar).configure {
// Example configuration to allow publishing using the maven-publish plugin
publishing {
- publications {
- register('mavenJava', MavenPublication) {
- artifact jar
- }
- }
- repositories {
- maven {
- url "file://${project.projectDir}/mcmodsrepo"
- }
- }
+
}
tasks.withType(JavaCompile).configureEach {
diff --git a/gradle.properties b/gradle.properties
index 2147373..e968192 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -3,7 +3,6 @@
org.gradle.jvmargs=-Xmx8G
org.gradle.daemon=false
-
## Environment Properties
# The Minecraft version must agree with the Forge version to get a valid artifact
@@ -18,6 +17,12 @@ forge_version=47.4.10
forge_version_range=[47,)
# The loader version range can only use the major version of Forge/FML as bounds
loader_version_range=[47,)
+
+architectury_api_version=9.2.14
+blablalib_version=1.0.4
+
+blablalib_version_range=[1.0.4,)
+
# The mapping channel to use for mappings.
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
@@ -48,7 +53,7 @@ mod_name=World's Colliding
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
-mod_version=1.1.6
+mod_version=1.2.0
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
diff --git a/settings.gradle b/settings.gradle
index e693003..608f44a 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -2,6 +2,7 @@ pluginManagement {
repositories {
gradlePluginPortal()
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
+ maven { url "https://maven.architectury.dev/" }
maven {
name = 'MinecraftForge'
url = 'https://maven.minecraftforge.net/'
diff --git a/src/main/java/fr/gcjojo/worldscolliding/ModEntry.java b/src/main/java/fr/gcjojo/worldscolliding/ModEntry.java
index 1df3a15..2862d74 100644
--- a/src/main/java/fr/gcjojo/worldscolliding/ModEntry.java
+++ b/src/main/java/fr/gcjojo/worldscolliding/ModEntry.java
@@ -7,6 +7,7 @@
import fr.gcjojo.worldscolliding.entity.AwakenedScourgeEntity;
import fr.gcjojo.worldscolliding.entity.ModEntities;
import fr.gcjojo.worldscolliding.entity.ScourgeEntity;
+import fr.gcjojo.worldscolliding.events.ModEvents;
import fr.gcjojo.worldscolliding.items.ModItems;
import fr.gcjojo.worldscolliding.network.ModNetwork;
import fr.gcjojo.worldscolliding.worldgen.dimension.ModDimensions;
@@ -62,6 +63,8 @@ public ModEntry(FMLJavaModLoadingContext context)
MinecraftForge.EVENT_BUS.register(this);
context.registerConfig(ModConfig.Type.COMMON, Config.SPEC);
+
+ ModEvents.registerBlablaLibEvents();
}
public static Logger getLogger() { return LOGGER; }
diff --git a/src/main/java/fr/gcjojo/worldscolliding/client/gui/DialogueScreen.java b/src/main/java/fr/gcjojo/worldscolliding/client/gui/DialogueScreen.java
deleted file mode 100644
index 88e9871..0000000
--- a/src/main/java/fr/gcjojo/worldscolliding/client/gui/DialogueScreen.java
+++ /dev/null
@@ -1,352 +0,0 @@
-package fr.gcjojo.worldscolliding.client.gui;
-
-import fr.gcjojo.worldscolliding.ModEntry;
-import com.google.gson.Gson;
-import com.google.gson.JsonObject;
-import fr.gcjojo.worldscolliding.dialogues.*;
-import fr.gcjojo.worldscolliding.network.ModNetwork;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.GuiGraphics;
-import net.minecraft.client.gui.components.Button;
-import net.minecraft.client.gui.screens.Screen;
-import net.minecraft.network.chat.Component;
-import net.minecraft.resources.ResourceLocation;
-import net.minecraft.util.FastColor;
-import net.minecraft.util.Mth;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-public class DialogueScreen extends Screen {
- private List dialogueActions;
- private int actionIndex = -1;
- private List dialogueSpeakers;
-
- private String currentSet;
-
- private final List currentActions = new ArrayList<>();
-
- private boolean advanceDialogueAtTickEnd = false;
- private String queuedNextSet = null;
-
- private float currentFadingTime = -1.0f;
- private static final float endFade = 7.5f;
-
- private boolean guiVisible = true;
-
- private final List buttons = new ArrayList<>();
-
- public DialogueScreen(String setName) {
- super(Component.literal("Dialogue"));
- this.currentSet = setName;
- var actions = loadSet(setName);
- if(actions == null || actions.isEmpty())
- {
- this.onClose();
- return;
- }
- this.dialogueActions = actions;
-
- var speakers = loadSpeakers(setName);
- if(speakers == null || speakers.isEmpty())
- {
- this.onClose();
- return;
- }
- this.dialogueSpeakers = speakers;
- }
-
- public DialogueScreen(String setName, List actions, List speakers) {
- super(Component.literal("Dialogue"));
- this.currentSet = setName;
- this.dialogueActions = actions;
- this.dialogueSpeakers = speakers;
- }
-
- @Override
- protected void init() {
- super.init();
- if(actionIndex == -1)
- advanceDialogue();
-
- buttons.forEach(this::addRenderableWidget);
- }
-
- public void drawButton(Button button)
- {
- this.addRenderableWidget(button);
- buttons.add(button);
- }
-
- public void handleChoiceSelection(String nextSet, String saveSet, String action) {
- ModNetwork.sendToServer(new ModNetwork.ChoiceSelectedPacket(nextSet, saveSet, action));
- if (action != null && action.startsWith("seal_")) {
- currentFadingTime = 0.0f;
- return;
- }
-
- changeSet(nextSet);
- }
-
- public void changeSet(String setName) {
- List newActions = loadSet(setName);
- if(newActions == null) {
- this.onClose();
- return;
- }
- List newSpeakers = loadSpeakers(setName);
- if(newSpeakers == null) {
- this.onClose();
- return;
- }
-
- currentSet = setName;
- actionIndex = -1;
- dialogueActions = newActions;
- dialogueSpeakers = newSpeakers;
- advanceDialogue();
- }
-
- public static List loadSet(String setPath) {
- try {
- String namespace = ModEntry.MODID;
- String setName = setPath;
- if(setPath.contains(":")) {
- namespace = setPath.split(":")[0];
- setName = setPath.split(":")[1];
- }
-
- ResourceLocation res = ResourceLocation.fromNamespaceAndPath(namespace, "dialogues.json");
- var resourceOpt = Minecraft.getInstance().getResourceManager().getResource(res);
- if (resourceOpt.isPresent()) {
- JsonObject root = new Gson().fromJson(new InputStreamReader(resourceOpt.get().open()), JsonObject.class);
- if (root.has(setName)) {
- List actions = new ArrayList<>();
- root.getAsJsonArray(setName).forEach(element -> {
- JsonObject obj = element.getAsJsonObject();
- if(!obj.has("action"))
- return;
-
- String action = obj.get("action").getAsString();
- switch(action)
- {
- case "clear" -> actions.add(new DialogueClear(obj));
- case "wait" -> actions.add(new DialogueWait(obj));
- case "choice" -> actions.add(new DialogueChoice(obj));
- case "change_set" -> actions.add(new DialogueNext(obj.get("set").getAsString()));
- case "fade" -> actions.add(new DialogueFading(obj));
- case "message" -> actions.add(new DialogueMessage(obj.get("speaker").getAsInt(), Component.translatable(obj.get("text").getAsString()).getString()));
- case "image" -> actions.add(new DialogueImage(obj));
- case "credit" -> actions.add(new DialogueCredit(obj));
- case "image_move" -> actions.add(new DialogueMoveImage(obj));
- case "command" -> actions.add(new DialogueExecuteCommand(obj));
- default -> actions.add(new DialogueRawAction(obj));
- }
-
- });
- return actions;
- }
- }
- } catch (Exception e) {
- ModEntry.getLogger().error(e.getMessage());
- Arrays.stream(e.getStackTrace()).forEach(stackTraceElement -> ModEntry.getLogger().error(stackTraceElement.toString()));
- return null;
- }
- return null;
- }
-
- public static List loadSpeakers(String setPath){
- try {
- String namespace = ModEntry.MODID;
- if (setPath.contains(":"))
- namespace = setPath.split(":")[0];
-
- ResourceLocation res = ResourceLocation.fromNamespaceAndPath(namespace, "dialogues.json");
- var resourceOpt = Minecraft.getInstance().getResourceManager().getResource(res);
- if (resourceOpt.isPresent()) {
- JsonObject root = new Gson().fromJson(new InputStreamReader(resourceOpt.get().open()), JsonObject.class);
- List speakers = new ArrayList<>();
- if(!root.has("speakers"))
- return speakers;
-
- root.getAsJsonArray("speakers").forEach(element -> {
- JsonObject obj = element.getAsJsonObject();
- speakers.add(new DialogueSpeaker(obj));
- });
-
- return speakers;
- }
- } catch (Exception e) {
- ModEntry.getLogger().warn("Oopsie cannot load speakers !");
- }
-
- return null;
- }
-
- public static void openForSet(String setName) {
- List actions = loadSet(setName);
- List speakers = loadSpeakers(setName);
- if(actions != null && !actions.isEmpty() && speakers != null)
- Minecraft.getInstance().tell(() -> Minecraft.getInstance().setScreen(new DialogueScreen(setName, actions, speakers)));
- }
-
- @Override
- public void tick() {
- if(actionIndex >= dialogueActions.size())
- return;
-
- currentActions.forEach(DialogueAction::step);
-
- if(advanceDialogueAtTickEnd) {
- this.advanceDialogueAtTickEnd = false;
- this.advanceDialogue();
- }
-
- if(queuedNextSet != null){
- changeSet(queuedNextSet);
- queuedNextSet = null;
- }
- }
-
- @Override
- public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
- if(this.currentFadingTime >= 0.0){
- if(this.currentFadingTime >= endFade || !this.guiVisible){
- this.onClose();
- return;
- }
-
- float fadePercentage = currentFadingTime / endFade;
-
- int topColor = Mth.lerpInt(fadePercentage, 0x11, 0x00);
- int bottomColor = Mth.lerpInt(fadePercentage, 0xDD, 0x00);
- int topPoint = Mth.lerpInt(fadePercentage, 0, (int)(this.height * 0.5));
-
- graphics.fillGradient(0, topPoint, this.width, this.height,
- FastColor.ARGB32.color(topColor, 0, 0, 0), FastColor.ARGB32.color(bottomColor, 0, 0, 0));
- currentFadingTime += partialTick;
- return;
- }
-
- if(actionIndex >= dialogueActions.size())
- return;
- if(guiVisible)
- graphics.fillGradient(0, 0, this.width, this.height, 0x11000000, 0xDD000000);
-
- currentActions.forEach(action -> action.draw(graphics, mouseX, mouseY, partialTick));
- super.render(graphics, mouseX, mouseY, partialTick);
- }
-
- @Override
- public boolean mouseClicked(double mouseX, double mouseY, int button) {
- if(actionIndex < dialogueActions.size()) {
- currentActions.forEach(dialogueAction -> dialogueAction.mouseClicked(mouseX, mouseY, button));
- }
- return super.mouseClicked(mouseX, mouseY, button);
- }
-
- @Override
- public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
- if(keyCode == 256) {
- skipDialogue();
- return true;
- }
-
- if(actionIndex < dialogueActions.size()) {
- currentActions.forEach(dialogueAction -> dialogueAction.keyPressed(keyCode, scanCode, modifiers));
- }
-
- return false;
- }
-
- public void queueAdvanceDialogue() { this.advanceDialogueAtTickEnd = true; }
-
- public void queueChangeSet(String nextSet) { this.queuedNextSet = nextSet; }
-
- public void advanceDialogue() {
- actionIndex++;
- buttons.clear();
- if (dialogueActions.isEmpty() || actionIndex >= dialogueActions.size()) {
- endDialogue();
- return;
- }
-
- currentActions.removeIf(DialogueAction::isBlocking);
-
- for(int i = actionIndex; i <= dialogueActions.size(); i++)
- {
- DialogueAction currentAction = dialogueActions.get(i);
-
- if(currentAction instanceof DialogueRawAction){
- switch(((DialogueRawAction) currentAction).getRawAction()){
- case "hide_ui" -> hideGui();
- case "show_ui" -> showGui();
- }
- continue;
- }
- currentActions.add(currentAction);
-
- currentAction.setup(this);
- if(currentAction.isBlocking())
- {
- actionIndex = i;
- break;
- }
- }
- }
-
- public List getDialogueSpeakers() { return this.dialogueSpeakers; }
-
- public DialogueSpeaker getDialogueSpeaker(int id){
- if (dialogueSpeakers.isEmpty())
- return null;
- for(var speaker : this.dialogueSpeakers)
- if(speaker.getId() == id) return speaker;
- return null;
- }
-
- public void clearActions() { currentActions.clear(); }
-
- public void clearActions(String clearedClass){
- Class extends DialogueAction> classToRemove = null;
-
- switch (clearedClass)
- {
- case "message" -> classToRemove = DialogueMessage.class;
- case "credit" -> classToRemove = DialogueCredit.class;
- case "fade" -> classToRemove = DialogueFading.class;
- case "image" -> classToRemove = DialogueImage.class;
- case "move_image" -> classToRemove = DialogueMoveImage.class;
- }
- if(classToRemove != null)
- currentActions.removeIf(classToRemove::isInstance);
- }
-
- public void showGui() { this.guiVisible = true; }
- public void hideGui() { this.guiVisible = false; }
-
- @Override
- public boolean shouldCloseOnEsc() { return false; }
-
- @Override
- public boolean isPauseScreen() { return false; }
-
- public void skipDialogue(){
- while(actionIndex < dialogueActions.size() && dialogueActions.get(actionIndex).isSkippable())
- advanceDialogue();
- }
-
- public void endDialogue(){
- clearActions();
- ModNetwork.sendToServer(new ModNetwork.DialogueCompletedPacket(currentSet));
- currentFadingTime = 0.0f;
- //this.onClose();
- }
-
- public List getCurrentActions() {
- return this.currentActions;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/fr/gcjojo/worldscolliding/commands/DialogueCommand.java b/src/main/java/fr/gcjojo/worldscolliding/commands/ModCommands.java
similarity index 88%
rename from src/main/java/fr/gcjojo/worldscolliding/commands/DialogueCommand.java
rename to src/main/java/fr/gcjojo/worldscolliding/commands/ModCommands.java
index d82b9f1..2cdf854 100644
--- a/src/main/java/fr/gcjojo/worldscolliding/commands/DialogueCommand.java
+++ b/src/main/java/fr/gcjojo/worldscolliding/commands/ModCommands.java
@@ -1,11 +1,13 @@
package fr.gcjojo.worldscolliding.commands;
import com.mojang.brigadier.arguments.StringArgumentType;
+import com.mojang.brigadier.context.CommandContext;
import fr.gcjojo.worldscolliding.entity.AwakenedScourgeEntity;
import fr.gcjojo.worldscolliding.entity.ScourgeEntity;
-import fr.gcjojo.worldscolliding.network.ModNetwork;
import fr.gcjojo.worldscolliding.events.ModEvents;
import fr.gcjojo.worldscolliding.ModSounds;
+import io.github.gcjojo.blablalib.commands.DialogueCommand;
+import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.commands.SharedSuggestionProvider;
import net.minecraft.network.chat.Component;
@@ -39,7 +41,7 @@
import java.util.List;
@Mod.EventBusSubscriber(modid = "worldscolliding", bus = Mod.EventBusSubscriber.Bus.FORGE)
-public class DialogueCommand {
+public class ModCommands {
@SuppressWarnings({"unchecked", "rawtypes"})
private static BlockState copyProperty(BlockState from, BlockState to, Property property) {
@@ -49,12 +51,35 @@ private static BlockState copyProperty(BlockState from, BlockState to, Property
@SubscribeEvent
public static void onRegisterCommands(RegisterCommandsEvent event) {
// Load chapters dynamically
- List chapters = Arrays.asList("dogcheck", "credits", "chapter_0_set", "chapter_1_set", "chapter_1_ask", "chapter_2_set", "chapter_2_ask", "chapter_3_set", "chapter_3_ask", "chapter_4_set", "chapter_5_6_set", "chapter_5_past_set", "chapter_5_set", "chapter_5_ask", "chapter_6_set", "chapter_6_ask", "chapter_7_prologue_set", "chapter_7_light_set", "chapter_7_dark_set");
+ List chapters = Arrays.asList("\"worldscolliding:dogcheck\"", "\"worldscolliding:credits\"", "\"worldscolliding:chapter_0_set\"", "\"worldscolliding:chapter_1_set\"", "\"worldscolliding:chapter_1_ask\"", "\"worldscolliding:chapter_2_set\"", "\"worldscolliding:chapter_2_ask\"", "\"worldscolliding:chapter_3_set\"", "\"worldscolliding:chapter_3_ask\"", "\"worldscolliding:chapter_4_set\"", "\"worldscolliding:chapter_5_set\"", "\"worldscolliding:chapter_5_past_set\"", "\"worldscolliding:chapter_5_seal_ask\"", "\"worldscolliding:chapter_6_set\"", "\"worldscolliding:chapter_6_ask\"", "\"worldscolliding:chapter_7_prologue_set\"", "\"worldscolliding:chapter_7_light_set\"", "\"worldscolliding:chapter_7_dark_set\"");
List animations = Arrays.asList("sceal1", "sceal2", "sceal3", "sceal4", "sceal5", "sceal6", "sceal7", "sceal8", "ascend");
List cinematics = Arrays.asList("laugh", "tp_effect");
List sealTypes = Arrays.asList("remnant", "dark", "light", "first_remnant");
- event.getDispatcher().register(Commands.literal("dialogue").requires(commandSourceStack -> commandSourceStack.hasPermission(2))
+ DialogueCommand.register(event.getDispatcher(), chapters, (CommandContext context, String dialogue) -> {
+ if(!dialogue.equalsIgnoreCase("chapter_5_6_set") ||
+ !context.getSource().isPlayer() ||
+ context.getSource().getPlayer() == null)
+ return dialogue;
+
+ ServerPlayer player = context.getSource().getPlayer();
+
+ String chapterName = "";
+ if(!player.getPersistentData().contains("Chapter5") || !player.getPersistentData().getBoolean("Chapter5"))
+ {
+ chapterName = "chapter_5_set";
+ player.getPersistentData().putBoolean("Chapter5", true);
+ }
+ else
+ {
+ chapterName = "chapter_6_set";
+ player.getPersistentData().putBoolean("Chapter5", false);
+ }
+
+ return chapterName;
+ });
+
+ /*event.getDispatcher().register(Commands.literal("dialogue").requires(commandSourceStack -> commandSourceStack.hasPermission(2))
.then(Commands.literal("play")
.executes(context -> {
ServerPlayer player = context.getSource().getPlayerOrException();
@@ -91,7 +116,7 @@ public static void onRegisterCommands(RegisterCommandsEvent event) {
context.getSource().sendSuccess(() -> Component.literal("Chapitre mis à jour avec succès : " + finalChapterName), true);
return 1;
})))
- );
+ );*/
event.getDispatcher().register(Commands.literal("scourge").requires(commandSourceStack -> commandSourceStack.hasPermission(2))
.then(Commands.literal("cinematic")
diff --git a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueAction.java b/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueAction.java
deleted file mode 100644
index c6bd333..0000000
--- a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueAction.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package fr.gcjojo.worldscolliding.dialogues;
-
-import fr.gcjojo.worldscolliding.client.gui.DialogueScreen;
-import net.minecraft.client.gui.GuiGraphics;
-
-public abstract class DialogueAction
-{
- protected DialogueScreen screen;
-
- public void setup(DialogueScreen screen)
- {
- this.screen = screen;
- }
-
- public abstract void step();
- public abstract void draw(GuiGraphics graphics, int mouseX, int mouseY, float partialTick);
-
- public abstract void mouseClicked(double mouseX, double mouseY, int button);
- public abstract void keyPressed(int keyCode, int scanCode, int modifiers);
-
- public abstract boolean isBlocking();
- public abstract boolean isSkippable();
-}
diff --git a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueChoice.java b/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueChoice.java
deleted file mode 100644
index b368fe3..0000000
--- a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueChoice.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package fr.gcjojo.worldscolliding.dialogues;
-
-import com.google.gson.JsonObject;
-import fr.gcjojo.worldscolliding.client.gui.DialogueScreen;
-import net.minecraft.client.gui.GuiGraphics;
-import net.minecraft.client.gui.components.Button;
-import net.minecraft.network.chat.Component;
-
-public class DialogueChoice extends DialogueAction {
- private String choice1;
- private String nextSet1;
- private String saveSet1;
- private String action1;
-
- private String choice2;
- private String nextSet2;
- private String saveSet2;
- private String action2;
-
- public DialogueChoice(String choice1, String nextSet1, String saveSet1, String action1, String choice2, String nextSet2, String saveSet2, String action2)
- {
- this.choice1 = choice1;
- this.nextSet1 = nextSet1;
- this.saveSet1 = saveSet1;
- this.action1 = action1;
-
- this.choice2 = choice2;
- this.nextSet2 = nextSet2;
- this.saveSet2 = saveSet2;
- this.action2 = action2;
- }
-
- public DialogueChoice(JsonObject object){
- this.choice1 = object.get("option1").getAsString();
- this.nextSet1 = object.get("next1").getAsString();
- this.saveSet1 = object.get("save1").getAsString();
- this.action1 = object.get("action1").getAsString();
- this.choice2 = object.get("option2").getAsString();
- this.nextSet2 = object.get("next2").getAsString();
- this.saveSet2 = object.get("save2").getAsString();
- this.action2 = object.get("action2").getAsString();
- }
-
- @Override
- public void setup(DialogueScreen screen) {
- super.setup(screen);
-
- int btnWidth = 140;
- int btnHeight = 20;
- int yPos = screen.height / 2 + 50;
-
- screen.drawButton(Button.builder(Component.translatable(choice1), b -> {
- screen.handleChoiceSelection(nextSet1, saveSet1, action1);
- }).bounds(screen.width / 4 - btnWidth / 2, yPos, btnWidth, btnHeight).build());
-
- screen.drawButton(Button.builder(Component.translatable(choice2), b -> {
- screen.handleChoiceSelection(nextSet2, saveSet2, action2);
- }).bounds(3 * screen.width / 4 - btnWidth / 2, yPos, btnWidth, btnHeight).build());
- }
-
- @Override
- public void step() {
-
- }
-
- @Override
- public void draw(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
-
- }
-
- @Override
- public void mouseClicked(double mouseX, double mouseY, int button) {
-
- }
-
- @Override
- public void keyPressed(int keyCode, int scanCode, int modifiers) {
-
- }
-
- @Override
- public boolean isBlocking() { return true; }
-
- @Override
- public boolean isSkippable() { return false; }
-}
diff --git a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueClear.java b/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueClear.java
deleted file mode 100644
index cf0c6b0..0000000
--- a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueClear.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package fr.gcjojo.worldscolliding.dialogues;
-
-import com.google.gson.JsonObject;
-import fr.gcjojo.worldscolliding.client.gui.DialogueScreen;
-import net.minecraft.client.gui.GuiGraphics;
-
-public class DialogueClear extends DialogueAction {
-
- String clearedClass;
-
- public DialogueClear(){
- this.clearedClass = "none";
- }
-
- public DialogueClear(String clearedClass){
- this.clearedClass = clearedClass;
- }
-
- public DialogueClear(JsonObject object){
- if(object.has("cleared_actions"))
- this.clearedClass = object.get("cleared_actions").getAsString();
- else
- this.clearedClass = "none";
- }
-
- @Override
- public void setup(DialogueScreen screen) {
- super.setup(screen);
- if(clearedClass.equals("none"))
- screen.clearActions();
- else
- screen.clearActions(this.clearedClass);
- screen.advanceDialogue();
- }
-
- @Override
- public void step() {
-
- }
-
- @Override
- public void draw(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
-
- }
-
- @Override
- public void mouseClicked(double mouseX, double mouseY, int button) {
-
- }
-
- @Override
- public void keyPressed(int keyCode, int scanCode, int modifiers) {
-
- }
-
- @Override
- public boolean isBlocking() {
- return true;
- }
-
- @Override
- public boolean isSkippable() { return true; }
-}
diff --git a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueCredit.java b/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueCredit.java
deleted file mode 100644
index 7a7f84c..0000000
--- a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueCredit.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package fr.gcjojo.worldscolliding.dialogues;
-
-import com.eliotlash.mclib.utils.MathUtils;
-import com.google.gson.JsonObject;
-import com.mojang.blaze3d.systems.RenderSystem;
-import com.mojang.blaze3d.vertex.PoseStack;
-import fr.gcjojo.worldscolliding.ModEntry;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.Font;
-import net.minecraft.client.gui.GuiGraphics;
-import net.minecraft.core.Vec3i;
-import net.minecraft.network.chat.Component;
-import net.minecraft.network.chat.MutableComponent;
-import net.minecraft.util.FastColor;
-
-public class DialogueCredit extends DialogueAction {
- enum DisplayState
- {
- FADE_IN,
- HOLD,
- FADE_OUT,
- TRANSPARENT
- }
-
- enum TextAlignment{
- LEFT,
- CENTER,
- RIGHT
- }
-
- private String text;
- private float fadeInTime;
- private float holdTime;
- private float fadeOutTime;
- private float xPercentage;
- private float yPercentage;
- private float scale;
- private Vec3i color;
- private TextAlignment alignment;
-
- private DisplayState state;
- private static final Font font = Minecraft.getInstance().font;
-
- private int alpha = 0;
- private float currentTime = 0.0f;
-
- public DialogueCredit(String text, float fadeInTime, float holdTime, float fadeOutTime, float xPercentage, float yPercentage, float scale, String color){
- this.text = text;
- this.fadeInTime = fadeInTime;
- this.holdTime = holdTime;
- this.fadeOutTime = fadeOutTime;
- this.xPercentage = xPercentage;
- this.yPercentage = yPercentage;
- this.scale = scale;
-
- try {
- if(color.length() == 6) {
- int red = Integer.parseInt(color.substring(0, 2), 16);
- int green = Integer.parseInt(color.substring(2, 4), 16);
- int blue = Integer.parseInt(color.substring(4, 6), 16);
- this.color = new Vec3i(red, green, blue);
- }
- } catch (Exception e) { ModEntry.getLogger().error(e.getMessage()); }
-
- this.alignment = TextAlignment.CENTER;
- this.alpha = 0;
- state = DisplayState.FADE_IN;
- }
-
- public DialogueCredit(JsonObject object){
- this.text = "";
- this.fadeInTime = 0.0f;
- this.holdTime = 1.0f;
- this.fadeOutTime = 0.0f;
- this.xPercentage = 0.0f;
- this.yPercentage = 0.0f;
- this.scale = 1.0f;
- this.color = new Vec3i(255, 255, 255);
- this.alignment = TextAlignment.CENTER;
-
- this.alpha = 0;
- this.state = DisplayState.FADE_IN;
-
- if(object.has("text"))
- this.text = object.get("text").getAsString();
- if(object.has("fade_in_time"))
- this.fadeInTime = object.get("fade_in_time").getAsFloat();
- if(object.has("hold_time"))
- this.holdTime = object.get("hold_time").getAsFloat();
- if(object.has("fade_out_time"))
- this.fadeOutTime = object.get("fade_out_time").getAsFloat();
- if(object.has("x"))
- this.xPercentage = object.get("x").getAsFloat();
- if(object.has("y"))
- this.yPercentage = object.get("y").getAsFloat();
- if(object.has("scale"))
- this.scale = object.get("scale").getAsFloat();
- if(object.has("color")) {
- String color = object.get("color").getAsString();
- try {
- if(color.length() == 6) {
- int red = Integer.parseInt(color.substring(0, 2), 16);
- int green = Integer.parseInt(color.substring(2, 4), 16);
- int blue = Integer.parseInt(color.substring(4, 6), 16);
- this.color = new Vec3i(red, green, blue);
- }
- } catch (Exception e) { ModEntry.getLogger().error(e.getMessage()); }
- }
-
- if(object.has("alignment"))
- {
- switch(object.get("alignment").getAsString())
- {
- case "center" -> this.alignment = TextAlignment.CENTER;
- case "right" -> this.alignment = TextAlignment.RIGHT;
- default -> this.alignment = TextAlignment.LEFT;
- }
- }
- }
-
- @Override
- public void step() {
- }
-
- @Override
- public void draw(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
- if(state == DisplayState.TRANSPARENT)
- return;
-
- this.alpha = 0;
- RenderSystem.enableBlend();
- PoseStack pose = graphics.pose();
- pose.pushPose();
- switch (state)
- {
- case FADE_IN -> {
- float percentage = MathUtils.clamp(currentTime / fadeInTime, 0.00f, 1.0f);
- this.alpha = (int)(percentage * 255);
- if(currentTime >= fadeInTime) {
- currentTime = 0.0f;
- state = DisplayState.HOLD;
- }
- }
- case HOLD -> {
- this.alpha = 255;
- if(currentTime >= holdTime) {
- currentTime = 0.0f;
- state = DisplayState.FADE_OUT;
- }
- }
- case FADE_OUT -> {
- float percentage = MathUtils.clamp(currentTime / fadeOutTime, 0.0f, 1.0f);
- this.alpha = 255 - (int)(percentage * 255);
- if (currentTime >= fadeOutTime)
- {
- currentTime = 0.0f;
- state = DisplayState.TRANSPARENT;
- this.alpha = 0;
- }
- }
- }
-
- if(this.alpha >= 8)
- {
- MutableComponent textComponent = Component.translatable(this.text);
-
- int color = FastColor.ARGB32.color(this.alpha, this.color.getX(), this.color.getY(), this.color.getZ());
-
- //ModEntry.getLogger().info("Alpha : %d, Red : %d, Green : %d, Blue : %d".formatted(this.alpha, this.color.getX(), this.color.getY(), this.color.getZ()));
-
- int xPos;
- switch(this.alignment)
- {
- case LEFT -> xPos = (int)(screen.width * (this.xPercentage * 0.01f));
- case RIGHT -> xPos = (int)(screen.width * (this.xPercentage * 0.01f) - (font.width(textComponent) * scale));
- default -> xPos = (int)(screen.width * (this.xPercentage * 0.01f) - (font.width(textComponent) * scale * 0.5f)); // CENTER ALIGNMENT
- }
-
- int yPos = (int)(screen.height * (this.yPercentage * 0.01f));
-
- pose.translate(xPos, yPos, 1.0f);
- pose.scale(this.scale, this.scale, 1.0f);
- graphics.drawString(font, textComponent, 0, 0, color);
- }
- pose.popPose();
-
- currentTime += partialTick;
- RenderSystem.disableBlend();
- }
-
- @Override
- public void mouseClicked(double mouseX, double mouseY, int button) {
-
- }
-
- @Override
- public void keyPressed(int keyCode, int scanCode, int modifiers) {
-
- }
-
- @Override
- public boolean isBlocking() {
- return false;
- }
-
- @Override
- public boolean isSkippable() { return true; }
-}
diff --git a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueExecuteCommand.java b/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueExecuteCommand.java
deleted file mode 100644
index dd24945..0000000
--- a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueExecuteCommand.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package fr.gcjojo.worldscolliding.dialogues;
-
-import com.google.gson.JsonObject;
-import fr.gcjojo.worldscolliding.client.gui.DialogueScreen;
-import fr.gcjojo.worldscolliding.network.ModNetwork;
-import net.minecraft.client.gui.GuiGraphics;
-
-public class DialogueExecuteCommand extends DialogueAction {
- private String command;
-
- public DialogueExecuteCommand(JsonObject object){
- if(object.has("command")) {
- this.command = object.get("command").getAsString();
- }
- }
-
- @Override
- public void setup(DialogueScreen screen){
- super.setup(screen);
- if(this.command != null) {
- if (this.command.contains(""))
- this.command = this.command.replace("", screen.getMinecraft().player.getName().getString());
-
- ModNetwork.sendToServer(new ModNetwork.DialogueCommandPacket(command));
- }
- screen.queueAdvanceDialogue();
- }
-
- @Override
- public void step() { }
-
- @Override
- public void draw(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) { }
-
- @Override
- public void mouseClicked(double mouseX, double mouseY, int button) { }
-
- @Override
- public void keyPressed(int keyCode, int scanCode, int modifiers) { }
-
- @Override
- public boolean isBlocking() {
- return true;
- }
-
- @Override
- public boolean isSkippable() {
- return true;
- }
-}
diff --git a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueFading.java b/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueFading.java
deleted file mode 100644
index fd4792e..0000000
--- a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueFading.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package fr.gcjojo.worldscolliding.dialogues;
-
-import com.eliotlash.mclib.utils.MathUtils;
-import com.google.gson.JsonObject;
-import fr.gcjojo.worldscolliding.ModEntry;
-import net.minecraft.client.gui.GuiGraphics;
-import net.minecraft.util.FastColor;
-
-public class DialogueFading extends DialogueAction
-{
- private int fromColor;
- private int toColor;
- private float time;
-
- private float partialTicks = 0;
-
- public DialogueFading(String from, String to, float time) {
- this.fromColor = 0x00000000;
- this.toColor = 0x00000000;
- this.time = time;
- try{
- if(from.length() == 8) {
- int alpha = Integer.parseInt(from.substring(0, 2), 16);
- int red = Integer.parseInt(from.substring(2, 4), 16);
- int green = Integer.parseInt(from.substring(4, 6), 16);
- int blue = Integer.parseInt(from.substring(6, 8), 16);
- this.fromColor = FastColor.ARGB32.color(alpha, red, green, blue);
- }
- if(to.length() == 8) {
- int alpha = Integer.parseInt(to.substring(0, 2), 16);
- int red = Integer.parseInt(to.substring(2, 4), 16);
- int green = Integer.parseInt(to.substring(4, 6), 16);
- int blue = Integer.parseInt(to.substring(6, 8), 16);
- this.toColor = FastColor.ARGB32.color(alpha, red, green, blue);
- }
- } catch (Exception e) {
- ModEntry.getLogger().error(e.getMessage());
- }
- }
-
- public DialogueFading(JsonObject object){
- try{
- if(object.has("from")) {
- String from = object.get("from").getAsString();
- if(from.length() == 8) {
- int alpha = Integer.parseInt(from.substring(0, 2), 16);
- int red = Integer.parseInt(from.substring(2, 4), 16);
- int green = Integer.parseInt(from.substring(4, 6), 16);
- int blue = Integer.parseInt(from.substring(6, 8), 16);
- this.fromColor = FastColor.ARGB32.color(alpha, red, green, blue);
- }
- }
- if(object.has("to")){
- String to = object.get("to").getAsString();
- if(to.length() == 8) {
- int alpha = Integer.parseInt(to.substring(0, 2), 16);
- int red = Integer.parseInt(to.substring(2, 4), 16);
- int green = Integer.parseInt(to.substring(4, 6), 16);
- int blue = Integer.parseInt(to.substring(6, 8), 16);
- this.toColor = FastColor.ARGB32.color(alpha, red, green, blue);
- }
- }
- } catch (Exception e) {
- ModEntry.getLogger().error(e.getMessage());
- }
-
- if(object.has("time"))
- this.time = object.get("time").getAsFloat();
- }
-
- @Override
- public void step() {
-
- }
-
- // partialTicks = deltaTime ?
- @Override
- public void draw(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
- partialTicks += partialTick;
- float percentage = MathUtils.clamp(partialTicks / time, 0.0f, 1.0f);
-
- int lerpColor = FastColor.ARGB32.lerp(percentage, fromColor, toColor);
-
- graphics.fill(0, 0, screen.width, screen.height, lerpColor);
- }
-
- @Override
- public void mouseClicked(double mouseX, double mouseY, int button) { }
-
- @Override
- public void keyPressed(int keyCode, int scanCode, int modifiers) { }
-
- @Override
- public boolean isBlocking() { return false; }
-
- @Override
- public boolean isSkippable() { return true; }
-}
diff --git a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueImage.java b/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueImage.java
deleted file mode 100644
index ad464bf..0000000
--- a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueImage.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package fr.gcjojo.worldscolliding.dialogues;
-
-import com.google.gson.JsonObject;
-import com.mojang.blaze3d.systems.RenderSystem;
-import com.mojang.blaze3d.vertex.PoseStack;
-import net.minecraft.client.gui.GuiGraphics;
-import net.minecraft.resources.ResourceLocation;
-
-
-public class DialogueImage extends DialogueAction {
-
- private int imageId;
- private ResourceLocation image;
- private int initialWidth;
- private int initialHeight;
- private float xPercentage = 50;
- private float yPercentage = 50;
- private float scale = 1.0f;
-
- private int alpha = 255;
-
- public DialogueImage(int imageId, String imagePath, int initialWidth, int initialHeight) {
- this.imageId = imageId;
- this.image = ResourceLocation.parse(imagePath);
- this.initialWidth = initialWidth;
- this.initialHeight = initialHeight;
- }
-
- public DialogueImage(JsonObject object){
- if(object.has("id"))
- this.imageId = object.get("id").getAsInt();
- if(object.has("image"))
- this.image = ResourceLocation.parse(object.get("image").getAsString());
- if(object.has("width"))
- this.initialWidth = object.get("width").getAsInt();
- if(object.has("height"))
- this.initialHeight = object.get("height").getAsInt();
- if(object.has("x"))
- this.xPercentage = object.get("x").getAsFloat();
- if(object.has("y"))
- this.yPercentage = object.get("y").getAsFloat();
- if(object.has("scale"))
- this.scale = object.get("scale").getAsFloat();
- if(object.has("alpha"))
- this.alpha = object.get("alpha").getAsInt();
- }
-
- @Override
- public void step() {
-
- }
-
- @Override
- public void draw(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
- if(alpha <= 8)
- return;
-
- if(this.alpha >= 255) this.alpha = 255;
-
- PoseStack pose = graphics.pose();
- pose.pushPose();
- //pose.translate(screen.width / 2f,screen.height / 2f, 0);
- float xPos = screen.width * xPercentage * 0.01f;
- float yPos = screen.height * yPercentage * 0.01f;
- pose.translate(xPos, yPos, 1);
-
- double imageHeight = ((double) screen.height * 0.5d) / initialHeight;
- double imageWidth = (double)initialWidth * (imageHeight / (double)initialHeight);
-
- //image, topPos, leftPos, uvX, uvY, width, height
- pose.scale((float) imageHeight * scale, (float) imageWidth * scale, 1);
-
- // Merci copislop AKA copiflop >:(
- RenderSystem.enableBlend();
- RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, (float) this.alpha / 255);
- graphics.blit(image, -initialWidth / 2, -initialHeight / 2, 0, 0, initialWidth, initialHeight, initialWidth, initialHeight);
- RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
- RenderSystem.disableBlend();
-
- pose.popPose();
- }
-
- @Override
- public void mouseClicked(double mouseX, double mouseY, int button) {
-
- }
-
- @Override
- public void keyPressed(int keyCode, int scanCode, int modifiers) {
-
- }
-
- @Override
- public boolean isBlocking() {
- return false;
- }
-
- @Override
- public boolean isSkippable() { return true; }
-
- public int getImageId() { return this.imageId; }
- public float getXPercentage() { return this.xPercentage; }
- public float getYPercentage() { return this.yPercentage; }
- public float getScale() { return this.scale; }
- public int getAlpha() { return this.alpha; }
- public void setXPercentage(float newValue) { this.xPercentage = newValue; }
- public void setYPercentage(float newValue) { this.yPercentage = newValue; }
- public void setScale(float newValue) { this.scale = newValue; }
- public void setAlpha(int newValue) { this.alpha = newValue; }
-}
diff --git a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueMessage.java b/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueMessage.java
deleted file mode 100644
index 59bbc0a..0000000
--- a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueMessage.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package fr.gcjojo.worldscolliding.dialogues;
-
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.Font;
-import net.minecraft.client.gui.GuiGraphics;
-import net.minecraft.client.resources.sounds.SimpleSoundInstance;
-import net.minecraft.network.chat.Component;
-import net.minecraft.sounds.SoundEvent;
-
-import java.util.Random;
-
-public class DialogueMessage extends DialogueAction
-{
- private final int speakerId;
- private final String dialogueLine;
-
- private int charIndex = 0;
- private int tickCount = 0;
- private int pauseTimer = 0;
- private final Random random = new Random();
- private static final Font font = Minecraft.getInstance().font;
-
- public DialogueMessage(int speakerId, String dialogueLine) {
- this.speakerId = speakerId;
- this.dialogueLine = dialogueLine;
- }
-
- @Override
- public void step() {
- tickCount++;
-
- if (pauseTimer > 0) {
- pauseTimer--;
- return;
- }
-
- if (charIndex >= dialogueLine.length()) return;
-
- charIndex++;
- SoundEvent[] sounds = screen.getDialogueSpeaker(this.speakerId).getSounds();
- if(sounds.length >= 1)
- Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(sounds[random.nextInt(sounds.length)], 1.0F));
-
- char currentChar = dialogueLine.charAt(charIndex - 1);
- if (currentChar == '.' || currentChar == '!' || currentChar == '?') {
- pauseTimer = 8;
- }
- }
-
- @Override
- public void draw(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
- int boxWidth = 300;
- int boxHeight = 80;
- int boxX = (screen.width - boxWidth) / 2;
- int boxY = screen.height - boxHeight - 20;
-
- graphics.fill(boxX, boxY, boxX + boxWidth, boxY + boxHeight, 0x80000000);
- String speakerTranslated = Component.translatable(screen.getDialogueSpeaker(this.speakerId).getName()).getString();
- graphics.drawString(font, speakerTranslated, boxX + 10, boxY + 5, screen.getDialogueSpeaker(this.speakerId).getColor(), false);
-
- if (dialogueLine != null) {
- String displayedText = dialogueLine.substring(0, charIndex);
- graphics.drawWordWrap(font, Component.literal(displayedText), boxX + 10, boxY + 20, boxWidth - 20, 0xFFFFFF);
-
- if (charIndex >= dialogueLine.length() && (tickCount % 20 < 10)) {
- graphics.drawString(font, "▼", boxX + boxWidth - 15, boxY + boxHeight - 15, 0xFFFFFF, false);
- }
- }
- }
-
- @Override
- public void mouseClicked(double mouseX, double mouseY, int button) {
- if(charIndex >= dialogueLine.length())
- screen.queueAdvanceDialogue();
- else
- charIndex = dialogueLine.length();
- }
-
- @Override
- public void keyPressed(int keyCode, int scanCode, int modifiers) {
- if (keyCode != 257 && keyCode != 32)
- return;
-
- if(charIndex >= dialogueLine.length())
- screen.queueAdvanceDialogue();
- else
- charIndex = dialogueLine.length();
- }
-
- @Override
- public boolean isBlocking() { return true; }
-
- @Override
- public boolean isSkippable() { return true; }
-}
diff --git a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueMoveImage.java b/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueMoveImage.java
deleted file mode 100644
index 6bb2c4a..0000000
--- a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueMoveImage.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package fr.gcjojo.worldscolliding.dialogues;
-
-import com.google.gson.JsonObject;
-import net.minecraft.client.gui.GuiGraphics;
-import net.minecraft.util.Mth;
-
-import java.util.Optional;
-
-public class DialogueMoveImage extends DialogueAction{
-
- private int imageId;
- private float animTime;
- private Optional xPercentageStart = Optional.empty();
- private Optional yPercentageStart = Optional.empty();
- private Optional xPercentageEnd = Optional.empty();
- private Optional yPercentageEnd = Optional.empty();
- private Optional scaleStart = Optional.empty();
- private Optional scaleEnd = Optional.empty();
- private Optional alphaStart = Optional.empty();
- private Optional alphaEnd = Optional.empty();
-
- private boolean animateX = false;
- private boolean animateY = false;
- private boolean animateScale = false;
- private boolean animateAlpha = false;
-
- private float currentTime;
-
- public DialogueMoveImage(JsonObject object){
- if(object.has("id"))
- this.imageId = object.get("id").getAsInt();
- if(object.has("anim_time"))
- this.animTime = object.get("anim_time").getAsFloat();
- if(object.has("x_start"))
- this.xPercentageStart = Optional.of(object.get("x_start").getAsFloat());
- if(object.has("y_start"))
- this.yPercentageStart = Optional.of(object.get("y_start").getAsFloat());
- if(object.has("x_end"))
- this.xPercentageEnd = Optional.of(object.get("x_end").getAsFloat());
- if(object.has("y_end"))
- this.yPercentageEnd = Optional.of(object.get("y_end").getAsFloat());
- if(object.has("scale_start"))
- this.scaleStart = Optional.of(object.get("scale_start").getAsFloat());
- if(object.has("scale_end"))
- this.scaleEnd = Optional.of(object.get("scale_end").getAsFloat());
- if(object.has("alpha_start"))
- this.alphaStart = Optional.of(object.get("alpha_start").getAsInt());
- if(object.has("alpha_end"))
- this.alphaEnd = Optional.of(object.get("alpha_end").getAsInt());
-
- this.animateX = this.xPercentageStart.isPresent() && this.xPercentageEnd.isPresent();
- this.animateY = this.yPercentageStart.isPresent() && this.yPercentageEnd.isPresent();
- this.animateScale = this.scaleStart.isPresent() && this.scaleEnd.isPresent();
- this.animateAlpha = this.alphaStart.isPresent() && this.alphaEnd.isPresent();
- }
-
- @Override
- public void step() { }
-
- @Override
- public void draw(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
- if(currentTime >= animTime)
- return;
-
- Optional imageAction = screen.getCurrentActions().stream()
- .filter(action -> action instanceof DialogueImage && ((DialogueImage)action)
- .getImageId() == this.imageId).findFirst();
-
- if(imageAction.isEmpty() || !(imageAction.get() instanceof DialogueImage))
- return;
-
- DialogueImage image = (DialogueImage) imageAction.get();
-
- float animPercentage = currentTime / animTime;
-
- float xPercentage = animateX ? Mth.lerp(animPercentage, xPercentageStart.get(), xPercentageEnd.get()) : image.getXPercentage();
- float yPercentage = animateY ? Mth.lerp(animPercentage, yPercentageStart.get(), yPercentageEnd.get()) : image.getYPercentage();
- float scale = animateScale ? Mth.lerp(animPercentage, scaleStart.get(), scaleEnd.get()) : image.getScale();
- int alpha = animateAlpha ? (int) Mth.lerp(animPercentage, (float) alphaStart.get(), (float) alphaEnd.get()) : image.getAlpha();
-
- image.setXPercentage(xPercentage);
- image.setYPercentage(yPercentage);
- image.setScale(scale);
- image.setAlpha(alpha);
-
- currentTime += partialTick;
- }
-
- @Override
- public void mouseClicked(double mouseX, double mouseY, int button) { }
-
- @Override
- public void keyPressed(int keyCode, int scanCode, int modifiers) { }
-
- @Override
- public boolean isBlocking() { return false; }
-
- @Override
- public boolean isSkippable() { return true; }
-}
diff --git a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueNext.java b/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueNext.java
deleted file mode 100644
index 73a3b88..0000000
--- a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueNext.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package fr.gcjojo.worldscolliding.dialogues;
-
-import fr.gcjojo.worldscolliding.client.gui.DialogueScreen;
-import net.minecraft.client.gui.GuiGraphics;
-
-public class DialogueNext extends DialogueAction {
-
- String nextSet;
-
- public DialogueNext(String nextSet) {
- this.nextSet = nextSet;
- }
-
- @Override
- public void setup(DialogueScreen screen) {
- super.setup(screen);
- screen.queueChangeSet(nextSet);
- }
-
- @Override
- public void step() { }
-
- @Override
- public void draw(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) { }
-
- @Override
- public void mouseClicked(double mouseX, double mouseY, int button) { }
-
- @Override
- public void keyPressed(int keyCode, int scanCode, int modifiers) { }
-
- @Override
- public boolean isBlocking() { return true; }
-
- @Override
- public boolean isSkippable() { return false; }
-}
diff --git a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueRawAction.java b/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueRawAction.java
deleted file mode 100644
index bda9974..0000000
--- a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueRawAction.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package fr.gcjojo.worldscolliding.dialogues;
-
-import com.google.gson.JsonObject;
-import net.minecraft.client.gui.GuiGraphics;
-
-public class DialogueRawAction extends DialogueAction {
-
- private String action;
-
- public DialogueRawAction(JsonObject object){
- this.action = object.get("action").getAsString();
- }
-
- public String getRawAction() { return this.action; }
-
- @Override
- public void step() { }
-
- @Override
- public void draw(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) { }
-
- @Override
- public void mouseClicked(double mouseX, double mouseY, int button) { }
-
- @Override
- public void keyPressed(int keyCode, int scanCode, int modifiers) { }
-
- @Override
- public boolean isBlocking() { return false; }
-
- @Override
- public boolean isSkippable() { return true; }
-}
diff --git a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueSpeaker.java b/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueSpeaker.java
deleted file mode 100644
index c1e8051..0000000
--- a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueSpeaker.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package fr.gcjojo.worldscolliding.dialogues;
-
-import com.google.gson.Gson;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import fr.gcjojo.worldscolliding.ModEntry;
-import net.minecraft.core.registries.Registries;
-import net.minecraft.resources.ResourceLocation;
-import net.minecraft.sounds.SoundEvent;
-import net.minecraft.sounds.SoundEvents;
-import net.minecraft.util.FastColor;
-import net.minecraftforge.registries.ForgeRegistries;
-import net.minecraftforge.registries.RegistryObject;
-
-public class DialogueSpeaker {
- private int id;
- private String name;
- private int color;
- private SoundEvent[] sounds;
-
- public DialogueSpeaker(JsonObject obj){
- this.color = 0xFFFFFFFF;
- String colorStr = obj.get("color").getAsString();
- try{
- if(colorStr.length() == 8) {
- int alpha = Integer.parseInt(colorStr.substring(0, 2), 16);
- int red = Integer.parseInt(colorStr.substring(2, 4), 16);
- int green = Integer.parseInt(colorStr.substring(4, 6), 16);
- int blue = Integer.parseInt(colorStr.substring(6, 8), 16);
- this.color = FastColor.ARGB32.color(alpha, red, green, blue);
- }
- } catch (Exception e) {
- ModEntry.getLogger().warn("Unable to parse color {}", colorStr);
- }
-
- JsonArray soundsArray = obj.get("sounds").getAsJsonArray();
- String[] soundNames = new String[soundsArray.size()];
- for(int i = 0; i <= obj.get("sounds").getAsJsonArray().size() - 1; i++)
- soundNames[i] = soundsArray.get(i).getAsString();
-
- this.id = obj.get("id").getAsInt();
- this.name = obj.get("name").getAsString();
- this.sounds = loadSounds(soundNames);
- }
-
- public DialogueSpeaker(int id, String name, int color, String[] soundNames){
- this.id = id;
- this.name = name;
- this.color = color;
- this.sounds = loadSounds(soundNames);
- }
-
- public DialogueSpeaker(int id, String name, int color, SoundEvent[] sounds){
- this.id = id;
- this.name = name;
- this.color = color;
- this.sounds = sounds;
- }
-
- public static SoundEvent[] loadSounds(String[] soundNames){
- SoundEvent[] loadedSounds = new SoundEvent[soundNames.length];
- for(int i = 0; i <= soundNames.length - 1; i++)
- {
- String soundName = soundNames[i];
- RegistryObject soundEvent = RegistryObject.create(ResourceLocation.parse(soundName), ForgeRegistries.SOUND_EVENTS);
- if(!soundEvent.isPresent()) continue;
- loadedSounds[i] = soundEvent.get();
- }
- return loadedSounds;
- }
-
- public int getId() { return this.id; }
- public String getName() { return this.name; }
- public int getColor() { return this.color; }
- public SoundEvent[] getSounds() { return this.sounds; }
-}
diff --git a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueWait.java b/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueWait.java
deleted file mode 100644
index 8adc7da..0000000
--- a/src/main/java/fr/gcjojo/worldscolliding/dialogues/DialogueWait.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package fr.gcjojo.worldscolliding.dialogues;
-
-import com.google.gson.JsonObject;
-import net.minecraft.client.gui.GuiGraphics;
-
-public class DialogueWait extends DialogueAction {
-
- float waitTime;
- float currentWaitTime;
-
- public DialogueWait(float waitTime){
- this.waitTime = waitTime;
- }
-
- public DialogueWait(JsonObject object){
- if(object.has("time"))
- this.waitTime = object.get("time").getAsFloat();
- else
- this.waitTime = 0.0f;
- }
-
- @Override
- public void step() {
- if(currentWaitTime >= waitTime)
- screen.queueAdvanceDialogue();
- }
-
- @Override
- public void draw(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
- currentWaitTime += partialTick;
- }
-
- @Override
- public void mouseClicked(double mouseX, double mouseY, int button) { }
-
- @Override
- public void keyPressed(int keyCode, int scanCode, int modifiers) { }
-
- @Override
- public boolean isBlocking() {
- return true;
- }
-
- @Override
- public boolean isSkippable() { return true; }
-}
diff --git a/src/main/java/fr/gcjojo/worldscolliding/entity/AwakenedScourgeEntity.java b/src/main/java/fr/gcjojo/worldscolliding/entity/AwakenedScourgeEntity.java
index b68bc64..6a0a580 100644
--- a/src/main/java/fr/gcjojo/worldscolliding/entity/AwakenedScourgeEntity.java
+++ b/src/main/java/fr/gcjojo/worldscolliding/entity/AwakenedScourgeEntity.java
@@ -3,6 +3,7 @@
import fr.gcjojo.worldscolliding.ModSounds;
import fr.gcjojo.worldscolliding.events.ModEvents;
import fr.gcjojo.worldscolliding.network.ModNetwork;
+import io.github.gcjojo.blablalib.BlablaLib;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.DustParticleOptions;
@@ -340,9 +341,9 @@ public void tick() {
boolean isLight = playerData.getBoolean("LightEssence");
playerData.remove("LightEssence");
playerData.putBoolean("RespawnsScourge", isLight);
- String setName = isLight ? "chapter_7_after_boss_light_set" : "chapter_7_after_boss_dark_set";
- playerData.putString("CurrentChapter", setName);
- ModNetwork.sendToPlayer(new ModNetwork.OpenDialoguePacket(setName), (ServerPlayer) player);
+ String setName = isLight ? "worldscolliding:chapter_7_after_boss_light_set" : "worldscolliding:chapter_7_after_boss_dark_set";
+
+ BlablaLib.openDialogue((ServerPlayer) player, setName);
}
this.discard();
diff --git a/src/main/java/fr/gcjojo/worldscolliding/entity/ScourgeEntity.java b/src/main/java/fr/gcjojo/worldscolliding/entity/ScourgeEntity.java
index 6b34279..8269c31 100644
--- a/src/main/java/fr/gcjojo/worldscolliding/entity/ScourgeEntity.java
+++ b/src/main/java/fr/gcjojo/worldscolliding/entity/ScourgeEntity.java
@@ -2,6 +2,7 @@
import fr.gcjojo.worldscolliding.ModSounds;
import fr.gcjojo.worldscolliding.network.ModNetwork;
+import io.github.gcjojo.blablalib.BlablaLib;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
@@ -20,6 +21,7 @@
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
+import org.apache.logging.log4j.core.jmx.Server;
import software.bernie.geckolib.animatable.GeoEntity;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.core.animation.AnimatableManager;
@@ -63,29 +65,25 @@ public void tick() {
if(level().isClientSide())
return;
- level().getEntities(this, getBoundingBox().inflate(5), entity -> entity instanceof Player).forEach(player -> {
- if(!(player instanceof Player))
+ level().getEntities(this, getBoundingBox().inflate(5), entity -> entity instanceof Player).forEach(playerEntity -> {
+ if(!(playerEntity instanceof ServerPlayer))
return;
+ ServerPlayer player = (ServerPlayer) playerEntity;
if(!this.getPersistentData().contains("Player"))
this.getPersistentData().putUUID("Player", player.getUUID());
- boolean isInDialogue = player.getPersistentData().getBoolean("IsInDialogue");
- if(isInDialogue)
+ if(BlablaLib.isPlayerInDialogue(player))
return;
- String currentChapter = player.getPersistentData().getString("CurrentChapter");
- String lastReadChapter = player.getPersistentData().getString("LastReadChapter");
- if (currentChapter.isEmpty()) {
- currentChapter = "chapter_0_set";
- player.getPersistentData().putString("CurrentChapter", currentChapter);
- }
+ String currentChapter = BlablaLib.getPlayerDialogue(player);
+ String lastReadChapter = BlablaLib.getPlayerLastReadDialogue(player);
+
+ if (currentChapter.isEmpty())
+ currentChapter = "worldscolliding:chapter_0_set";
if(lastReadChapter.isEmpty() || !lastReadChapter.equals(currentChapter))
- {
- player.getPersistentData().putBoolean("IsInDialogue", true);
- ModNetwork.sendToPlayer(new ModNetwork.OpenDialoguePacket(currentChapter), (ServerPlayer) player);
- }
+ BlablaLib.openDialogue(player, currentChapter);
});
if (this.entityData.get(ASCENDING)) {
@@ -117,9 +115,8 @@ public void tick() {
MutableComponent msg = Component.translatable("worldscolliding.dialogue.scourge_ban_message").withStyle(net.minecraft.ChatFormatting.GRAY, net.minecraft.ChatFormatting.ITALIC);
serverPlayer.sendSystemMessage(msg, false);
- serverPlayer.getPersistentData().putString("CurrentChapter", "chapter_7_after_scourge_banned_set");
+ BlablaLib.openDialogue(serverPlayer, "worldscolliding:chapter_7_after_scourge_banned_set");
serverPlayer.getPersistentData().putBoolean("RespawnsScourge", true);
- ModNetwork.sendToPlayer(new ModNetwork.OpenDialoguePacket("chapter_7_after_scourge_banned_set"), serverPlayer);
}
}
diff --git a/src/main/java/fr/gcjojo/worldscolliding/events/ModEvents.java b/src/main/java/fr/gcjojo/worldscolliding/events/ModEvents.java
index 998e5ce..05beed0 100644
--- a/src/main/java/fr/gcjojo/worldscolliding/events/ModEvents.java
+++ b/src/main/java/fr/gcjojo/worldscolliding/events/ModEvents.java
@@ -1,25 +1,33 @@
package fr.gcjojo.worldscolliding.events;
+import dev.architectury.event.EventResult;
import fr.gcjojo.worldscolliding.Config;
import fr.gcjojo.worldscolliding.ModEntry;
import fr.gcjojo.worldscolliding.PlayerStoryDimensionData;
import fr.gcjojo.worldscolliding.StoryDimensionData;
+import fr.gcjojo.worldscolliding.entity.AwakenedScourgeEntity;
import fr.gcjojo.worldscolliding.entity.ModEntities;
import fr.gcjojo.worldscolliding.entity.ScourgeEntity;
-import fr.gcjojo.worldscolliding.network.ModNetwork;
import fr.gcjojo.worldscolliding.worldgen.dimension.ModDimensions;
+import io.github.gcjojo.blablalib.BlablaLib;
+import io.github.gcjojo.blablalib.events.BlablalibEvents;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
+import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer;
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.GameType;
+import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager;
+import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
@@ -116,7 +124,7 @@ public static void onServerTick(TickEvent.ServerTickEvent event) {
player.connection.teleport(data.originalPosition.x, data.originalPosition.y, data.originalPosition.z, player.getYRot(), player.getXRot());
player.setGameMode(data.previousGameMode);
if (!data.nextDialogue.isEmpty()) {
- ModNetwork.sendToPlayer(new ModNetwork.OpenDialoguePacket(data.nextDialogue), player);
+ BlablaLib.openDialogue(player, data.nextDialogue);
}
}
iterator.remove();
@@ -148,7 +156,7 @@ public static void onServerTick(TickEvent.ServerTickEvent event) {
item.setDeltaMovement(0, 0.02, 0);
}
else if (age < 120) {
- Player player = item.level().getNearestPlayer(item, 20.0);
+ Player player = item.level().getNearestPlayer(item, 50.0d);
if (player != null) {
Vec3 dir = player.position().add(0, 1, 0).subtract(item.position()).normalize();
item.setDeltaMovement(dir.scale(0.15));
@@ -181,12 +189,6 @@ public static void onPlayerCloned(PlayerEvent.Clone event){
newPersistentData.putBoolean("LightEssence", oldPersistentData.getBoolean("LightEssence"));
if(oldPersistentData.contains("ScourgeRespawnPosition"))
newPersistentData.put("ScourgeRespawnPosition", oldPersistentData.getCompound("ScourgeRespawnPosition"));
- if(oldPersistentData.contains("IsInDialogue"))
- newPersistentData.putBoolean("IsInDialogue", false);
- if(oldPersistentData.contains("CurrentChapter"))
- newPersistentData.putString("CurrentChapter", oldPersistentData.getString("CurrentChapter"));
- if(oldPersistentData.contains("LastReadChapter"))
- newPersistentData.putString("LastReadChapter", oldPersistentData.getString("LastReadChapter"));
if(oldPersistentData.contains("RespawnsScourge"))
newPersistentData.putBoolean("RespawnsScourge", oldPersistentData.getBoolean("RespawnsScourge"));
}
@@ -246,7 +248,7 @@ public static void onPlayerChangedDimension(PlayerEvent.PlayerChangedDimensionEv
player.level().addFreshEntity(newScourge);
playerPersistentData.remove("ScourgeRespawnPosition");
playerPersistentData.remove("RespawnsScourge");
- playerPersistentData.putString("CurrentChapter", "new_game_plus_choice");
+ BlablaLib.setPlayerDialogue((ServerPlayer) player, "worldscolliding:new_game_plus_choice");
}
return;
}
@@ -276,7 +278,7 @@ public static void onPlayerChangedDimension(PlayerEvent.PlayerChangedDimensionEv
return;
if(player.getPersistentData().contains("ShowCredits") && player.getPersistentData().getBoolean("ShowCredits")) {
- ModNetwork.sendToPlayer(new ModNetwork.OpenDialoguePacket("credits"), (ServerPlayer) player);
+ BlablaLib.openDialogue((ServerPlayer) player, "worldscolliding:credits");
player.getPersistentData().putBoolean("ShowCredits", false);
if(player.getPersistentData().contains("ScourgeRespawnPosition"))
@@ -317,4 +319,88 @@ private static void placeScourgeDenStructure(ServerLevel level, BlockPos pos)
2
);
}
+
+ public static void registerBlablaLibEvents(){
+ BlablalibEvents.DIALOGUE_COMPLETED.register(ModEvents::onDialogueCompleted);
+ BlablalibEvents.DIALOGUE_CHOICE_MADE.register(ModEvents::onDialogueChoiceMade);
+ }
+
+ private static EventResult onDialogueCompleted(ServerPlayer player, String dialogue) {
+ if(player != null) {
+ if(dialogue.equals("worldscolliding:chapter_7_light_set") || dialogue.equals("worldscolliding:chapter_7_dark_set"))
+ spawnBoss(player, dialogue.contains("light"));
+ }
+ return EventResult.pass();
+ }
+
+ private static EventResult onDialogueChoiceMade(ServerPlayer player, String nextDialogue, String saveDialogue, String action) {
+ if (player != null && action != null) {
+ if(!action.equalsIgnoreCase("no_tp")){
+ CompoundTag spawnpointTag = player.getPersistentData().getCompound("StoryDimension").getCompound("Spawnpoint");
+ player.teleportTo(spawnpointTag.getInt("x"), spawnpointTag.getInt("y"), spawnpointTag.getInt("z"));
+ }
+
+ if (action.startsWith("seal_")) {
+ String animNum = action.replace("seal_", "");
+ String animName = "sceal" + animNum;
+
+ ServerLevel level = (ServerLevel) player.level();
+ AABB searchBox = player.getBoundingBox().inflate(50.0);
+ List scourges = level.getEntitiesOfClass(LivingEntity.class, searchBox, e -> e instanceof ScourgeEntity || e instanceof AwakenedScourgeEntity);
+
+ if (!scourges.isEmpty()) {
+ LivingEntity boss = scourges.get(0);
+ Vec3 camPos = new Vec3(boss.getX() + 13.0, boss.getY() + 2.0, boss.getZ());
+ double dx = boss.getX() - camPos.x;
+ double dy = (boss.getY() + boss.getEyeHeight()) - camPos.y;
+ double dz = boss.getZ() - camPos.z;
+ float yaw = (float)(Math.atan2(dz, dx) * (180D / Math.PI)) - 90.0F;
+ float pitch = (float)(-(Math.atan2(dy, Math.sqrt(dx * dx + dz * dz)) * (180D / Math.PI)));
+
+ ModEvents.freezePlayer(player.getUUID(), camPos, yaw, pitch, 400, player.gameMode.getGameModeForPlayer(), nextDialogue);
+ player.setGameMode(GameType.SPECTATOR);
+
+ if (boss instanceof software.bernie.geckolib.animatable.GeoEntity geoBoss) {
+ geoBoss.triggerAnim("seal_controller", animName);
+ }
+ return EventResult.interruptFalse();
+ } else {
+ player.sendSystemMessage(Component.literal("Scourge introuvable pour l'animation de scellement."));
+ }
+ }
+ }
+ return EventResult.pass();
+ }
+
+ private static void spawnBoss(ServerPlayer player, boolean isLight){
+ Level level = player.level();
+
+ player.getPersistentData().putBoolean("LightEssence", isLight);
+
+ level.getEntities(player, player.getBoundingBox().inflate(15.0f), entity -> entity instanceof ScourgeEntity).forEach(scourge -> {
+ Vec3 bossSpawnPos = scourge.getPosition(1.0f).add(0d, 2.0d, 0d);
+ float xRot = scourge.getXRot();
+ float yRot = scourge.getYRot();
+ if(isLight)
+ scourge.discard();
+
+ CompoundTag scourgeRespawnPosTag = new CompoundTag();
+ scourgeRespawnPosTag.putDouble("x", bossSpawnPos.x);
+ scourgeRespawnPosTag.putDouble("y", bossSpawnPos.y);
+ scourgeRespawnPosTag.putDouble("z", bossSpawnPos.z);
+
+ player.getPersistentData().put("ScourgeRespawnPosition", scourgeRespawnPosTag);
+
+ level.explode(scourge, bossSpawnPos.x, bossSpawnPos.y, bossSpawnPos.z, 10.0f, Level.ExplosionInteraction.NONE);
+ Entity boss = new AwakenedScourgeEntity(ModEntities.AWAKENED_SCOURGE.get(), level);
+ level.addFreshEntity(boss);
+ boss.setPos(bossSpawnPos);
+ boss.setXRot(xRot);
+ boss.setYRot(yRot);
+
+ boss.teleportTo((ServerLevel) level, bossSpawnPos.x, bossSpawnPos.y + 1.5, bossSpawnPos.z, Set.of(), xRot, yRot);
+ scourge.getPersistentData().putBoolean("BossBattle", isLight);
+ boss.getPersistentData().putUUID("Player", player.getUUID());
+ });
+ }
}
\ No newline at end of file
diff --git a/src/main/java/fr/gcjojo/worldscolliding/network/ModNetwork.java b/src/main/java/fr/gcjojo/worldscolliding/network/ModNetwork.java
index 7135445..17f39dd 100644
--- a/src/main/java/fr/gcjojo/worldscolliding/network/ModNetwork.java
+++ b/src/main/java/fr/gcjojo/worldscolliding/network/ModNetwork.java
@@ -2,7 +2,6 @@
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import fr.gcjojo.worldscolliding.ModEntry;
-import fr.gcjojo.worldscolliding.client.gui.DialogueScreen;
import fr.gcjojo.worldscolliding.entity.AwakenedScourgeEntity;
import fr.gcjojo.worldscolliding.entity.ModEntities;
import fr.gcjojo.worldscolliding.entity.ScourgeEntity;
@@ -30,7 +29,7 @@
import java.util.function.Supplier;
public class ModNetwork {
- private static final String PROTOCOL_VERSION = "1.1.6";
+ private static final String PROTOCOL_VERSION = "1.2.0";
public static final SimpleChannel CHANNEL = NetworkRegistry.ChannelBuilder
.named(ResourceLocation.fromNamespaceAndPath(ModEntry.MODID, "main"))
.clientAcceptedVersions(PROTOCOL_VERSION::equals)
@@ -41,29 +40,7 @@ public class ModNetwork {
private static int packetId = 0;
public static void register() {
- CHANNEL.messageBuilder(OpenDialoguePacket.class, packetId++, NetworkDirection.PLAY_TO_CLIENT)
- .encoder(OpenDialoguePacket::encode)
- .decoder(OpenDialoguePacket::new)
- .consumerMainThread(OpenDialoguePacket::handle)
- .add();
- CHANNEL.messageBuilder(ChoiceSelectedPacket.class, packetId++, NetworkDirection.PLAY_TO_SERVER)
- .encoder(ChoiceSelectedPacket::encode)
- .decoder(ChoiceSelectedPacket::new)
- .consumerMainThread(ChoiceSelectedPacket::handle)
- .add();
-
- CHANNEL.messageBuilder(DialogueCompletedPacket.class, packetId++, NetworkDirection.PLAY_TO_SERVER)
- .encoder(DialogueCompletedPacket::encode)
- .decoder(DialogueCompletedPacket::new)
- .consumerMainThread(DialogueCompletedPacket::handle)
- .add();
-
- CHANNEL.messageBuilder(DialogueCommandPacket.class, packetId++, NetworkDirection.PLAY_TO_SERVER)
- .encoder(DialogueCommandPacket::encode)
- .decoder(DialogueCommandPacket::new)
- .consumerMainThread(DialogueCommandPacket::handle)
- .add();
}
public static void sendToPlayer(Object packet, ServerPlayer player) {
@@ -73,193 +50,4 @@ public static void sendToPlayer(Object packet, ServerPlayer player) {
public static void sendToServer(Object packet) {
CHANNEL.sendToServer(packet);
}
-
- public static class OpenDialoguePacket {
- private final String setName;
-
- public OpenDialoguePacket(String setName) {
- this.setName = setName;
- }
-
- public OpenDialoguePacket(FriendlyByteBuf buf) {
- this.setName = buf.readUtf();
- }
-
- public void encode(FriendlyByteBuf buf) {
- buf.writeUtf(this.setName);
- }
-
- public static void handle(OpenDialoguePacket msg, Supplier ctx) {
- ctx.get().enqueueWork(() -> DialogueScreen.openForSet(msg.setName));
- ctx.get().setPacketHandled(true);
- }
- }
-
- public static class ChoiceSelectedPacket {
- private final String nextSet;
- private final String saveSet;
- private final String action;
-
- public ChoiceSelectedPacket(String nextSet, String saveSet, String action) {
- this.nextSet = nextSet;
- this.saveSet = saveSet;
- this.action = action;
- }
-
- public ChoiceSelectedPacket(FriendlyByteBuf buf) {
- this.nextSet = buf.readUtf();
- this.saveSet = buf.readUtf();
- this.action = buf.readUtf();
- }
-
- public void encode(FriendlyByteBuf buf) {
- buf.writeUtf(this.nextSet);
- buf.writeUtf(this.saveSet);
- buf.writeUtf(this.action);
- }
-
- public static void handle(ChoiceSelectedPacket msg, Supplier ctx) {
- ctx.get().enqueueWork(() -> {
- ServerPlayer player = ctx.get().getSender();
- if (player != null) {
- player.getPersistentData().putString("CurrentChapter", msg.saveSet);
-
- CompoundTag spawnpointTag = player.getPersistentData().getCompound("StoryDimension").getCompound("Spawnpoint");
-
- player.teleportTo(spawnpointTag.getInt("x"), spawnpointTag.getInt("y"), spawnpointTag.getInt("z"));
-
- if (msg.action != null && msg.action.startsWith("seal_")) {
- String animNum = msg.action.replace("seal_", "");
- String animName = "sceal" + animNum;
-
- ServerLevel level = (ServerLevel) player.level();
- AABB searchBox = player.getBoundingBox().inflate(50.0);
- List scourges = level.getEntitiesOfClass(LivingEntity.class, searchBox, e -> e instanceof ScourgeEntity || e instanceof AwakenedScourgeEntity);
-
- if (!scourges.isEmpty()) {
- LivingEntity boss = scourges.get(0);
- Vec3 camPos = new Vec3(boss.getX() + 13.0, boss.getY() + 2.0, boss.getZ());
- double dx = boss.getX() - camPos.x;
- double dy = (boss.getY() + boss.getEyeHeight()) - camPos.y;
- double dz = boss.getZ() - camPos.z;
- float yaw = (float)(Math.atan2(dz, dx) * (180D / Math.PI)) - 90.0F;
- float pitch = (float)(-(Math.atan2(dy, Math.sqrt(dx * dx + dz * dz)) * (180D / Math.PI)));
-
- ModEvents.freezePlayer(player.getUUID(), camPos, yaw, pitch, 400, player.gameMode.getGameModeForPlayer(), msg.nextSet);
- player.setGameMode(GameType.SPECTATOR);
-
- if (boss instanceof software.bernie.geckolib.animatable.GeoEntity geoBoss) {
- geoBoss.triggerAnim("seal_controller", animName);
- }
- return;
- } else {
- player.sendSystemMessage(Component.literal("Scourge introuvable pour l'animation de scellement."));
- }
- }
-
- if (msg.nextSet != null && !msg.nextSet.isEmpty()) {
- ModNetwork.CHANNEL.send(net.minecraftforge.network.PacketDistributor.PLAYER.with(() -> player),
- new OpenDialoguePacket(msg.nextSet));
- }
- }
- });
- ctx.get().setPacketHandled(true);
- }
- }
-
- public static class DialogueCompletedPacket {
- private final String setName;
-
- public DialogueCompletedPacket(String setName) {
- this.setName = setName;
- }
-
- public DialogueCompletedPacket(FriendlyByteBuf buf) {
- this.setName = buf.readUtf();
- }
-
- public void encode(FriendlyByteBuf buf) {
- buf.writeUtf(this.setName);
- }
-
- public static void handle(DialogueCompletedPacket msg, Supplier ctx){
- ctx.get().enqueueWork(() -> {
- ServerPlayer player = ctx.get().getSender();
- if(player != null) {
- player.getPersistentData().putBoolean("IsInDialogue", false);
- player.getPersistentData().putString("LastReadChapter", msg.setName);
-
- if(msg.setName.equals("chapter_7_light_set") || msg.setName.equals("chapter_7_dark_set"))
- spawnBoss(player, msg.setName.contains("light"));
- }
- });
- ctx.get().setPacketHandled(true);
- }
-
- public static void spawnBoss(ServerPlayer player, boolean isLight){
- Level level = player.level();
-
- player.getPersistentData().putBoolean("LightEssence", isLight);
-
- level.getEntities(player, player.getBoundingBox().inflate(15.0f), entity -> entity instanceof ScourgeEntity).forEach(scourge -> {
- Vec3 bossSpawnPos = scourge.getPosition(1.0f).add(0d, 2.0d, 0d);
- float xRot = scourge.getXRot();
- float yRot = scourge.getYRot();
- if(isLight)
- scourge.discard();
-
- CompoundTag scourgeRespawnPosTag = new CompoundTag();
- scourgeRespawnPosTag.putDouble("x", bossSpawnPos.x);
- scourgeRespawnPosTag.putDouble("y", bossSpawnPos.y);
- scourgeRespawnPosTag.putDouble("z", bossSpawnPos.z);
-
- player.getPersistentData().put("ScourgeRespawnPosition", scourgeRespawnPosTag);
-
- level.explode(scourge, bossSpawnPos.x, bossSpawnPos.y, bossSpawnPos.z, 10.0f, Level.ExplosionInteraction.NONE);
- Entity boss = new AwakenedScourgeEntity(ModEntities.AWAKENED_SCOURGE.get(), level);
- level.addFreshEntity(boss);
- boss.setPos(bossSpawnPos);
- boss.setXRot(xRot);
- boss.setYRot(yRot);
-
- boss.teleportTo((ServerLevel) level, bossSpawnPos.x, bossSpawnPos.y + 1.5, bossSpawnPos.z, Set.of(), xRot, yRot);
- scourge.getPersistentData().putBoolean("BossBattle", isLight);
- boss.getPersistentData().putUUID("Player", player.getUUID());
- });
- }
- }
-
- public static class DialogueCommandPacket {
- private String command;
-
- public DialogueCommandPacket(String command) {
- this.command = command;
- }
-
- public DialogueCommandPacket(FriendlyByteBuf buf) {
- this.command = buf.readUtf();
- }
-
- public void encode(FriendlyByteBuf buf) {
- buf.writeUtf(this.command);
- }
-
- public static void handle(DialogueCommandPacket msg, Supplier ctx){
- ctx.get().enqueueWork(() -> {
- ServerPlayer player = ctx.get().getSender();
- if(player == null) return;
- MinecraftServer server = player.getServer();
- if(server == null) return;
-
- String formattedCommand = "execute positioned as %s run %s".formatted(player.getName().getString(), msg.command);
- try {
- int success = server.getCommands().getDispatcher().execute(formattedCommand, server.createCommandSourceStack().withEntity(player).withLevel((ServerLevel) player.level()));
- ModEntry.getLogger().warn(String.valueOf(success));
- } catch (CommandSyntaxException e) {
- throw new RuntimeException(e);
- }
- });
- ctx.get().setPacketHandled(true);
- }
- }
}
\ No newline at end of file
diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml
index 2f01a3d..b25d399 100644
--- a/src/main/resources/META-INF/mods.toml
+++ b/src/main/resources/META-INF/mods.toml
@@ -65,6 +65,12 @@ description='''${mod_description}'''
versionRange="${minecraft_version_range}"
ordering="NONE"
side="BOTH"
+[[dependencies.${mod_id}]]
+ modId="blablalib"
+ mandatory=true
+ versionRange="${blablalib_version_range}"
+ ordering="AFTER"
+ side="BOTH"
# Features are specific properties of the game environment, that you may want to declare you require. This example declares
# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't
diff --git a/src/main/resources/assets/worldscolliding/dialogues.json b/src/main/resources/assets/worldscolliding/dialogues.json
index 4b538d3..94a97d3 100644
--- a/src/main/resources/assets/worldscolliding/dialogues.json
+++ b/src/main/resources/assets/worldscolliding/dialogues.json
@@ -99,12 +99,12 @@
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter1_set.5" },
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter1_set.6" },
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter1_set.7" },
- { "action": "change_set", "set": "chapter_1_ask" }
+ { "action": "change_set", "set": "worldscolliding:chapter_1_ask" }
],
"chapter_1_ask": [
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter_1_ask.text" },
- { "action": "choice", "option1": "worldscolliding.dialogue.choice.yes", "action1": "seal_1", "next1": "chapter_1_yes_set", "save1": "chapter_2_set", "option2": "worldscolliding.dialogue.choice.no", "action2": "none", "next2": "chapter_1_no_set", "save2": "chapter_1_ask" }
+ { "action": "choice", "option1": "worldscolliding.dialogue.choice.yes", "action1": "seal_1", "next1": "worldscolliding:chapter_1_yes_set", "save1": "worldscolliding:chapter_1_yes_set", "option2": "worldscolliding.dialogue.choice.no", "action2": "none", "next2": "worldscolliding:chapter_1_no_set", "save2": "worldscolliding:chapter_1_ask" }
],
"chapter_1_yes_set": [
@@ -116,8 +116,6 @@
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter1_yes_set.6" },
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter1_yes_set.7" },
{ "action": "command", "command": "scourge sealeffect remnant" },
- { "action": "hide_ui" },
- { "action": "wait", "time": 90 },
{ "action": "command", "command": "struct_unlock @s 2" }
],
@@ -131,12 +129,12 @@
{ "action": "message", "speaker": 0, "text": "worldscolliding.dialogue.chapter2_set.3" },
{ "action": "message", "speaker": 0, "text": "worldscolliding.dialogue.chapter2_set.4" },
{ "action": "message", "speaker": 0, "text": "worldscolliding.dialogue.chapter2_set.5" },
- { "action": "change_set", "set": "chapter_2_ask" }
+ { "action": "change_set", "set": "worldscolliding:chapter_2_ask" }
],
"chapter_2_ask": [
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter_2_ask.text" },
- { "action": "choice", "option1": "worldscolliding.dialogue.choice.yes", "action1": "seal_2", "next1": "chapter_2_yes_set", "save1": "chapter_3_set", "option2": "worldscolliding.dialogue.choice.no", "action2": "none", "next2": "chapter_2_no_set", "save2": "chapter_2_ask" }
+ { "action": "choice", "option1": "worldscolliding.dialogue.choice.yes", "action1": "seal_2", "next1": "worldscolliding:chapter_2_yes_set", "save1": "worldscolliding:chapter_2_yes_set", "option2": "worldscolliding.dialogue.choice.no", "action2": "none", "next2": "worldscolliding:chapter_2_no_set", "save2": "worldscolliding:chapter_2_ask" }
],
"chapter_2_yes_set": [
@@ -147,8 +145,6 @@
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter2_yes_set.5" },
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter2_yes_set.6" },
{ "action": "command", "command": "scourge sealeffect remnant" },
- { "action": "hide_ui" },
- { "action": "wait", "time": 410 },
{ "action": "command", "command": "struct_unlock @s 3" }
],
@@ -170,20 +166,18 @@
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter3_set.11" },
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter3_set.12" },
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter3_set.13" },
- { "action": "change_set", "set": "chapter_3_ask" }
+ { "action": "change_set", "set": "worldscolliding:chapter_3_ask" }
],
"chapter_3_ask": [
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter3_ask.text" },
- { "action": "choice", "option1": "worldscolliding.dialogue.choice.yes", "action1": "seal_3", "next1": "chapter_3_yes_set", "save1": "chapter_4_set", "option2": "worldscolliding.dialogue.choice.no", "action2": "none", "next2": "chapter_3_no_set", "save2": "chapter_3_ask" }
+ { "action": "choice", "option1": "worldscolliding.dialogue.choice.yes", "action1": "seal_3", "next1": "worldscolliding:chapter_3_yes_set", "save1": "worldscolliding:chapter_3_yes_set", "option2": "worldscolliding.dialogue.choice.no", "action2": "none", "next2": "worldscolliding:chapter_3_no_set", "save2": "worldscolliding:chapter_3_ask" }
],
"chapter_3_yes_set": [
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter3_yes_set.1" },
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter3_yes_set.2" },
{ "action": "command", "command": "scourge sealeffect remnant" },
- { "action": "hide_ui" },
- { "action": "wait", "time": 410 },
{ "action": "command", "command": "struct_unlock @s 4" }
],
@@ -200,12 +194,12 @@
{ "action": "message", "speaker": 0, "text": "worldscolliding.dialogue.chapter4_set.6" },
{ "action": "message", "speaker": 0, "text": "worldscolliding.dialogue.chapter4_set.7" },
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter4_set.8" },
- { "action": "change_set", "set": "chapter_4_ask" }
+ { "action": "change_set", "set": "worldscolliding:chapter_4_ask" }
],
"chapter_4_ask": [
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter4_ask.text" },
- { "action": "choice", "option1": "worldscolliding.dialogue.choice.yes", "action1": "seal_4", "next1": "chapter_4_yes_set", "save1": "chapter_5_6_past_set", "option2": "worldscolliding.dialogue.choice.no", "action2": "none", "next2": "chapter_4_no_set", "save2": "chapter_4_ask" }
+ { "action": "choice", "option1": "worldscolliding.dialogue.choice.yes", "action1": "seal_4", "next1": "worldscolliding:chapter_4_yes_set", "save1": "worldscolliding:chapter_4_yes_set", "option2": "worldscolliding.dialogue.choice.no", "action2": "none", "next2": "worldscolliding:chapter_4_no_set", "save2": "worldscolliding:chapter_4_ask" }
],
"chapter_4_yes_set": [
@@ -217,8 +211,6 @@
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter4_yes_set.6" },
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter4_yes_set.7" },
{ "action": "command", "command": "scourge sealeffect remnant" },
- { "action": "hide_ui" },
- { "action": "wait", "time": 410 },
{ "action": "command", "command": "struct_unlock @s 5" }
],
@@ -229,7 +221,7 @@
"chapter_5_set": [
{ "action": "message", "speaker": 0, "text": "worldscolliding.dialogue.chapter_5_set.1" },
{ "action": "message", "speaker": 0, "text": "worldscolliding.dialogue.chapter_5_set.2" },
- { "action": "choice", "option1": "worldscolliding.dialogue.choice.accept", "action1": "none", "next1": "chapter_5_past_accept_set", "save1": "chapter_5_seal_set", "option2": "worldscolliding.dialogue.choice.refuse", "action2": "none", "next2": "chapter_5_seal_ask", "save2": "chapter_5_seal_ask" }
+ { "action": "choice", "option1": "worldscolliding.dialogue.choice.accept", "action1": "no_tp", "next1": "worldscolliding:chapter_5_past_accept_set", "save1": "worldscolliding:chapter_5_past_accept_set", "option2": "worldscolliding.dialogue.choice.refuse", "action2": "no_tp", "next2": "worldscolliding:chapter_5_seal_ask", "save2": "worldscolliding:chapter_5_seal_ask" }
],
"chapter_5_past_accept_set": [
@@ -251,24 +243,33 @@
{ "action": "clear" },
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter_5_past_accept_set.11" },
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter_5_past_accept_set.12" },
- { "action": "change_set", "set": "chapter_5_seal_ask" }
+ { "action": "change_set", "set": "worldscolliding:chapter_5_seal_ask" }
],
"chapter_5_seal_ask": [
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter_5_seal_ask.text" },
- { "action": "choice", "option1": "worldscolliding.dialogue.choice.yes", "action1": "none", "next1": "chapter_5_past_accept_set", "save1": "chapter_5_seal_set", "option2": "worldscolliding.dialogue.choice.no", "action2": "none", "next2": "chapter_5_seal_no_set", "save2": "chapter_5_seal_ask" }
+ { "action": "choice", "option1": "worldscolliding.dialogue.choice.yes", "action1": "seal_5", "next1": "worldscolliding:chapter_5_yes_set", "save1": "worldscolliding:chapter_5_yes_set", "option2": "worldscolliding.dialogue.choice.no", "action2": "none", "next2": "worldscolliding:chapter_5_no_set", "save2": "worldscolliding:chapter_5_seal_ask" }
+ ],
+
+ "chapter_5_yes_set" : [
+ { "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter_5_seal_yes.1" },
+ { "action": "command", "command": "scourge sealeffect remnant" }
+ ],
+
+ "chapter_5_no_set" : [
+ { "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter_5_seal_no.1" }
],
"chapter_6_set": [
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter_6_set.1" },
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter_6_set.2" },
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter_6_set.3" },
- { "action": "change_set", "set": "chapter_6_seal_ask" }
+ { "action": "change_set", "set": "worldscolliding:chapter_6_seal_ask" }
],
"chapter_6_seal_ask": [
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter_6_seal_ask.text" },
- { "action": "choice", "option1": "worldscolliding.dialogue.choice.yes", "action1": "seal_6", "next1": "chapter_6_seal_yes_set", "save1": "chapter_7_prologue_set", "option2": "worldscolliding.dialogue.choice.no", "action2": "none", "next2": "chapter_6_seal_no_set", "save2": "chapter_6_seal_ask" }
+ { "action": "choice", "option1": "worldscolliding.dialogue.choice.yes", "action1": "seal_6", "next1": "worldscolliding:chapter_6_seal_yes_set", "save1": "worldscolliding:chapter_6_seal_yes_set", "option2": "worldscolliding.dialogue.choice.no", "action2": "none", "next2": "worldscolliding:chapter_6_seal_no_set", "save2": "worldscolliding:chapter_6_seal_ask" }
],
"chapter_6_seal_no_set": [
@@ -286,7 +287,7 @@
{ "action": "message", "speaker": 0, "text": "worldscolliding.dialogue.chapter_6_seal_yes_set.8" },
{ "action": "message", "speaker": 0, "text": "worldscolliding.dialogue.chapter_6_seal_yes_set.9" },
{ "action": "message", "speaker": 1, "text": "worldscolliding.dialogue.chapter_6_seal_yes_set.10" },
- { "action": "choice", "option1": "worldscolliding.dialogue.choice.seal_light", "action1": "none", "next1": "chapter_6_seal_light_set", "save1": "chapter_7_light_set", "option2": "worldscolliding.dialogue.choice.seal_dark", "action2": "none", "next2": "chapter_6_seal_dark_set", "save2": "chapter_7_dark_set" }
+ { "action": "choice", "option1": "worldscolliding.dialogue.choice.seal_light", "action1": "none", "next1": "worldscolliding:chapter_6_seal_light_set", "save1": "worldscolliding:chapter_6_seal_light_set", "option2": "worldscolliding.dialogue.choice.seal_dark", "action2": "none", "next2": "worldscolliding:chapter_6_seal_dark_set", "save2": "worldscolliding:chapter_6_seal_dark_set" }
],
"chapter_6_seal_light_set": [
@@ -364,7 +365,7 @@
"new_game_plus_choice" : [
{ "action": "message", "speaker": 2, "text": "worldscolliding.dialogue.new_game_plus_choice.1" },
{ "action": "message", "speaker": 2, "text": "worldscolliding.dialogue.new_game_plus_choice.2" },
- { "action": "choice", "option1": "worldscolliding.dialogue.choice.seal_light", "action1": "none", "next1": "chapter_5_6_seal_light_set", "save1": "chapter_7_light_set", "option2": "worldscolliding.dialogue.choice.seal_dark", "action2": "none", "next2": "chapter_5_6_seal_dark_set", "save2": "chapter_7_dark_set" }
+ { "action": "choice", "option1": "worldscolliding.dialogue.choice.seal_light", "action1": "none", "next1": "worldscolliding:chapter_6_seal_light_set", "save1": "worldscolliding:chapter_6_seal_light_set", "option2": "worldscolliding.dialogue.choice.seal_dark", "action2": "none", "next2": "worldscolliding:chapter_6_seal_dark_set", "save2": "worldscolliding:chapter_6_seal_dark_set" }
]
}
\ No newline at end of file