- Game can randomly crash due to atomic operation failure. (MC-249933)
- You cannot launch the game without authenticating/in offline mode; add
--uuid=123
run arg to fix.
java.util.Random
has been replaced with AbstractRandom
in most of the code. This interface, previously under net.minecraft.world.gen.random
package and now under net.minecraft.util.math.random
, provides most of the operations Random
supports. There are 3 vanilla implementations based on Java Random
:
SimpleRandom
: Not thread safe at all.AtomicSimpleRandom
: Throws when used concurrently. (Causes the known issue mentioned above.)BlockingSimpleRandom
: Blocks the thread when used concurrently.
They are not the perfect reimplementation of Java Random
due to a bug (MC-239059).
There is also Xoroshiro128PlusPlusRandom
, which implements the Xoroshiro128++ algorithm and is used primarily in the world generation.
AbstractRandom
's nextFoo
methods perform the same as the ones in Random
. There are also nextBetween
(returns a random integer min <= N <= max
) and nextBetweenExclusive
(returns a random integer min <= N < max
). MathHelper#nextBetween
does still exist, but expects AbstractRandom
now. To obtain an instance you can call one of the static methods or construct the classes yourself; you can basically replace new Random()
with AbstractRandom.createAtomic()
.
Util#getRandom
was updated to take AbstractRandom
, and two new Util
methods for shuffling a list were added; shuffle
(mutating) and copyShuffled
(does not mutate).
MobSpawnS2CPacket
was removed. EntitySpawnS2CPacket
is used for all entities instead. This also means Entity#readFromPacket
is gone - onSpawnPacket
should be overridden instead. ClientPlayNetworkHandler#playSpawnSound
now plays the minecart/bee sound when spawning.
Sounds now have a seed, sent from the server to determine which sound is used in a specific sound event. This is useful in multiplayer where there are multiple people receiving the same sound event, since they now hear the same sound. World#playSound
takes a long seed
argument, so you should pass world.random.nextLong()
or something similar to that. If you send the same seed, assuming the client's sounds are unmodified, it plays the same sound even if the sound event has multiple sounds. There is still a playSound
method that does not take the seed argument - this uses a random seed.
Resource
is now a class, and the impl class for that was removed. A new functional interface, ResourceMetadata
, was added - its sole purpose is to allow decoding the data to a meaningful value (e.g. JsonObject
) using ResourceMetadataReader
passed to decode
. ResourceRef
was also removed and its lazy-loading feature was moved to Resource$InputSupplier
(a functional interface that can throw IOException
).
AbstractRandom
is an interface, not an abstract class.