Add CREATE_FOG BossFlag

This commit is contained in:
Nassim Jahnke 2021-08-27 19:29:00 +02:00
parent 257eea5b04
commit 533572e8cd
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
3 changed files with 6 additions and 1 deletions

View File

@ -73,6 +73,7 @@ public interface EntityTracker {
*
* @param id entity id
* @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);
@ -81,6 +82,7 @@ public interface EntityTracker {
*
* @param id entity id
* @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);

View File

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

View File

@ -70,12 +70,14 @@ public class EntityTrackerBase implements EntityTracker, ClientEntityIdChangeLis
@Override
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);
return type != null ? entityData.computeIfAbsent(id, s -> new StoredEntityImpl(type)) : null;
}
@Override
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);
}