[PORT] 25w31a
This commit is contained in:
@@ -4,8 +4,7 @@ import com.hypherionmc.craterlib.core.networking.data.PacketHolder;
|
||||
import com.hypherionmc.craterlib.nojang.network.BridgedFriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
|
||||
public record CommonPacketWrapper<T>(PacketHolder<T> container, T packet) implements CustomPacketPayload
|
||||
{
|
||||
public record CommonPacketWrapper<T>(PacketHolder<T> container, T packet) implements CustomPacketPayload {
|
||||
public void encode(BridgedFriendlyByteBuf buf)
|
||||
{
|
||||
container().encoder().accept(packet(), buf);
|
||||
|
@@ -342,9 +342,9 @@ public class CraterConfigScreen extends Screen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double d, double e, int i) {
|
||||
public boolean mouseClicked(double d, double e, int i, boolean bl) {
|
||||
this.dragging = i == 0 && d >= width - 6 && d < width;
|
||||
return super.mouseClicked(d, e, i) || dragging;
|
||||
return super.mouseClicked(d, e, i, bl);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -12,6 +12,7 @@ import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.network.CommonListenerCookie;
|
||||
import net.minecraft.server.players.NameAndId;
|
||||
import net.minecraft.server.players.PlayerList;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -43,8 +44,8 @@ public class PlayerListMixin {
|
||||
}
|
||||
|
||||
@Inject(method = "canPlayerLogin", at = @At("HEAD"), cancellable = true)
|
||||
private void injectPreLoginEvent(SocketAddress address, GameProfile gameProfile, CallbackInfoReturnable<Component> cir) {
|
||||
PlayerPreLoginEvent event = new PlayerPreLoginEvent(address, BridgedGameProfile.of(gameProfile));
|
||||
private void injectPreLoginEvent(SocketAddress socketAddress, NameAndId arg, CallbackInfoReturnable<Component> cir) {
|
||||
PlayerPreLoginEvent event = new PlayerPreLoginEvent(socketAddress, BridgedGameProfile.of(arg));
|
||||
CraterEventBus.INSTANCE.postEvent(event);
|
||||
if (event.getMessage() != null) {
|
||||
cir.setReturnValue(ChatUtils.adventureToMojang(event.getMessage()));
|
||||
|
@@ -2,6 +2,7 @@ package com.hypherionmc.craterlib.nojang.authlib;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.minecraft.server.players.NameAndId;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -14,6 +15,10 @@ public class BridgedGameProfile {
|
||||
return new BridgedGameProfile(new GameProfile(id, name));
|
||||
}
|
||||
|
||||
public static BridgedGameProfile of(NameAndId nameAndId) {
|
||||
return BridgedGameProfile.of(new GameProfile(nameAndId.id(), nameAndId.name()));
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return internal.getName();
|
||||
}
|
||||
@@ -26,4 +31,8 @@ public class BridgedGameProfile {
|
||||
return internal;
|
||||
}
|
||||
|
||||
public NameAndId toNameAndId() {
|
||||
return new NameAndId(internal);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ public class BridgedScreen {
|
||||
}
|
||||
|
||||
public boolean isLoadingScreen() {
|
||||
return internal instanceof LevelLoadingScreen || internal instanceof ReceivingLevelScreen;
|
||||
return internal instanceof LevelLoadingScreen || internal instanceof ConnectScreen;
|
||||
}
|
||||
|
||||
public boolean isPauseScreen() {
|
||||
|
@@ -50,21 +50,21 @@ public class BridgedMinecraftServer {
|
||||
}
|
||||
|
||||
public boolean isPlayerBanned(BridgedGameProfile profile) {
|
||||
return internal.getPlayerList().getBans().isBanned(profile.toMojang());
|
||||
return internal.getPlayerList().getBans().isBanned(profile.toNameAndId());
|
||||
}
|
||||
|
||||
public void whitelistPlayer(BridgedGameProfile gameProfile) {
|
||||
if (!internal.getPlayerList().isUsingWhitelist())
|
||||
return;
|
||||
|
||||
internal.getPlayerList().getWhiteList().add(new UserWhiteListEntry(gameProfile.toMojang()));
|
||||
internal.getPlayerList().getWhiteList().add(new UserWhiteListEntry(gameProfile.toNameAndId()));
|
||||
}
|
||||
|
||||
public void unWhitelistPlayer(BridgedGameProfile gameProfile) {
|
||||
if (!internal.getPlayerList().isUsingWhitelist())
|
||||
return;
|
||||
|
||||
internal.getPlayerList().getWhiteList().remove(new UserWhiteListEntry(gameProfile.toMojang()));
|
||||
internal.getPlayerList().getWhiteList().remove(new UserWhiteListEntry(gameProfile.toNameAndId()));
|
||||
}
|
||||
|
||||
public List<BridgedPlayer> getPlayers() {
|
||||
@@ -83,7 +83,7 @@ public class BridgedMinecraftServer {
|
||||
}
|
||||
|
||||
public void banPlayer(BridgedGameProfile profile) {
|
||||
internal.getPlayerList().getBans().add(new UserBanListEntry(profile.toMojang()));
|
||||
internal.getPlayerList().getBans().add(new UserBanListEntry(profile.toNameAndId()));
|
||||
}
|
||||
|
||||
public void executeCommand(BridgedMinecraftServer server, BridgedFakePlayer player, String command) {
|
||||
|
@@ -62,7 +62,7 @@ public class BridgedGameRules {
|
||||
public static final WrappedBooleanKey RULE_DO_VINES_SPREAD = WrappedBooleanKey.wrap(GameRules.RULE_DO_VINES_SPREAD);
|
||||
public static final WrappedBooleanKey RULE_ENDER_PEARLS_VANISH_ON_DEATH = WrappedBooleanKey.wrap(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH);
|
||||
public static final WrappedIntegerKey RULE_MINECART_MAX_SPEED = WrappedIntegerKey.wrap(GameRules.RULE_MINECART_MAX_SPEED);
|
||||
public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(GameRules.RULE_SPAWN_CHUNK_RADIUS);
|
||||
public static final WrappedIntegerKey RULE_SPAWN_CHUNK_RADIUS = WrappedIntegerKey.wrap(null);
|
||||
public static final WrappedBooleanKey RULE_TNT_EXPLODES = WrappedBooleanKey.wrap(GameRules.RULE_TNT_EXPLODES);
|
||||
|
||||
public boolean getBoolean(WrappedBooleanKey key) {
|
||||
|
Reference in New Issue
Block a user