Update to 1.20.4

This commit is contained in:
Exopandora
2023-12-09 14:39:09 +01:00
parent 1b715f1ac3
commit bfbf99d2c7
12 changed files with 116 additions and 54 deletions

View File

@@ -1,7 +1,7 @@
plugins { plugins {
id 'java' id 'java'
id 'eclipse' id 'eclipse'
id 'net.minecraftforge.gradle' version '6.0.+' id 'net.minecraftforge.gradle' version '[6.0.16,6.2)'
id 'me.hypherionmc.cursegradle' version '2.+' id 'me.hypherionmc.cursegradle' version '2.+'
} }
@@ -17,61 +17,38 @@ minecraft {
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs { runs {
client { configureEach {
workingDirectory project.file('run') workingDirectory project.file('run')
}
client {
taskName "${project.name}Client" taskName "${project.name}Client"
mods {
"${mod_id}" {
source sourceSets.main
}
}
} }
server { server {
workingDirectory project.file('run')
taskName "${project.name}Server" taskName "${project.name}Server"
mods {
"${mod_id}" {
source sourceSets.main
}
}
} }
gameTestServer { gameTestServer {
workingDirectory project.file('run')
taskName "${project.name}GameTest" taskName "${project.name}GameTest"
property 'forge.enabledGameTestNamespaces', mod_id
mods {
"${mod_id}" {
source sourceSets.main
}
}
} }
data { data {
workingDirectory project.file('run') workingDirectory project.file('run-data')
taskName "${project.name}Data" taskName "${project.name}Data"
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
args '--mod', "${mod_id}", '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
mods {
"${mod_id}" {
source sourceSets.main
}
}
} }
} }
} }
sourceSets.main.resources.srcDir 'src/generated/resources' sourceSets.main.resources { srcDir 'src/generated/resources' }
dependencies { dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
} }
jar { tasks.named('jar', Jar).configure {
manifest { manifest {
attributes([ attributes([
"Specification-Title": "${mod_id}", "Specification-Title": "${mod_id}",
@@ -86,7 +63,7 @@ jar {
} }
} }
processResources { tasks.named('processResources', ProcessResources).configure {
outputs.upToDateWhen { outputs.upToDateWhen {
false false
} }

View File

@@ -2,14 +2,14 @@
mod_id = worldhandler mod_id = worldhandler
mod_name = WorldHandler mod_name = WorldHandler
mod_version = 3.5.1 mod_version = 3.5.1
minecraft_version = 1.20.2 minecraft_version = 1.20.4
group = exopandora.worldhandler group = exopandora.worldhandler
main_class = exopandora.worldhandler.Main main_class = exopandora.worldhandler.Main
author = Exopandora author = Exopandora
# Forge # Forge
forge_version = 48.0.0 forge_version = 49.0.3
forge_compatible_minecraft_versions = 1.20.2 forge_compatible_minecraft_versions = 1.20.3,1.20.4
# Publishing # Publishing
curse_project_id = 228970 curse_project_id = 228970

View File

@@ -11,7 +11,7 @@ public class Main
{ {
public static final String NAME = "World Handler"; public static final String NAME = "World Handler";
public static final String MODID = "worldhandler"; public static final String MODID = "worldhandler";
public static final String MC_VERSION = "1.20.2"; public static final String MC_VERSION = "1.20.4";
public static final String MOD_VERSION = "3.5.1"; public static final String MOD_VERSION = "3.5.1";
public static final String URL = "https://minecraft.curseforge.com/projects/world-handler-command-gui"; public static final String URL = "https://minecraft.curseforge.com/projects/world-handler-command-gui";

View File

@@ -37,7 +37,6 @@ public class WorldHandler
public static final Logger LOGGER = LogManager.getLogger(); public static final Logger LOGGER = LogManager.getLogger();
public static final Path USERCONTENT_PATH = FMLPaths.CONFIGDIR.get().resolve(Main.MODID).resolve("usercontent"); public static final Path USERCONTENT_PATH = FMLPaths.CONFIGDIR.get().resolve(Main.MODID).resolve("usercontent");
@SuppressWarnings("serial")
public WorldHandler() public WorldHandler()
{ {
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();

View File

@@ -2,25 +2,34 @@ package exopandora.worldhandler.builder.argument;
import java.util.function.Function; import java.util.function.Function;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
import com.mojang.brigadier.StringReader; import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.serialization.JsonOps;
import exopandora.worldhandler.builder.argument.PrimitiveArgument.Linkage; import exopandora.worldhandler.builder.argument.PrimitiveArgument.Linkage;
import exopandora.worldhandler.builder.argument.PrimitiveArgument.Operation; import exopandora.worldhandler.builder.argument.PrimitiveArgument.Operation;
import exopandora.worldhandler.builder.argument.PrimitiveArgument.Relation; import exopandora.worldhandler.builder.argument.PrimitiveArgument.Relation;
import exopandora.worldhandler.builder.argument.PrimitiveArgument.Type; import exopandora.worldhandler.builder.argument.PrimitiveArgument.Type;
import exopandora.worldhandler.util.EnumHelper; import exopandora.worldhandler.util.EnumHelper;
import net.minecraft.Util;
import net.minecraft.advancements.critereon.MinMaxBounds; import net.minecraft.advancements.critereon.MinMaxBounds;
import net.minecraft.commands.ParserUtils;
import net.minecraft.commands.arguments.EntityAnchorArgument.Anchor; import net.minecraft.commands.arguments.EntityAnchorArgument.Anchor;
import net.minecraft.core.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.Difficulty; import net.minecraft.world.Difficulty;
import net.minecraft.world.scores.criteria.ObjectiveCriteria.RenderType; import net.minecraft.world.scores.criteria.ObjectiveCriteria.RenderType;
public class Arguments public class Arguments
{ {
private static final Gson GSON = (new GsonBuilder()).disableHtmlEscaping().create();
public static PrimitiveArgument<Short> shortArg() public static PrimitiveArgument<Short> shortArg()
{ {
return PrimitiveArgument.builder(string -> return PrimitiveArgument.builder(string ->
@@ -339,4 +348,21 @@ public class Arguments
{ {
return new DimensionArgument(); return new DimensionArgument();
} }
public static PrimitiveArgument<Style> style()
{
return PrimitiveArgument.<Style>builder(string ->
{
try
{
return ParserUtils.parseJson(new StringReader(string), Style.Serializer.CODEC);
}
catch(Exception e)
{
return null;
}
})
.serializer(style -> GSON.toJson(Util.getOrThrow(Style.Serializer.CODEC.encodeStart(JsonOps.INSTANCE, style), JsonParseException::new)))
.build();
}
} }

View File

@@ -338,6 +338,7 @@ public class ExecuteCommandBuilder extends CommandBuilder
private final PrimitiveArgument<String> targetObjective = Arguments.word(); private final PrimitiveArgument<String> targetObjective = Arguments.word();
private final PrimitiveArgument<String> sourceObjective = Arguments.word(); private final PrimitiveArgument<String> sourceObjective = Arguments.word();
private final RangeArgument<Integer> range = Arguments.intRange(); private final RangeArgument<Integer> range = Arguments.intRange();
private final PrimitiveArgument<ResourceLocation> function = Arguments.resourceLocation();
private final CommandNodeLiteral root; private final CommandNodeLiteral root;
public ConditionOptionalArgument(String condition, Label label) public ConditionOptionalArgument(String condition, Label label)
@@ -406,7 +407,10 @@ public class ExecuteCommandBuilder extends CommandBuilder
.label(Label.SCORE_GE)))) .label(Label.SCORE_GE))))
.then(CommandNode.literal("matches") .then(CommandNode.literal("matches")
.then(CommandNode.argument("range", this.range) .then(CommandNode.argument("range", this.range)
.label(Label.SCORE_MATCHES)))))); .label(Label.SCORE_MATCHES))))))
.then(CommandNode.literal("function")
.then(CommandNode.argument("function", this.function)
.label(Label.FUNCTION)));
} }
public BlockPosArgument pos() public BlockPosArgument pos()
@@ -469,6 +473,11 @@ public class ExecuteCommandBuilder extends CommandBuilder
return this.range; return this.range;
} }
public PrimitiveArgument<ResourceLocation> function()
{
return this.function;
}
@Override @Override
protected CommandNodeLiteral root() protected CommandNodeLiteral root()
{ {
@@ -492,7 +501,8 @@ public class ExecuteCommandBuilder extends CommandBuilder
SCORE_EQ, SCORE_EQ,
SCORE_GT, SCORE_GT,
SCORE_GE, SCORE_GE,
SCORE_MATCHES; SCORE_MATCHES,
FUNCTION;
} }
} }

View File

@@ -8,6 +8,7 @@ import exopandora.worldhandler.builder.argument.PrimitiveArgument;
import exopandora.worldhandler.builder.argument.PrimitiveArgument.Operation; import exopandora.worldhandler.builder.argument.PrimitiveArgument.Operation;
import exopandora.worldhandler.builder.argument.TargetArgument; import exopandora.worldhandler.builder.argument.TargetArgument;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.world.scores.criteria.ObjectiveCriteria.RenderType; import net.minecraft.world.scores.criteria.ObjectiveCriteria.RenderType;
public class ScoreboardCommandBuilder extends CommandBuilder public class ScoreboardCommandBuilder extends CommandBuilder
@@ -17,11 +18,13 @@ public class ScoreboardCommandBuilder extends CommandBuilder
private final PrimitiveArgument<Component> displayName = Arguments.textComponent(); private final PrimitiveArgument<Component> displayName = Arguments.textComponent();
private final PrimitiveArgument<String> slot = Arguments.word(); private final PrimitiveArgument<String> slot = Arguments.word();
private final PrimitiveArgument<RenderType> renderType = Arguments.renderType(); private final PrimitiveArgument<RenderType> renderType = Arguments.renderType();
private final PrimitiveArgument<Boolean> displayAutoUpdate = Arguments.boolArg();
private final TargetArgument target = Arguments.target(); private final TargetArgument target = Arguments.target();
private final TargetArgument targets = Arguments.target(); private final TargetArgument targets = Arguments.target();
private final PrimitiveArgument<Integer> score = Arguments.intArg(); private final PrimitiveArgument<Integer> score = Arguments.intArg();
private final PrimitiveArgument<Operation> operation = Arguments.operation(); private final PrimitiveArgument<Operation> operation = Arguments.operation();
private final PrimitiveArgument<String> sourceObjective = Arguments.word(); private final PrimitiveArgument<String> sourceObjective = Arguments.word();
private final PrimitiveArgument<Style> style = Arguments.style();
private final CommandNodeLiteral root = CommandNode.literal("scoreboard") private final CommandNodeLiteral root = CommandNode.literal("scoreboard")
.then(CommandNode.literal("objectives") .then(CommandNode.literal("objectives")
@@ -39,7 +42,18 @@ public class ScoreboardCommandBuilder extends CommandBuilder
.label(Label.OBJECTIVES_MODIFY_DISPLAYNAME))) .label(Label.OBJECTIVES_MODIFY_DISPLAYNAME)))
.then(CommandNode.literal("rendertype") .then(CommandNode.literal("rendertype")
.then(CommandNode.argument("renderType", this.renderType) .then(CommandNode.argument("renderType", this.renderType)
.label(Label.OBJECTIVES_MODIFY_RENDERTYPE))))) .label(Label.OBJECTIVES_MODIFY_RENDERTYPE)))
.then(CommandNode.literal("displayautoupdate")
.then(CommandNode.argument("displayAutoUpdate", this.displayAutoUpdate)
.label(Label.OBJECTIVES_MODIFY_DISPLAYAUTOUPDATE)))
.then(CommandNode.literal("numberformat")
.label(Label.OBJECTIVES_MODIFY_NUMBERFORMAT)
.then(CommandNode.argument("styled", this.style)
.label(Label.OBJECTIVES_MODIFY_NUMBERFORMAT_STYLED))
.then(CommandNode.argument("fixed", this.displayName)
.label(Label.OBJECTIVES_MODIFY_NUMBERFORMAT_FIXED))
.then(CommandNode.literal("blank")
.label(Label.OBJECTIVES_MODIFY_NUMBERFORMAT_BLANK)))))
.then(CommandNode.literal("remove") .then(CommandNode.literal("remove")
.then(CommandNode.argument("objective", this.objective) .then(CommandNode.argument("objective", this.objective)
.label(Label.OBJECTIVES_REMOVE))) .label(Label.OBJECTIVES_REMOVE)))
@@ -87,6 +101,23 @@ public class ScoreboardCommandBuilder extends CommandBuilder
.label(Label.PLAYERS_ENABLE) .label(Label.PLAYERS_ENABLE)
.then(CommandNode.argument("objective", this.objective) .then(CommandNode.argument("objective", this.objective)
.label(Label.PLAYERS_ENABLE_OBJECTIVE)))) .label(Label.PLAYERS_ENABLE_OBJECTIVE))))
.then(CommandNode.literal("display")
.then(CommandNode.literal("name")
.then(CommandNode.argument("targets", this.targets)
.then(CommandNode.argument("objective", this.objective)
.label(Label.PLAYERS_DISPLAY)
.then(CommandNode.argument("name", this.displayName)
.label(Label.PLAYERS_DISPLAY_NAME))))
.then(CommandNode.literal("numberformat")
.then(CommandNode.argument("targets", this.targets)
.then(CommandNode.argument("objective", this.objective)
.label(Label.PLAYERS_DISPLAY_NUMBERFORMAT)
.then(CommandNode.argument("styled", this.style)
.label(Label.PLAYERS_DISPLAY_NUMBERFORMAT_STYLED))
.then(CommandNode.argument("fixed", this.displayName)
.label(Label.PLAYERS_DISPLAY_NUMBERFORMAT_FIXED))
.then(CommandNode.literal("blank")
.label(Label.PLAYERS_DISPLAY_NUMBERFORMAT_BLANK)))))))
.then(CommandNode.literal("operation") .then(CommandNode.literal("operation")
.then(CommandNode.argument("targetObjective", this.objective) .then(CommandNode.argument("targetObjective", this.objective)
.then(CommandNode.argument("operation", this.operation) .then(CommandNode.argument("operation", this.operation)
@@ -144,6 +175,11 @@ public class ScoreboardCommandBuilder extends CommandBuilder
return this.sourceObjective; return this.sourceObjective;
} }
public PrimitiveArgument<Style> style()
{
return this.style;
}
@Override @Override
protected CommandNodeLiteral root() protected CommandNodeLiteral root()
{ {
@@ -157,6 +193,11 @@ public class ScoreboardCommandBuilder extends CommandBuilder
OBJECTIVES_ADD_DISPLAYNAME, OBJECTIVES_ADD_DISPLAYNAME,
OBJECTIVES_MODIFY_DISPLAYNAME, OBJECTIVES_MODIFY_DISPLAYNAME,
OBJECTIVES_MODIFY_RENDERTYPE, OBJECTIVES_MODIFY_RENDERTYPE,
OBJECTIVES_MODIFY_DISPLAYAUTOUPDATE,
OBJECTIVES_MODIFY_NUMBERFORMAT,
OBJECTIVES_MODIFY_NUMBERFORMAT_STYLED,
OBJECTIVES_MODIFY_NUMBERFORMAT_FIXED,
OBJECTIVES_MODIFY_NUMBERFORMAT_BLANK,
OBJECTIVES_REMOVE, OBJECTIVES_REMOVE,
OBJECTIVES_SETDISPLAY_SLOT, OBJECTIVES_SETDISPLAY_SLOT,
OBJECTIVES_SETDISPLAY_SLOT_OBJECTIVE, OBJECTIVES_SETDISPLAY_SLOT_OBJECTIVE,
@@ -170,6 +211,12 @@ public class ScoreboardCommandBuilder extends CommandBuilder
PLAYERS_RESET_SCORE, PLAYERS_RESET_SCORE,
PLAYERS_ENABLE, PLAYERS_ENABLE,
PLAYERS_ENABLE_OBJECTIVE, PLAYERS_ENABLE_OBJECTIVE,
PLAYERS_OPERATION; PLAYERS_OPERATION,
PLAYERS_DISPLAY,
PLAYERS_DISPLAY_NAME,
PLAYERS_DISPLAY_NUMBERFORMAT,
PLAYERS_DISPLAY_NUMBERFORMAT_STYLED,
PLAYERS_DISPLAY_NUMBERFORMAT_FIXED,
PLAYERS_DISPLAY_NUMBERFORMAT_BLANK;
} }
} }

View File

@@ -86,7 +86,10 @@ public class ContentChangeWorld extends ContentChild
} }
else if(connection instanceof IntegratedConnection integrated) else if(connection instanceof IntegratedConnection integrated)
{ {
Minecraft.getInstance().createWorldOpenFlows().loadLevel(new TitleScreen(), integrated.getFolder()); Minecraft.getInstance().createWorldOpenFlows().checkForBackupAndLoad(integrated.getFolder(), () ->
{
Minecraft.getInstance().setScreen(new TitleScreen());
});
Minecraft.getInstance().mouseHandler.grabMouse(); Minecraft.getInstance().mouseHandler.grabMouse();
} }
else if(connection instanceof DedicatedConnection dedicated) else if(connection instanceof DedicatedConnection dedicated)

View File

@@ -23,9 +23,9 @@ public class GuiHintTextField extends EditBox
} }
@Override @Override
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks)
{ {
super.render(guiGraphics, mouseX, mouseY, partialTicks); super.renderWidget(guiGraphics, mouseX, mouseY, partialTicks);
if(this.isVisible() && !this.isFocused() && this.hint != null && ChatFormatting.stripFormatting(this.getValue()).isEmpty()) if(this.isVisible() && !this.isFocused() && this.hint != null && ChatFormatting.stripFormatting(this.getValue()).isEmpty())
{ {

View File

@@ -12,7 +12,7 @@ import net.minecraft.network.chat.ClickEvent.Action;
import net.minecraft.network.chat.ComponentContents; import net.minecraft.network.chat.ComponentContents;
import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.Style; import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.contents.LiteralContents; import net.minecraft.network.chat.contents.PlainTextContents;
public class UserStylableComponent extends MutableComponent public class UserStylableComponent extends MutableComponent
{ {
@@ -20,7 +20,7 @@ public class UserStylableComponent extends MutableComponent
public UserStylableComponent() public UserStylableComponent()
{ {
super(ComponentContents.EMPTY, Lists.newArrayList(), Style.EMPTY); super(PlainTextContents.EMPTY, Lists.newArrayList(), Style.EMPTY);
} }
public void setText(String text) public void setText(String text)
@@ -66,10 +66,10 @@ public class UserStylableComponent extends MutableComponent
{ {
if(this.isStyled()) if(this.isStyled())
{ {
return new LiteralContents(applyStyleFormatting(this.text)); return PlainTextContents.create(applyStyleFormatting(this.text));
} }
return new LiteralContents(this.text); return PlainTextContents.create(this.text);
} }
public boolean isStyled() public boolean isStyled()

View File

@@ -1,5 +1,5 @@
modLoader="javafml" modLoader="javafml"
loaderVersion="[48,)" loaderVersion="[49,)"
updateJSONURL="https://raw.githubusercontent.com/Exopandora/worldhandler/master/version.json" updateJSONURL="https://raw.githubusercontent.com/Exopandora/worldhandler/master/version.json"
issueTrackerURL="https://github.com/Exopandora/WorldHandler/issues" issueTrackerURL="https://github.com/Exopandora/WorldHandler/issues"
displayURL="https://minecraft.curseforge.com/projects/world-handler-command-gui" displayURL="https://minecraft.curseforge.com/projects/world-handler-command-gui"
@@ -11,13 +11,13 @@ license="GPL v3.0"
[[mods]] [[mods]]
modId="worldhandler" modId="worldhandler"
version="1.20.2-${version}" version="1.20.4-${version}"
displayName="World Handler" displayName="World Handler"
description="The World Handler provides a simple and easy to use graphical user interface for commands. It lets you create powerful and complex sub-commands alongside NBT-structures within seconds." description="The World Handler provides a simple and easy to use graphical user interface for commands. It lets you create powerful and complex sub-commands alongside NBT-structures within seconds."
[[dependencies.worldhandler]] [[dependencies.worldhandler]]
modId="minecraft" modId="minecraft"
mandatory=true mandatory=true
versionRange="[1.20.2,)" versionRange="[1.20.3,)"
ordering="NONE" ordering="NONE"
side="BOTH" side="BOTH"

View File

@@ -1,6 +1,6 @@
{ {
"pack": { "pack": {
"description": "World Handler", "description": "World Handler",
"pack_format": 18 "pack_format": 22
} }
} }