-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
184 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package xaeroplus.event; | ||
|
||
import net.minecraftforge.client.event.RenderWorldLastEvent; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
import xaero.common.XaeroMinimapSession; | ||
import xaero.common.minimap.waypoints.render.WaypointsIngameRenderer; | ||
import xaeroplus.util.CustomWaypointsIngameRenderer; | ||
|
||
public class ForgeEventHandler { | ||
@SubscribeEvent | ||
public void onRenderWorldLastEvent(final RenderWorldLastEvent event) { | ||
XaeroMinimapSession minimapSession = XaeroMinimapSession.getCurrentSession(); | ||
if (minimapSession == null) return; | ||
WaypointsIngameRenderer waypointsIngameRenderer = minimapSession.getModMain().getInterfaces().getMinimapInterface().getWaypointsIngameRenderer(); | ||
((CustomWaypointsIngameRenderer) waypointsIngameRenderer).renderWaypointBeacons(event.getContext(), event.getPartialTicks()); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/xaeroplus/mixin/client/MixinGuiWaypointSettings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package xaeroplus.mixin.client; | ||
|
||
import net.minecraft.client.gui.GuiScreen; | ||
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; | ||
import xaero.common.IXaeroMinimap; | ||
import xaero.common.gui.ConfigSettingEntry; | ||
import xaero.common.gui.GuiMinimapSettings; | ||
import xaero.common.gui.GuiWaypointSettings; | ||
import xaero.common.gui.ISettingEntry; | ||
import xaeroplus.settings.XaeroPlusSettingsReflectionHax; | ||
|
||
@Mixin(value = GuiWaypointSettings.class, remap = false) | ||
public abstract class MixinGuiWaypointSettings extends GuiMinimapSettings { | ||
public MixinGuiWaypointSettings(final IXaeroMinimap modMain, final String screenTitle, final GuiScreen par1Screen, final GuiScreen escScreen) { | ||
super(modMain, screenTitle, par1Screen, escScreen); | ||
} | ||
|
||
@Inject(method = "<init>", at = @At("RETURN")) | ||
public void init(final IXaeroMinimap modMain, final GuiScreen backScreen, final GuiScreen escScreen, final CallbackInfo ci) { | ||
final ConfigSettingEntry[] configSettingEntries = XaeroPlusSettingsReflectionHax.getWaypointSettingEntries() | ||
.toArray(new ConfigSettingEntry[0]); | ||
final int oldLen = this.entries.length; | ||
final int newLen = configSettingEntries.length; | ||
final int totalNewLen = oldLen + configSettingEntries.length; | ||
final ISettingEntry[] newEntries = new ISettingEntry[totalNewLen]; | ||
System.arraycopy(this.entries, 0, newEntries, newLen, oldLen); | ||
System.arraycopy(configSettingEntries, 0, newEntries, 0, newLen); | ||
this.entries = newEntries; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/java/xaeroplus/util/CustomWaypointsIngameRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package xaeroplus.util; | ||
|
||
import net.minecraft.client.renderer.RenderGlobal; | ||
|
||
public interface CustomWaypointsIngameRenderer { | ||
void renderWaypointBeacons(final RenderGlobal renderGlobal, final float partialTicks); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters