Backport to 1.20.1

Dieser Commit ist enthalten in:
Moulberry 2023-10-10 13:07:49 +08:00
Ursprung 3f613db359
Commit 7c8f5000c5
13 geänderte Dateien mit 22 neuen und 35 gelöschten Zeilen

Datei anzeigen

@ -25,7 +25,7 @@ repositories {
}
dependencies {
paperweight.paperDevBundle("1.20.2-R0.1-20231010.011415-29")
paperweight.paperDevBundle("1.20.1-R0.1-SNAPSHOT")
implementation("xyz.jpenilla:reflection-remapper:0.1.0-SNAPSHOT")
// Zstd Compression Library

Datei anzeigen

@ -17,7 +17,7 @@ import net.minecraft.network.ConnectionProtocol;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.PacketFlow;
import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket;
import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket;
import net.minecraft.resources.ResourceLocation;
import org.bukkit.*;
import org.bukkit.entity.Player;

Datei anzeigen

@ -1,12 +0,0 @@
package com.moulberry.axiom.packet;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
public record CustomByteArrayPayload(ResourceLocation id, byte[] bytes) implements CustomPacketPayload {
@Override
public void write(FriendlyByteBuf buf) {
buf.writeBytes(bytes);
}
}

Datei anzeigen

@ -14,7 +14,7 @@ import net.minecraft.network.FriendlyByteBuf;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.persistence.PersistentDataContainer;

Datei anzeigen

@ -9,7 +9,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket;
import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
@ -21,7 +21,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.LevelChunkSection;
import net.minecraft.world.level.chunk.PalettedContainer;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener;
import org.jetbrains.annotations.NotNull;
@ -149,7 +149,7 @@ public class RequestChunkDataPacketListener implements PluginMessageListener {
buf.writeBoolean(false);
byte[] bytes = new byte[buf.writerIndex()];
buf.getBytes(0, bytes);
player.connection.send(new ClientboundCustomPayloadPacket(new CustomByteArrayPayload(RESPONSE_ID, bytes)));
player.connection.send(new ClientboundCustomPayloadPacket(RESPONSE_ID, buf));
// Continuation packet
buf = new FriendlyByteBuf(Unpooled.buffer());
@ -169,7 +169,7 @@ public class RequestChunkDataPacketListener implements PluginMessageListener {
buf.writeBoolean(false);
byte[] bytes = new byte[buf.writerIndex()];
buf.getBytes(0, bytes);
player.connection.send(new ClientboundCustomPayloadPacket(new CustomByteArrayPayload(RESPONSE_ID, bytes)));
player.connection.send(new ClientboundCustomPayloadPacket(RESPONSE_ID, buf));
// Continuation packet
buf = new FriendlyByteBuf(Unpooled.buffer());
@ -205,7 +205,7 @@ public class RequestChunkDataPacketListener implements PluginMessageListener {
buf.writeBoolean(false);
byte[] bytes = new byte[buf.writerIndex()];
buf.getBytes(0, bytes);
player.connection.send(new ClientboundCustomPayloadPacket(new CustomByteArrayPayload(RESPONSE_ID, bytes)));
player.connection.send(new ClientboundCustomPayloadPacket(RESPONSE_ID, buf));
// Continuation packet
buf = new FriendlyByteBuf(Unpooled.buffer());
@ -225,7 +225,7 @@ public class RequestChunkDataPacketListener implements PluginMessageListener {
buf.writeBoolean(false);
byte[] bytes = new byte[buf.writerIndex()];
buf.getBytes(0, bytes);
player.connection.send(new ClientboundCustomPayloadPacket(new CustomByteArrayPayload(RESPONSE_ID, bytes)));
player.connection.send(new ClientboundCustomPayloadPacket(RESPONSE_ID, buf));
// Continuation packet
buf = new FriendlyByteBuf(Unpooled.buffer());
@ -245,7 +245,7 @@ public class RequestChunkDataPacketListener implements PluginMessageListener {
buf.writeBoolean(true);
byte[] bytes = new byte[buf.writerIndex()];
buf.getBytes(0, bytes);
player.connection.send(new ClientboundCustomPayloadPacket(new CustomByteArrayPayload(RESPONSE_ID, bytes)));
player.connection.send(new ClientboundCustomPayloadPacket(RESPONSE_ID, buf));
}
private void sendEmptyResponse(ServerPlayer player, long id) {
@ -257,7 +257,7 @@ public class RequestChunkDataPacketListener implements PluginMessageListener {
byte[] bytes = new byte[buf.writerIndex()];
buf.getBytes(0, bytes);
player.connection.send(new ClientboundCustomPayloadPacket(new CustomByteArrayPayload(RESPONSE_ID, bytes)));
player.connection.send(new ClientboundCustomPayloadPacket(RESPONSE_ID, buf));
}
}

Datei anzeigen

@ -24,8 +24,8 @@ import net.minecraft.world.level.lighting.LightEngine;
import net.minecraft.world.phys.BlockHitResult;
import org.bukkit.Bukkit;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_20_R2.block.CraftBlock;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_20_R1.block.CraftBlock;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
@ -38,7 +38,6 @@ import java.lang.reflect.Method;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.logging.Level;
public class SetBlockPacketListener implements PluginMessageListener {

Datei anzeigen

@ -4,7 +4,7 @@ import com.moulberry.axiom.event.AxiomFlySpeedChangeEvent;
import io.netty.buffer.Unpooled;
import net.minecraft.network.FriendlyByteBuf;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener;
import org.jetbrains.annotations.NotNull;

Datei anzeigen

@ -6,7 +6,7 @@ import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.level.GameType;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener;
import org.jetbrains.annotations.NotNull;

Datei anzeigen

@ -5,8 +5,8 @@ import com.moulberry.axiom.persistence.ItemStackDataType;
import io.netty.buffer.Unpooled;
import net.minecraft.network.FriendlyByteBuf;
import org.bukkit.NamespacedKey;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;

Datei anzeigen

@ -9,7 +9,7 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.Level;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_20_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R1.CraftWorld;
import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener;
import org.jetbrains.annotations.NotNull;

Datei anzeigen

@ -7,7 +7,7 @@ import net.minecraft.network.FriendlyByteBuf;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.persistence.PersistentDataContainer;

Datei anzeigen

@ -1,8 +1,8 @@
package com.moulberry.axiom.persistence;
import net.minecraft.nbt.CompoundTag;
import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_20_R2.persistence.CraftPersistentDataContainer;
import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_20_R1.persistence.CraftPersistentDataContainer;
import org.bukkit.inventory.ItemStack;
import org.bukkit.persistence.PersistentDataAdapterContext;
import org.bukkit.persistence.PersistentDataContainer;

Datei anzeigen

@ -9,7 +9,7 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.GameRules;
import org.bukkit.GameRule;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_20_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R1.CraftWorld;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;