Mirror von
https://github.com/Moulberry/AxiomPaperPlugin.git
synchronisiert 2024-11-16 21:30:08 +01:00
Use VersionHelper to create resource location
Dieser Commit ist enthalten in:
Ursprung
74660fa866
Commit
7000929a2d
@ -11,4 +11,12 @@ public class VersionHelper {
|
||||
serverPlayer.connection.send(new ClientboundCustomPayloadPacket(new CustomByteArrayPayload(id, data)));
|
||||
}
|
||||
|
||||
public static ResourceLocation createResourceLocation(String composed) {
|
||||
return ResourceLocation.parse(composed);
|
||||
}
|
||||
|
||||
public static ResourceLocation createResourceLocation(String namespace, String path) {
|
||||
return ResourceLocation.fromNamespaceAndPath(namespace, path);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,8 +2,6 @@ package com.moulberry.axiom;
|
||||
|
||||
import com.moulberry.axiom.persistence.UUIDDataType;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@ -113,7 +111,7 @@ public final class View {
|
||||
view.pinLevel = tag.getOrDefault(PIN_LEVEL_KEY, PersistentDataType.BOOLEAN, false);
|
||||
if (tag.has(LEVEL_KEY)) {
|
||||
String level = tag.get(LEVEL_KEY, PersistentDataType.STRING);
|
||||
view.level = ResourceKey.create(Registries.DIMENSION, new ResourceLocation(level));
|
||||
view.level = ResourceKey.create(Registries.DIMENSION, VersionHelper.createResourceLocation(level));
|
||||
}
|
||||
|
||||
view.pinLocation = tag.getOrDefault(PIN_LOCATION_KEY, PersistentDataType.BOOLEAN, false);
|
||||
|
@ -2,6 +2,7 @@ package com.moulberry.axiom.blueprint;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.Dynamic;
|
||||
import com.moulberry.axiom.VersionHelper;
|
||||
import com.moulberry.axiom.buffer.CompressedBlockEntity;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||
@ -88,7 +89,7 @@ public class BlueprintIo {
|
||||
long pos = blockPos.asLong();
|
||||
|
||||
String id = blockEntityCompound.getString("id");
|
||||
BlockEntityType<?> type = BuiltInRegistries.BLOCK_ENTITY_TYPE.get(new ResourceLocation(id));
|
||||
BlockEntityType<?> type = BuiltInRegistries.BLOCK_ENTITY_TYPE.get(VersionHelper.createResourceLocation(id));
|
||||
|
||||
if (type != null) {
|
||||
PalettedContainer<BlockState> container = blockMap.get(BlockPos.asLong(
|
||||
|
@ -26,7 +26,7 @@ public class ServerBlueprintManager {
|
||||
}
|
||||
|
||||
private static final int MAX_SIZE = 1000000;
|
||||
private static final ResourceLocation PACKET_BLUEPRINT_MANIFEST_IDENTIFIER = new ResourceLocation("axiom:blueprint_manifest");
|
||||
private static final ResourceLocation PACKET_BLUEPRINT_MANIFEST_IDENTIFIER = VersionHelper.createResourceLocation("axiom:blueprint_manifest");
|
||||
|
||||
public static void sendManifest(List<ServerPlayer> serverPlayers) {
|
||||
if (registry != null) {
|
||||
|
@ -16,9 +16,9 @@ import java.util.List;
|
||||
|
||||
public class AxiomBigPayloadHandler extends ByteToMessageDecoder {
|
||||
|
||||
private static final ResourceLocation SET_BUFFER = new ResourceLocation("axiom", "set_buffer");
|
||||
private static final ResourceLocation UPLOAD_BLUEPRINT = new ResourceLocation("axiom", "upload_blueprint");
|
||||
private static final ResourceLocation REQUEST_CHUNK_DATA = new ResourceLocation("axiom", "request_chunk_data");
|
||||
private static final ResourceLocation SET_BUFFER = VersionHelper.createResourceLocation("axiom", "set_buffer");
|
||||
private static final ResourceLocation UPLOAD_BLUEPRINT = VersionHelper.createResourceLocation("axiom", "upload_blueprint");
|
||||
private static final ResourceLocation REQUEST_CHUNK_DATA = VersionHelper.createResourceLocation("axiom", "request_chunk_data");
|
||||
private final int payloadId;
|
||||
private final Connection connection;
|
||||
private final SetBlockBufferPacketListener setBlockBuffer;
|
||||
|
@ -24,7 +24,7 @@ public class BlueprintRequestPacketListener implements PluginMessageListener {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
private static final ResourceLocation RESPONSE_PACKET_IDENTIFIER = new ResourceLocation("axiom:response_blueprint");
|
||||
private static final ResourceLocation RESPONSE_PACKET_IDENTIFIER = VersionHelper.createResourceLocation("axiom:response_blueprint");
|
||||
|
||||
@Override
|
||||
public void onPluginMessageReceived(@NotNull String channel, @NotNull Player player, @NotNull byte[] message) {
|
||||
|
@ -35,7 +35,7 @@ import java.io.ByteArrayOutputStream;
|
||||
|
||||
public class RequestChunkDataPacketListener implements PluginMessageListener {
|
||||
|
||||
private static final ResourceLocation RESPONSE_ID = new ResourceLocation("axiom:response_chunk_data");
|
||||
private static final ResourceLocation RESPONSE_ID = VersionHelper.createResourceLocation("axiom:response_chunk_data");
|
||||
|
||||
private final AxiomPaper plugin;
|
||||
public RequestChunkDataPacketListener(AxiomPaper plugin) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren