What is displayed in the scoreboard doesn’t actually match the information the client has. Pigs/Striders only hold one integer field of synced metadata for the total boosting time (see https://minecraft.wiki/w/Java_Edition_protocol/Entity_metadata#Pig ), so after relogging the client couldn’t possibly know how long the pig has already been boosting for. A fix for point 15. of your list would thus require a protocol change to include a second integer metadata field corresponding to boost_time/boost_time_elapsed.I guess you could fix 16. without that by sending the difference (how much time of the boost is left) to the client instead of the full boost time, but that seems kinda hacky.
Alternatively one could just use movement_speed attribute modifiers and make the timer be decremented whenever the pig is ticked (not just when a player is riding it), but this would also include a significant amount of packet spam.
Also, Experience Orbs are naturally bouncy on every surface due to code in ExperienceOrb::tick added before 26.2. This overwrites the velocity from bouncing on a slime block and thus they bounce equally high no matter the surface. This could be changed by making the ExperienceOrb class overwrite the Entity::getEntityBounciness method instead of relying on the hardcoded bounce in the tick method.
Client behaviour with regard to Falling Block Entities seems to be fixed (maybe was never an issue) in 26.4 snapshot 8. Everything else still applies, including the seemingly arbitrary vertical velocity flip when a Primed TNT is considered onGround (on client & server) and the same for Falling Blocks on the server (the server turns the entity into a block anyway, so it has no effect until that is changed).
Apologies, I meant 26.4-snapshot-8, not 26.3.
Apologies, I meant 26.4-snapshot-8, not 26.3.
Affects 26.3-snapshot-8. This is caused by incorrect usage of the Shulker::getProgressDeltaAabb method:
public static AABB getProgressDeltaAabb(final float size, final Direction direction, final float progressFrom, final float progressTo, final Vec3 position) {
AABB boundsAtBottomCenter = new AABB(-size * 0.5, 0.0, -size * 0.5, size * 0.5, size, size * 0.5);
double maxMovement = Math.max(progressFrom, progressTo);
double minMovement = Math.min(progressFrom, progressTo);
AABB aabb = boundsAtBottomCenter.expandTowards(
direction.getStepX() * maxMovement * size, direction.getStepY() * maxMovement * size, direction.getStepZ() * maxMovement * size
)
.contract(
-direction.getStepX() * (1.0 + minMovement) * size,
-direction.getStepY() * (1.0 + minMovement) * size,
-direction.getStepZ() * (1.0 + minMovement) * size
);
return aabb.move(position.x, position.y, position.z);
}In order for this method to produce the correct delta bounding box, the progressFrom and progressTo floats need to be passed as absolute values, not just as values between 0 and 1 representing how much of the total movement was completed. The ShulkerBoxBlockEntity::moveCollidedEntities method gets this wrong and since an opened shulker box only extends out half a block, this causes the push to be effectively twice as strong. Multiplying the progressOld and progress fields of the ShulkerBoxBlockEntity by 0.5F before passing into Shulker::getProgressDeltaAabb fixes this issue.
Still happens in 26.3-snapshot-8 and using a normal shulker entity instead of the shulker box has the same outcome. The following is the relevant code snippet from Entity::move:
profiler.push("move");
if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7) {
if (moverType != MoverType.PISTON) {
delta = delta.multiply(this.stuckSpeedMultiplier);
}
this.stuckSpeedMultiplier = Vec3.ZERO;
this.setDeltaMovement(Vec3.ZERO);
}The game only ignores the stuckSpeedMultiplier of the cobweb/sweetberry bush if the entity was pushed by a piston, not a shulker or a shulker box. Changing this to include both of these cases fixes the reported behaviour, but causes any entities in this scenario to be pushed much higher than intended (more than a block) due to MC-269178.
I think this is an interesting issue. The game essentially never compares ItemStacks directly by reference and instead only compares them using their data. This allows players to switch slots freely while breaking blocks or charging the attack strength ticker, if those slots all contain the “same” item. I think it’s clear that switching between empty slots should not reset the current block breaking progress nor the attack strength, but I’m not sure if this should be intended behaviour if any of those slots are not empty. Intuitively all items within different slots of a players inventory are different items and it seems illogical that switching between two tools of the same type would allow you to keep breaking a block/charging an attack, whereas switching between two of the same tools but of different types doesn’t.
This introduces the question of what should happen when the player changes the item in it’s currently held slot in an inventory/container, or if the server overwrites it. Should enchanting an item (applied from server) reset the items block break progress/attack strength? Should the attack strength be reset if the player manually changes the item in it’s held slot to one of the same type? I believe in the first case the answer would most likely be no (durability changes resetting block break progress is annyoing), but I’m not so sure about the second one. I would say any client-initiated change of the currently held slot should cause a reset of those fields.
This would need a significant amount of changes, since simply comparing two ItemStacks do determine wheter attack strength/block break progress should be reset would not be sufficient anymore, as we also need to take the currently held slot into account.
Otherwise one could just make the attack strength ticker use isSameItemSameComponents() or possibly a new method that compares all data components except for durability (which is frequently changed during normal usage).
I can also not notice any more ticks of non-movement during interpolation in single-player. Also @Kolleen , the player and entity interpolation steps are identical in the newest snapshot to what they were before. Players now also interpolate over the span of 3 ticks again. I think most of the observable difference is due to the fact that the old interpolation basically had some built-in smoothing, whereas the new interpolation strictly follows a jagged path.
This is not fixed in 26.4 Snapshot 6 (at least not to the expected behavior). In this snapshot the block in question now simply reappears until the player has landed instead of reappearing only for a tick, as it has been in previous versions. I think it’s very clear that the intended behaviour is for the block to not reappear at all.
This is not fully a duplicate of MC-28289(also called attribute swapping). Attribute swapping is a purely server-side issue, whereas this bug causes the client to send attack packets when it shouldn’t be able to. Specifically, the issue is that the client performs the raycasting/picking logic before it updates what slot the player is hovering. See the following code snippet from Minecraft::tick:
this.pick(1.0F);
this.tutorial.onLookAt(this.level, this.hitResult);
profiler.push("gui");
this.gui.tick();
if (this.gui.screen() != null) {
this.missTime = 10000;
}
if (this.gui.overlay() == null && this.gui.screen() == null) {
profiler.popPush("Keybindings");
this.handleKeybinds();
[...]The pick() method uses the current held items attack range data component to determine what object the local player is targeting (either a block, entity or nothing) and the handleKeybinds() methods then processes the keyboard inputs of the player to update the held slot. Additionally the players attack strength ticker is also reset after the attack is already processed, so the attack goes through even though a spear normally requires a minimum charge.
If one wanted to achieve the behaviour of swapping a slot at the same time as attacking being treated as attacking with the new item with reset attack strength, one would need to make sure to do the following things in order:
1. update held slot/item if player pressed a different hotkey
2. reset the local players attack strength ticker if held item has changed and perform raytracing/call pick() method (these should be independent).
3. perform attacking/interaction logic
Sorry Rachel, looks like my fault. I wasn’t reading carefully (mojira shows oldest comments and hides newer ones) and thought you were implying the necessary changes had to be made in ChunkMap::tick instead of the ServerLevel class. I’ll make sure to be more careful next time :upside_down_smile:
Yes, MC-297196 definitely explains some of the observed server behaviour and I have left a comment on there as well.
Also, instead of the tickOffset of the PositionStep being set as the number of ticks since the last update was sent, it should rather be a prediction of when the next packet is going to be sent (with possibly 1 extra tick added). So e.g. if updateInterval = 3 and we’re currently on tick 1, we’d be sending a tickOffset of 2 + 1 = 3.
Rachel Arevalo seems to have already pointed out the main issue with a slight inaccuracy (maybe due to outdated/obfuscated code). The root of the problem is that the server sends updated positions to players before actually moving them, causing a tick of unnecessary delay. This is due to this.getChunkSource().tick(…) being called before this.tickNonPassenger(…) in ServerLevel::tick.
If the server receives an attack packet, it adds some velocity to the attacked entity and sets the entities needsSync flag to true. The server then distributes the old position on the next tick and won’t trigger again for possibly up to 3 ticks.
can confirm, experiencing this as well in one particular world.
To further clarify on what I mean when I say that entities can be stuck interpolating forever. Imagine a scenario where remainingTicks = 0 and currentStepTicks = 2.99995 < 3 or similar due to floating point precision. If remainingSteps contains a single step of tickOffset 3, then this will cause the entity to try interpolating on every tick when standing completely still. I noticed something like that happening when testing a few things but cannot reproduce it consistently right now.
On the server side the undesired behaviour is due to code found in ServerEntity::sendChanges and how it interacts with SteppedInterpolationTracker. It calls SteppedInterpolationTracker::getPositionPath to get the PositionPath which is then sent to the player, including the tickOffset. The problem is due to how the steps are added in SteppedInterpolationTracker::addStep;
private void addStep(final Vec3 pos) {
if (this.ticksSinceLastStep > 0) {
this.trackedSteps.add(new PositionStep(pos, this.ticksSinceLastStep));
this.ticksSinceLastStep = 0;
}
}Occasionally this produces very small steps of tickOffset 1-2, causing very visibile stutters in the entities interpolated movement
There are several problems with the current version of the stepped interpolation and using updateInterval() + 1 instead of updateInterval() is not going to fix the most notable stutters. Please make sure to first quickly read my report MC-311976 on this (mostly same) issue.
The first issue is that the vanilla server seemingly already sends move entity packets using the new PositionPath.Stepped packet protocol. This is especially noticeable when hitting an entity currently in rest, as the server will sometimes sent stepped move entity packets with a tickOffset of only 1 or 2, making any changes on the client useless in this regard as they overwrite the interpolationSteps value.
Another issue i mention is that entities can get stuck interpolating on every client tick even though they are not being moved at all.
For a complete fix one must change the interpolationSteps value to updateInterval() + 1 as proposed, must stop the server from sending the move entity packets with PositionSteps of small tickOffset and adjust the following methods in a way similar like I did (I do not guarantee that these are completely free of bugs, but at least entities move smoothly °_°),
In SteppedInterpolationHandler:
protected void doInterpolate() {
float tick = this.entity.level().getRelativeTickSpeed();
this.interpolationData.advance(tick, this.interpolationSteps);
PositionAndRotation target = this.interpolationData.getNewPositionAndRotation();
this.entity.setPos(target.position());
this.entity.setRot(target.yRot(), target.xRot());
}
and in SteppedInterpolationHandler.InterpolationData:
private void setStartingPoint(Vec3 position, float yRot, float xRot) {
this.lastStepPosRot.set(position, yRot, xRot);
this.currentStepTicks = 0.0F;
}private void advance(float ticks, final int interpolationSteps) {
float targetSpeed = Math.max(this.remainingTicks / interpolationSteps, 1.0F);
this.interpolationSpeed = Mth.lerp(1.0F / interpolationSteps, this.interpolationSpeed, targetSpeed);
ticks *= this.interpolationSpeed;
this.currentStepTicks += ticks;
this.remainingTicks -= ticks;
while (!this.remainingSteps.isEmpty()) {
SteppedInterpolationHandler.Step step = this.remainingSteps.getFirst();
int offset = step.tickOffset;
if (this.currentStepTicks < offset) {
return;
}
this.currentStepTicks -= offset;
this.lastStepPosRot.set(step.position(), step.yRot(), step.xRot());
this.remainingSteps.removeFirst();
}
this.remainingTicks = 0.0F;
}
private PositionAndRotation getNewPositionAndRotation() {
if (this.remainingSteps.isEmpty()) {
return this;
}
SteppedInterpolationHandler.Step step = this.remainingSteps.getFirst();
float a = this.currentStepTicks / step.tickOffset;
return PositionAndRotation.of(
this.lastStepPosRot.position().lerp(step.position(), a),
Mth.rotLerp(a, this.lastStepPosRot.yRot(), step.yRot()),
Mth.lerp(a, this.lastStepPosRot.xRot(), step.xRot())
);
}
I think it makes sense structurally to have all of the core logic in the advance method only and avoid the problem with checking for having cleared the full path twice in this way. We set the starting value of currentStepTicks to 0 instead of 1 and instead run the advance() method before getting the new position and rotation.
The “fix” of this seems to have just been reverted in 26.3-rc-3. I think it would be a much better approach to make the attack_damage attribute syncable. That should be a very simple change and it only changes client behaviour slightly, importantly it makes baseDamage be equal to 0 in Player::attack if the attack_damage attribute value is 0, skipping most of the attacking logic.
The code analysis of why this happens is mostly identical to MC-310564 and it can be avoided by making the following changes in Player::canFallAtLeast:
This value also used to be 1.0E-5 before 1.21.5, which caused this change of behaviour.