[FEAT] APIs for Player Revive mod and Whitelist changes
This commit is contained in:
@@ -8,6 +8,8 @@ dependencies {
|
||||
stupidRemapArch("dev.ftb.mods:ftb-ranks-neoforge:${ftb_ranks}")
|
||||
|
||||
modImplementation("me.shedaniel.cloth:cloth-config-neoforge:${cloth_config}")
|
||||
modImplementation("unimaven.curseforge:playerrevive-266890:${player_revive}")
|
||||
modImplementation("unimaven.curseforge:creativecore-257814:${creative_core}")
|
||||
|
||||
// Do not edit or remove
|
||||
implementation project(":Common")
|
||||
|
@@ -2,6 +2,7 @@ package com.hypherionmc.craterlib;
|
||||
|
||||
import com.hypherionmc.craterlib.client.NeoForgeClientHelper;
|
||||
import com.hypherionmc.craterlib.common.NeoForgeServerEvents;
|
||||
import com.hypherionmc.craterlib.compat.PlayerReviveEvents;
|
||||
import com.hypherionmc.craterlib.compat.Vanish;
|
||||
import com.hypherionmc.craterlib.core.networking.CraterPacketNetwork;
|
||||
import com.hypherionmc.craterlib.core.networking.PacketRegistry;
|
||||
@@ -29,6 +30,10 @@ public class CraterLib {
|
||||
if (ModloaderEnvironment.INSTANCE.isModLoaded("vmod")) {
|
||||
NeoForge.EVENT_BUS.register(new Vanish());
|
||||
}
|
||||
|
||||
if (ModloaderEnvironment.INSTANCE.isModLoaded("playerrevive")) {
|
||||
NeoForge.EVENT_BUS.register(new PlayerReviveEvents());
|
||||
}
|
||||
}
|
||||
|
||||
public void commonSetup(FMLCommonSetupEvent evt) {
|
||||
|
@@ -4,6 +4,8 @@ import com.hypherionmc.craterlib.core.platform.CompatUtils;
|
||||
import com.hypherionmc.craterlib.core.platform.ModloaderEnvironment;
|
||||
import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
|
||||
import redstonedubstep.mods.vanishmod.VanishUtil;
|
||||
import team.creative.playerrevive.api.IBleeding;
|
||||
import team.creative.playerrevive.server.PlayerReviveServer;
|
||||
|
||||
public class NeoForgeCompatHelper implements CompatUtils {
|
||||
|
||||
@@ -19,4 +21,30 @@ public class NeoForgeCompatHelper implements CompatUtils {
|
||||
public String getSkinUUID(BridgedPlayer player) {
|
||||
return player.getStringUUID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlayerBleeding(BridgedPlayer player) {
|
||||
if (!ModloaderEnvironment.INSTANCE.isModLoaded("playerrevive"))
|
||||
return false;
|
||||
|
||||
return PlayerReviveServer.isBleeding(player.toMojangServerPlayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerBledOut(BridgedPlayer player) {
|
||||
if (!ModloaderEnvironment.INSTANCE.isModLoaded("playerrevive"))
|
||||
return false;
|
||||
|
||||
IBleeding bleeding = PlayerReviveServer.getBleeding(player.toMojangServerPlayer());
|
||||
return bleeding != null && bleeding.bledOut();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRevived(BridgedPlayer player) {
|
||||
if (!ModloaderEnvironment.INSTANCE.isModLoaded("playerrevive"))
|
||||
return false;
|
||||
|
||||
IBleeding bleeding = PlayerReviveServer.getBleeding(player.toMojangServerPlayer());
|
||||
return bleeding != null && bleeding.revived();
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,23 @@
|
||||
package com.hypherionmc.craterlib.compat;
|
||||
|
||||
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
||||
import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
|
||||
import lombok.NoArgsConstructor;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import team.creative.playerrevive.api.event.PlayerBleedOutEvent;
|
||||
import team.creative.playerrevive.api.event.PlayerRevivedEvent;
|
||||
|
||||
@NoArgsConstructor
|
||||
public class PlayerReviveEvents {
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerRevived(PlayerRevivedEvent event) {
|
||||
CraterEventBus.INSTANCE.postEvent(com.hypherionmc.craterlib.api.events.compat.PlayerRevivedEvent.of(BridgedPlayer.of(event.getEntity())));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerBledOutEvent(PlayerBleedOutEvent event) {
|
||||
CraterEventBus.INSTANCE.postEvent(com.hypherionmc.craterlib.api.events.compat.PlayerRevivedEvent.of(BridgedPlayer.of(event.getEntity())));
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user