Generate a random seed to simulate random sounds (#2944)

This commit is contained in:
Owen 2022-06-11 13:02:54 -04:00 committed by GitHub
parent 40f5cb6e71
commit 702ced200e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,6 +54,7 @@ import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
import java.security.spec.EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.concurrent.ThreadLocalRandom;
public final class Protocol1_19To1_18_2 extends AbstractProtocol<ClientboundPackets1_18, ClientboundPackets1_19, ServerboundPackets1_17, ServerboundPackets1_19> {
@ -97,7 +98,7 @@ public final class Protocol1_19To1_18_2 extends AbstractProtocol<ClientboundPack
map(Type.INT); // Z
map(Type.FLOAT); // Volume
map(Type.FLOAT); // Pitch
create(Type.LONG, 0L); // Seed
create(Type.LONG, randomLong()); // Seed
handler(soundRewriter.getSoundHandler());
}
});
@ -109,7 +110,7 @@ public final class Protocol1_19To1_18_2 extends AbstractProtocol<ClientboundPack
map(Type.VAR_INT); // Entity id
map(Type.FLOAT); // Volume
map(Type.FLOAT); // Pitch
create(Type.LONG, 0L); // Seed
create(Type.LONG, randomLong()); // Seed
handler(soundRewriter.getSoundHandler());
}
});
@ -123,7 +124,7 @@ public final class Protocol1_19To1_18_2 extends AbstractProtocol<ClientboundPack
map(Type.INT); // Z
map(Type.FLOAT); // Volume
map(Type.FLOAT); // Pitch
create(Type.LONG, 0L); // Seed
create(Type.LONG, randomLong()); // Seed
}
});
@ -295,6 +296,10 @@ public final class Protocol1_19To1_18_2 extends AbstractProtocol<ClientboundPack
});
}
private static long randomLong() {
return ThreadLocalRandom.current().nextLong();
}
@Override
protected void onMappingDataLoaded() {
Types1_19.PARTICLE.filler(this)