mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-20 12:20:11 +00:00
Fixes ChatScreen calling .setScreen (#9443)
Fix test compile failures also.
This commit is contained in:
1 parent
d4f211b815
commit
0ae63b0b07
4 files changed
+51
-3
No files matched your search
@@ -16,6 +16,7 @@ import net.minecraft.commands.arguments.TeamArgument;
|
||||
import net.minecraft.commands.arguments.coordinates.BlockPosArgument;
|
||||
import net.minecraft.commands.synchronization.SuggestionProviders;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraftforge.debug.client.TestScreen;
|
||||
import net.minecraftforge.client.event.RegisterClientCommandsEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@@ -104,7 +105,10 @@ public class ClientCommandTest
|
||||
.executes((context) -> {
|
||||
context.getSource().sendSuccess(Component.literal("Executed command"), false);
|
||||
return 1;
|
||||
})));
|
||||
}))
|
||||
// Used for testing the screen after using commands
|
||||
.then(Commands.literal("screentest")
|
||||
.executes((stack) -> TestScreen.open())));
|
||||
|
||||
// Used for testing that client command redirects can only be used with client commands
|
||||
LiteralArgumentBuilder<CommandSourceStack> fork = Commands.literal("clientcommandfork");
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.debug.client;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.brigadier.Command;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
public class TestScreen extends Screen
|
||||
{
|
||||
public static int open()
|
||||
{
|
||||
Minecraft.getInstance().setScreen(new TestScreen());
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
public TestScreen()
|
||||
{
|
||||
super(Component.literal("testscreen"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack PoseStack, int MouseX, int MouseY, float PartialTick)
|
||||
{
|
||||
renderBackground(PoseStack);
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,7 @@ import java.util.stream.Collectors;
|
||||
* To test if the packet is too large simply remove the login packet from the {@link net.minecraftforge.network.filters.ForgeConnectionNetworkFilter}
|
||||
* and try connecting again. You should see the connection fail.
|
||||
*/
|
||||
|
||||
@Mod(LoginPacketSplitTest.MOD_ID)
|
||||
public class LoginPacketSplitTest
|
||||
{
|
||||
@@ -133,7 +134,7 @@ public class LoginPacketSplitTest
|
||||
record RegistryData(Registry<BigData> registry)
|
||||
{
|
||||
}
|
||||
buf.writeWithCodec(RecordCodecBuilder.create(in -> in.group(
|
||||
buf.writeJsonWithCodec(RecordCodecBuilder.create(in -> in.group(
|
||||
RegistryCodecs.networkCodec(BIG_DATA, Lifecycle.stable(), BigData.CODEC).fieldOf("registry").forGetter(RegistryData::registry)
|
||||
).apply(in, RegistryData::new)), new RegistryData(dummyRegistry)); // RegistryCodecs.networkCodec returns a list codec, and writeWithNbt doesn't like non-compounds
|
||||
|
||||
@@ -174,7 +175,7 @@ public class LoginPacketSplitTest
|
||||
final JsonObject mcmeta = new JsonObject();
|
||||
final JsonObject packJson = new JsonObject();
|
||||
packJson.addProperty("description", "A virtual resource pack.");
|
||||
packJson.addProperty("pack_format", SharedConstants.getCurrentVersion().getPackVersion(com.mojang.bridge.game.PackType.DATA));
|
||||
packJson.addProperty("pack_format", SharedConstants.getCurrentVersion().getPackVersion(PackType.SERVER_DATA));
|
||||
mcmeta.add("pack", packJson);
|
||||
|
||||
putRoot("pack.mcmeta", mcmeta);
|
||||
|
||||
Reference in new issue
Block a user