Update to MC 1.14 / Fabric
This commit is contained in:
@@ -1,37 +1,26 @@
|
||||
package com.replaymod.extras;
|
||||
|
||||
import com.replaymod.core.ReplayMod;
|
||||
import com.replaymod.core.versions.MCVer.Keyboard;
|
||||
import com.replaymod.replay.ReplayHandler;
|
||||
import com.replaymod.replay.ReplayModReplay;
|
||||
import com.replaymod.replay.events.ReplayOpenEvent;
|
||||
import com.replaymod.replay.events.ReplayOpenedCallback;
|
||||
import com.replaymod.replay.gui.overlay.GuiReplayOverlay;
|
||||
import de.johni0702.minecraft.gui.element.GuiImage;
|
||||
import de.johni0702.minecraft.gui.element.IGuiImage;
|
||||
import de.johni0702.minecraft.gui.layout.HorizontalLayout;
|
||||
|
||||
//#if MC>=11300
|
||||
import com.replaymod.core.versions.MCVer.Keyboard;
|
||||
import de.johni0702.minecraft.gui.utils.EventRegistrations;
|
||||
import net.minecraft.client.GameSettings;
|
||||
//#else
|
||||
//$$ import net.minecraft.client.settings.GameSettings;
|
||||
//$$ import org.lwjgl.input.Keyboard;
|
||||
//#endif
|
||||
|
||||
//#if MC>=10800
|
||||
//#if MC>=11300
|
||||
//#if MC>=11400
|
||||
//$$ import com.replaymod.core.events.PreRenderCallback;
|
||||
//$$ import com.replaymod.core.events.PostRenderCallback;
|
||||
//#else
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
//#endif
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
//#else
|
||||
//$$ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
//$$ import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
//#endif
|
||||
|
||||
import static com.replaymod.core.versions.MCVer.*;
|
||||
|
||||
public class FullBrightness implements Extra {
|
||||
public class FullBrightness extends EventRegistrations implements Extra {
|
||||
private ReplayModReplay module;
|
||||
|
||||
private final IGuiImage indicator = new GuiImage().setTexture(ReplayMod.TEXTURE, 90, 20, 19, 13).setSize(19, 13);
|
||||
@@ -65,26 +54,37 @@ public class FullBrightness implements Extra {
|
||||
}
|
||||
});
|
||||
|
||||
FML_BUS.register(this);
|
||||
register();
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//$$ { on(PreRenderCallback.EVENT, this::preRender); }
|
||||
//$$ private void preRender() {
|
||||
//#else
|
||||
@SubscribeEvent
|
||||
public void preRender(TickEvent.RenderTickEvent event) {
|
||||
if (event.phase != TickEvent.Phase.START) return;
|
||||
//#endif
|
||||
if (active && module.getReplayHandler() != null) {
|
||||
if (event.phase == TickEvent.Phase.START) {
|
||||
originalGamma = gameSettings.gammaSetting;
|
||||
gameSettings.gammaSetting = 1000;
|
||||
} else if (event.phase == TickEvent.Phase.END) {
|
||||
gameSettings.gammaSetting = originalGamma;
|
||||
}
|
||||
originalGamma = gameSettings.gammaSetting;
|
||||
gameSettings.gammaSetting = 1000;
|
||||
}
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
//$$ { on(PostRenderCallback.EVENT, this::postRender); }
|
||||
//$$ private void postRender() {
|
||||
//#else
|
||||
@SubscribeEvent
|
||||
public void replayOpened(ReplayOpenEvent.Post event) {
|
||||
updateIndicator(event.getReplayHandler().getOverlay());
|
||||
public void postRender(TickEvent.RenderTickEvent event) {
|
||||
if (event.phase != TickEvent.Phase.END) return;
|
||||
//#endif
|
||||
if (active && module.getReplayHandler() != null) {
|
||||
gameSettings.gammaSetting = originalGamma;
|
||||
}
|
||||
}
|
||||
|
||||
{ on(ReplayOpenedCallback.EVENT, replayHandler -> updateIndicator(replayHandler.getOverlay())); }
|
||||
private void updateIndicator(GuiReplayOverlay overlay) {
|
||||
if (active) {
|
||||
overlay.statusIndicatorPanel.addElements(new HorizontalLayout.Data(1), indicator);
|
||||
|
||||
Reference in New Issue
Block a user