Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-20 15:00:11 +01:00
Add url codec creation method with no content key, remove boolean return to registerAll, fix typo
Dieser Commit ist enthalten in:
Ursprung
2683b59406
Commit
ba78dbaf34
@ -62,9 +62,8 @@ public abstract class SessionLoadResourcePacksEvent extends ConnectionEvent {
|
|||||||
* Registers a collection of {@link ResourcePack} to be sent to clients.
|
* Registers a collection of {@link ResourcePack} to be sent to clients.
|
||||||
*
|
*
|
||||||
* @param resourcePacks collection of resourcePack's that will be sent to clients.
|
* @param resourcePacks collection of resourcePack's that will be sent to clients.
|
||||||
* @return true if resource packs were added successfully, false if at least one failed
|
|
||||||
*/
|
*/
|
||||||
public abstract boolean registerAll(@NonNull Collection<ResourcePack> resourcePacks);
|
public abstract void registerAll(@NonNull Collection<ResourcePack> resourcePacks);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unregisters a {@link ResourcePack} from being sent to the client.
|
* Unregisters a {@link ResourcePack} from being sent to the client.
|
||||||
|
@ -58,9 +58,8 @@ public abstract class GeyserDefineResourcePacksEvent implements Event {
|
|||||||
* Registers a collection of {@link ResourcePack} to be sent to clients.
|
* Registers a collection of {@link ResourcePack} to be sent to clients.
|
||||||
*
|
*
|
||||||
* @param resourcePacks collection of resourcePack's that will be sent to clients.
|
* @param resourcePacks collection of resourcePack's that will be sent to clients.
|
||||||
* @return true if resource packs were added successfully, false if at least one failed
|
|
||||||
*/
|
*/
|
||||||
public abstract boolean registerAll(@NonNull Collection<ResourcePack> resourcePacks);
|
public abstract void registerAll(@NonNull Collection<ResourcePack> resourcePacks);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,6 +81,17 @@ public abstract class PackCodec {
|
|||||||
return GeyserApi.api().provider(PathPackCodec.class, path);
|
return GeyserApi.api().provider(PathPackCodec.class, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new pack provider from the given url with no content key.
|
||||||
|
*
|
||||||
|
* @param url the url to create the pack provider from
|
||||||
|
* @return the new pack provider
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public static PackCodec url(@NonNull String url) {
|
||||||
|
return url(url, null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new pack provider from the given url and content key.
|
* Creates a new pack provider from the given url and content key.
|
||||||
*
|
*
|
||||||
|
@ -60,14 +60,8 @@ public class GeyserDefineResourcePacksEventImpl extends GeyserDefineResourcePack
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean registerAll(@NonNull Collection<ResourcePack> resourcePacks) {
|
public void registerAll(@NonNull Collection<ResourcePack> resourcePacks) {
|
||||||
boolean successful = true;
|
resourcePacks.forEach(this::register);
|
||||||
for (ResourcePack pack : resourcePacks) {
|
|
||||||
if (!this.register(pack)) {
|
|
||||||
successful = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return successful;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -61,14 +61,8 @@ public class SessionLoadResourcePacksEventImpl extends SessionLoadResourcePacksE
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean registerAll(@NonNull Collection<ResourcePack> resourcePacks) {
|
public void registerAll(@NonNull Collection<ResourcePack> resourcePacks) {
|
||||||
boolean successful = true;
|
resourcePacks.forEach(this::register);
|
||||||
for (ResourcePack pack : resourcePacks) {
|
|
||||||
if (!this.register(pack)) {
|
|
||||||
successful = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return successful;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -70,7 +70,7 @@ import java.util.OptionalInt;
|
|||||||
public class UpstreamPacketHandler extends LoggingPacketHandler {
|
public class UpstreamPacketHandler extends LoggingPacketHandler {
|
||||||
|
|
||||||
private boolean networkSettingsRequested = false;
|
private boolean networkSettingsRequested = false;
|
||||||
private final Deque<String> packsToSent = new ArrayDeque<>();
|
private final Deque<String> packsToSend = new ArrayDeque<>();
|
||||||
private final CompressionStrategy compressionStrategy;
|
private final CompressionStrategy compressionStrategy;
|
||||||
|
|
||||||
private SessionLoadResourcePacksEventImpl resourcePackLoadEvent;
|
private SessionLoadResourcePacksEventImpl resourcePackLoadEvent;
|
||||||
@ -227,8 +227,8 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
|
|||||||
geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.connect", session.getAuthData().name()));
|
geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.connect", session.getAuthData().name()));
|
||||||
}
|
}
|
||||||
case SEND_PACKS -> {
|
case SEND_PACKS -> {
|
||||||
packsToSent.addAll(packet.getPackIds());
|
packsToSend.addAll(packet.getPackIds());
|
||||||
sendPackDataInfo(packsToSent.pop());
|
sendPackDataInfo(packsToSend.pop());
|
||||||
}
|
}
|
||||||
case HAVE_ALL_PACKS -> {
|
case HAVE_ALL_PACKS -> {
|
||||||
ResourcePackStackPacket stackPacket = new ResourcePackStackPacket();
|
ResourcePackStackPacket stackPacket = new ResourcePackStackPacket();
|
||||||
@ -329,8 +329,8 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
|
|||||||
session.sendUpstreamPacket(data);
|
session.sendUpstreamPacket(data);
|
||||||
|
|
||||||
// Check if it is the last chunk and send next pack in queue when available.
|
// Check if it is the last chunk and send next pack in queue when available.
|
||||||
if (remainingSize <= GeyserResourcePack.CHUNK_SIZE && !packsToSent.isEmpty()) {
|
if (remainingSize <= GeyserResourcePack.CHUNK_SIZE && !packsToSend.isEmpty()) {
|
||||||
sendPackDataInfo(packsToSent.pop());
|
sendPackDataInfo(packsToSend.pop());
|
||||||
}
|
}
|
||||||
|
|
||||||
return PacketSignal.HANDLED;
|
return PacketSignal.HANDLED;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren