The bug
In 1.8.8 and maybe later animals which can breed showed hearts the whole time they were able to breed.
Now the hearts are only shown once.
The reason
The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.
The reason why this happens is because the client never receives the InLove
value from the server. In 1.8.9 and earlier the method net.minecraft.entity.EntityAgeable.getGrowingAge()
(MCP 9.10) returned for the client the stored value whether or not the animal is a child (for 1.8 entry 12 of the data watcher, for 1.9 net.minecraft.entity.EntityAgeable.field_184751_bv
). In 1.9 it returns -1
if the animal is a child, 1
if it is not. This breaks some logic for the net.minecraft.entity.passive.EntityAnimal
class.
Besides that the client should receive the InLove
value because neither in 1.8.9 nor in the latest versions summoning an animal with InLove
greater than 0 shows particles.
/summon pig ~ ~ ~ {InLove:2147483647}
Note: The server should not run the particle spawning code of the method net.minecraft.entity.passive.EntityAnimal.onLivingUpdate()
.
Linked issues
is duplicated by 3
relates to 4
Attachments
Comments 41
I do not quiet understand the reason that was given by Marcono1234. It was working in 1.8 and prior versions, why does it only occur since the 1.9 snapshots? Clients are using an internal server since 1.3, so the issue should have appeared back then already, but it did not. So why now in 1.9?
You are right, I kind of messed up yesterday. The reason seems to be that the client does not receive the InLove
value anymore, because in 1.8 the client had the correct InLove
value, in 1.9 it does not. I will update the report in a moment.
This is easily fixed
Using Mojmaps 1.20.1
In the aiStep method the code calls the addParticles method but as pointed out by other users the inLove ticks aren't sent client side.
if (this.inLove > 0) {
--this.inLove;
if (this.inLove % 10 == 0) {
double d0 = this.random.nextGaussian() * 0.02D;
double d1 = this.random.nextGaussian() * 0.02D;
double d2 = this.random.nextGaussian() * 0.02D;
this.level().addParticle(ParticleTypes.HEART, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), d0, d1, d2);
}
}
This can be fixed by checking if the code is running server side and then send the particles to clients
if (this.inLove > 0) {
--this.inLove;
if (this.inLove % 10 == 0) {
double d0 = this.random.nextGaussian() * 0.02D;
double d1 = this.random.nextGaussian() * 0.02D;
double d2 = this.random.nextGaussian() * 0.02D;
//Note, I didn't use the speed calculated above
if (this.level instanceof ServerLevel serverLevel)
serverLevel.sendParticles(ParticleTypes.HEART, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), 1, 0, 0.1f);
}
}
Issue still exists up to latest version, Minecraft 1.9.1-pre3.