This repository has been archived by the owner on Sep 24, 2024. It is now read-only.
generated from MeteorDevelopment/meteor-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added goto to map and waypoints in Journey Map
- Loading branch information
Showing
6 changed files
with
120 additions
and
14 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
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
pluginManagement { | ||
repositories { | ||
maven { | ||
name = 'Fabric' | ||
url = 'https://maven.fabricmc.net/' | ||
} | ||
repositories { | ||
maven { | ||
name = 'Fabric' | ||
url = 'https://maven.fabricmc.net/' | ||
} | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
gradlePluginPortal() | ||
} | ||
} |
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
71 changes: 71 additions & 0 deletions
71
src/main/java/olejka/meteorplus/journeymap/JourneyMapMeteorPlus.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,71 @@ | ||
package olejka.meteorplus.journeymap; | ||
|
||
import baritone.api.BaritoneAPI; | ||
import baritone.api.pathing.goals.GoalBlock; | ||
import journeymap.client.api.IClientAPI; | ||
import journeymap.client.api.IClientPlugin; | ||
import journeymap.client.api.display.ModPopupMenu; | ||
import journeymap.client.api.event.ClientEvent; | ||
import journeymap.client.api.event.fabric.FabricEvents; | ||
import olejka.meteorplus.MeteorPlus; | ||
|
||
import java.util.EnumSet; | ||
|
||
import static journeymap.client.api.event.ClientEvent.Type.*; | ||
|
||
public class JourneyMapMeteorPlus implements IClientPlugin { | ||
// API reference | ||
private IClientAPI jmAPI = null; | ||
|
||
private static JourneyMapMeteorPlus INSTANCE; | ||
|
||
public JourneyMapMeteorPlus() | ||
{ | ||
INSTANCE = this; | ||
} | ||
|
||
@Override | ||
public void initialize(final IClientAPI jmClientApi) { | ||
|
||
MeteorPlus.LOG.info("Loading Journey Map integrate"); | ||
jmAPI = jmClientApi; | ||
FabricEvents.FULLSCREEN_POPUP_MENU_EVENT.register(event -> { | ||
MeteorPlus.LOG.info("Register fullscreen Journey Map"); | ||
ModPopupMenu popupMenu = event.getPopupMenu(); | ||
|
||
popupMenu.addMenuItem("Goto", p -> { | ||
GoalBlock goal = new GoalBlock(p.up()); | ||
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(goal); | ||
}); | ||
|
||
MeteorPlus.LOG.info("Register fullscreen Journey Map done"); | ||
}); | ||
|
||
FabricEvents.WAYPOINT_POPUP_MENU_EVENT.register(event -> { | ||
MeteorPlus.LOG.info("Register waypoints Journey Map"); | ||
ModPopupMenu popupMenu = event.getPopupMenu(); | ||
|
||
popupMenu.addMenuItem("Goto", p -> { | ||
GoalBlock goal = new GoalBlock(p.up()); | ||
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(goal); | ||
}); | ||
|
||
MeteorPlus.LOG.info("Register waypoints Journey Map done"); | ||
}); | ||
|
||
// Subscribe to desired ClientEvent types from JourneyMap | ||
this.jmAPI.subscribe(getModId(), EnumSet.of(DEATH_WAYPOINT, MAPPING_STARTED, MAPPING_STOPPED, REGISTRY)); | ||
|
||
MeteorPlus.LOG.info("Journey Map integrate loaded"); | ||
} | ||
|
||
@Override | ||
public String getModId() { | ||
return "meteorplus"; | ||
} | ||
|
||
@Override | ||
public void onEvent(ClientEvent event) { | ||
|
||
} | ||
} |
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