Update to 1.18.2
Swapped arguments for wh replace
This commit is contained in:
@@ -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";
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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, () -> () ->
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 ->
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user