Skip to content

Commit

Permalink
Update to 1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Moulberry committed Nov 16, 2024
1 parent 6f77f82 commit 8fee0bd
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
7 changes: 7 additions & 0 deletions src/main/java/com/moulberry/axiom/VersionHelper.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.moulberry.axiom;

import com.moulberry.axiom.packet.CustomByteArrayPayload;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
Expand All @@ -11,6 +12,12 @@ public static void sendCustomPayload(ServerPlayer serverPlayer, ResourceLocation
serverPlayer.connection.send(new ClientboundCustomPayloadPacket(new CustomByteArrayPayload(id, data)));
}

public static void sendCustomPayload(ServerPlayer serverPlayer, ResourceLocation id, FriendlyByteBuf friendlyByteBuf) {
byte[] data = new byte[friendlyByteBuf.writerIndex()];
friendlyByteBuf.getBytes(friendlyByteBuf.readerIndex(), data);
sendCustomPayload(serverPlayer, id, data);
}

public static ResourceLocation createResourceLocation(String composed) {
return new ResourceLocation(composed);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import net.minecraft.world.level.block.state.BlockState;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
import org.bukkit.entity.Player;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
import io.netty.buffer.Unpooled;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;

import java.util.*;

Expand Down Expand Up @@ -102,7 +101,7 @@ private static void sendResponse(ServerPlayer player, long id, boolean finished,
friendlyByteBuf.writeBoolean(finished);
friendlyByteBuf.writeMap(map, (buf, uuid) -> buf.writeUUID(uuid), (buf, nbt) -> buf.writeNbt(nbt));

player.connection.send(new ClientboundCustomPayloadPacket(RESPONSE_ID, friendlyByteBuf));
VersionHelper.sendCustomPayload(player, RESPONSE_ID, friendlyByteBuf);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.lighting.LightEngine;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
import org.bukkit.entity.Player;
import xyz.jpenilla.reflectionremapper.ReflectionRemapper;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.moulberry.axiom.packet.PacketHandler;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.server.level.ServerPlayer;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
import org.bukkit.entity.Player;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
import org.bukkit.entity.Player;

import java.io.BufferedOutputStream;
Expand Down

0 comments on commit 8fee0bd

Please sign in to comment.