Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
Baritone integrate to Journer Map
Browse files Browse the repository at this point in the history
Added goto to map and waypoints in Journey Map
  • Loading branch information
Nekiplay committed Jul 30, 2023
1 parent efb84c5 commit e157951
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 14 deletions.
25 changes: 24 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,26 @@ archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

configurations.all {
// Check for snapshots more frequently than Gradle's default of 1 day. 0 = every build.
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}

repositories {
maven {
url "https://jm.gserv.me/repository/maven-public/"
content {
includeGroup "info.journeymap"
}
}
maven {
url "https://api.modrinth.com/maven/"
content {
includeGroup "maven.modrinth"
}
}
}

dependencies {
// Fabric
minecraft "com.mojang:minecraft:${project.minecraft_version}"
Expand All @@ -17,6 +37,10 @@ dependencies {
// Meteor client
modImplementation files("libs\\baritone-fabric-1.20.1-SNAPSHOT.jar")
modImplementation files("libs\\meteor-client-0.5.4-1870.jar")

// Journey Map
modCompileOnlyApi group: 'info.journeymap', name: 'journeymap-api', version: project.journeymap_api_fabric_version, changing: true
modRuntimeOnly "maven.modrinth:journeymap:${project.jm_fabric_version}"
}

loom {
Expand All @@ -27,7 +51,6 @@ processResources {
filesMatching("fabric.mod.json") {
expand "version": project.mod_version, "mc_version": project.minecraft_version, "gh_hash": (System.getenv("GITHUB_SHA") ?: "")
}

}

tasks.withType(JavaCompile).configureEach {
Expand Down
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ archives_base_name=meteor-plus

# Meteor (https://maven.meteordev.org/)
meteor_version=0.5.4-SNAPSHOT

# Journer Map
journeymap_api_fabric_version=1.20-1.9-fabric-SNAPSHOT
jm_fabric_version=1.20.1-5.9.12-fabric
14 changes: 7 additions & 7 deletions settings.gradle
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()
}
}
11 changes: 8 additions & 3 deletions src/main/java/olejka/meteorplus/MeteorPlus.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
import meteordevelopment.meteorclient.addons.GithubRepo;
import meteordevelopment.meteorclient.commands.Commands;
import meteordevelopment.meteorclient.gui.tabs.Tabs;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.loader.api.FabricLoader;
import olejka.meteorplus.commands.Eclip;
//import olejka.meteorplus.hud.CustomImageHud;
import olejka.meteorplus.gui.tabs.HiddenModulesTab;
import olejka.meteorplus.hud.MeteorPlusLogoHud;
//import olejka.meteorplus.hud.TargetHud;
import meteordevelopment.meteorclient.addons.MeteorAddon;
import meteordevelopment.meteorclient.systems.modules.Category;
import meteordevelopment.meteorclient.systems.modules.Modules;
Expand All @@ -27,7 +26,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class MeteorPlus extends MeteorAddon {
public class MeteorPlus extends MeteorAddon implements ClientModInitializer {
public static final Logger LOG = LoggerFactory.getLogger(MeteorPlus.class);
public static final Category CATEGORY = new Category("MeteorPlus", Items.EMERALD_BLOCK.getDefaultStack());
public static final HudGroup HUD_GROUP = new HudGroup("MeteorPlusHud");
Expand All @@ -46,6 +45,7 @@ public static MeteorPlus getInstance() {
return instance;
}


@Override
public void onInitialize() {
instance = this;
Expand Down Expand Up @@ -142,4 +142,9 @@ public String getCommit() {
public String getPackage() {
return "olejka.meteorplus";
}

@Override
public void onInitializeClient() {

}
}
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) {

}
}
9 changes: 6 additions & 3 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"name": "Meteor Plus",
"description": "An addon for Meteor client that adds many blatant features.",
"authors": [
"Olejka",
"Neki_play",
"Olejka",
"Vazgen005"
],
"contact": {
Expand All @@ -18,11 +18,14 @@

"license": "GPL-3.0",
"icon": "assets/plus/icon.png",
"environment": "client",
"environment": "*",
"entrypoints": {
"meteor": [
"olejka.meteorplus.MeteorPlus"
]
],
"journeymap": [
"olejka.meteorplus.journeymap.JourneyMapMeteorPlus"
]
},
"mixins": [
"meteor-plus.mixins.json"
Expand Down

0 comments on commit e157951

Please sign in to comment.