-
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.
Merge pull request #28 from FTBTeam/dev
Dev
- Loading branch information
Showing
10 changed files
with
74 additions
and
18 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
10 changes: 10 additions & 0 deletions
10
common/src/main/java/dev/ftb/mods/ftbxmodcompat/ClientUtil.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,10 @@ | ||
package dev.ftb.mods.ftbxmodcompat; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.world.entity.player.Player; | ||
|
||
public class ClientUtil { | ||
public static Player getClientPlayer() { | ||
return Minecraft.getInstance().player; | ||
} | ||
} |
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
19 changes: 15 additions & 4 deletions
19
.../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,40 @@ | ||
package dev.ftb.mods.ftbxmodcompat.fabric.ftbchunks.waystones; | ||
|
||
import dev.ftb.mods.ftbxmodcompat.FTBXModCompat; | ||
import com.mojang.logging.LogUtils; | ||
import dev.architectury.platform.Platform; | ||
import dev.architectury.utils.Env; | ||
import dev.ftb.mods.ftbxmodcompat.ClientUtil; | ||
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 (Platform.getEnvironment() == Env.CLIENT && (!FTBXModConfig.ONLY_SHOW_KNOWN_WAYSTONES.get() || WaystonesAPI.isWaystoneActivated(ClientUtil.getClientPlayer(), 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
20 changes: 16 additions & 4 deletions
20
...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,40 @@ | ||
package dev.ftb.mods.ftbxmodcompat.neoforge.ftbchunks.waystones; | ||
|
||
import dev.ftb.mods.ftbxmodcompat.FTBXModCompat; | ||
import com.mojang.logging.LogUtils; | ||
import dev.architectury.platform.Platform; | ||
import dev.architectury.utils.Env; | ||
import dev.ftb.mods.ftbxmodcompat.ClientUtil; | ||
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 net.neoforged.api.distmarker.Dist; | ||
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 (Platform.getEnvironment() == Env.CLIENT && (!FTBXModConfig.ONLY_SHOW_KNOWN_WAYSTONES.get() || WaystonesAPI.isWaystoneActivated(ClientUtil.getClientPlayer(), 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