Merge branch '1.8' into 1.9.4
5b3284fUpdate jGui and ReplayStudio (fixes #33)61d6fd4Close replay file zip after recording (fixes #32)00bcc9eFix paths of files that are supposed to be in the mc data dir (fixes #40)e6a789dFix camera rotation when jumping in time (fixes #39)50b53fcAdd a way to register key bindings triggered every render tick (fixes #31)a817c73Prevent GUIs of other mods from opening during replayd64ef8bHide NPCs in the Player Overview GUI (fixes #29)1f2c05eFix spectating player entities past death and respawn (fixes #36)ad2893bFix vanilla bug caused by unremovable entities in the entityList of ClientWorld (fixes #29)c934cb9Fix spawn player packet being sent twice6efbf91Handle F1 properly while mouse is visible in the replay overlay (fixes #30)9add2afDeselect keyframe when pressing "V" aka. sync timelines (fixes #27)
This commit is contained in:
@@ -280,7 +280,7 @@ public class ReplayHandler {
|
||||
CameraEntity cam = getCameraEntity();
|
||||
if (cam != null) {
|
||||
targetCameraPosition = new Location(cam.posX, cam.posY, cam.posZ,
|
||||
cam.rotationPitch, cam.rotationYaw);
|
||||
cam.rotationYaw, cam.rotationPitch);
|
||||
} else {
|
||||
targetCameraPosition = null;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,11 @@ public class CameraEntity extends EntityPlayerSP {
|
||||
public CameraEntity(Minecraft mcIn, World worldIn, NetHandlerPlayClient netHandlerPlayClient, StatisticsManager statisticsManager) {
|
||||
super(mcIn, worldIn, netHandlerPlayClient, statisticsManager);
|
||||
MinecraftForge.EVENT_BUS.register(eventHandler);
|
||||
cameraController = ReplayModReplay.instance.createCameraController(this);
|
||||
if (ReplayModReplay.instance.getReplayHandler().getSpectatedUUID() == null) {
|
||||
cameraController = ReplayModReplay.instance.createCameraController(this);
|
||||
} else {
|
||||
cameraController = new SpectatorCameraController(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,7 +155,9 @@ public class CameraEntity extends EntityPlayerSP {
|
||||
// This is important if the spectated player respawns as their
|
||||
// entity is recreated and we have to spectate a new entity
|
||||
UUID spectating = ReplayModReplay.instance.getReplayHandler().getSpectatedUUID();
|
||||
if (spectating != null && (view.getUniqueID() != spectating || view.worldObj != worldObj)) {
|
||||
if (spectating != null && (view.getUniqueID() != spectating
|
||||
|| view.worldObj != worldObj)
|
||||
|| worldObj.getEntityByID(view.getEntityId()) != view) {
|
||||
view = worldObj.getPlayerEntityByUUID(spectating);
|
||||
if (view != null) {
|
||||
mc.setRenderViewEntity(view);
|
||||
@@ -322,6 +328,12 @@ public class CameraEntity extends EntityPlayerSP {
|
||||
return pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) {
|
||||
// Do not open any block GUIs for the camera entities
|
||||
// Note: Vanilla GUIs are filtered out on a packet level, this only applies to mod GUIs
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead() {
|
||||
super.setDead();
|
||||
@@ -394,7 +406,11 @@ public class CameraEntity extends EntityPlayerSP {
|
||||
@SubscribeEvent
|
||||
public void onSettingsChanged(SettingsChangedEvent event) {
|
||||
if (event.getKey() == Setting.CAMERA) {
|
||||
cameraController = ReplayModReplay.instance.createCameraController(CameraEntity.this);
|
||||
if (ReplayModReplay.instance.getReplayHandler().getSpectatedUUID() == null) {
|
||||
cameraController = ReplayModReplay.instance.createCameraController(CameraEntity.this);
|
||||
} else {
|
||||
cameraController = new SpectatorCameraController(CameraEntity.this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.util.ReadableDimension;
|
||||
import org.lwjgl.util.ReadablePoint;
|
||||
import org.lwjgl.util.WritablePoint;
|
||||
@@ -153,6 +154,23 @@ public class GuiReplayOverlay extends AbstractGuiOverlay<GuiReplayOverlay> {
|
||||
setMouseVisible(true);
|
||||
}
|
||||
}
|
||||
if (Keyboard.getEventKeyState()) {
|
||||
// Handle the F1 key binding while the overlay is opened as a gui screen
|
||||
if (isMouseVisible() && Keyboard.getEventKey() == Keyboard.KEY_F1) {
|
||||
gameSettings.hideGUI = !gameSettings.hideGUI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) {
|
||||
// Do not render overlay when user pressed F1 and we are not currently in some popup
|
||||
if (getMinecraft().gameSettings.hideGUI && isAllowUserInput()) {
|
||||
// Note that this only applies to when the mouse is visible, otherwise
|
||||
// the draw method isn't called in the first place
|
||||
return;
|
||||
}
|
||||
super.draw(renderer, size, renderInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user