初始化项目#2
This commit is contained in:
parent
32ec10cfeb
commit
f8ccd1a673
|
|
@ -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.7
|
lib39_version=0.0.8
|
||||||
## 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.
|
||||||
|
|
|
||||||
BIN
libs/lib39-1.20.1-0.0.8.jar
Normal file
BIN
libs/lib39-1.20.1-0.0.8.jar
Normal file
Binary file not shown.
|
|
@ -1,10 +1,38 @@
|
||||||
package top.r3944realms.eroticdungeongame;
|
package top.r3944realms.eroticdungeongame;
|
||||||
|
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent;
|
||||||
|
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||||
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
import top.r3944realms.eroticdungeongame.content.capability.DungeonDataSyncManager;
|
||||||
|
import top.r3944realms.eroticdungeongame.content.register.EDGCapabilities;
|
||||||
|
import top.r3944realms.lib39.api.event.SyncManagerRegisterEvent;
|
||||||
|
|
||||||
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)
|
||||||
public static class Game extends CommonHandler {
|
public static class Game extends CommonHandler {
|
||||||
|
public static DungeonDataSyncManager dungeonDataSyncManager;
|
||||||
|
public static ResourceLocation DUNGEON_SYNC = EroticDungeon.rl("dungeon_sync");
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void attachCapability(AttachCapabilitiesEvent<?> event) {
|
||||||
|
EDGCapabilities.attachCapability(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void syncCapabilities(SyncManagerRegisterEvent event) {
|
||||||
|
dungeonDataSyncManager = new DungeonDataSyncManager();
|
||||||
|
event.registerSyncManager(DUNGEON_SYNC, dungeonDataSyncManager, EDGCapabilities.PLAYER_DUNGEON_DATA_CAP);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@net.minecraftforge.fml.common.Mod.EventBusSubscriber(modid = EroticDungeon.MOD_ID, bus = net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD)
|
||||||
|
|
||||||
public static class Mod extends CommonHandler {
|
public static class Mod extends CommonHandler {
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void registerCapability(RegisterCapabilitiesEvent event) {
|
||||||
|
EDGCapabilities.registerCapability(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,7 @@ import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import top.r3944realms.eroticdungeongame.content.register.EDGBlockEntities;
|
import top.r3944realms.eroticdungeongame.content.register.*;
|
||||||
import top.r3944realms.eroticdungeongame.content.register.EDGBlocks;
|
|
||||||
import top.r3944realms.eroticdungeongame.content.register.EDGCreativeTabs;
|
|
||||||
import top.r3944realms.eroticdungeongame.content.register.EDGEntities;
|
|
||||||
|
|
||||||
@Mod(EroticDungeon.MOD_ID)
|
@Mod(EroticDungeon.MOD_ID)
|
||||||
public class EroticDungeon {
|
public class EroticDungeon {
|
||||||
|
|
@ -20,6 +17,7 @@ public class EroticDungeon {
|
||||||
initialize(eventBus);
|
initialize(eventBus);
|
||||||
}
|
}
|
||||||
public static void initialize(IEventBus eventBus) {
|
public static void initialize(IEventBus eventBus) {
|
||||||
|
EDGItems.register(eventBus);
|
||||||
EDGBlocks.register(eventBus);
|
EDGBlocks.register(eventBus);
|
||||||
EDGBlockEntities.register(eventBus);
|
EDGBlockEntities.register(eventBus);
|
||||||
EDGCreativeTabs.register(eventBus);
|
EDGCreativeTabs.register(eventBus);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,24 @@
|
||||||
package top.r3944realms.eroticdungeongame.content.animation;
|
package top.r3944realms.eroticdungeongame.content.animation;
|
||||||
|
|
||||||
public class AnimationHandler implements IAnimationHandler {
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public enum AnimationHandler implements IAnimationHandler {
|
||||||
|
INSTANCE;
|
||||||
|
public static final Logger LOGGER = LoggerFactory.getLogger(ClientAnimationHandler.class);
|
||||||
|
public final Map<Integer, AnimationProperties> SEAT_ANIMATIONS = new HashMap<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void playerSeatAnimation(Player player, Integer animationId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeSeatAnimation(Player player) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
package top.r3944realms.eroticdungeongame.content.animation;
|
package top.r3944realms.eroticdungeongame.content.animation;
|
||||||
|
|
||||||
public interface IAnimationHandler {
|
import net.minecraft.world.entity.player.Player;
|
||||||
default void loadAllAnimations() {
|
|
||||||
|
|
||||||
}
|
public interface IAnimationHandler {
|
||||||
|
String CURRENT_ANIMATION_KEY = "currentAnimation";
|
||||||
|
default void loadAllAnimations() {}
|
||||||
|
void playerSeatAnimation(Player player, Integer animationId);
|
||||||
|
void removeSeatAnimation(Player player);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
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 {
|
||||||
|
protected AbstractPlayerDungeonData(ResourceLocation id) {
|
||||||
|
super(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract Integer getSeatAnimId();
|
||||||
|
abstract void setSeatAnimId(Integer seatAnimId);
|
||||||
|
|
||||||
|
abstract BlockPos getSeatPosition();
|
||||||
|
abstract void setSeatPosition(BlockPos seatPosition);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package top.r3944realms.eroticdungeongame.content.capability;
|
||||||
|
|
||||||
|
import top.r3944realms.lib39.core.sync.ISyncManager;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class DungeonDataSyncManager implements ISyncManager<AbstractPlayerDungeonData> {
|
||||||
|
public static Set<AbstractPlayerDungeonData> playerDungeons = new HashSet<>();
|
||||||
|
@Override
|
||||||
|
public Set<AbstractPlayerDungeonData> getSyncSet() {
|
||||||
|
return playerDungeons;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
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 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;
|
||||||
|
|
||||||
|
public final class PlayerDungeonData extends AbstractPlayerDungeonData {
|
||||||
|
public final Player player;
|
||||||
|
|
||||||
|
PlayerDungeonData(Player player) {
|
||||||
|
super(EroticDungeon.rl(EDGCapabilities.DUNGEON_DATA));
|
||||||
|
this.player = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompoundTag serializeNBT() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserializeNBT(CompoundTag compoundTag) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkIfDirtyThenUpdate() {
|
||||||
|
if (isDirty()) {
|
||||||
|
NetworkHandler.sendToPlayer(new SyncNBTDataS2CPack(player.getId(), id(), this), (ServerPlayer)player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getSeatAnimId() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSeatAnimId(Integer seatAnimId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockPos getSeatPosition() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSeatPosition(BlockPos seatPosition) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package top.r3944realms.eroticdungeongame.content.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.ICapabilitySerializable;
|
||||||
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import top.r3944realms.eroticdungeongame.content.register.EDGCapabilities;
|
||||||
|
|
||||||
|
public class PlayerDungeonDataProvider implements ICapabilitySerializable<CompoundTag> {
|
||||||
|
private final AbstractPlayerDungeonData instance;
|
||||||
|
private final LazyOptional<AbstractPlayerDungeonData> optional;
|
||||||
|
|
||||||
|
public PlayerDungeonDataProvider(final Player player) {
|
||||||
|
this.instance = new PlayerDungeonData(player);
|
||||||
|
this.optional = LazyOptional.of(() -> this.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull <T> LazyOptional<T> getCapability(@NotNull Capability<T> capability, @Nullable Direction direction) {
|
||||||
|
return EDGCapabilities.PLAYER_DUNGEON_DATA_CAP.orEmpty(capability, this.optional);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompoundTag serializeNBT() {
|
||||||
|
return instance.serializeNBT();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserializeNBT(CompoundTag compoundTag) {
|
||||||
|
instance.deserializeNBT(compoundTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
package top.r3944realms.eroticdungeongame.content.device;
|
|
||||||
|
|
||||||
public class SeatSessionManager {
|
|
||||||
}
|
|
||||||
|
|
@ -60,7 +60,9 @@ public class SeatEntity extends Entity {
|
||||||
@Override
|
@Override
|
||||||
public void onPassengerTurned(@NotNull Entity passenger) {
|
public void onPassengerTurned(@NotNull Entity passenger) {
|
||||||
super.onPassengerTurned(passenger);
|
super.onPassengerTurned(passenger);
|
||||||
|
if(passenger instanceof LivingEntity livingEntity){
|
||||||
|
limitPassengerRotation(livingEntity);
|
||||||
|
}
|
||||||
// // 如果不是笼子类型的座椅,限制乘客的旋转 (未做)
|
// // 如果不是笼子类型的座椅,限制乘客的旋转 (未做)
|
||||||
// if (!SeatType.CAGE.equals(FurnitureHelper.get(this)) &&
|
// if (!SeatType.CAGE.equals(FurnitureHelper.get(this)) &&
|
||||||
// passenger instanceof LivingEntity livingEntity) {
|
// passenger instanceof LivingEntity livingEntity) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package top.r3944realms.eroticdungeongame.content.register;
|
||||||
|
|
||||||
|
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.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;
|
||||||
|
|
||||||
|
public class EDGCapabilities {
|
||||||
|
public static final Capability<AbstractPlayerDungeonData> PLAYER_DUNGEON_DATA_CAP = CapabilityManager.get(new CapabilityToken<>() {});
|
||||||
|
public static final String DUNGEON_DATA = "dungeon_data";
|
||||||
|
|
||||||
|
public static void registerCapability(@NotNull RegisterCapabilitiesEvent event) {
|
||||||
|
event.register(AbstractPlayerDungeonData.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void attachCapability(@NotNull AttachCapabilitiesEvent<?> event) {
|
||||||
|
if (event.getObject() instanceof Player player) {
|
||||||
|
event.addCapability(EroticDungeon.rl(DUNGEON_DATA), new PlayerDungeonDataProvider(player));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package top.r3944realms.eroticdungeongame.content.register;
|
package top.r3944realms.eroticdungeongame.content.register;
|
||||||
|
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import net.minecraftforge.registries.DeferredRegister;
|
import net.minecraftforge.registries.DeferredRegister;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import top.r3944realms.eroticdungeongame.EroticDungeon;
|
import top.r3944realms.eroticdungeongame.EroticDungeon;
|
||||||
|
|
@ -8,4 +9,7 @@ import top.r3944realms.eroticdungeongame.EroticDungeon;
|
||||||
public class EDGItems {
|
public class EDGItems {
|
||||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, EroticDungeon.MOD_ID);
|
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, EroticDungeon.MOD_ID);
|
||||||
|
|
||||||
|
public static void register(IEventBus eventBus) {
|
||||||
|
ITEMS.register(eventBus);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,9 +60,9 @@ public class FurnitureHelper {
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPlayerBound(UUID playerUuid) {
|
public static boolean isPlayerBound(UUID playerUUID) {
|
||||||
return DeviceManager.getInstance().entrySet().stream()
|
return DeviceManager.getInstance().entrySet().stream()
|
||||||
.anyMatch(entry -> entry.getValue().getBoundPlayerUuid().equals(playerUuid));
|
.anyMatch(entry -> entry.getValue().getBoundPlayerUuid().equals(playerUUID));
|
||||||
}
|
}
|
||||||
public static void releasePlayerFromDevice(Player player) {
|
public static void releasePlayerFromDevice(Player player) {
|
||||||
SeatBlockEntity deviceBlockEntity;
|
SeatBlockEntity deviceBlockEntity;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user