feat: 文档更新,代码导入调整
This commit is contained in:
parent
7a7eee8abf
commit
2e4bd500f2
|
|
@ -14,7 +14,7 @@
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
name = "LTD Maven"
|
name = "LTD Maven"
|
||||||
url = "https://maven.sighs.cc/repository/maven-public/"
|
url = "https://nexus.bot.leisuretimedock.top/repository/maven-public/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,6 @@ void onlyInData(Runnable action) {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(jarJar("io.github.llamalad7:mixinextras-forge:[0.4.1,)"))
|
|
||||||
modCompileOnly("blank:freecam-1.20.1:1.2.1")
|
modCompileOnly("blank:freecam-1.20.1:1.2.1")
|
||||||
modCompileOnly("curse.maven:real-camera-851574:7082366")
|
modCompileOnly("curse.maven:real-camera-851574:7082366")
|
||||||
modCompileOnly("blank:firstperson-1.20.1:2.6.2")
|
modCompileOnly("blank:firstperson-1.20.1:2.6.2")
|
||||||
|
|
|
||||||
|
|
@ -17,15 +17,11 @@
|
||||||
package top.r3944realms.eroticdungeongame.api;
|
package top.r3944realms.eroticdungeongame.api;
|
||||||
|
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
|
||||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
|
||||||
import net.minecraftforge.common.capabilities.CapabilityToken;
|
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import top.r3944realms.eroticdungeongame.api.capability.IPlayerDungeonData;
|
import top.r3944realms.eroticdungeongame.api.capability.IPlayerDungeonData;
|
||||||
import top.r3944realms.eroticdungeongame.api.workspace.Services;
|
import top.r3944realms.eroticdungeongame.api.workspace.Services;
|
||||||
import top.r3944realms.eroticdungeongame.content.capability.AbstractPlayerDungeonData;
|
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
@ -43,10 +39,6 @@ public class EroticDungeonGameApi {
|
||||||
* The constant MOD_ID.
|
* The constant MOD_ID.
|
||||||
*/
|
*/
|
||||||
public static final String MOD_ID = "eroticdungeongame"; //Erotic Dungeon Game
|
public static final String MOD_ID = "eroticdungeongame"; //Erotic Dungeon Game
|
||||||
/**
|
|
||||||
* The constant PLAYER_DUNGEON_DATA_CAP.
|
|
||||||
*/
|
|
||||||
public static final Capability<AbstractPlayerDungeonData> PLAYER_DUNGEON_DATA_CAP = CapabilityManager.get(new CapabilityToken<>() {});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets mod event bus.
|
* Gets mod event bus.
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,10 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||||
import org.jetbrains.annotations.Contract;
|
import org.jetbrains.annotations.Contract;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import top.r3944realms.eroticdungeongame.api.EroticDungeonGameApi;
|
|
||||||
import top.r3944realms.eroticdungeongame.content.block.AbstractSeatBlock;
|
import top.r3944realms.eroticdungeongame.content.block.AbstractSeatBlock;
|
||||||
import top.r3944realms.eroticdungeongame.content.entity.SeatEntity;
|
import top.r3944realms.eroticdungeongame.content.entity.SeatEntity;
|
||||||
import top.r3944realms.eroticdungeongame.content.util.FurnitureHelper;
|
import top.r3944realms.eroticdungeongame.content.util.FurnitureHelper;
|
||||||
|
import top.r3944realms.eroticdungeongame.core.capability.PlayerDungeonDataProvider;
|
||||||
import top.r3944realms.eroticdungeongame.core.device.ISeatType;
|
import top.r3944realms.eroticdungeongame.core.device.ISeatType;
|
||||||
import top.r3944realms.eroticdungeongame.core.service.SeatService;
|
import top.r3944realms.eroticdungeongame.core.service.SeatService;
|
||||||
import top.r3944realms.lib39.util.nbt.NBTReader;
|
import top.r3944realms.lib39.util.nbt.NBTReader;
|
||||||
|
|
@ -146,7 +146,7 @@ public abstract class BaseSeatBlockEntity extends BlockEntity {
|
||||||
Player playerByUUID = level.getPlayerByUUID(boundPlayerUUID);
|
Player playerByUUID = level.getPlayerByUUID(boundPlayerUUID);
|
||||||
// 更新实体朝向
|
// 更新实体朝向
|
||||||
if (playerByUUID != null) {
|
if (playerByUUID != null) {
|
||||||
playerByUUID.getCapability(EroticDungeonGameApi.PLAYER_DUNGEON_DATA_CAP).ifPresent(cap -> {
|
playerByUUID.getCapability(PlayerDungeonDataProvider.PLAYER_DUNGEON_DATA_CAP).ifPresent(cap -> {
|
||||||
BlockPos deviceMainBlockPos = cap.getDeviceMainBlockPos();
|
BlockPos deviceMainBlockPos = cap.getDeviceMainBlockPos();
|
||||||
if (playerByUUID.isPassenger() || deviceMainBlockPos != null) {
|
if (playerByUUID.isPassenger() || deviceMainBlockPos != null) {
|
||||||
Entity vehicle = playerByUUID.getVehicle();
|
Entity vehicle = playerByUUID.getVehicle();
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package top.r3944realms.eroticdungeongame.content.capability;
|
package top.r3944realms.eroticdungeongame.core.capability;
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package top.r3944realms.eroticdungeongame.content.capability;
|
package top.r3944realms.eroticdungeongame.core.capability;
|
||||||
|
|
||||||
import net.minecraft.world.entity.EntityDimensions;
|
import net.minecraft.world.entity.EntityDimensions;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
|
@ -23,7 +23,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import top.r3944realms.eroticdungeongame.api.EroticDungeonGameApi;
|
|
||||||
import top.r3944realms.eroticdungeongame.content.animation.IEDGAnimation;
|
import top.r3944realms.eroticdungeongame.content.animation.IEDGAnimation;
|
||||||
import top.r3944realms.eroticdungeongame.content.block.ISeatBlock;
|
import top.r3944realms.eroticdungeongame.content.block.ISeatBlock;
|
||||||
import top.r3944realms.eroticdungeongame.content.block.blockentity.BaseSeatBlockEntity;
|
import top.r3944realms.eroticdungeongame.content.block.blockentity.BaseSeatBlockEntity;
|
||||||
|
|
@ -48,7 +47,7 @@ public class DungeonDataSyncManager extends CachedSyncManager<UUID, AbstractPlay
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void tick(@NotNull Player player) {
|
public static void tick(@NotNull Player player) {
|
||||||
player.getCapability(EroticDungeonGameApi.PLAYER_DUNGEON_DATA_CAP).ifPresent(
|
player.getCapability(PlayerDungeonDataProvider.PLAYER_DUNGEON_DATA_CAP).ifPresent(
|
||||||
cap -> {
|
cap -> {
|
||||||
if (player.level().isClientSide) {
|
if (player.level().isClientSide) {
|
||||||
clientTick(player);
|
clientTick(player);
|
||||||
|
|
@ -69,7 +68,7 @@ public class DungeonDataSyncManager extends CachedSyncManager<UUID, AbstractPlay
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void login(@NotNull Player player) {
|
public static void login(@NotNull Player player) {
|
||||||
player.getCapability(EroticDungeonGameApi.PLAYER_DUNGEON_DATA_CAP).ifPresent(
|
player.getCapability(PlayerDungeonDataProvider.PLAYER_DUNGEON_DATA_CAP).ifPresent(
|
||||||
cap -> {
|
cap -> {
|
||||||
if (cap.getDeviceMainBlockPos() != null) {
|
if (cap.getDeviceMainBlockPos() != null) {
|
||||||
BlockState blockState = player.level().getBlockState(cap.getDeviceMainBlockPos());
|
BlockState blockState = player.level().getBlockState(cap.getDeviceMainBlockPos());
|
||||||
|
|
@ -85,7 +84,7 @@ public class DungeonDataSyncManager extends CachedSyncManager<UUID, AbstractPlay
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void logout(@NotNull Player player) {
|
public static void logout(@NotNull Player player) {
|
||||||
player.getCapability(EroticDungeonGameApi.PLAYER_DUNGEON_DATA_CAP).ifPresent(
|
player.getCapability(PlayerDungeonDataProvider.PLAYER_DUNGEON_DATA_CAP).ifPresent(
|
||||||
cap -> {
|
cap -> {
|
||||||
if (cap.getDeviceMainBlockPos() != null && player.level().getBlockEntity(cap.getDeviceMainBlockPos()) instanceof BaseSeatBlockEntity seat) {
|
if (cap.getDeviceMainBlockPos() != null && player.level().getBlockEntity(cap.getDeviceMainBlockPos()) instanceof BaseSeatBlockEntity seat) {
|
||||||
((IEDGEntity)player).releaseEntityFromEDGDevice(true);
|
((IEDGEntity)player).releaseEntityFromEDGDevice(true);
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package top.r3944realms.eroticdungeongame.content.capability;
|
package top.r3944realms.eroticdungeongame.core.capability;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
|
@ -14,19 +14,24 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package top.r3944realms.eroticdungeongame.content.capability;
|
package top.r3944realms.eroticdungeongame.core.capability;
|
||||||
|
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
|
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||||
|
import net.minecraftforge.common.capabilities.CapabilityToken;
|
||||||
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
|
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
|
||||||
import net.minecraftforge.common.util.LazyOptional;
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import top.r3944realms.eroticdungeongame.api.EroticDungeonGameApi;
|
|
||||||
|
|
||||||
public class PlayerDungeonDataProvider implements ICapabilitySerializable<CompoundTag> {
|
public class PlayerDungeonDataProvider implements ICapabilitySerializable<CompoundTag> {
|
||||||
|
/**
|
||||||
|
* The constant PLAYER_DUNGEON_DATA_CAP.
|
||||||
|
*/
|
||||||
|
public static final Capability<AbstractPlayerDungeonData> PLAYER_DUNGEON_DATA_CAP = CapabilityManager.get(new CapabilityToken<>() {});
|
||||||
private final AbstractPlayerDungeonData instance;
|
private final AbstractPlayerDungeonData instance;
|
||||||
private final LazyOptional<AbstractPlayerDungeonData> optional;
|
private final LazyOptional<AbstractPlayerDungeonData> optional;
|
||||||
|
|
||||||
|
|
@ -37,7 +42,7 @@ public class PlayerDungeonDataProvider implements ICapabilitySerializable<Compou
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull <T> LazyOptional<T> getCapability(@NotNull Capability<T> capability, @Nullable Direction direction) {
|
public @NotNull <T> LazyOptional<T> getCapability(@NotNull Capability<T> capability, @Nullable Direction direction) {
|
||||||
return EroticDungeonGameApi.PLAYER_DUNGEON_DATA_CAP.orEmpty(capability, this.optional);
|
return PLAYER_DUNGEON_DATA_CAP.orEmpty(capability, this.optional);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -18,7 +18,6 @@ package top.r3944realms.eroticdungeongame.core.compat.jei;
|
||||||
|
|
||||||
import mezz.jei.api.IModPlugin;
|
import mezz.jei.api.IModPlugin;
|
||||||
import mezz.jei.api.JeiPlugin;
|
import mezz.jei.api.JeiPlugin;
|
||||||
import mezz.jei.api.registration.*;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.item.crafting.RecipeManager;
|
import net.minecraft.world.item.crafting.RecipeManager;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
|
|
||||||
|
|
@ -37,14 +37,14 @@ import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLConstructModEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLConstructModEvent;
|
||||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
import top.r3944realms.eroticdungeongame.EroticDungeon;
|
import top.r3944realms.eroticdungeongame.EroticDungeon;
|
||||||
import top.r3944realms.eroticdungeongame.api.EroticDungeonGameApi;
|
|
||||||
import top.r3944realms.eroticdungeongame.content.EDGVillagerTrades;
|
import top.r3944realms.eroticdungeongame.content.EDGVillagerTrades;
|
||||||
import top.r3944realms.eroticdungeongame.content.capability.DungeonDataSyncManager;
|
|
||||||
import top.r3944realms.eroticdungeongame.content.command.EDGCommand;
|
import top.r3944realms.eroticdungeongame.content.command.EDGCommand;
|
||||||
import top.r3944realms.eroticdungeongame.content.recipe.DungeonCraftingBookCategory;
|
import top.r3944realms.eroticdungeongame.content.recipe.DungeonCraftingBookCategory;
|
||||||
import top.r3944realms.eroticdungeongame.content.recipe.DungeonRecipe;
|
import top.r3944realms.eroticdungeongame.content.recipe.DungeonRecipe;
|
||||||
import top.r3944realms.eroticdungeongame.content.recipe.EDGRecipeBookTypes;
|
import top.r3944realms.eroticdungeongame.content.recipe.EDGRecipeBookTypes;
|
||||||
import top.r3944realms.eroticdungeongame.content.recipe.EDGRecipeTypeCategories;
|
import top.r3944realms.eroticdungeongame.content.recipe.EDGRecipeTypeCategories;
|
||||||
|
import top.r3944realms.eroticdungeongame.core.capability.DungeonDataSyncManager;
|
||||||
|
import top.r3944realms.eroticdungeongame.core.capability.PlayerDungeonDataProvider;
|
||||||
import top.r3944realms.eroticdungeongame.core.compat.*;
|
import top.r3944realms.eroticdungeongame.core.compat.*;
|
||||||
import top.r3944realms.eroticdungeongame.core.register.EDGCapabilities;
|
import top.r3944realms.eroticdungeongame.core.register.EDGCapabilities;
|
||||||
import top.r3944realms.eroticdungeongame.core.register.EDGRecipeTypes;
|
import top.r3944realms.eroticdungeongame.core.register.EDGRecipeTypes;
|
||||||
|
|
@ -68,7 +68,7 @@ public class CommonHandler {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void syncCapabilities(SyncManagerRegisterEvent event) {
|
public static void syncCapabilities(SyncManagerRegisterEvent event) {
|
||||||
dungeonDataSyncManager = new DungeonDataSyncManager();
|
dungeonDataSyncManager = new DungeonDataSyncManager();
|
||||||
event.registerSyncManager(DUNGEON_SYNC, dungeonDataSyncManager, EroticDungeonGameApi.PLAYER_DUNGEON_DATA_CAP);
|
event.registerSyncManager(DUNGEON_SYNC, dungeonDataSyncManager, PlayerDungeonDataProvider.PLAYER_DUNGEON_DATA_CAP);
|
||||||
}
|
}
|
||||||
private static char ticks = 0;
|
private static char ticks = 0;
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent;
|
||||||
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import top.r3944realms.eroticdungeongame.EroticDungeon;
|
import top.r3944realms.eroticdungeongame.EroticDungeon;
|
||||||
import top.r3944realms.eroticdungeongame.content.capability.AbstractPlayerDungeonData;
|
import top.r3944realms.eroticdungeongame.core.capability.AbstractPlayerDungeonData;
|
||||||
import top.r3944realms.eroticdungeongame.content.capability.PlayerDungeonDataProvider;
|
import top.r3944realms.eroticdungeongame.core.capability.PlayerDungeonDataProvider;
|
||||||
|
|
||||||
public class EDGCapabilities {
|
public class EDGCapabilities {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import top.r3944realms.eroticdungeongame.EroticDungeon;
|
import top.r3944realms.eroticdungeongame.EroticDungeon;
|
||||||
import top.r3944realms.eroticdungeongame.api.EroticDungeonGameApi;
|
|
||||||
import top.r3944realms.eroticdungeongame.api.event.RideDeviceEvent;
|
import top.r3944realms.eroticdungeongame.api.event.RideDeviceEvent;
|
||||||
import top.r3944realms.eroticdungeongame.api.event.UnRideDeviceEvent;
|
import top.r3944realms.eroticdungeongame.api.event.UnRideDeviceEvent;
|
||||||
import top.r3944realms.eroticdungeongame.content.animation.IEDGAnimation;
|
import top.r3944realms.eroticdungeongame.content.animation.IEDGAnimation;
|
||||||
|
|
@ -41,6 +40,7 @@ import top.r3944realms.eroticdungeongame.content.block.part.SeatPart;
|
||||||
import top.r3944realms.eroticdungeongame.content.block.type.PilloryBlock;
|
import top.r3944realms.eroticdungeongame.content.block.type.PilloryBlock;
|
||||||
import top.r3944realms.eroticdungeongame.content.entity.SeatEntity;
|
import top.r3944realms.eroticdungeongame.content.entity.SeatEntity;
|
||||||
import top.r3944realms.eroticdungeongame.content.util.FurnitureHelper;
|
import top.r3944realms.eroticdungeongame.content.util.FurnitureHelper;
|
||||||
|
import top.r3944realms.eroticdungeongame.core.capability.PlayerDungeonDataProvider;
|
||||||
import top.r3944realms.eroticdungeongame.core.device.ISeatType;
|
import top.r3944realms.eroticdungeongame.core.device.ISeatType;
|
||||||
import top.r3944realms.eroticdungeongame.core.register.EDGEntities;
|
import top.r3944realms.eroticdungeongame.core.register.EDGEntities;
|
||||||
import top.r3944realms.eroticdungeongame.util.IEDGEntity;
|
import top.r3944realms.eroticdungeongame.util.IEDGEntity;
|
||||||
|
|
@ -126,7 +126,7 @@ public class SeatService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static @NotNull Optional<SeatEntity> getPlayerSeat(@NotNull Player player) {
|
public static @NotNull Optional<SeatEntity> getPlayerSeat(@NotNull Player player) {
|
||||||
return player.getCapability(EroticDungeonGameApi.PLAYER_DUNGEON_DATA_CAP).resolve().map(cap -> {
|
return player.getCapability(PlayerDungeonDataProvider.PLAYER_DUNGEON_DATA_CAP).resolve().map(cap -> {
|
||||||
BlockPos deviceMainBlockPos = cap.getDeviceMainBlockPos();
|
BlockPos deviceMainBlockPos = cap.getDeviceMainBlockPos();
|
||||||
if (player.isPassenger() || deviceMainBlockPos != null) {
|
if (player.isPassenger() || deviceMainBlockPos != null) {
|
||||||
Entity vehicle = player.getVehicle();
|
Entity vehicle = player.getVehicle();
|
||||||
|
|
@ -142,7 +142,7 @@ public class SeatService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static @NotNull Optional<SeatEntity> getOrCreatePlayerSeat(@NotNull Player player) {
|
public static @NotNull Optional<SeatEntity> getOrCreatePlayerSeat(@NotNull Player player) {
|
||||||
return player.getCapability(EroticDungeonGameApi.PLAYER_DUNGEON_DATA_CAP).resolve().map(cap -> {
|
return player.getCapability(PlayerDungeonDataProvider.PLAYER_DUNGEON_DATA_CAP).resolve().map(cap -> {
|
||||||
BlockPos deviceMainBlockPos = cap.getDeviceMainBlockPos();
|
BlockPos deviceMainBlockPos = cap.getDeviceMainBlockPos();
|
||||||
if (player.isPassenger() && deviceMainBlockPos != null) {
|
if (player.isPassenger() && deviceMainBlockPos != null) {
|
||||||
Entity vehicle = player.getVehicle();
|
Entity vehicle = player.getVehicle();
|
||||||
|
|
@ -208,7 +208,7 @@ public class SeatService {
|
||||||
player.setYBodyRot(seatEntity.getYRot());
|
player.setYBodyRot(seatEntity.getYRot());
|
||||||
|
|
||||||
// 设置玩家cap
|
// 设置玩家cap
|
||||||
player.getCapability(EroticDungeonGameApi.PLAYER_DUNGEON_DATA_CAP).resolve()
|
player.getCapability(PlayerDungeonDataProvider.PLAYER_DUNGEON_DATA_CAP).resolve()
|
||||||
.ifPresent(cap -> cap.setDungeonData(ISeatType, varNumber, seatEntity));
|
.ifPresent(cap -> cap.setDungeonData(ISeatType, varNumber, seatEntity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -263,7 +263,7 @@ public class SeatService {
|
||||||
isCancelled = EroticDungeon.EVENT_BUS.post(new UnRideDeviceEvent.Pre(playerByUUID, blockPos, blockState, be, seat));
|
isCancelled = EroticDungeon.EVENT_BUS.post(new UnRideDeviceEvent.Pre(playerByUUID, blockPos, blockState, be, seat));
|
||||||
if (!isCancelled) {
|
if (!isCancelled) {
|
||||||
if(seat != null) ((IEDGEntity)(playerByUUID)).releaseEntityFromEDGDevice(true);
|
if(seat != null) ((IEDGEntity)(playerByUUID)).releaseEntityFromEDGDevice(true);
|
||||||
playerByUUID.getCapability(EroticDungeonGameApi.PLAYER_DUNGEON_DATA_CAP)
|
playerByUUID.getCapability(PlayerDungeonDataProvider.PLAYER_DUNGEON_DATA_CAP)
|
||||||
.ifPresent(i -> i.clearDungeonData(playerByUUID));
|
.ifPresent(i -> i.clearDungeonData(playerByUUID));
|
||||||
} else {
|
} else {
|
||||||
bindPlayerToSeat(playerByUUID, blockPos);
|
bindPlayerToSeat(playerByUUID, blockPos);
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@ import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import top.r3944realms.eroticdungeongame.EroticDungeon;
|
import top.r3944realms.eroticdungeongame.EroticDungeon;
|
||||||
import top.r3944realms.eroticdungeongame.api.EroticDungeonGameApi;
|
|
||||||
import top.r3944realms.eroticdungeongame.api.capability.IPlayerDungeonData;
|
import top.r3944realms.eroticdungeongame.api.capability.IPlayerDungeonData;
|
||||||
import top.r3944realms.eroticdungeongame.api.workspace.IWorkSpaceHelper;
|
import top.r3944realms.eroticdungeongame.api.workspace.IWorkSpaceHelper;
|
||||||
import top.r3944realms.eroticdungeongame.content.entity.SeatEntity;
|
import top.r3944realms.eroticdungeongame.content.entity.SeatEntity;
|
||||||
|
import top.r3944realms.eroticdungeongame.core.capability.PlayerDungeonDataProvider;
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
@ -37,7 +37,7 @@ public class WorkSpaceHelper implements IWorkSpaceHelper {
|
||||||
public boolean isInDevice(@NotNull Entity player) {
|
public boolean isInDevice(@NotNull Entity player) {
|
||||||
if (checkIsPlayer(player) && player.isPassenger() && player.getVehicle() instanceof SeatEntity) {
|
if (checkIsPlayer(player) && player.isPassenger() && player.getVehicle() instanceof SeatEntity) {
|
||||||
AtomicBoolean hasSeat = new AtomicBoolean(false);
|
AtomicBoolean hasSeat = new AtomicBoolean(false);
|
||||||
player.getCapability(EroticDungeonGameApi.PLAYER_DUNGEON_DATA_CAP)
|
player.getCapability(PlayerDungeonDataProvider.PLAYER_DUNGEON_DATA_CAP)
|
||||||
.ifPresent(i->{
|
.ifPresent(i->{
|
||||||
if (i.getDeviceMainBlockPos() != null) {
|
if (i.getDeviceMainBlockPos() != null) {
|
||||||
hasSeat.set(true);
|
hasSeat.set(true);
|
||||||
|
|
@ -51,7 +51,7 @@ public class WorkSpaceHelper implements IWorkSpaceHelper {
|
||||||
@Override
|
@Override
|
||||||
public void tryToDoIfInDevice(@NotNull Entity player, Consumer<IPlayerDungeonData> action, Runnable fallback) {
|
public void tryToDoIfInDevice(@NotNull Entity player, Consumer<IPlayerDungeonData> action, Runnable fallback) {
|
||||||
if (checkIsPlayer(player) && player.isPassenger() && player.getVehicle() instanceof SeatEntity) {
|
if (checkIsPlayer(player) && player.isPassenger() && player.getVehicle() instanceof SeatEntity) {
|
||||||
player.getCapability(EroticDungeonGameApi.PLAYER_DUNGEON_DATA_CAP)
|
player.getCapability(PlayerDungeonDataProvider.PLAYER_DUNGEON_DATA_CAP)
|
||||||
.ifPresent(i->{
|
.ifPresent(i->{
|
||||||
if (i.getDeviceMainBlockPos() != null) {
|
if (i.getDeviceMainBlockPos() != null) {
|
||||||
action.accept(i);
|
action.accept(i);
|
||||||
|
|
@ -66,7 +66,7 @@ public class WorkSpaceHelper implements IWorkSpaceHelper {
|
||||||
public <T> T tryToDoIfInDeviceAndRet(@NotNull Entity player, Function<IPlayerDungeonData, T> action, Supplier<T> fallback) {
|
public <T> T tryToDoIfInDeviceAndRet(@NotNull Entity player, Function<IPlayerDungeonData, T> action, Supplier<T> fallback) {
|
||||||
if (checkIsPlayer(player) && player.isPassenger() && player.getVehicle() instanceof SeatEntity) {
|
if (checkIsPlayer(player) && player.isPassenger() && player.getVehicle() instanceof SeatEntity) {
|
||||||
AtomicReference<T> ret = new AtomicReference<>();
|
AtomicReference<T> ret = new AtomicReference<>();
|
||||||
player.getCapability(EroticDungeonGameApi.PLAYER_DUNGEON_DATA_CAP)
|
player.getCapability(PlayerDungeonDataProvider.PLAYER_DUNGEON_DATA_CAP)
|
||||||
.ifPresent(i->{
|
.ifPresent(i->{
|
||||||
if (i.getDeviceMainBlockPos() != null) {
|
if (i.getDeviceMainBlockPos() != null) {
|
||||||
ret.set(action.apply(i));
|
ret.set(action.apply(i));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user