Skip to content

Commit

Permalink
Update to Minecraft 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
IzzelAliz committed Dec 9, 2023
1 parent 5e1b3b3 commit fca7585
Show file tree
Hide file tree
Showing 77 changed files with 864 additions and 952 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ A Bukkit server implementation utilizing Mixin.

![Downloads](https://img.shields.io/github/downloads/IzzelAliz/Arclight/total?style=flat-square) ![GitHub](https://img.shields.io/github/license/IzzelAliz/Arclight?style=flat-square)

| Release | Forge | Status | Build |
|:--------------------:|:-------:|:------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| Net (1.20.2) | 48.1.0 | ACTIVE | [![1.20.2 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=Net&style=flat-square)](https://github.com/IzzelAliz/Arclight/actions?query=branch%3ANet) |
| Trials (1.20-1.20.1) | 47.2.16 | LTS | [![1.20.1 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=Trials&style=flat-square)](https://github.com/IzzelAliz/Arclight/actions?query=branch%3ATrials) |
| Horn (1.19-1.19.2) | 43.3.2 | LTS | [![Horn Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-19?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-19) |
| Release | Forge | Status | Build |
|:--------------------:|:-------:|:------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| Whisper (1.20.4) | 49.0.3 | ACTIVE | [![1.20.4 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=Whisper&style=flat-square)](https://github.com/IzzelAliz/Arclight/actions?query=branch%3AWhisper) |
| Trials (1.20-1.20.1) | 47.2.16 | LTS | [![1.20.1 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=Trials&style=flat-square)](https://github.com/IzzelAliz/Arclight/actions?query=branch%3ATrials) |
| Horn (1.19-1.19.2) | 43.3.2 | LTS | [![Horn Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-19?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-19) |

**Legacy versions**:

<details>

| Release | Forge | Status | Build |
|:-------------------:|:-------:|:-------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| Net (1.20.2) | 48.1.0 | [LEGACY](https://github.com/IzzelAliz/Arclight/releases/tag/Net%2F1.0.1) | [![1.20.2 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=Net&style=flat-square)](https://github.com/IzzelAliz/Arclight/actions?query=branch%3ANet) |
| Executions (1.19.4) | 45.2.6 | [LEGACY](https://github.com/IzzelAliz/Arclight/releases/tag/Executions%2F1.0.6) | [![1.19.4 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=Executions&style=flat-square)](https://github.com/IzzelAliz/Arclight/actions?query=branch%3AExecutions) |
| Great Horn (1.19.3) | 44.1.22 | [LEGACY](https://github.com/IzzelAliz/Arclight/releases/tag/GreatHorn/1.0.3) | [![1.19 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=GreatHorn&style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-19) |
| 1.18.x | 40.2.14 | [LEGACY](https://github.com/IzzelAliz/Arclight/releases/tag/1.18%2F1.0.10) | [![1.18 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=1.18&style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-18) |
Expand Down
2 changes: 1 addition & 1 deletion arclight-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ apply plugin: 'io.izzel.arclight'
arclight {
mcVersion = minecraftVersion
forgeVersion = project.ext.forgeVersion
bukkitVersion = 'v1_20_R2'
bukkitVersion = 'v1_20_R3'
wipeVersion = true
reobfVersion = true
accessTransformer = project.file('bukkit.at')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ public interface ExplosionBridge {
Explosion.BlockInteraction bridge$getMode();

boolean bridge$wasCancelled();

float bridge$getYield();
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public CraftHumanEntityMixin(CraftServer server, Entity entity) {
super(server, entity);
}

@Redirect(method = "<init>", at = @At(value = "NEW", target = "org/bukkit/permissions/PermissibleBase"))
@Redirect(method = "<init>", at = @At(value = "NEW", target = "(Lorg/bukkit/permissions/ServerOperator;)Lorg/bukkit/permissions/PermissibleBase;"))
private PermissibleBase arclight$forwardPerm(ServerOperator opable) {
if (ArclightConfig.spec().getCompat().isForwardPermissionReverse()) {
return new ArclightForgePermissible(opable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.google.common.collect.ImmutableSet;
import io.izzel.arclight.common.bridge.bukkit.ItemMetaBridge;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtAccounter;
import net.minecraft.nbt.NbtIo;
import net.minecraft.nbt.Tag;
import org.apache.commons.codec.binary.Base64;
Expand Down Expand Up @@ -168,7 +169,7 @@ public class CraftMetaItemMixin implements ItemMetaBridge {
Object forgeCaps = map.get("forgeCaps");
try {
ByteArrayInputStream buf = new ByteArrayInputStream(Base64.decodeBase64(forgeCaps.toString()));
this.forgeCaps = NbtIo.readCompressed(buf);
this.forgeCaps = NbtIo.readCompressed(buf, NbtAccounter.unlimitedHeap());
} catch (IOException e) {
LogManager.getLogger(getClass()).error("Reading forge caps", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@Mixin(JavaPlugin.class)
public class JavaPluginMixin {

@Redirect(method = "init", remap = false, at = @At(value = "NEW", target = "org/bukkit/plugin/PluginLogger"))
@Redirect(method = "init", remap = false, at = @At(value = "NEW", target = "(Lorg/bukkit/plugin/Plugin;)Lorg/bukkit/plugin/PluginLogger;"))
private PluginLogger arclight$createLogger(Plugin plugin) {
return new ArclightPluginLogger(plugin);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import io.izzel.arclight.common.mod.util.BukkitDispatcher;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.commands.ExecutionCommandSource;
import net.minecraft.commands.SharedSuggestionProvider;
import net.minecraft.commands.synchronization.SuggestionProviders;
import net.minecraft.network.protocol.game.ClientboundCommandsPacket;
Expand All @@ -34,23 +35,23 @@
public abstract class CommandsMixin {

// @formatter:off
@Shadow public abstract int performCommand(ParseResults<CommandSourceStack> p_242844_, String p_242841_);
@Shadow public abstract int performPrefixedCommand(CommandSourceStack p_230958_, String p_230959_);
@Shadow public abstract void performCommand(ParseResults<CommandSourceStack> p_242844_, String p_242841_);
@Shadow public abstract void performPrefixedCommand(CommandSourceStack p_230958_, String p_230959_);
@Mutable @Shadow @Final private CommandDispatcher<CommandSourceStack> dispatcher;
@Shadow protected abstract void fillUsableCommands(CommandNode<CommandSourceStack> rootCommandSource, CommandNode<SharedSuggestionProvider> rootSuggestion, CommandSourceStack source, Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> commandNodeToSuggestionNode);
// @formatter:on

public void arclight$constructor() {
this.dispatcher = new BukkitDispatcher((Commands) (Object) this);
this.dispatcher.setConsumer((context, b, i) -> context.getSource().onCommandComplete(context, b, i));
this.dispatcher.setConsumer(ExecutionCommandSource.resultConsumer());
}

public int performPrefixedCommand(CommandSourceStack commandSourceStack, String s, String label) {
return this.performPrefixedCommand(commandSourceStack, s);
public void performPrefixedCommand(CommandSourceStack commandSourceStack, String s, String label) {
this.performPrefixedCommand(commandSourceStack, s);
}

public int performCommand(ParseResults<CommandSourceStack> parseResults, String s, String label) {
return this.performCommand(parseResults, s);
public void performCommand(ParseResults<CommandSourceStack> parseResults, String s, String label) {
this.performCommand(parseResults, s);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,6 @@ protected Object evaluate() {

@Inject(method = "handleResourcePackResponse", at = @At("RETURN"))
private void arclight$handleResourcePackStatus(ServerboundResourcePackPacket packetIn, CallbackInfo ci) {
this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), PlayerResourcePackStatusEvent.Status.values()[packetIn.getAction().ordinal()]));
this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), packetIn.id(), PlayerResourcePackStatusEvent.Status.values()[packetIn.action().ordinal()]));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void handleIntention(ClientIntentionPacket packetIn) {
synchronized (throttleTracker) {
if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) {
throttleTracker.put(address, currentTime);
var component = Component.translatable("Connection throttled! Please wait before reconnecting.");
var component = Component.literal("Connection throttled! Please wait before reconnecting.");
this.connection.send(new ClientboundLoginDisconnectPacket(component));
this.connection.disconnect(component);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import io.izzel.arclight.common.bridge.core.network.common.ServerCommonPacketListenerBridge;
import io.izzel.arclight.common.bridge.core.server.MinecraftServerBridge;
import io.izzel.arclight.common.bridge.core.server.management.PlayerListBridge;
import io.izzel.arclight.i18n.ArclightConfig;
import net.minecraft.DefaultUncaughtExceptionHandler;
import net.minecraft.core.UUIDUtil;
import net.minecraft.network.Connection;
Expand All @@ -24,6 +23,7 @@
import net.minecraft.server.players.PlayerList;
import net.minecraft.util.Crypt;
import net.minecraft.util.CryptException;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.fml.util.thread.SidedThreadGroups;
import org.apache.commons.lang3.Validate;
import org.bukkit.Bukkit;
Expand Down Expand Up @@ -54,8 +54,6 @@
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;

import static net.minecraft.server.network.ServerLoginPacketListenerImpl.isValidUsername;

@Mixin(ServerLoginPacketListenerImpl.class)
public abstract class ServerLoginNetHandlerMixin {

Expand All @@ -82,19 +80,14 @@ public void disconnect(final String s) {
this.disconnect(Component.literal(s));
}

private static boolean arclight$validUsernameCheck(String name) {
var regex = ArclightConfig.spec().getCompat().getValidUsernameRegex();
return !regex.isBlank() && name.matches(regex);
}

/**
* @author IzzelAliz
* @reason
*/
@Overwrite
public void handleHello(ServerboundHelloPacket packetIn) {
Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet");
Validate.validState(arclight$validUsernameCheck(packetIn.name()) || isValidUsername(packetIn.name()), "Invalid characters in username");
Validate.validState(Player.isValidUsername(packetIn.name()), "Invalid characters in username");
this.requestedUsername = packetIn.name();
GameProfile gameprofile = this.server.getSingleplayerProfile();
if (gameprofile != null && this.requestedUsername.equalsIgnoreCase(gameprofile.getName())) {
Expand Down
Loading

0 comments on commit fca7585

Please sign in to comment.