初始化项目#3

This commit is contained in:
叁玖领域 2025-10-15 20:11:26 +08:00
parent f8ccd1a673
commit 21e167a0e7
33 changed files with 463 additions and 45 deletions

View File

@ -29,7 +29,7 @@ player_anim_version=1.0.2-rc1+1.20
bend
geckolib_version=4.2.1
curios_version=5.5.0+1.20.1
lib39_version=0.0.8
lib39_version=0.0.14
## Mod Properties
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
# Must match the String constant located in the main mod class annotated with @Mod.

Binary file not shown.

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame;
import net.minecraftforge.api.distmarker.Dist;

View File

@ -1,6 +1,19 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent;
import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@ -8,9 +21,13 @@ import top.r3944realms.eroticdungeongame.content.capability.DungeonDataSyncManag
import top.r3944realms.eroticdungeongame.content.register.EDGCapabilities;
import top.r3944realms.lib39.api.event.SyncManagerRegisterEvent;
import java.util.UUID;
import java.util.function.Function;
public class CommonHandler {
@net.minecraftforge.fml.common.Mod.EventBusSubscriber(modid = EroticDungeon.MOD_ID, bus = net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.FORGE)
public static class Game extends CommonHandler {
private static Function<UUID, Entity> entityProvider;
public static DungeonDataSyncManager dungeonDataSyncManager;
public static ResourceLocation DUNGEON_SYNC = EroticDungeon.rl("dungeon_sync");
@SubscribeEvent
@ -23,6 +40,9 @@ public class CommonHandler {
dungeonDataSyncManager = new DungeonDataSyncManager();
event.registerSyncManager(DUNGEON_SYNC, dungeonDataSyncManager, EDGCapabilities.PLAYER_DUNGEON_DATA_CAP);
}
public static Function<UUID, Entity> getEntityProvider() {
return entityProvider;
}
}
@net.minecraftforge.fml.common.Mod.EventBusSubscriber(modid = EroticDungeon.MOD_ID, bus = net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD)

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame;
import net.minecraft.resources.ResourceLocation;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.animation;
import net.minecraft.world.entity.player.Player;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.animation;
import dev.kosmx.playerAnim.api.layered.IAnimation;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.animation;
import dev.kosmx.playerAnim.core.data.KeyframeAnimation;

View File

@ -1,5 +1,18 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.animation;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.slf4j.Logger;
@ -19,6 +32,16 @@ public enum ClientAnimationHandler implements IAnimationHandler {
loadSeatAnimations();
}
@Override
public void playerSeatAnimation(Player player, Integer animationId) {
}
@Override
public void removeSeatAnimation(Player player) {
}
private void loadSeatAnimations() {
}

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.animation;
import net.minecraft.world.entity.player.Player;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.animation.type;
public interface IAnimationType {

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.animation.type;
import org.jetbrains.annotations.Contract;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.block;
import net.minecraft.core.BlockPos;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.block;
import net.minecraft.core.BlockPos;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.block;
public enum FurnitureType {

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.block;
import net.minecraft.core.Direction;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.block.blockentity;
import net.minecraft.core.BlockPos;
@ -23,7 +35,6 @@ import java.util.UUID;
*/
@SuppressWarnings("unused")
public class SeatBlockEntity extends BlockEntity {
private int seatEntityId;
private UUID boundPlayerUUID;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.block.part;
import net.minecraft.util.StringRepresentable;

View File

@ -1,17 +1,35 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.capability;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import top.r3944realms.lib39.core.sync.NBTSyncData;
public abstract class AbstractPlayerDungeonData extends NBTSyncData {
import java.util.UUID;
public sealed abstract class AbstractPlayerDungeonData extends NBTSyncData permits PlayerDungeonData {
protected AbstractPlayerDungeonData(ResourceLocation id) {
super(id);
}
abstract Integer getSeatAnimId();
abstract void setSeatAnimId(Integer seatAnimId);
abstract BlockPos getSeatPosition();
abstract void setSeatPosition(BlockPos seatPosition);
abstract public UUID getPlayerUUID();
abstract public Integer getSeatAnimId();
abstract public void setSeatAnimId(Integer seatAnimId);
abstract public Integer getSeatEntityId();
abstract public void setSeatEntityId(Integer seatEntityId);
public void removeSeatAnimId() {
setSeatAnimId(null);
}
public void removeSeatEntityId() {
setSeatEntityId(null);
}
}

View File

@ -1,14 +1,47 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.capability;
import top.r3944realms.lib39.core.sync.ISyncManager;
import net.minecraftforge.common.util.LazyOptional;
import org.jetbrains.annotations.Nullable;
import top.r3944realms.eroticdungeongame.content.register.EDGCapabilities;
import top.r3944realms.lib39.core.event.CommonHandler;
import top.r3944realms.lib39.core.sync.CachedSyncManager;
import java.util.HashSet;
import java.util.Set;
import java.util.*;
public class DungeonDataSyncManager implements ISyncManager<AbstractPlayerDungeonData> {
public static Set<AbstractPlayerDungeonData> playerDungeons = new HashSet<>();
public class DungeonDataSyncManager extends CachedSyncManager<UUID, AbstractPlayerDungeonData> {
public static Map<UUID, AbstractPlayerDungeonData> playerDungeonData = new HashMap<>();
@Override
public Set<AbstractPlayerDungeonData> getSyncSet() {
return playerDungeons;
public Map<UUID, AbstractPlayerDungeonData> getSyncMap() {
return playerDungeonData;
}
@Nullable
public AbstractPlayerDungeonData getPlayerDungeonData(UUID uuid) {
return playerDungeonData.get(uuid);
}
public void removePlayerSeatEntity(UUID uuid) {
try {
Optional<AbstractPlayerDungeonData> abstractPlayerDungeonData = Optional.ofNullable(CommonHandler.Game.getServerLevel())
.map(i -> i.getEntity(uuid))
.map(i -> i.getCapability(EDGCapabilities.PLAYER_DUNGEON_DATA_CAP))
.map(LazyOptional::resolve)
.map(Optional::orElseThrow);
abstractPlayerDungeonData
.ifPresent(AbstractPlayerDungeonData::removeSeatEntityId);
abstractPlayerDungeonData
.ifPresent(AbstractPlayerDungeonData::removeSeatAnimId);
} catch (NoSuchElementException ignored) {}
}
}

View File

@ -1,59 +1,88 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.capability;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player;
import org.jetbrains.annotations.NotNull;
import top.r3944realms.eroticdungeongame.EroticDungeon;
import top.r3944realms.eroticdungeongame.content.register.EDGCapabilities;
import top.r3944realms.lib39.core.network.NetworkHandler;
import top.r3944realms.lib39.core.network.toClient.SyncNBTDataS2CPack;
import top.r3944realms.lib39.util.nbt.NBTReader;
import top.r3944realms.lib39.util.nbt.NBTWriter;
import java.util.UUID;
public final class PlayerDungeonData extends AbstractPlayerDungeonData {
public final String SEAT_ANIMATION_ID = "seat_animation_id";
public final String SEAT_ENTITY_ID = "seat_entity_id";
public final Player player;
PlayerDungeonData(Player player) {
public Integer seatAnimationId;
public Integer seatEntityId;
public PlayerDungeonData(Player player) {
super(EroticDungeon.rl(EDGCapabilities.DUNGEON_DATA));
this.player = player;
}
@Override
public CompoundTag serializeNBT() {
return null;
return NBTWriter.builder()
.intValue(SEAT_ANIMATION_ID, seatAnimationId)
.intValue(SEAT_ENTITY_ID, seatEntityId)
.build();
}
@Override
public void deserializeNBT(CompoundTag compoundTag) {
NBTReader.of(compoundTag)
.intValue(SEAT_ANIMATION_ID, i -> seatAnimationId = i)
.intValue(SEAT_ENTITY_ID, i -> seatEntityId = i);
}
@Override
public void checkIfDirtyThenUpdate() {
if (isDirty()) {
NetworkHandler.sendToPlayer(new SyncNBTDataS2CPack(player.getId(), id(), this), (ServerPlayer)player);
if (isDirty() && player instanceof ServerPlayer serverPlayer) {
NetworkHandler.sendToPlayer(new SyncNBTDataS2CPack(player.getId(), id(), this), serverPlayer);
}
}
@Override
public @NotNull UUID getPlayerUUID() {
return player.getUUID();
}
@Override
public Integer getSeatAnimId() {
return 0;
return seatAnimationId;
}
@Override
public void setSeatAnimId(Integer seatAnimId) {
this.setSeatEntityId(seatAnimId);
makeDirty();
}
@Override
public BlockPos getSeatPosition() {
return null;
public Integer getSeatEntityId() {
return seatEntityId;
}
@Override
public void setSeatPosition(BlockPos seatPosition) {
public void setSeatEntityId(Integer seatEntityId) {
seatAnimationId = seatEntityId;
makeDirty();
}
}

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.capability;
import net.minecraft.core.Direction;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.device;
import net.minecraft.world.entity.EntityType;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.device;
import net.minecraft.world.entity.EntityType;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.entity;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.register;
import net.minecraft.world.level.block.entity.BlockEntityType;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.register;
import net.minecraft.world.level.block.Block;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.register;
import net.minecraft.world.entity.player.Player;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.register;
import net.minecraft.core.registries.Registries;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.register;
import net.minecraft.world.entity.Entity;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.register;
import net.minecraft.world.item.Item;

View File

@ -1,3 +1,15 @@
/*
* *
* * Copyright (c) 2025 R3944Realms. All rights reserved.
* *
* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
* * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
* *
* * 本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可
*
*/
package top.r3944realms.eroticdungeongame.content.util;
import net.minecraft.core.BlockPos;
@ -10,8 +22,10 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import top.r3944realms.eroticdungeongame.CommonHandler;
import top.r3944realms.eroticdungeongame.EroticDungeon;
import top.r3944realms.eroticdungeongame.content.block.blockentity.SeatBlockEntity;
import top.r3944realms.eroticdungeongame.content.capability.DungeonDataSyncManager;
import top.r3944realms.eroticdungeongame.content.device.SeatType;
import top.r3944realms.eroticdungeongame.content.entity.SeatEntity;
@ -22,6 +36,7 @@ public class FurnitureHelper {
}
public static List<Block> RESTRAINT_FURNACES = new ArrayList<>();
public static @Nullable String getEntityDeviceId(@NotNull Entity entity) {
// "entity.eroticdungeongame.wall_cuff -> 8 + modid -> wall_cuff"
return entity.getEncodeId() == null ? null : entity.getEncodeId().substring(8 + EroticDungeon.MOD_ID.length());
@ -60,11 +75,12 @@ public class FurnitureHelper {
.orElse(null);
}
public static boolean isPlayerBound(UUID playerUUID) {
return DeviceManager.getInstance().entrySet().stream()
.anyMatch(entry -> entry.getValue().getBoundPlayerUuid().equals(playerUUID));
public static boolean isPlayerBound(@NotNull UUID player) {
DungeonDataSyncManager dungeonDataSyncManager = Objects.requireNonNull(CommonHandler.Game.dungeonDataSyncManager, "DungeonDataSyncManager is not initialized");
return Optional.ofNullable(dungeonDataSyncManager.getPlayerDungeonData(player)).map(i->i.getSeatEntityId() != null).orElse(false);
}
public static void releasePlayerFromDevice(Player player) {
public static void releasePlayerFromDevice(@NotNull Player player) {
SeatBlockEntity deviceBlockEntity;
// 检查玩家是否骑乘在实体上
@ -92,15 +108,7 @@ public class FurnitureHelper {
deviceBlockEntity.releasePlayer(player.level(), deviceBlockEntity.getBlockPos());
// 从设备管理器中移除会话
DeviceManager.getSeatSessions().remove(deviceBlockEntity.getBoundPlayerUUID());
// 检查玩家是否仍被其他设备绑定
if (isPlayerBound(player.getUUID())) {
return;
}
// 重置玩家的姿势状态
DeviceManager.resetSeatSession(player);
CommonHandler.Game.dungeonDataSyncManager.removePlayerSeatEntity(deviceBlockEntity.getBoundPlayerUUID());
}
}
}