初始化项目#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 bend
geckolib_version=4.2.1 geckolib_version=4.2.1
curios_version=5.5.0+1.20.1 curios_version=5.5.0+1.20.1
lib39_version=0.0.8 lib39_version=0.0.14
## Mod Properties ## 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} # 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. # 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; package top.r3944realms.eroticdungeongame;
import net.minecraftforge.api.distmarker.Dist; 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; package top.r3944realms.eroticdungeongame;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent;
import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; 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.eroticdungeongame.content.register.EDGCapabilities;
import top.r3944realms.lib39.api.event.SyncManagerRegisterEvent; import top.r3944realms.lib39.api.event.SyncManagerRegisterEvent;
import java.util.UUID;
import java.util.function.Function;
public class CommonHandler { public class CommonHandler {
@net.minecraftforge.fml.common.Mod.EventBusSubscriber(modid = EroticDungeon.MOD_ID, bus = net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.FORGE) @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 { public static class Game extends CommonHandler {
private static Function<UUID, Entity> entityProvider;
public static DungeonDataSyncManager dungeonDataSyncManager; public static DungeonDataSyncManager dungeonDataSyncManager;
public static ResourceLocation DUNGEON_SYNC = EroticDungeon.rl("dungeon_sync"); public static ResourceLocation DUNGEON_SYNC = EroticDungeon.rl("dungeon_sync");
@SubscribeEvent @SubscribeEvent
@ -23,6 +40,9 @@ public class CommonHandler {
dungeonDataSyncManager = new DungeonDataSyncManager(); dungeonDataSyncManager = new DungeonDataSyncManager();
event.registerSyncManager(DUNGEON_SYNC, dungeonDataSyncManager, EDGCapabilities.PLAYER_DUNGEON_DATA_CAP); 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) @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; package top.r3944realms.eroticdungeongame;
import net.minecraft.resources.ResourceLocation; 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; package top.r3944realms.eroticdungeongame.content.animation;
import net.minecraft.world.entity.player.Player; 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; package top.r3944realms.eroticdungeongame.content.animation;
import dev.kosmx.playerAnim.api.layered.IAnimation; 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; package top.r3944realms.eroticdungeongame.content.animation;
import dev.kosmx.playerAnim.core.data.KeyframeAnimation; 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; package top.r3944realms.eroticdungeongame.content.animation;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -19,6 +32,16 @@ public enum ClientAnimationHandler implements IAnimationHandler {
loadSeatAnimations(); loadSeatAnimations();
} }
@Override
public void playerSeatAnimation(Player player, Integer animationId) {
}
@Override
public void removeSeatAnimation(Player player) {
}
private void loadSeatAnimations() { 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; package top.r3944realms.eroticdungeongame.content.animation;
import net.minecraft.world.entity.player.Player; 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; package top.r3944realms.eroticdungeongame.content.animation.type;
public interface IAnimationType { 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; package top.r3944realms.eroticdungeongame.content.animation.type;
import org.jetbrains.annotations.Contract; 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; package top.r3944realms.eroticdungeongame.content.block;
import net.minecraft.core.BlockPos; 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; package top.r3944realms.eroticdungeongame.content.block;
import net.minecraft.core.BlockPos; 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; package top.r3944realms.eroticdungeongame.content.block;
public enum FurnitureType { 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; package top.r3944realms.eroticdungeongame.content.block;
import net.minecraft.core.Direction; 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; package top.r3944realms.eroticdungeongame.content.block.blockentity;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -23,7 +35,6 @@ import java.util.UUID;
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class SeatBlockEntity extends BlockEntity { public class SeatBlockEntity extends BlockEntity {
private int seatEntityId; private int seatEntityId;
private UUID boundPlayerUUID; 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; package top.r3944realms.eroticdungeongame.content.block.part;
import net.minecraft.util.StringRepresentable; 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; package top.r3944realms.eroticdungeongame.content.capability;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import top.r3944realms.lib39.core.sync.NBTSyncData; 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) { protected AbstractPlayerDungeonData(ResourceLocation id) {
super(id); super(id);
} }
abstract public UUID getPlayerUUID();
abstract Integer getSeatAnimId(); abstract public Integer getSeatAnimId();
abstract void setSeatAnimId(Integer seatAnimId); abstract public void setSeatAnimId(Integer seatAnimId);
abstract public Integer getSeatEntityId();
abstract BlockPos getSeatPosition(); abstract public void setSeatEntityId(Integer seatEntityId);
abstract void setSeatPosition(BlockPos seatPosition); 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; 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.*;
import java.util.Set;
public class DungeonDataSyncManager implements ISyncManager<AbstractPlayerDungeonData> { public class DungeonDataSyncManager extends CachedSyncManager<UUID, AbstractPlayerDungeonData> {
public static Set<AbstractPlayerDungeonData> playerDungeons = new HashSet<>(); public static Map<UUID, AbstractPlayerDungeonData> playerDungeonData = new HashMap<>();
@Override @Override
public Set<AbstractPlayerDungeonData> getSyncSet() { public Map<UUID, AbstractPlayerDungeonData> getSyncMap() {
return playerDungeons; 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; package top.r3944realms.eroticdungeongame.content.capability;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import org.jetbrains.annotations.NotNull;
import top.r3944realms.eroticdungeongame.EroticDungeon; import top.r3944realms.eroticdungeongame.EroticDungeon;
import top.r3944realms.eroticdungeongame.content.register.EDGCapabilities; import top.r3944realms.eroticdungeongame.content.register.EDGCapabilities;
import top.r3944realms.lib39.core.network.NetworkHandler; import top.r3944realms.lib39.core.network.NetworkHandler;
import top.r3944realms.lib39.core.network.toClient.SyncNBTDataS2CPack; 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 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; public final Player player;
public Integer seatAnimationId;
PlayerDungeonData(Player player) { public Integer seatEntityId;
public PlayerDungeonData(Player player) {
super(EroticDungeon.rl(EDGCapabilities.DUNGEON_DATA)); super(EroticDungeon.rl(EDGCapabilities.DUNGEON_DATA));
this.player = player; this.player = player;
} }
@Override @Override
public CompoundTag serializeNBT() { public CompoundTag serializeNBT() {
return null; return NBTWriter.builder()
.intValue(SEAT_ANIMATION_ID, seatAnimationId)
.intValue(SEAT_ENTITY_ID, seatEntityId)
.build();
} }
@Override @Override
public void deserializeNBT(CompoundTag compoundTag) { public void deserializeNBT(CompoundTag compoundTag) {
NBTReader.of(compoundTag)
.intValue(SEAT_ANIMATION_ID, i -> seatAnimationId = i)
.intValue(SEAT_ENTITY_ID, i -> seatEntityId = i);
} }
@Override @Override
public void checkIfDirtyThenUpdate() { public void checkIfDirtyThenUpdate() {
if (isDirty()) { if (isDirty() && player instanceof ServerPlayer serverPlayer) {
NetworkHandler.sendToPlayer(new SyncNBTDataS2CPack(player.getId(), id(), this), (ServerPlayer)player); NetworkHandler.sendToPlayer(new SyncNBTDataS2CPack(player.getId(), id(), this), serverPlayer);
} }
} }
@Override
public @NotNull UUID getPlayerUUID() {
return player.getUUID();
}
@Override @Override
public Integer getSeatAnimId() { public Integer getSeatAnimId() {
return 0; return seatAnimationId;
} }
@Override @Override
public void setSeatAnimId(Integer seatAnimId) { public void setSeatAnimId(Integer seatAnimId) {
this.setSeatEntityId(seatAnimId);
makeDirty();
} }
@Override @Override
public BlockPos getSeatPosition() { public Integer getSeatEntityId() {
return null; return seatEntityId;
} }
@Override @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; package top.r3944realms.eroticdungeongame.content.capability;
import net.minecraft.core.Direction; 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; package top.r3944realms.eroticdungeongame.content.device;
import net.minecraft.world.entity.EntityType; 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; package top.r3944realms.eroticdungeongame.content.device;
import net.minecraft.world.entity.EntityType; 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; 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; package top.r3944realms.eroticdungeongame.content.register;
import net.minecraft.world.level.block.entity.BlockEntityType; 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; package top.r3944realms.eroticdungeongame.content.register;
import net.minecraft.world.level.block.Block; 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; package top.r3944realms.eroticdungeongame.content.register;
import net.minecraft.world.entity.player.Player; 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; package top.r3944realms.eroticdungeongame.content.register;
import net.minecraft.core.registries.Registries; 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; package top.r3944realms.eroticdungeongame.content.register;
import net.minecraft.world.entity.Entity; 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; package top.r3944realms.eroticdungeongame.content.register;
import net.minecraft.world.item.Item; 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; package top.r3944realms.eroticdungeongame.content.util;
import net.minecraft.core.BlockPos; 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 net.minecraft.world.level.block.state.properties.BooleanProperty;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import top.r3944realms.eroticdungeongame.CommonHandler;
import top.r3944realms.eroticdungeongame.EroticDungeon; import top.r3944realms.eroticdungeongame.EroticDungeon;
import top.r3944realms.eroticdungeongame.content.block.blockentity.SeatBlockEntity; 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.device.SeatType;
import top.r3944realms.eroticdungeongame.content.entity.SeatEntity; import top.r3944realms.eroticdungeongame.content.entity.SeatEntity;
@ -22,6 +36,7 @@ public class FurnitureHelper {
} }
public static List<Block> RESTRAINT_FURNACES = new ArrayList<>(); public static List<Block> RESTRAINT_FURNACES = new ArrayList<>();
public static @Nullable String getEntityDeviceId(@NotNull Entity entity) { public static @Nullable String getEntityDeviceId(@NotNull Entity entity) {
// "entity.eroticdungeongame.wall_cuff -> 8 + modid -> wall_cuff" // "entity.eroticdungeongame.wall_cuff -> 8 + modid -> wall_cuff"
return entity.getEncodeId() == null ? null : entity.getEncodeId().substring(8 + EroticDungeon.MOD_ID.length()); return entity.getEncodeId() == null ? null : entity.getEncodeId().substring(8 + EroticDungeon.MOD_ID.length());
@ -60,11 +75,12 @@ public class FurnitureHelper {
.orElse(null); .orElse(null);
} }
public static boolean isPlayerBound(UUID playerUUID) { public static boolean isPlayerBound(@NotNull UUID player) {
return DeviceManager.getInstance().entrySet().stream() DungeonDataSyncManager dungeonDataSyncManager = Objects.requireNonNull(CommonHandler.Game.dungeonDataSyncManager, "DungeonDataSyncManager is not initialized");
.anyMatch(entry -> entry.getValue().getBoundPlayerUuid().equals(playerUUID)); 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; SeatBlockEntity deviceBlockEntity;
// 检查玩家是否骑乘在实体上 // 检查玩家是否骑乘在实体上
@ -92,15 +108,7 @@ public class FurnitureHelper {
deviceBlockEntity.releasePlayer(player.level(), deviceBlockEntity.getBlockPos()); deviceBlockEntity.releasePlayer(player.level(), deviceBlockEntity.getBlockPos());
// 从设备管理器中移除会话 // 从设备管理器中移除会话
DeviceManager.getSeatSessions().remove(deviceBlockEntity.getBoundPlayerUUID()); CommonHandler.Game.dungeonDataSyncManager.removePlayerSeatEntity(deviceBlockEntity.getBoundPlayerUUID());
// 检查玩家是否仍被其他设备绑定
if (isPlayerBound(player.getUUID())) {
return;
}
// 重置玩家的姿势状态
DeviceManager.resetSeatSession(player);
} }
} }
} }