Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2025-01-11 23:51:11 +01:00
Fix NPE with area effect cloud particles
Dieser Commit ist enthalten in:
Ursprung
25ff3661e3
Commit
1afa22d5cf
@ -27,9 +27,11 @@ package org.geysermc.connector.utils;
|
|||||||
|
|
||||||
import com.github.steveice10.mc.protocol.data.game.world.particle.ParticleType;
|
import com.github.steveice10.mc.protocol.data.game.world.particle.ParticleType;
|
||||||
import com.nukkitx.protocol.bedrock.data.LevelEventType;
|
import com.nukkitx.protocol.bedrock.data.LevelEventType;
|
||||||
import lombok.NonNull;
|
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
import org.geysermc.connector.registry.Registries;
|
import org.geysermc.connector.registry.Registries;
|
||||||
|
import org.geysermc.connector.registry.type.ParticleMapping;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Util for particles and effects.
|
* Util for particles and effects.
|
||||||
@ -42,8 +44,13 @@ public class EffectUtils {
|
|||||||
* @param type the Java particle to search for
|
* @param type the Java particle to search for
|
||||||
* @return the Bedrock integer ID of the particle, or -1 if it does not exist
|
* @return the Bedrock integer ID of the particle, or -1 if it does not exist
|
||||||
*/
|
*/
|
||||||
public static int getParticleId(GeyserSession session, @NonNull ParticleType type) {
|
public static int getParticleId(GeyserSession session, @Nonnull ParticleType type) {
|
||||||
LevelEventType levelEventType = Registries.PARTICLES.get(type).getLevelEventType();
|
ParticleMapping mapping = Registries.PARTICLES.get(type);
|
||||||
|
if (mapping == null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
LevelEventType levelEventType = mapping.getLevelEventType();
|
||||||
if (levelEventType == null) {
|
if (levelEventType == null) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren