Merge branch '1.8' into 1.9.4

5b3284f Update jGui and ReplayStudio (fixes #33)
61d6fd4 Close replay file zip after recording (fixes #32)
00bcc9e Fix paths of files that are supposed to be in the mc data dir (fixes #40)
e6a789d Fix camera rotation when jumping in time (fixes #39)
50b53fc Add a way to register key bindings triggered every render tick (fixes #31)
a817c73 Prevent GUIs of other mods from opening during replay
d64ef8b Hide NPCs in the Player Overview GUI (fixes #29)
1f2c05e Fix spectating player entities past death and respawn (fixes #36)
ad2893b Fix vanilla bug caused by unremovable entities in the entityList of ClientWorld (fixes #29)
c934cb9 Fix spawn player packet being sent twice
6efbf91 Handle F1 properly while mouse is visible in the replay overlay (fixes #30)
9add2af Deselect keyframe when pressing "V" aka. sync timelines (fixes #27)
This commit is contained in:
johni0702
2016-11-29 22:32:03 +01:00
17 changed files with 168 additions and 27 deletions

View File

@@ -0,0 +1,31 @@
package com.replaymod.replay.mixin;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(WorldClient.class)
public abstract class MixinWorldClient {
/**
* Fixes a bug in vanilla Minecraft that leaves entities remaining in the entityList even after respawn.
* The entityList in WorldClient is a Set that assumes that the entity ID of its entities does not change.
* However in {@link WorldClient#addEntityToWorld(int, Entity)}, the entity passed in is first added to the
* set and subsequently its id is changed, leaving it stuck in he Set. That is the buggy method.
* This wouldn't be too much of a problem if the entity had the correct id to begin with, however the handler for
* the spawn player packet creates an EntityOtherPlayerMP which takes its id from a counter and then passes it to
* this method with the wrong id.
* This mixin fixes the id of the entity before it is added to the set instead of right after.
* The original id change right after is not changed, however it should not have any effect.
* @param entityId The id to be set for the entity
* @param entity The entity to be added
* @param ci Callback info
*/
@Inject(method = "addEntityToWorld", at=@At("HEAD"))
public void replayModReplay_fix_addEntityToWorld(int entityId, Entity entity, CallbackInfo ci) {
entity.setEntityId(entityId);
}
}