Skip to content

Commit

Permalink
Implemented #74
Browse files Browse the repository at this point in the history
  • Loading branch information
CodexAdrian committed Dec 7, 2023
1 parent dbe562e commit e5bc8f6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# 2.2.4

Fixed favorited locations not being saved
Fixed favorited locations not being saved
Add config to disabled waystones & fwaystones compat
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public static void registerLocationGetter(String getterId, BiFunction<Level, UUI
public static void gatherLocations(Level level, UUID player, Map<UUID, LocationData> locations) {
for (var getter : LOCATION_GETTERS.entrySet()) {
try {
Map<UUID, LocationData> apply = getter.getValue().apply(level, player);
locations.putAll(apply);
locations.putAll(getter.getValue().apply(level, player));
} catch (Exception e) {
Tempad.LOG.error("Error gathering locations from " + getter.getKey(), e);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
package me.codexadrian.tempad.common.compat.waystones;

import me.codexadrian.tempad.api.locations.LocationsApi;
import me.codexadrian.tempad.common.config.ConfigCache;
import me.codexadrian.tempad.common.config.TempadConfig;
import me.codexadrian.tempad.common.data.LocationData;
import net.blay09.mods.waystones.api.IWaystone;
import net.blay09.mods.waystones.core.PlayerWaystoneManager;
import net.minecraft.world.entity.player.Player;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

public class WaystoneLocationGetter {
public static void init() {
LocationsApi.registerLocationGetter("tempad:waystones", (level, uuid) -> {
if (!TempadConfig.waystonesCompat) return Map.of();
var locations = new HashMap<UUID, LocationData>();
Player player = level.getPlayerByUUID(uuid);
if (player != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ public final class TempadConfig {
@Comment("Whether or not the Tempad should consume a cooldown when exporting a location.")
public static boolean consumeCooldown = true;

//enable waystones compat
@ConfigEntry(id = "waystonesCompat", type = EntryType.BOOLEAN, translation = "config.tempad.waystones_compat")
@Comment("Whether or not the Tempad should allow teleporting to waystones.")
public static boolean waystonesCompat = true;

//enable fabric waystones compat
@ConfigEntry(id = "fabricWaystonesCompat", type = EntryType.BOOLEAN, translation = "config.tempad.fabric_waystones_compat")
@Comment("Whether or not the Tempad should allow teleporting to waystones from the Fabric version of Waystones by LordDeatHunter (fwaystones) (ignore on forge).")
public static boolean fabricWaystonesCompat = true;

@ConfigEntry(id = "timedoorFuelAmount", type = EntryType.INTEGER, translation = "config.tempad.timedoor_fuel_amount")
@Comment("The amount of fuel that the timedoor will consume on opening of the timedoor.")
public static int tempadFuelConsumptionValue = 180;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package me.codexadrian.tempad.common.compat.fabricwaystones;

import me.codexadrian.tempad.api.locations.LocationsApi;
import me.codexadrian.tempad.common.config.TempadConfig;
import me.codexadrian.tempad.common.data.LocationData;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
Expand All @@ -9,11 +10,13 @@
import wraith.fwaystones.FabricWaystones;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public class FabricWaystoneLocationGetter {
public static void init() {
LocationsApi.registerLocationGetter("tempad:fabric_waystones", (level, playerId) -> {
if (!TempadConfig.fabricWaystonesCompat) return Map.of();
var locations = new HashMap<UUID, LocationData>();
Player player = level.getPlayerByUUID(playerId);
if (player != null) {
Expand Down

0 comments on commit e5bc8f6

Please sign in to comment.