feat(api): add setPacketDispatcher method to EntityLibAPI

This commit is contained in:
Felipe Paschoal Bergamo 2025-04-03 00:03:40 -03:00
parent d7eda34611
commit 9e7ecf310e
2 changed files with 9 additions and 1 deletions

View file

@ -60,6 +60,8 @@ public interface EntityLibAPI<T> {
@NotNull BiConsumer<UUID, PacketWrapper<?>> getPacketDispatcher(); @NotNull BiConsumer<UUID, PacketWrapper<?>> getPacketDispatcher();
void setPacketDispatcher(@NotNull BiConsumer<UUID, PacketWrapper<?>> packetDispatcher);
@NotNull EntityContainer getDefaultContainer(); @NotNull EntityContainer getDefaultContainer();
} }

View file

@ -25,7 +25,8 @@ public abstract class AbstractEntityLibAPI<P, T> implements EntityLibAPI<T> {
protected final APIConfig settings; protected final APIConfig settings;
protected final Collection<TickContainer<?, T>> tickContainers; protected final Collection<TickContainer<?, T>> tickContainers;
protected final EntityContainer defaultEntityContainer = EntityContainer.basic(); protected final EntityContainer defaultEntityContainer = EntityContainer.basic();
protected final BiConsumer<UUID, PacketWrapper<?>> packetDispatcher;
protected BiConsumer<UUID, PacketWrapper<?>> packetDispatcher;
protected AbstractEntityLibAPI(Platform<P> platform, APIConfig settings) { protected AbstractEntityLibAPI(Platform<P> platform, APIConfig settings) {
this.platform = platform; this.platform = platform;
@ -81,6 +82,11 @@ public abstract class AbstractEntityLibAPI<P, T> implements EntityLibAPI<T> {
return packetDispatcher; return packetDispatcher;
} }
@Override
public void setPacketDispatcher(@NotNull BiConsumer<UUID, PacketWrapper<?>> packetDispatcher) {
this.packetDispatcher = packetDispatcher;
}
@Override @Override
public @NotNull Collection<TickContainer<?, T>> getTickContainers() { public @NotNull Collection<TickContainer<?, T>> getTickContainers() {
return tickContainers; return tickContainers;