Update to 1.18.2

Swapped arguments for wh replace
This commit is contained in:
Marcel Konrad
2022-03-03 21:45:13 +01:00
parent a8c84ed3ad
commit a65d4a6213
10 changed files with 21 additions and 51 deletions

View File

@@ -15,7 +15,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
version = '1.18.1-3.0.1'
version = '1.18.2-3.0.1'
group = 'exopandora.worldhandler' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'WorldHandler'
@@ -34,7 +34,7 @@ minecraft {
//
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'official', version: '1.18.1'
mappings channel: 'official', version: '1.18.2'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
@@ -106,7 +106,7 @@ dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.18.1-39.0.0'
minecraft 'net.minecraftforge:forge:1.18.2-40.0.2'
// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"

View File

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

View File

@@ -139,7 +139,7 @@ public class BlockPredicateArgument extends TagArgument
}
else
{
this.resource = parser.getTag();
this.resource = parser.getTag().location();
this.isTag = true;
this.properties = parser.getVagueProperties();
this.setTag(parser.getNbt());

View File

@@ -70,7 +70,7 @@ public class ItemPredicateArgument extends TagArgument
}
else
{
this.resource = parser.getTag();
this.resource = parser.getTag().location();
this.setTag(parser.getNbt());
this.isTag = true;
}

View File

@@ -40,9 +40,9 @@ public class CommandWH
.executes(context -> fill(context.getSource(), BlockStateArgument.getBlock(context, "block")))))
.then(Commands.literal("replace")
.requires(source -> source.hasPermission(2))
.then(Commands.argument("block", BlockStateArgument.block())
.then(Commands.argument("filter", BlockPredicateArgument.blockPredicate())
.executes(context -> replace(context.getSource(), BlockStateArgument.getBlock(context, "block"), getCommandNode("filter", context.getNodes()).getRange().get(context.getInput()))))))
.then(Commands.argument("filter", BlockPredicateArgument.blockPredicate())
.then(Commands.argument("block", BlockStateArgument.block())
.executes(context -> replace(context.getSource(), getCommandNode("filter", context.getNodes()).getRange().get(context.getInput()), BlockStateArgument.getBlock(context, "block"))))))
.then(Commands.literal("clone")
.requires(source -> source.hasPermission(2))
.executes(context -> clone(context.getSource(), "masked", null))
@@ -95,7 +95,7 @@ public class CommandWH
return 1;
}
private static int replace(CommandSourceStack source, BlockInput block, String filter)
private static int replace(CommandSourceStack source, String filter, BlockInput block)
{
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
{

View File

@@ -18,12 +18,8 @@ import net.minecraft.client.gui.screens.multiplayer.SafetyScreen;
import net.minecraft.client.gui.screens.worldselection.SelectWorldScreen;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.multiplayer.resolver.ServerAddress;
import net.minecraft.client.server.IntegratedServer;
import net.minecraft.core.RegistryAccess;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.level.LevelSettings;
import net.minecraft.world.level.levelgen.WorldGenSettings;
public class ContentChangeWorld extends ContentChild
{
@@ -63,15 +59,11 @@ public class ContentChangeWorld extends ContentChild
if(isIntegrated)
{
IntegratedServer integrated = Minecraft.getInstance().getSingleplayerServer();
String folder = integrated.storageSource.getLevelId();
WorldGenSettings worldGenSettings = integrated.getWorldData().worldGenSettings();
LevelSettings levelSettings = integrated.getWorldData().getLevelSettings();
String folder = Minecraft.getInstance().getSingleplayerServer().storageSource.getLevelId();
Minecraft.getInstance().level.disconnect();
Minecraft.getInstance().clearLevel(new GenericDirtMessageScreen(new TranslatableComponent("menu.savingLevel")));
return new IntegratedConnection(folder, levelSettings, worldGenSettings);
return new IntegratedConnection(folder);
}
if(Minecraft.getInstance().level != null)
@@ -94,15 +86,13 @@ public class ContentChangeWorld extends ContentChild
{
Minecraft.getInstance().setScreen(new RealmsMainScreen(new TitleScreen()));
}
else if(connection instanceof IntegratedConnection)
else if(connection instanceof IntegratedConnection integrated)
{
IntegratedConnection integrated = (IntegratedConnection) connection;
Minecraft.getInstance().createLevel(integrated.getFolder(), integrated.getWorldSettings(), RegistryAccess.builtin(), integrated.getWorldGenSettings());
Minecraft.getInstance().loadLevel(integrated.getFolder());;
Minecraft.getInstance().mouseHandler.grabMouse();
}
else if(connection instanceof DedicatedConnection)
else if(connection instanceof DedicatedConnection dedicated)
{
DedicatedConnection dedicated = (DedicatedConnection) connection;
ServerData data = dedicated.getData();
ConnectScreen.startConnecting(new TitleScreen(), Minecraft.getInstance(), ServerAddress.parseString(data.ip), data);
}

View File

@@ -13,8 +13,8 @@ import net.minecraft.server.packs.PackResources;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.repository.Pack;
import net.minecraft.server.packs.resources.PreparableReloadListener;
import net.minecraft.server.packs.resources.ReloadableResourceManager;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.server.packs.resources.SimpleReloadableResourceManager;
import net.minecraft.util.Unit;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.storage.loot.PredicateManager;
@@ -29,7 +29,7 @@ public class AdvancementHelper implements PreparableReloadListener
{
return CompletableFuture.supplyAsync(() ->
{
SimpleReloadableResourceManager serverResourceManager = new SimpleReloadableResourceManager(PackType.SERVER_DATA);
ReloadableResourceManager serverResourceManager = new ReloadableResourceManager(PackType.SERVER_DATA);
serverResourceManager.registerReloadListener(this.manager);
return serverResourceManager;
}).thenCompose(stage::wait).thenAcceptAsync(serverResourceManager ->

View File

@@ -1,38 +1,22 @@
package exopandora.worldhandler.util;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.world.level.LevelSettings;
import net.minecraft.world.level.levelgen.WorldGenSettings;
public interface IConnection
{
public static class IntegratedConnection implements IConnection
{
private final String folder;
private final LevelSettings levelSettings;
private final WorldGenSettings worldGenSettings;
public IntegratedConnection(String folderName, LevelSettings levelSettings, WorldGenSettings worldGenSettings)
public IntegratedConnection(String folderName)
{
this.folder = folderName;
this.levelSettings = levelSettings;
this.worldGenSettings = worldGenSettings;
}
public String getFolder()
{
return this.folder;
}
public LevelSettings getWorldSettings()
{
return this.levelSettings;
}
public WorldGenSettings getWorldGenSettings()
{
return this.worldGenSettings;
}
}
public static class DedicatedConnection implements IConnection

View File

@@ -7,15 +7,12 @@ import java.util.function.Function;
import javax.annotation.Nullable;
import exopandora.worldhandler.Main;
import net.minecraft.core.Registry;
import net.minecraft.core.RegistryAccess;
import net.minecraft.locale.Language;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.ForgeRegistryEntry;
@@ -33,8 +30,7 @@ public class RegistryHelper
registerRegistry(ForgeRegistries.MOB_EFFECTS, MobEffect::getDescriptionId);
registerRegistry(ForgeRegistries.BIOMES, biome ->
{
Registry<Biome> registry = RegistryAccess.builtin().registryOrThrow(Registry.BIOME_REGISTRY);
ResourceLocation resource = registry.getKey(biome);
ResourceLocation resource = biome.getRegistryName();
String key = "biome." + biome.getRegistryName().getNamespace() + "." + resource.getPath();
return Language.getInstance().has(key) ? key : resource.toString();
});

View File

@@ -1,5 +1,5 @@
modLoader="javafml"
loaderVersion="[39,)"
loaderVersion="[40,)"
updateJSONURL="https://raw.githubusercontent.com/Exopandora/worldhandler/master/version.json"
issueTrackerURL="https://github.com/Exopandora/WorldHandler/issues"
displayURL="https://minecraft.curseforge.com/projects/world-handler-command-gui"
@@ -11,7 +11,7 @@ license="GPL v3.0"
[[mods]]
modId="worldhandler"
version="1.18.1-3.0.1"
version="1.18.2-3.0.1"
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."