ed56673Merge branch '1.8' into 1.8.991573d9Update jGui, ReplayStudio and Translationsd71358bAdd confirmation dialog before overwriting path presets (fixes #65)1a55983Move addCallback method from integration test Utils to main Utils18c5bcdBe more cooperative with other mods on the ingame menu (fixes #42)c054fe8Register keys for simplepathing only once (fixes #63)f13297cFix default interpolator handling in keyframe gui and after loading (fixes #64)391f304Show error popup if entity tracker fails to load0e0eaaaFix entity tracker being set even if it failed loading (fixes #50)a34bbbcFix NPE when spectating a player without a camera entity60879fbChange local class to be an inner class because Srg2Source breaks with itdfafbecLoad translations from github repo, only reload language not all resource packs8a6ec51Add missing tooltips to player overview and various missing chat messages5677fc5Re-add warning to replay editor748a91eFix missing tooltips on fav/like/dislike buttons in replay centeree24866Fix upload replay button not being updated when name/tags changedba085cMove translations into separate repo3f0e3e7Fix NPE when receiving Replay|Restrict messages (fixes #16 GH)40e1d85Fix crash when saving the last keyframe in the edit gui (fixes #61)03aada1Update Mixin to 0.6.8 (fixes #9 GH)0c1dc65Fix interpolator being lost when moving keyframe to the end (fixes #62)fcbbbc9Add integration test. Run with ./gradlew runIntegrationTestfe6ded0Fix movement of keyframe via GuiEditKeyframe not updating selected keyframef58fa8fFix Login GUI not respecting other GUIs opened on startup4fc3a31Fix OpenEye being installed into working dir instead of mcDataDir
127 lines
4.1 KiB
Java
127 lines
4.1 KiB
Java
package com.replaymod.simplepathing;
|
|
|
|
import com.replaymod.core.ReplayMod;
|
|
import com.replaymod.core.events.SettingsChangedEvent;
|
|
import com.replaymod.replay.events.ReplayCloseEvent;
|
|
import com.replaymod.replay.events.ReplayOpenEvent;
|
|
import com.replaymod.replaystudio.pathing.path.Keyframe;
|
|
import com.replaymod.simplepathing.SPTimeline.SPPath;
|
|
import com.replaymod.simplepathing.gui.GuiPathing;
|
|
import com.replaymod.simplepathing.preview.PathPreview;
|
|
import lombok.Getter;
|
|
import net.minecraftforge.common.MinecraftForge;
|
|
import net.minecraftforge.fml.common.Mod;
|
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|
import org.apache.logging.log4j.Logger;
|
|
import org.lwjgl.input.Keyboard;
|
|
|
|
@Mod(modid = ReplayModSimplePathing.MOD_ID,
|
|
version = "@MOD_VERSION@",
|
|
acceptedMinecraftVersions = "@MC_VERSION@",
|
|
useMetadata = true)
|
|
public class ReplayModSimplePathing {
|
|
public static final String MOD_ID = "replaymod-simplepathing";
|
|
|
|
@Mod.Instance(MOD_ID)
|
|
public static ReplayModSimplePathing instance;
|
|
|
|
private ReplayMod core;
|
|
|
|
public static Logger LOGGER;
|
|
|
|
private GuiPathing guiPathing;
|
|
|
|
@Mod.EventHandler
|
|
public void preInit(FMLPreInitializationEvent event) {
|
|
LOGGER = event.getModLog();
|
|
core = ReplayMod.instance;
|
|
|
|
core.getSettingsRegistry().register(Setting.class);
|
|
|
|
MinecraftForge.EVENT_BUS.register(this);
|
|
|
|
PathPreview pathPreview = new PathPreview(this);
|
|
pathPreview.register();
|
|
|
|
core.getKeyBindingRegistry().registerKeyBinding("replaymod.input.keyframerepository", Keyboard.KEY_X, () -> {
|
|
if (guiPathing != null) guiPathing.keyframeRepoButtonPressed();
|
|
});
|
|
core.getKeyBindingRegistry().registerKeyBinding("replaymod.input.clearkeyframes", Keyboard.KEY_C, () -> {
|
|
if (guiPathing != null) guiPathing.clearKeyframesButtonPressed();
|
|
});
|
|
core.getKeyBindingRegistry().registerRepeatedKeyBinding("replaymod.input.synctimeline", Keyboard.KEY_V, () -> {
|
|
if (guiPathing != null) guiPathing.syncTimeButtonPressed();
|
|
});
|
|
core.getKeyBindingRegistry().registerRaw(Keyboard.KEY_DELETE, () -> {
|
|
if (guiPathing != null) guiPathing.deleteButtonPressed();
|
|
});
|
|
}
|
|
|
|
@SubscribeEvent
|
|
public void postReplayOpen(ReplayOpenEvent.Post event) {
|
|
clearCurrentTimeline();
|
|
guiPathing = new GuiPathing(core, this, event.getReplayHandler());
|
|
}
|
|
|
|
@SubscribeEvent
|
|
public void onReplayClose(ReplayCloseEvent.Post event) {
|
|
currentTimeline = null;
|
|
guiPathing = null;
|
|
selectedPath = null;
|
|
}
|
|
|
|
@SubscribeEvent
|
|
public void onSettingsChanged(SettingsChangedEvent event) {
|
|
if (event.getKey() == Setting.DEFAULT_INTERPOLATION) {
|
|
if (currentTimeline != null && guiPathing != null) {
|
|
updateDefaultInterpolatorType();
|
|
}
|
|
}
|
|
}
|
|
|
|
private SPTimeline currentTimeline;
|
|
|
|
@Getter
|
|
private SPPath selectedPath;
|
|
@Getter
|
|
private long selectedTime;
|
|
|
|
public boolean isSelected(Keyframe keyframe) {
|
|
return selectedPath != null && currentTimeline.getKeyframe(selectedPath, selectedTime) == keyframe;
|
|
}
|
|
|
|
public void setSelected(SPPath path, long time) {
|
|
selectedPath = path;
|
|
selectedTime = time;
|
|
}
|
|
|
|
public void setCurrentTimeline(SPTimeline newTimeline) {
|
|
selectedPath = null;
|
|
currentTimeline = newTimeline;
|
|
updateDefaultInterpolatorType();
|
|
}
|
|
|
|
public void clearCurrentTimeline() {
|
|
setCurrentTimeline(new SPTimeline());
|
|
}
|
|
|
|
public SPTimeline getCurrentTimeline() {
|
|
return currentTimeline;
|
|
}
|
|
|
|
private void updateDefaultInterpolatorType() {
|
|
InterpolatorType newDefaultType =
|
|
InterpolatorType.fromString(core.getSettingsRegistry().get(Setting.DEFAULT_INTERPOLATION));
|
|
currentTimeline.setDefaultInterpolatorType(newDefaultType);
|
|
}
|
|
|
|
public ReplayMod getCore() {
|
|
return core;
|
|
}
|
|
|
|
public GuiPathing getGuiPathing() {
|
|
return guiPathing;
|
|
}
|
|
}
|