mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Handle effects with infinite duration (#3834)
This commit is contained in:
parent
231e9a1cc6
commit
6791acd215
1 changed files with 7 additions and 1 deletions
|
@ -45,9 +45,15 @@ public class JavaUpdateMobEffectTranslator extends PacketTranslator<ClientboundU
|
||||||
if (entity == null)
|
if (entity == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
int duration = packet.getDuration();
|
||||||
|
if (duration < 0) {
|
||||||
|
// java edition uses -1 for infinite, but bedrock doesn't have infinite
|
||||||
|
duration = Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
MobEffectPacket mobEffectPacket = new MobEffectPacket();
|
MobEffectPacket mobEffectPacket = new MobEffectPacket();
|
||||||
mobEffectPacket.setAmplifier(packet.getAmplifier());
|
mobEffectPacket.setAmplifier(packet.getAmplifier());
|
||||||
mobEffectPacket.setDuration(packet.getDuration());
|
mobEffectPacket.setDuration(duration);
|
||||||
mobEffectPacket.setEvent(MobEffectPacket.Event.ADD);
|
mobEffectPacket.setEvent(MobEffectPacket.Event.ADD);
|
||||||
mobEffectPacket.setRuntimeEntityId(entity.getGeyserId());
|
mobEffectPacket.setRuntimeEntityId(entity.getGeyserId());
|
||||||
mobEffectPacket.setParticles(packet.isShowParticles());
|
mobEffectPacket.setParticles(packet.isShowParticles());
|
||||||
|
|
Loading…
Reference in a new issue