diff --git a/README.md b/README.md index 03e9cf0f..00a9733a 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ repositories { maven { name = "LTD Maven" - url = "https://maven.sighs.cc/repository/maven-public/" + url = "https://nexus.bot.leisuretimedock.top/repository/maven-public/" } } ``` diff --git a/build.gradle b/build.gradle index d0f4a797..0c6ac911 100644 --- a/build.gradle +++ b/build.gradle @@ -184,7 +184,6 @@ void onlyInData(Runnable action) { } dependencies { - implementation(jarJar("io.github.llamalad7:mixinextras-forge:[0.4.1,)")) modCompileOnly("blank:freecam-1.20.1:1.2.1") modCompileOnly("curse.maven:real-camera-851574:7082366") modCompileOnly("blank:firstperson-1.20.1:2.6.2") diff --git a/src/main/java/top/r3944realms/eroticdungeongame/api/EroticDungeonGameApi.java b/src/main/java/top/r3944realms/eroticdungeongame/api/EroticDungeonGameApi.java index 280f1779..54f40762 100644 --- a/src/main/java/top/r3944realms/eroticdungeongame/api/EroticDungeonGameApi.java +++ b/src/main/java/top/r3944realms/eroticdungeongame/api/EroticDungeonGameApi.java @@ -17,15 +17,11 @@ package top.r3944realms.eroticdungeongame.api; 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 org.slf4j.Logger; import org.slf4j.LoggerFactory; import top.r3944realms.eroticdungeongame.api.capability.IPlayerDungeonData; import top.r3944realms.eroticdungeongame.api.workspace.Services; -import top.r3944realms.eroticdungeongame.content.capability.AbstractPlayerDungeonData; import java.util.function.Consumer; import java.util.function.Function; @@ -43,10 +39,6 @@ public class EroticDungeonGameApi { * The constant MOD_ID. */ public static final String MOD_ID = "eroticdungeongame"; //Erotic Dungeon Game - /** - * The constant PLAYER_DUNGEON_DATA_CAP. - */ - public static final Capability PLAYER_DUNGEON_DATA_CAP = CapabilityManager.get(new CapabilityToken<>() {}); /** * Gets mod event bus. diff --git a/src/main/java/top/r3944realms/eroticdungeongame/content/block/blockentity/BaseSeatBlockEntity.java b/src/main/java/top/r3944realms/eroticdungeongame/content/block/blockentity/BaseSeatBlockEntity.java index ab505ca3..c0e59f03 100644 --- a/src/main/java/top/r3944realms/eroticdungeongame/content/block/blockentity/BaseSeatBlockEntity.java +++ b/src/main/java/top/r3944realms/eroticdungeongame/content/block/blockentity/BaseSeatBlockEntity.java @@ -33,10 +33,10 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BooleanProperty; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; -import top.r3944realms.eroticdungeongame.api.EroticDungeonGameApi; import top.r3944realms.eroticdungeongame.content.block.AbstractSeatBlock; import top.r3944realms.eroticdungeongame.content.entity.SeatEntity; 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.service.SeatService; import top.r3944realms.lib39.util.nbt.NBTReader; @@ -146,7 +146,7 @@ public abstract class BaseSeatBlockEntity extends BlockEntity { Player playerByUUID = level.getPlayerByUUID(boundPlayerUUID); // 更新实体朝向 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(); if (playerByUUID.isPassenger() || deviceMainBlockPos != null) { Entity vehicle = playerByUUID.getVehicle(); diff --git a/src/main/java/top/r3944realms/eroticdungeongame/content/capability/AbstractPlayerDungeonData.java b/src/main/java/top/r3944realms/eroticdungeongame/core/capability/AbstractPlayerDungeonData.java similarity index 97% rename from src/main/java/top/r3944realms/eroticdungeongame/content/capability/AbstractPlayerDungeonData.java rename to src/main/java/top/r3944realms/eroticdungeongame/core/capability/AbstractPlayerDungeonData.java index d2a95209..4c8af06e 100644 --- a/src/main/java/top/r3944realms/eroticdungeongame/content/capability/AbstractPlayerDungeonData.java +++ b/src/main/java/top/r3944realms/eroticdungeongame/core/capability/AbstractPlayerDungeonData.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.r3944realms.eroticdungeongame.content.capability; +package top.r3944realms.eroticdungeongame.core.capability; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; diff --git a/src/main/java/top/r3944realms/eroticdungeongame/content/capability/DungeonDataSyncManager.java b/src/main/java/top/r3944realms/eroticdungeongame/core/capability/DungeonDataSyncManager.java similarity index 90% rename from src/main/java/top/r3944realms/eroticdungeongame/content/capability/DungeonDataSyncManager.java rename to src/main/java/top/r3944realms/eroticdungeongame/core/capability/DungeonDataSyncManager.java index 5b79ab7b..f4fb3fa0 100644 --- a/src/main/java/top/r3944realms/eroticdungeongame/content/capability/DungeonDataSyncManager.java +++ b/src/main/java/top/r3944realms/eroticdungeongame/core/capability/DungeonDataSyncManager.java @@ -14,7 +14,7 @@ * 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.player.Player; @@ -23,7 +23,6 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import top.r3944realms.eroticdungeongame.api.EroticDungeonGameApi; import top.r3944realms.eroticdungeongame.content.animation.IEDGAnimation; import top.r3944realms.eroticdungeongame.content.block.ISeatBlock; import top.r3944realms.eroticdungeongame.content.block.blockentity.BaseSeatBlockEntity; @@ -48,7 +47,7 @@ public class DungeonDataSyncManager extends CachedSyncManager { if (player.level().isClientSide) { clientTick(player); @@ -69,7 +68,7 @@ public class DungeonDataSyncManager extends CachedSyncManager { if (cap.getDeviceMainBlockPos() != null) { BlockState blockState = player.level().getBlockState(cap.getDeviceMainBlockPos()); @@ -85,7 +84,7 @@ public class DungeonDataSyncManager extends CachedSyncManager { if (cap.getDeviceMainBlockPos() != null && player.level().getBlockEntity(cap.getDeviceMainBlockPos()) instanceof BaseSeatBlockEntity seat) { ((IEDGEntity)player).releaseEntityFromEDGDevice(true); diff --git a/src/main/java/top/r3944realms/eroticdungeongame/content/capability/PlayerDungeonData.java b/src/main/java/top/r3944realms/eroticdungeongame/core/capability/PlayerDungeonData.java similarity index 98% rename from src/main/java/top/r3944realms/eroticdungeongame/content/capability/PlayerDungeonData.java rename to src/main/java/top/r3944realms/eroticdungeongame/core/capability/PlayerDungeonData.java index 6440d07a..5e986ff4 100644 --- a/src/main/java/top/r3944realms/eroticdungeongame/content/capability/PlayerDungeonData.java +++ b/src/main/java/top/r3944realms/eroticdungeongame/core/capability/PlayerDungeonData.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package top.r3944realms.eroticdungeongame.content.capability; +package top.r3944realms.eroticdungeongame.core.capability; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; diff --git a/src/main/java/top/r3944realms/eroticdungeongame/content/capability/PlayerDungeonDataProvider.java b/src/main/java/top/r3944realms/eroticdungeongame/core/capability/PlayerDungeonDataProvider.java similarity index 79% rename from src/main/java/top/r3944realms/eroticdungeongame/content/capability/PlayerDungeonDataProvider.java rename to src/main/java/top/r3944realms/eroticdungeongame/core/capability/PlayerDungeonDataProvider.java index 5dd846c3..eb15f582 100644 --- a/src/main/java/top/r3944realms/eroticdungeongame/content/capability/PlayerDungeonDataProvider.java +++ b/src/main/java/top/r3944realms/eroticdungeongame/core/capability/PlayerDungeonDataProvider.java @@ -14,19 +14,24 @@ * limitations under the License. */ -package top.r3944realms.eroticdungeongame.content.capability; +package top.r3944realms.eroticdungeongame.core.capability; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.entity.player.Player; 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.util.LazyOptional; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import top.r3944realms.eroticdungeongame.api.EroticDungeonGameApi; public class PlayerDungeonDataProvider implements ICapabilitySerializable { + /** + * The constant PLAYER_DUNGEON_DATA_CAP. + */ + public static final Capability PLAYER_DUNGEON_DATA_CAP = CapabilityManager.get(new CapabilityToken<>() {}); private final AbstractPlayerDungeonData instance; private final LazyOptional optional; @@ -37,7 +42,7 @@ public class PlayerDungeonDataProvider implements ICapabilitySerializable LazyOptional getCapability(@NotNull Capability capability, @Nullable Direction direction) { - return EroticDungeonGameApi.PLAYER_DUNGEON_DATA_CAP.orEmpty(capability, this.optional); + return PLAYER_DUNGEON_DATA_CAP.orEmpty(capability, this.optional); } @Override diff --git a/src/main/java/top/r3944realms/eroticdungeongame/core/compat/jei/DungeonJeiPlugin.java b/src/main/java/top/r3944realms/eroticdungeongame/core/compat/jei/DungeonJeiPlugin.java index 0f49718d..50e94cba 100644 --- a/src/main/java/top/r3944realms/eroticdungeongame/core/compat/jei/DungeonJeiPlugin.java +++ b/src/main/java/top/r3944realms/eroticdungeongame/core/compat/jei/DungeonJeiPlugin.java @@ -18,7 +18,6 @@ package top.r3944realms.eroticdungeongame.core.compat.jei; import mezz.jei.api.IModPlugin; import mezz.jei.api.JeiPlugin; -import mezz.jei.api.registration.*; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.level.Level; diff --git a/src/main/java/top/r3944realms/eroticdungeongame/core/event/CommonHandler.java b/src/main/java/top/r3944realms/eroticdungeongame/core/event/CommonHandler.java index 31542e63..64333052 100644 --- a/src/main/java/top/r3944realms/eroticdungeongame/core/event/CommonHandler.java +++ b/src/main/java/top/r3944realms/eroticdungeongame/core/event/CommonHandler.java @@ -37,14 +37,14 @@ import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLConstructModEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import top.r3944realms.eroticdungeongame.EroticDungeon; -import top.r3944realms.eroticdungeongame.api.EroticDungeonGameApi; 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.recipe.DungeonCraftingBookCategory; import top.r3944realms.eroticdungeongame.content.recipe.DungeonRecipe; import top.r3944realms.eroticdungeongame.content.recipe.EDGRecipeBookTypes; 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.register.EDGCapabilities; import top.r3944realms.eroticdungeongame.core.register.EDGRecipeTypes; @@ -68,7 +68,7 @@ public class CommonHandler { @SubscribeEvent public static void syncCapabilities(SyncManagerRegisterEvent event) { 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; @SubscribeEvent diff --git a/src/main/java/top/r3944realms/eroticdungeongame/core/register/EDGCapabilities.java b/src/main/java/top/r3944realms/eroticdungeongame/core/register/EDGCapabilities.java index 19e3048d..08f3df1f 100644 --- a/src/main/java/top/r3944realms/eroticdungeongame/core/register/EDGCapabilities.java +++ b/src/main/java/top/r3944realms/eroticdungeongame/core/register/EDGCapabilities.java @@ -21,8 +21,8 @@ import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; import net.minecraftforge.event.AttachCapabilitiesEvent; import org.jetbrains.annotations.NotNull; import top.r3944realms.eroticdungeongame.EroticDungeon; -import top.r3944realms.eroticdungeongame.content.capability.AbstractPlayerDungeonData; -import top.r3944realms.eroticdungeongame.content.capability.PlayerDungeonDataProvider; +import top.r3944realms.eroticdungeongame.core.capability.AbstractPlayerDungeonData; +import top.r3944realms.eroticdungeongame.core.capability.PlayerDungeonDataProvider; public class EDGCapabilities { diff --git a/src/main/java/top/r3944realms/eroticdungeongame/core/service/SeatService.java b/src/main/java/top/r3944realms/eroticdungeongame/core/service/SeatService.java index 6f322bdb..bc8772bf 100644 --- a/src/main/java/top/r3944realms/eroticdungeongame/core/service/SeatService.java +++ b/src/main/java/top/r3944realms/eroticdungeongame/core/service/SeatService.java @@ -29,7 +29,6 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import org.jetbrains.annotations.NotNull; import top.r3944realms.eroticdungeongame.EroticDungeon; -import top.r3944realms.eroticdungeongame.api.EroticDungeonGameApi; import top.r3944realms.eroticdungeongame.api.event.RideDeviceEvent; import top.r3944realms.eroticdungeongame.api.event.UnRideDeviceEvent; 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.entity.SeatEntity; 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.register.EDGEntities; import top.r3944realms.eroticdungeongame.util.IEDGEntity; @@ -126,7 +126,7 @@ public class SeatService { } public static @NotNull Optional 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(); if (player.isPassenger() || deviceMainBlockPos != null) { Entity vehicle = player.getVehicle(); @@ -142,7 +142,7 @@ public class SeatService { } public static @NotNull Optional 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(); if (player.isPassenger() && deviceMainBlockPos != null) { Entity vehicle = player.getVehicle(); @@ -208,7 +208,7 @@ public class SeatService { player.setYBodyRot(seatEntity.getYRot()); // 设置玩家cap - player.getCapability(EroticDungeonGameApi.PLAYER_DUNGEON_DATA_CAP).resolve() + player.getCapability(PlayerDungeonDataProvider.PLAYER_DUNGEON_DATA_CAP).resolve() .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)); if (!isCancelled) { 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)); } else { bindPlayerToSeat(playerByUUID, blockPos); diff --git a/src/main/java/top/r3944realms/eroticdungeongame/workspace/WorkSpaceHelper.java b/src/main/java/top/r3944realms/eroticdungeongame/workspace/WorkSpaceHelper.java index babd14db..fa5ec4f7 100644 --- a/src/main/java/top/r3944realms/eroticdungeongame/workspace/WorkSpaceHelper.java +++ b/src/main/java/top/r3944realms/eroticdungeongame/workspace/WorkSpaceHelper.java @@ -20,10 +20,10 @@ import net.minecraft.world.entity.Entity; import net.minecraftforge.eventbus.api.IEventBus; import org.jetbrains.annotations.NotNull; import top.r3944realms.eroticdungeongame.EroticDungeon; -import top.r3944realms.eroticdungeongame.api.EroticDungeonGameApi; import top.r3944realms.eroticdungeongame.api.capability.IPlayerDungeonData; import top.r3944realms.eroticdungeongame.api.workspace.IWorkSpaceHelper; 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.AtomicReference; @@ -37,7 +37,7 @@ public class WorkSpaceHelper implements IWorkSpaceHelper { public boolean isInDevice(@NotNull Entity player) { if (checkIsPlayer(player) && player.isPassenger() && player.getVehicle() instanceof SeatEntity) { AtomicBoolean hasSeat = new AtomicBoolean(false); - player.getCapability(EroticDungeonGameApi.PLAYER_DUNGEON_DATA_CAP) + player.getCapability(PlayerDungeonDataProvider.PLAYER_DUNGEON_DATA_CAP) .ifPresent(i->{ if (i.getDeviceMainBlockPos() != null) { hasSeat.set(true); @@ -51,7 +51,7 @@ public class WorkSpaceHelper implements IWorkSpaceHelper { @Override public void tryToDoIfInDevice(@NotNull Entity player, Consumer action, Runnable fallback) { 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->{ if (i.getDeviceMainBlockPos() != null) { action.accept(i); @@ -66,7 +66,7 @@ public class WorkSpaceHelper implements IWorkSpaceHelper { public T tryToDoIfInDeviceAndRet(@NotNull Entity player, Function action, Supplier fallback) { if (checkIsPlayer(player) && player.isPassenger() && player.getVehicle() instanceof SeatEntity) { AtomicReference ret = new AtomicReference<>(); - player.getCapability(EroticDungeonGameApi.PLAYER_DUNGEON_DATA_CAP) + player.getCapability(PlayerDungeonDataProvider.PLAYER_DUNGEON_DATA_CAP) .ifPresent(i->{ if (i.getDeviceMainBlockPos() != null) { ret.set(action.apply(i));