1.20.2-pre1

This commit is contained in:
LexManos committed 2023-09-08 10:56:10 -07:00
1 parent 12d24df4f6
commit 3edefbe33e
368 files changed
+3555 -6356

No files matched your search

@@ -5,8 +5,7 @@
package net.minecraftforge.client;
import net.minecraft.Util;
import net.minecraft.advancements.Advancement;
import net.minecraft.advancements.AdvancementHolder;
import net.minecraft.client.Minecraft;
import net.minecraft.commands.CommandSource;
import net.minecraft.commands.CommandSourceStack;
@@ -32,30 +31,26 @@ import java.util.stream.Stream;
/**
* overrides for {@link CommandSourceStack} so that the methods will run successfully client side
*/
public class ClientCommandSourceStack extends CommandSourceStack
{
public ClientCommandSourceStack(CommandSource source, Vec3 position, Vec2 rotation, int permission, String plainTextName, Component displayName,
Entity executing)
{
public class ClientCommandSourceStack extends CommandSourceStack {
public ClientCommandSourceStack(CommandSource source, Vec3 position, Vec2 rotation, int permission, String plainTextName, Component displayName, Entity executing) {
super(source, position, rotation, null, permission, plainTextName, displayName, null, executing);
}
/**
* Sends a success message without attempting to get the server side list of admins
*/
@SuppressWarnings("resource")
@Override
public void sendSuccess(Supplier<Component> message, boolean sendToAdmins)
{
public void sendSuccess(Supplier<Component> message, boolean sendToAdmins) {
Minecraft.getInstance().player.sendSystemMessage(message.get());
}
/**
* {@return the list of teams from the client side}
*/
@SuppressWarnings("resource")
@Override
public Collection<String> getAllTeams()
{
public Collection<String> getAllTeams() {
return Minecraft.getInstance().level.getScoreboard().getTeamNames();
}
@@ -63,8 +58,7 @@ public class ClientCommandSourceStack extends CommandSourceStack
* {@return the list of online player names from the client side}
*/
@Override
public Collection<String> getOnlinePlayerNames()
{
public Collection<String> getOnlinePlayerNames() {
return Minecraft.getInstance().getConnection().getOnlinePlayers().stream().map((player) -> player.getProfile().getName()).collect(Collectors.toList());
}
@@ -72,8 +66,7 @@ public class ClientCommandSourceStack extends CommandSourceStack
* {@return a {@link Stream} of recipe ids that are available on the client}
*/
@Override
public Stream<ResourceLocation> getRecipeNames()
{
public Stream<ResourceLocation> getRecipeNames() {
return Minecraft.getInstance().getConnection().getRecipeManager().getRecipeIds();
}
@@ -81,8 +74,7 @@ public class ClientCommandSourceStack extends CommandSourceStack
* {@return a set of {@link ResourceKey} for levels from the client side}
*/
@Override
public Set<ResourceKey<Level>> levels()
{
public Set<ResourceKey<Level>> levels() {
return Minecraft.getInstance().getConnection().levels();
}
@@ -90,17 +82,16 @@ public class ClientCommandSourceStack extends CommandSourceStack
* {@return the {@link RegistryAccess} from the client side}
*/
@Override
public RegistryAccess registryAccess()
{
public RegistryAccess registryAccess() {
return Minecraft.getInstance().getConnection().registryAccess();
}
/**
* {@return the scoreboard from the client side}
*/
@SuppressWarnings("resource")
@Override
public Scoreboard getScoreboard()
{
public Scoreboard getScoreboard() {
return Minecraft.getInstance().level.getScoreboard();
}
@@ -108,26 +99,24 @@ public class ClientCommandSourceStack extends CommandSourceStack
* {@return the advancement from the id from the client side where the advancement needs to be visible to the player}
*/
@Override
public Advancement getAdvancement(ResourceLocation id)
{
return Minecraft.getInstance().getConnection().getAdvancements().getAdvancements().get(id);
public AdvancementHolder getAdvancement(ResourceLocation id) {
return Minecraft.getInstance().getConnection().getAdvancements().get(id);
}
/**
* {@return the {@link RecipeManager} from the client side}
*/
@Override
public RecipeManager getRecipeManager()
{
public RecipeManager getRecipeManager() {
return Minecraft.getInstance().getConnection().getRecipeManager();
}
/**
* {@return the level from the client side}
*/
@SuppressWarnings("resource")
@Override
public Level getUnsidedLevel()
{
public Level getUnsidedLevel() {
return Minecraft.getInstance().level;
}
@@ -136,8 +125,7 @@ public class ClientCommandSourceStack extends CommandSourceStack
* because the server isn't available on the client
*/
@Override
public MinecraftServer getServer()
{
public MinecraftServer getServer() {
throw new UnsupportedOperationException("Attempted to get server in client command");
}
@@ -146,9 +134,7 @@ public class ClientCommandSourceStack extends CommandSourceStack
* because the server side level isn't available on the client side
*/
@Override
public ServerLevel getLevel()
{
public ServerLevel getLevel() {
throw new UnsupportedOperationException("Attempted to get server level in client command");
}
}