3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-28 00:50:13 +01:00

Add CREATE_FOG BossFlag

Dieser Commit ist enthalten in:
Nassim Jahnke 2021-08-27 19:29:00 +02:00
Ursprung 257eea5b04
Commit 533572e8cd
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
3 geänderte Dateien mit 6 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -73,6 +73,7 @@ public interface EntityTracker {
* *
* @param id entity id * @param id entity id
* @return stored entity data if an entity with the id is tracked, else null * @return stored entity data if an entity with the id is tracked, else null
* @throws IllegalArgumentException if entitiy data storage has not been enabled via the implementation
*/ */
@Nullable StoredEntityData entityData(int id); @Nullable StoredEntityData entityData(int id);
@ -81,6 +82,7 @@ public interface EntityTracker {
* *
* @param id entity id * @param id entity id
* @return stored entity data if it has previously been initialized by {@link #entityData(int)} * @return stored entity data if it has previously been initialized by {@link #entityData(int)}
* @throws IllegalArgumentException if entitiy data storage has not been enabled via the implementation
*/ */
@Nullable StoredEntityData entityDataIfPresent(int id); @Nullable StoredEntityData entityDataIfPresent(int id);

Datei anzeigen

@ -25,7 +25,8 @@ package com.viaversion.viaversion.api.legacy.bossbar;
public enum BossFlag { public enum BossFlag {
DARKEN_SKY(1), DARKEN_SKY(1),
PLAY_BOSS_MUSIC(2); PLAY_BOSS_MUSIC(2),
CREATE_FOG(4);
private final int id; private final int id;

Datei anzeigen

@ -70,12 +70,14 @@ public class EntityTrackerBase implements EntityTracker, ClientEntityIdChangeLis
@Override @Override
public @Nullable StoredEntityData entityData(int id) { public @Nullable StoredEntityData entityData(int id) {
Preconditions.checkArgument(entityData != null, "Entity data storage has to be explicitly enabled via the constructor");
EntityType type = entityType(id); EntityType type = entityType(id);
return type != null ? entityData.computeIfAbsent(id, s -> new StoredEntityImpl(type)) : null; return type != null ? entityData.computeIfAbsent(id, s -> new StoredEntityImpl(type)) : null;
} }
@Override @Override
public @Nullable StoredEntityData entityDataIfPresent(int id) { public @Nullable StoredEntityData entityDataIfPresent(int id) {
Preconditions.checkArgument(entityData != null, "Entity data storage has to be explicitly enabled via the constructor");
return entityData.get(id); return entityData.get(id);
} }