-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add config option to only show "know" waypoints (#27)
* Add config option to only show "know" waypoints
- Loading branch information
1 parent
d5abed1
commit 2a03e61
Showing
8 changed files
with
47 additions
and
17 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
16 changes: 12 additions & 4 deletions
16
.../src/main/java/dev/ftb/mods/ftbxmodcompat/fabric/ftbchunks/waystones/WaystonesCompat.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 |
---|---|---|
@@ -1,29 +1,37 @@ | ||
package dev.ftb.mods.ftbxmodcompat.fabric.ftbchunks.waystones; | ||
|
||
import dev.ftb.mods.ftbxmodcompat.FTBXModCompat; | ||
import com.mojang.logging.LogUtils; | ||
import dev.ftb.mods.ftbxmodcompat.config.FTBXModConfig; | ||
import dev.ftb.mods.ftbxmodcompat.ftbchunks.waystones.WaystoneData; | ||
import dev.ftb.mods.ftbxmodcompat.ftbchunks.waystones.WaystoneMapIcon; | ||
import dev.ftb.mods.ftbxmodcompat.ftbchunks.waystones.WaystonesCommon; | ||
import net.blay09.mods.balm.api.Balm; | ||
import net.blay09.mods.waystones.api.Waystone; | ||
import net.blay09.mods.waystones.api.WaystoneVisibility; | ||
import net.blay09.mods.waystones.api.WaystonesAPI; | ||
import net.blay09.mods.waystones.api.event.WaystoneRemoveReceivedEvent; | ||
import net.blay09.mods.waystones.api.event.WaystoneUpdatedEvent; | ||
import net.minecraft.client.Minecraft; | ||
import org.slf4j.Logger; | ||
|
||
public class WaystonesCompat { | ||
private static final Logger LOGGER = LogUtils.getLogger(); | ||
|
||
public static void init() { | ||
Balm.getEvents().onEvent(WaystoneUpdatedEvent.class, WaystonesCompat::updateWaystone); | ||
Balm.getEvents().onEvent(WaystoneRemoveReceivedEvent.class, WaystonesCompat::removeWaystone); | ||
} | ||
|
||
private static void removeWaystone(WaystoneRemoveReceivedEvent event) { | ||
FTBXModCompat.LOGGER.info("waystone removed: " + event.getWaystoneId()); | ||
LOGGER.trace("Waystone removed: {}", event.getWaystoneId()); | ||
WaystonesCommon.removeWaystone(event.getWaystoneId()); | ||
} | ||
|
||
private static void updateWaystone(WaystoneUpdatedEvent event) { | ||
FTBXModCompat.LOGGER.info("waystone updated: " + event.getWaystone().getWaystoneUid()); | ||
LOGGER.trace("waystone updated: {} {}", event.getWaystone().getWaystoneUid(), event.getWaystone().getVisibility()); | ||
Waystone w = event.getWaystone(); | ||
WaystonesCommon.updateWaystone(w.getWaystoneUid(), new WaystoneData(w.getDimension(), new WaystoneMapIcon(w.getPos(), w.getName(), w.getVisibility() == WaystoneVisibility.GLOBAL))); | ||
if (!FTBXModConfig.ONLY_SHOW_KNOWN_WAYSTONES.get() || WaystonesAPI.isWaystoneActivated(Minecraft.getInstance().player, w)) { | ||
WaystonesCommon.updateWaystone(w.getWaystoneUid(), new WaystoneData(w.getDimension(), new WaystoneMapIcon(w.getPos(), w.getName(), w.getVisibility() == WaystoneVisibility.GLOBAL))); | ||
} | ||
} | ||
} |
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
16 changes: 12 additions & 4 deletions
16
...rc/main/java/dev/ftb/mods/ftbxmodcompat/neoforge/ftbchunks/waystones/WaystonesCompat.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 |
---|---|---|
@@ -1,28 +1,36 @@ | ||
package dev.ftb.mods.ftbxmodcompat.neoforge.ftbchunks.waystones; | ||
|
||
import dev.ftb.mods.ftbxmodcompat.FTBXModCompat; | ||
import com.mojang.logging.LogUtils; | ||
import dev.ftb.mods.ftbxmodcompat.config.FTBXModConfig; | ||
import dev.ftb.mods.ftbxmodcompat.ftbchunks.waystones.WaystoneData; | ||
import dev.ftb.mods.ftbxmodcompat.ftbchunks.waystones.WaystoneMapIcon; | ||
import dev.ftb.mods.ftbxmodcompat.ftbchunks.waystones.WaystonesCommon; | ||
import net.blay09.mods.balm.api.Balm; | ||
import net.blay09.mods.waystones.api.Waystone; | ||
import net.blay09.mods.waystones.api.WaystoneVisibility; | ||
import net.blay09.mods.waystones.api.WaystonesAPI; | ||
import net.blay09.mods.waystones.api.event.*; | ||
import net.minecraft.client.Minecraft; | ||
import org.slf4j.Logger; | ||
|
||
public class WaystonesCompat { | ||
private static final Logger LOGGER = LogUtils.getLogger(); | ||
|
||
public static void init() { | ||
Balm.getEvents().onEvent(WaystoneUpdatedEvent.class, WaystonesCompat::updateWaystone); | ||
Balm.getEvents().onEvent(WaystoneRemoveReceivedEvent.class, WaystonesCompat::removeWaystone); | ||
} | ||
|
||
private static void removeWaystone(WaystoneRemoveReceivedEvent event) { | ||
FTBXModCompat.LOGGER.info("waystone removed: " + event.getWaystoneId()); | ||
LOGGER.trace("Waystone removed: {}", event.getWaystoneId()); | ||
WaystonesCommon.removeWaystone(event.getWaystoneId()); | ||
} | ||
|
||
private static void updateWaystone(WaystoneUpdatedEvent event) { | ||
FTBXModCompat.LOGGER.info("waystone updated: " + event.getWaystone().getWaystoneUid()); | ||
LOGGER.trace("waystone updated: {} {}", event.getWaystone().getWaystoneUid(), event.getWaystone().getVisibility()); | ||
Waystone w = event.getWaystone(); | ||
WaystonesCommon.updateWaystone(w.getWaystoneUid(), new WaystoneData(w.getDimension(), new WaystoneMapIcon(w.getPos(), w.getName(), w.getVisibility() == WaystoneVisibility.GLOBAL))); | ||
if (!FTBXModConfig.ONLY_SHOW_KNOWN_WAYSTONES.get() || WaystonesAPI.isWaystoneActivated(Minecraft.getInstance().player, w)) { | ||
WaystonesCommon.updateWaystone(w.getWaystoneUid(), new WaystoneData(w.getDimension(), new WaystoneMapIcon(w.getPos(), w.getName(), w.getVisibility() == WaystoneVisibility.GLOBAL))); | ||
} | ||
} | ||
} |
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