mirror of
https://github.com/xSquishyLiam/mc-GeyserModelEngine-plugin.git
synced 2025-12-20 07:19:20 +00:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13c0b45d2a | ||
|
|
8f67ade51c | ||
|
|
d0fd719753 | ||
|
|
16e0dfcdfd | ||
|
|
b1969646e6 | ||
|
|
501eaaa37a | ||
|
|
f67ee6d9f8 | ||
|
|
3adb965697 | ||
|
|
63c20d3f74 | ||
|
|
c83fc4dd0a | ||
|
|
c0ed740b47 | ||
|
|
ed61baebf2 | ||
|
|
e22170d219 | ||
|
|
6e4947d827 | ||
|
|
0a1151be75 | ||
|
|
16fa85f52e | ||
|
|
ff1133a4d5 |
44
.gitignore
vendored
44
.gitignore
vendored
@@ -1,2 +1,42 @@
|
|||||||
# 项目排除路径
|
.gradle
|
||||||
/target/
|
build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
out/
|
||||||
|
!**/src/main/**/out/
|
||||||
|
!**/src/test/**/out/
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/main/**/bin/
|
||||||
|
!**/src/test/**/bin/
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,2 +0,0 @@
|
|||||||
#Tue May 27 16:38:57 BST 2025
|
|
||||||
gradle.version=8.12
|
|
||||||
Binary file not shown.
Binary file not shown.
14
.idea/compiler.xml
generated
14
.idea/compiler.xml
generated
@@ -1,18 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
<annotationProcessing>
|
<bytecodeTargetLevel target="21" />
|
||||||
<profile name="Maven default annotation processors profile" enabled="true">
|
|
||||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
|
||||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
|
||||||
<outputRelativeToContentRoot value="true" />
|
|
||||||
<module name="GeyserModelEngine" />
|
|
||||||
</profile>
|
|
||||||
</annotationProcessing>
|
|
||||||
</component>
|
|
||||||
<component name="JavacSettings">
|
|
||||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
|
||||||
<module name="GeyserModelEngine" options="" />
|
|
||||||
</option>
|
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
16
.idea/gradle.xml
generated
Normal file
16
.idea/gradle.xml
generated
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||||
|
<component name="GradleSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<GradleProjectSettings>
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</GradleProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
7
.idea/misc.xml
generated
7
.idea/misc.xml
generated
@@ -1,12 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="MavenProjectsManager">
|
|
||||||
<option name="originalFiles">
|
|
||||||
<list>
|
|
||||||
<option value="$PROJECT_DIR$/pom.xml" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK" />
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK" />
|
||||||
</project>
|
</project>
|
||||||
124
.idea/workspace.xml
generated
124
.idea/workspace.xml
generated
@@ -4,38 +4,132 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="ff2e9770-ec88-4715-adeb-b9dbda130e1a" name="Changes" comment="" />
|
<list default="true" id="ff2e9770-ec88-4715-adeb-b9dbda130e1a" name="Changes" comment="">
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/re/imc/geysermodelengine/managers/model/data/ModelEntityData.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/re/imc/geysermodelengine/managers/model/data/ModelEntityData.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/re/imc/geysermodelengine/runnables/EntityTaskRunnable.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/re/imc/geysermodelengine/runnables/EntityTaskRunnable.java" afterDir="false" />
|
||||||
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="ExternalProjectsData">
|
||||||
|
<projectState path="$PROJECT_DIR$">
|
||||||
|
<ProjectState />
|
||||||
|
</projectState>
|
||||||
|
</component>
|
||||||
|
<component name="ExternalProjectsManager">
|
||||||
|
<system id="GRADLE">
|
||||||
|
<state>
|
||||||
|
<task path="$PROJECT_DIR$">
|
||||||
|
<activation />
|
||||||
|
</task>
|
||||||
|
<projects_view>
|
||||||
|
<tree_state>
|
||||||
|
<expand>
|
||||||
|
<path>
|
||||||
|
<item name="" type="6a2764b6:ExternalProjectsStructure$RootNode" />
|
||||||
|
<item name="GeyserModelEngine" type="f1a62948:ProjectNode" />
|
||||||
|
</path>
|
||||||
|
<path>
|
||||||
|
<item name="" type="6a2764b6:ExternalProjectsStructure$RootNode" />
|
||||||
|
<item name="GeyserModelEngine" type="f1a62948:ProjectNode" />
|
||||||
|
<item name="Tasks" type="e4a08cd1:TasksNode" />
|
||||||
|
</path>
|
||||||
|
<path>
|
||||||
|
<item name="" type="6a2764b6:ExternalProjectsStructure$RootNode" />
|
||||||
|
<item name="GeyserModelEngine" type="f1a62948:ProjectNode" />
|
||||||
|
<item name="Tasks" type="e4a08cd1:TasksNode" />
|
||||||
|
<item name="build" type="c8890929:TasksNode$1" />
|
||||||
|
</path>
|
||||||
|
</expand>
|
||||||
|
<select />
|
||||||
|
</tree_state>
|
||||||
|
</projects_view>
|
||||||
|
</state>
|
||||||
|
</system>
|
||||||
|
</component>
|
||||||
|
<component name="FileTemplateManagerImpl">
|
||||||
|
<option name="RECENT_TEMPLATES">
|
||||||
|
<list>
|
||||||
|
<option value="Interface" />
|
||||||
|
<option value="Class" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
<component name="Git.Settings">
|
<component name="Git.Settings">
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
<component name="MavenRunner">
|
<component name="MavenRunner">
|
||||||
<option name="delegateBuildToMaven" value="true" />
|
<option name="delegateBuildToMaven" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectColorInfo"><![CDATA[{
|
<component name="ProblemsViewState">
|
||||||
"associatedIndex": 8
|
<option name="selectedTabId" value="DEPENDENCY_CHECKER_PROBLEMS_TAB" />
|
||||||
}]]></component>
|
</component>
|
||||||
|
<component name="ProjectColorInfo">{
|
||||||
|
"associatedIndex": 8
|
||||||
|
}</component>
|
||||||
<component name="ProjectId" id="2xedme8VKz03tyMoE1OuGEibnGo" />
|
<component name="ProjectId" id="2xedme8VKz03tyMoE1OuGEibnGo" />
|
||||||
|
<component name="ProjectLevelVcsManager">
|
||||||
|
<ConfirmationsSetting value="2" id="Add" />
|
||||||
|
</component>
|
||||||
<component name="ProjectViewState">
|
<component name="ProjectViewState">
|
||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent"><![CDATA[{
|
<component name="PropertiesComponent">{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"Maven.GeyserModelEngine [install...].executor": "Run",
|
"Gradle.GeyserModelEngine [jar].executor": "Run",
|
||||||
"Maven.GeyserModelEngine [install].executor": "Run",
|
"Maven.GeyserModelEngine [install...].executor": "Run",
|
||||||
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
"Maven.GeyserModelEngine [install].executor": "Run",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
||||||
"RunOnceActivity.git.unshallow": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"git-widget-placeholder": "main",
|
"RunOnceActivity.git.unshallow": "true",
|
||||||
"last_opened_file_path": "D:/Coding/Forks/Minecraft/GeyserModelEngine",
|
"git-widget-placeholder": "main",
|
||||||
"settings.editor.selected.configurable": "reference.settings.project.maven.runner"
|
"last_opened_file_path": "D:/Coding/Forks/Minecraft/GeyserModelEngine",
|
||||||
|
"project.structure.last.edited": "Project",
|
||||||
|
"project.structure.proportion": "0.0",
|
||||||
|
"project.structure.side.proportion": "0.2",
|
||||||
|
"settings.editor.selected.configurable": "reference.settings.project.maven.runner"
|
||||||
}
|
}
|
||||||
}]]></component>
|
}</component>
|
||||||
|
<component name="RecentsManager">
|
||||||
|
<key name="CopyFile.RECENT_KEYS">
|
||||||
|
<recent name="D:\Coding\Forks\Minecraft\GeyserModelEngine" />
|
||||||
|
</key>
|
||||||
|
<key name="MoveFile.RECENT_KEYS">
|
||||||
|
<recent name="D:\Coding\Forks\Minecraft\GeyserModelEngine\libs" />
|
||||||
|
</key>
|
||||||
|
</component>
|
||||||
|
<component name="RunManager">
|
||||||
|
<configuration name="GeyserModelEngine [jar]" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
|
||||||
|
<ExternalSystemSettings>
|
||||||
|
<option name="executionName" />
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="externalSystemIdString" value="GRADLE" />
|
||||||
|
<option name="scriptParameters" />
|
||||||
|
<option name="taskDescriptions">
|
||||||
|
<list />
|
||||||
|
</option>
|
||||||
|
<option name="taskNames">
|
||||||
|
<list>
|
||||||
|
<option value="jar" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
<option name="vmOptions" />
|
||||||
|
</ExternalSystemSettings>
|
||||||
|
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
|
||||||
|
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
|
||||||
|
<DebugAllEnabled>false</DebugAllEnabled>
|
||||||
|
<RunAsTest>false</RunAsTest>
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<recent_temporary>
|
||||||
|
<list>
|
||||||
|
<item itemvalue="Gradle.GeyserModelEngine [jar]" />
|
||||||
|
</list>
|
||||||
|
</recent_temporary>
|
||||||
|
</component>
|
||||||
<component name="TaskManager">
|
<component name="TaskManager">
|
||||||
<task active="true" id="Default" summary="Default task">
|
<task active="true" id="Default" summary="Default task">
|
||||||
<changelist id="ff2e9770-ec88-4715-adeb-b9dbda130e1a" name="Changes" comment="" />
|
<changelist id="ff2e9770-ec88-4715-adeb-b9dbda130e1a" name="Changes" comment="" />
|
||||||
|
|||||||
@@ -9,32 +9,27 @@ version = "1.0.0"
|
|||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://repo.papermc.io/repository/maven-public/")
|
maven("https://repo.papermc.io/repository/maven-public/")
|
||||||
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
|
maven("https://central.sonatype.com/repository/maven-snapshots/")
|
||||||
|
|
||||||
maven("https://mvn.lumine.io/repository/maven-public/")
|
maven("https://mvn.lumine.io/repository/maven-public/")
|
||||||
|
|
||||||
maven("https://repo.opencollab.dev/maven-releases/") {
|
maven("https://repo.opencollab.dev/main/")
|
||||||
isAllowInsecureProtocol = true
|
|
||||||
}
|
|
||||||
maven("https://repo.opencollab.dev/maven-snapshots/") {
|
|
||||||
isAllowInsecureProtocol = true
|
|
||||||
}
|
|
||||||
|
|
||||||
maven("https://repo.codemc.io/repository/maven-public/")
|
maven("https://repo.codemc.io/repository/maven-public/")
|
||||||
maven("https://repo.codemc.io/repository/maven-releases/")
|
maven("https://repo.codemc.io/repository/maven-releases/")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("io.papermc.paper:paper-api:1.21.5-R0.1-SNAPSHOT")
|
compileOnly("io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT")
|
||||||
|
implementation("dev.jorel:commandapi-bukkit-shade-mojang-mapped:10.1.2")
|
||||||
|
|
||||||
implementation("dev.jorel:commandapi-bukkit-shade-mojang-mapped:10.0.1")
|
compileOnly("com.ticxo.modelengine:ModelEngine:R4.0.9")
|
||||||
|
|
||||||
compileOnly("com.ticxo.modelengine:ModelEngine:R4.0.4")
|
|
||||||
|
|
||||||
compileOnly(files("libs/geyserutils-spigot-1.0-SNAPSHOT.jar"))
|
compileOnly(files("libs/geyserutils-spigot-1.0-SNAPSHOT.jar"))
|
||||||
compileOnly("org.geysermc.floodgate:api:2.2.2-SNAPSHOT")
|
compileOnly("org.geysermc.floodgate:api:2.2.4-SNAPSHOT")
|
||||||
|
|
||||||
implementation("com.github.retrooper:packetevents-spigot:2.8.0")
|
|
||||||
|
implementation("com.github.retrooper:packetevents-spigot:2.9.3")
|
||||||
|
|
||||||
implementation("org.reflections:reflections:0.10.2")
|
implementation("org.reflections:reflections:0.10.2")
|
||||||
}
|
}
|
||||||
@@ -56,6 +51,6 @@ tasks.shadowJar {
|
|||||||
relocate("org.reflections", "re.imc.geysermodelengine.libs.reflections")
|
relocate("org.reflections", "re.imc.geysermodelengine.libs.reflections")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.jar {
|
tasks.build {
|
||||||
dependsOn(tasks.shadowJar)
|
dependsOn("shadowJar")
|
||||||
}
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -1,4 +0,0 @@
|
|||||||
|
|
||||||
commands:
|
|
||||||
reload:
|
|
||||||
successfully-reloaded: "<#55FF55>GeyserModelEngine configuration reloaded!"
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
data-send-delay: 5
|
|
||||||
entity-view-distance: 50
|
|
||||||
join-send-delay: 20
|
|
||||||
entity-position-update-period: 35
|
|
||||||
model-entity-type: BAT # must be a living entity
|
|
||||||
enable-part-visibility-models:
|
|
||||||
- example
|
|
||||||
debug: false
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
main: re.imc.geysermodelengine.GeyserModelEngine
|
|
||||||
name: GeyserModelEngine
|
|
||||||
version: '1.0.0'
|
|
||||||
api-version: '1.21'
|
|
||||||
|
|
||||||
authors:
|
|
||||||
- zimzaza4
|
|
||||||
- willem.dev
|
|
||||||
- TheLividaProject
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
server:
|
|
||||||
GeyserUtils:
|
|
||||||
required: true
|
|
||||||
packetevents:
|
|
||||||
required: true
|
|
||||||
ModelEngine:
|
|
||||||
required: true
|
|
||||||
floodgate:
|
|
||||||
required: true
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,2 +0,0 @@
|
|||||||
Manifest-Version: 1.0
|
|
||||||
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
Manifest-Version: 1.0
|
|
||||||
|
|
||||||
Binary file not shown.
@@ -2,25 +2,18 @@ package re.imc.geysermodelengine;
|
|||||||
|
|
||||||
import com.github.retrooper.packetevents.PacketEvents;
|
import com.github.retrooper.packetevents.PacketEvents;
|
||||||
import com.github.retrooper.packetevents.event.PacketListenerPriority;
|
import com.github.retrooper.packetevents.event.PacketListenerPriority;
|
||||||
import com.ticxo.modelengine.api.ModelEngineAPI;
|
|
||||||
import com.ticxo.modelengine.api.model.ActiveModel;
|
import com.ticxo.modelengine.api.model.ActiveModel;
|
||||||
import com.ticxo.modelengine.api.model.ModeledEntity;
|
|
||||||
import dev.jorel.commandapi.CommandAPI;
|
import dev.jorel.commandapi.CommandAPI;
|
||||||
import dev.jorel.commandapi.CommandAPIBukkitConfig;
|
import dev.jorel.commandapi.CommandAPIBukkitConfig;
|
||||||
import io.github.retrooper.packetevents.factory.spigot.SpigotPacketEventsBuilder;
|
import io.github.retrooper.packetevents.factory.spigot.SpigotPacketEventsBuilder;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import re.imc.geysermodelengine.listener.ModelListener;
|
import re.imc.geysermodelengine.listener.ModelListener;
|
||||||
import re.imc.geysermodelengine.listener.MountPacketListener;
|
import re.imc.geysermodelengine.listener.MountPacketListener;
|
||||||
import re.imc.geysermodelengine.managers.ConfigManager;
|
import re.imc.geysermodelengine.managers.ConfigManager;
|
||||||
import re.imc.geysermodelengine.managers.bedrock.BedrockMountControlManager;
|
|
||||||
import re.imc.geysermodelengine.managers.commands.CommandManager;
|
import re.imc.geysermodelengine.managers.commands.CommandManager;
|
||||||
import re.imc.geysermodelengine.managers.model.EntityTaskManager;
|
import re.imc.geysermodelengine.managers.model.EntityTaskManager;
|
||||||
import re.imc.geysermodelengine.managers.model.ModelManager;
|
import re.imc.geysermodelengine.managers.model.ModelManager;
|
||||||
import re.imc.geysermodelengine.managers.player.PlayerManager;
|
|
||||||
import re.imc.geysermodelengine.managers.server.ServerManager;
|
|
||||||
import re.imc.geysermodelengine.managers.model.data.ModelEntityData;
|
import re.imc.geysermodelengine.managers.model.data.ModelEntityData;
|
||||||
import re.imc.geysermodelengine.runnables.BedrockMountControlRunnable;
|
import re.imc.geysermodelengine.runnables.BedrockMountControlRunnable;
|
||||||
import re.imc.geysermodelengine.runnables.UpdateTaskRunnable;
|
import re.imc.geysermodelengine.runnables.UpdateTaskRunnable;
|
||||||
@@ -31,15 +24,13 @@ import java.util.concurrent.*;
|
|||||||
public class GeyserModelEngine extends JavaPlugin {
|
public class GeyserModelEngine extends JavaPlugin {
|
||||||
|
|
||||||
private ConfigManager configManager;
|
private ConfigManager configManager;
|
||||||
private ServerManager serverManager;
|
|
||||||
|
|
||||||
private CommandManager commandManager;
|
private CommandManager commandManager;
|
||||||
|
|
||||||
private ModelManager modelManager;
|
private ModelManager modelManager;
|
||||||
private EntityTaskManager entityTaskManager;
|
private EntityTaskManager entityTaskManager;
|
||||||
private BedrockMountControlManager bedrockMountControlManager;
|
|
||||||
|
|
||||||
private PlayerManager playerManager;
|
private ScheduledExecutorService schedulerPool;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
@@ -58,24 +49,6 @@ public class GeyserModelEngine extends JavaPlugin {
|
|||||||
PacketEvents.getAPI().getEventManager().registerListener(new MountPacketListener(this), PacketListenerPriority.NORMAL);
|
PacketEvents.getAPI().getEventManager().registerListener(new MountPacketListener(this), PacketListenerPriority.NORMAL);
|
||||||
|
|
||||||
Bukkit.getPluginManager().registerEvents(new ModelListener(this), this);
|
Bukkit.getPluginManager().registerEvents(new ModelListener(this), this);
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskLater(this, () -> {
|
|
||||||
for (World world : Bukkit.getWorlds()) {
|
|
||||||
|
|
||||||
for (Entity entity : world.getEntities()) {
|
|
||||||
|
|
||||||
if (!modelManager.getEntitiesCache().containsKey(entity.getEntityId())) {
|
|
||||||
|
|
||||||
ModeledEntity modeledEntity = ModelEngineAPI.getModeledEntity(entity);
|
|
||||||
|
|
||||||
if (modeledEntity != null) {
|
|
||||||
Optional<ActiveModel> model = modeledEntity.getModels().values().stream().findFirst();
|
|
||||||
model.ifPresent(m -> modelManager.create(modeledEntity, m));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -98,19 +71,17 @@ public class GeyserModelEngine extends JavaPlugin {
|
|||||||
|
|
||||||
private void loadManagers() {
|
private void loadManagers() {
|
||||||
this.configManager = new ConfigManager(this);
|
this.configManager = new ConfigManager(this);
|
||||||
this.serverManager = new ServerManager();
|
|
||||||
|
|
||||||
this.commandManager = new CommandManager(this);
|
this.commandManager = new CommandManager(this);
|
||||||
|
|
||||||
this.modelManager = new ModelManager(this);
|
this.modelManager = new ModelManager(this);
|
||||||
this.entityTaskManager = new EntityTaskManager(this);
|
this.entityTaskManager = new EntityTaskManager(this);
|
||||||
this.bedrockMountControlManager = new BedrockMountControlManager();
|
|
||||||
|
|
||||||
this.playerManager = new PlayerManager();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadRunnables() {
|
private void loadRunnables() {
|
||||||
Bukkit.getAsyncScheduler().runAtFixedRate(this, new UpdateTaskRunnable(this), 10, configManager.getConfig().getLong("entity-position-update-period"), TimeUnit.MILLISECONDS);
|
this.schedulerPool = Executors.newScheduledThreadPool(configManager.getConfig().getInt("thread-pool-size", 4));
|
||||||
|
|
||||||
|
Bukkit.getAsyncScheduler().runAtFixedRate(this, new UpdateTaskRunnable(this), 10, configManager.getConfig().getLong("entity-position-update-period", 35), TimeUnit.MILLISECONDS);
|
||||||
Bukkit.getAsyncScheduler().runAtFixedRate(this, new BedrockMountControlRunnable(this), 1, 1, TimeUnit.MILLISECONDS);
|
Bukkit.getAsyncScheduler().runAtFixedRate(this, new BedrockMountControlRunnable(this), 1, 1, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,10 +89,6 @@ public class GeyserModelEngine extends JavaPlugin {
|
|||||||
return configManager;
|
return configManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServerManager getServerManager() {
|
|
||||||
return serverManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandManager getCommandManager() {
|
public CommandManager getCommandManager() {
|
||||||
return commandManager;
|
return commandManager;
|
||||||
}
|
}
|
||||||
@@ -134,11 +101,7 @@ public class GeyserModelEngine extends JavaPlugin {
|
|||||||
return entityTaskManager;
|
return entityTaskManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BedrockMountControlManager getBedrockMountControlManager() {
|
public ScheduledExecutorService getSchedulerPool() {
|
||||||
return bedrockMountControlManager;
|
return schedulerPool;
|
||||||
}
|
|
||||||
|
|
||||||
public PlayerManager getPlayerManager() {
|
|
||||||
return playerManager;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,10 +21,7 @@ public class GeyserModelEngineReloadCommand implements SubCommands {
|
|||||||
return new CommandAPICommand("reload")
|
return new CommandAPICommand("reload")
|
||||||
.withPermission("geysermodelengine.commands.reload")
|
.withPermission("geysermodelengine.commands.reload")
|
||||||
.executes((sender, args) -> {
|
.executes((sender, args) -> {
|
||||||
Bukkit.getAsyncScheduler().runNow(plugin, scheduledTask -> {
|
Bukkit.getAsyncScheduler().runNow(plugin, scheduledTask -> plugin.getConfigManager().load());
|
||||||
plugin.getConfigManager().load();
|
|
||||||
});
|
|
||||||
|
|
||||||
sender.sendMessage(colourUtils.miniFormat(plugin.getConfigManager().getLang().getString("commands.reload.successfully-reloaded")));
|
sender.sendMessage(colourUtils.miniFormat(plugin.getConfigManager().getLang().getString("commands.reload.successfully-reloaded")));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,16 +6,21 @@ import com.ticxo.modelengine.api.events.ModelMountEvent;
|
|||||||
import com.ticxo.modelengine.api.model.ActiveModel;
|
import com.ticxo.modelengine.api.model.ActiveModel;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.event.world.WorldInitEvent;
|
||||||
|
import org.bukkit.event.world.WorldLoadEvent;
|
||||||
|
import org.geysermc.floodgate.api.FloodgateApi;
|
||||||
import re.imc.geysermodelengine.GeyserModelEngine;
|
import re.imc.geysermodelengine.GeyserModelEngine;
|
||||||
import re.imc.geysermodelengine.managers.model.data.ModelEntityData;
|
import re.imc.geysermodelengine.managers.model.data.ModelEntityData;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class ModelListener implements Listener {
|
public class ModelListener implements Listener {
|
||||||
|
|
||||||
@@ -40,25 +45,35 @@ public class ModelListener implements Listener {
|
|||||||
ModelEntityData model = map.get(event.getVehicle());
|
ModelEntityData model = map.get(event.getVehicle());
|
||||||
|
|
||||||
if (model != null && event.getPassenger() instanceof Player player) {
|
if (model != null && event.getPassenger() instanceof Player player) {
|
||||||
plugin.getBedrockMountControlManager().getDriversCache().put(player, Pair.of(event.getVehicle(), event.getSeat()));
|
plugin.getModelManager().getDriversCache().put(player.getUniqueId(), Pair.of(event.getVehicle(), event.getSeat()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onModelDismount(ModelDismountEvent event) {
|
public void onModelDismount(ModelDismountEvent event) {
|
||||||
if (event.getPassenger() instanceof Player player) {
|
if (event.getPassenger() instanceof Player player) {
|
||||||
plugin.getBedrockMountControlManager().getDriversCache().remove(player);
|
plugin.getModelManager().getDriversCache().remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO Find out why we need this bc uh what?
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerLogin(PlayerJoinEvent event) {
|
public void onWorldInit(WorldInitEvent event) {
|
||||||
Bukkit.getGlobalRegionScheduler().runDelayed(plugin, scheduledTask -> plugin.getPlayerManager().getPlayerJoinedCache().add(event.getPlayer()), 10);
|
World world = event.getWorld();
|
||||||
|
world.getEntities().forEach(entity -> plugin.getModelManager().processEntities(entity));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
if (!FloodgateApi.getInstance().isFloodgatePlayer(player.getUniqueId())) return;
|
||||||
|
//TODO temp fix bc like why? - the issue is when a player logs out and the mob is there, the player logs back in sometimes it can display as a pig only
|
||||||
|
Bukkit.getAsyncScheduler().runDelayed(plugin, scheduledTask -> plugin.getModelManager().getPlayerJoinedCache().add(player.getUniqueId()), 10, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
Bukkit.getGlobalRegionScheduler().runDelayed(plugin, scheduledTask -> plugin.getPlayerManager().getPlayerJoinedCache().remove(event.getPlayer()), 10);
|
Player player = event.getPlayer();
|
||||||
|
if (!FloodgateApi.getInstance().isFloodgatePlayer(player.getUniqueId())) return;
|
||||||
|
plugin.getModelManager().getPlayerJoinedCache().remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class MountPacketListener implements PacketListener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
WrapperPlayClientEntityAction action = new WrapperPlayClientEntityAction(event);
|
WrapperPlayClientEntityAction action = new WrapperPlayClientEntityAction(event);
|
||||||
Pair<ActiveModel, Mount> seat = plugin.getBedrockMountControlManager().getDriversCache().get(player);
|
Pair<ActiveModel, Mount> seat = plugin.getModelManager().getDriversCache().get(player.getUniqueId());
|
||||||
|
|
||||||
if (seat == null) return;
|
if (seat == null) return;
|
||||||
if (action.getAction() != WrapperPlayClientEntityAction.Action.START_SNEAKING) return;
|
if (action.getAction() != WrapperPlayClientEntityAction.Action.START_SNEAKING) return;
|
||||||
|
|||||||
@@ -18,6 +18,12 @@ public class ConfigManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void load() {
|
public void load() {
|
||||||
|
if (!plugin.getDataFolder().exists()) {
|
||||||
|
plugin.getDataFolder().mkdir();
|
||||||
|
plugin.saveResource("config.yml", false);
|
||||||
|
plugin.saveResource("Lang/messages.yml", false);
|
||||||
|
}
|
||||||
|
|
||||||
this.config = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "config.yml"));
|
this.config = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "config.yml"));
|
||||||
this.lang = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "Lang/messages.yml"));
|
this.lang = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "Lang/messages.yml"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
package re.imc.geysermodelengine.managers.bedrock;
|
|
||||||
|
|
||||||
import com.ticxo.modelengine.api.model.ActiveModel;
|
|
||||||
import com.ticxo.modelengine.api.model.bone.type.Mount;
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
public class BedrockMountControlManager {
|
|
||||||
|
|
||||||
private final ConcurrentHashMap<Player, Pair<ActiveModel, Mount>> driversCache = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
public ConcurrentHashMap<Player, Pair<ActiveModel, Mount>> getDriversCache() {
|
|
||||||
return driversCache;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -60,9 +60,7 @@ public class EntityTaskManager {
|
|||||||
for (Player player : players) {
|
for (Player player : players) {
|
||||||
EntityUtils.sendCustomScale(player, model.getEntity().getEntityId(), average);
|
EntityUtils.sendCustomScale(player, model.getEntity().getEntityId(), average);
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable ignored) {}
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendColor(ModelEntityData model, Collection<Player> players, Color lastColor, boolean firstSend) {
|
public void sendColor(ModelEntityData model, Collection<Player> players, Color lastColor, boolean firstSend) {
|
||||||
@@ -82,10 +80,9 @@ public class EntityTaskManager {
|
|||||||
|
|
||||||
public void checkViewers(ModelEntityData model, Set<Player> viewers) {
|
public void checkViewers(ModelEntityData model, Set<Player> viewers) {
|
||||||
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
|
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
|
||||||
if (FloodgateApi.getInstance().isFloodgatePlayer(onlinePlayer.getUniqueId())) {
|
if (!FloodgateApi.getInstance().isFloodgatePlayer(onlinePlayer.getUniqueId())) continue;
|
||||||
|
|
||||||
if (canSee(onlinePlayer, model.getEntity())) {
|
if (canSee(onlinePlayer, model.getEntity())) {
|
||||||
|
|
||||||
if (!viewers.contains(onlinePlayer)) {
|
if (!viewers.contains(onlinePlayer)) {
|
||||||
sendSpawnPacket(model, onlinePlayer);
|
sendSpawnPacket(model, onlinePlayer);
|
||||||
viewers.add(onlinePlayer);
|
viewers.add(onlinePlayer);
|
||||||
@@ -98,11 +95,11 @@ public class EntityTaskManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// Issue here - start: See ModelListener.class and look at function onPlayerJoin
|
||||||
private void sendSpawnPacket(ModelEntityData model, Player onlinePlayer) {
|
private void sendSpawnPacket(ModelEntityData model, Player onlinePlayer) {
|
||||||
EntityTaskRunnable task = model.getEntityTask();
|
EntityTaskRunnable task = model.getEntityTask();
|
||||||
boolean firstJoined = !plugin.getPlayerManager().getPlayerJoinedCache().contains(onlinePlayer);
|
boolean firstJoined = !plugin.getModelManager().getPlayerJoinedCache().contains(onlinePlayer.getUniqueId());
|
||||||
|
|
||||||
if (firstJoined) {
|
if (firstJoined) {
|
||||||
task.sendEntityData(model, onlinePlayer, plugin.getConfigManager().getConfig().getInt("join-send-delay") / 50);
|
task.sendEntityData(model, onlinePlayer, plugin.getConfigManager().getConfig().getInt("join-send-delay") / 50);
|
||||||
@@ -113,7 +110,7 @@ public class EntityTaskManager {
|
|||||||
|
|
||||||
public boolean canSee(Player player, PacketEntity entity) {
|
public boolean canSee(Player player, PacketEntity entity) {
|
||||||
if (!player.isOnline()) return false;
|
if (!player.isOnline()) return false;
|
||||||
if (!plugin.getPlayerManager().getPlayerJoinedCache().contains(player)) return false;
|
if (!plugin.getModelManager().getPlayerJoinedCache().contains(player.getUniqueId())) return false;
|
||||||
|
|
||||||
Location playerLocation = player.getLocation().clone();
|
Location playerLocation = player.getLocation().clone();
|
||||||
Location entityLocation = entity.getLocation().clone();
|
Location entityLocation = entity.getLocation().clone();
|
||||||
@@ -125,6 +122,7 @@ public class EntityTaskManager {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// Issue here - end
|
||||||
|
|
||||||
public void sendHitBoxToAll(ModelEntityData model) {
|
public void sendHitBoxToAll(ModelEntityData model) {
|
||||||
for (Player viewer : model.getViewers()) {
|
for (Player viewer : model.getViewers()) {
|
||||||
|
|||||||
@@ -1,21 +1,27 @@
|
|||||||
package re.imc.geysermodelengine.managers.model;
|
package re.imc.geysermodelengine.managers.model;
|
||||||
|
|
||||||
|
import com.ticxo.modelengine.api.ModelEngineAPI;
|
||||||
import com.ticxo.modelengine.api.model.ActiveModel;
|
import com.ticxo.modelengine.api.model.ActiveModel;
|
||||||
import com.ticxo.modelengine.api.model.ModeledEntity;
|
import com.ticxo.modelengine.api.model.ModeledEntity;
|
||||||
|
import com.ticxo.modelengine.api.model.bone.type.Mount;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import re.imc.geysermodelengine.GeyserModelEngine;
|
import re.imc.geysermodelengine.GeyserModelEngine;
|
||||||
import re.imc.geysermodelengine.managers.model.data.ModelEntityData;
|
import re.imc.geysermodelengine.managers.model.data.ModelEntityData;
|
||||||
import re.imc.geysermodelengine.runnables.EntityTaskRunnable;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class ModelManager {
|
public class ModelManager {
|
||||||
|
|
||||||
private final GeyserModelEngine plugin;
|
private final GeyserModelEngine plugin;
|
||||||
|
|
||||||
|
private final HashSet<UUID> playerJoinedCache = new HashSet<>();
|
||||||
|
|
||||||
private final ConcurrentHashMap<Integer, Map<ActiveModel, ModelEntityData>> entitiesCache = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<Integer, Map<ActiveModel, ModelEntityData>> entitiesCache = new ConcurrentHashMap<>();
|
||||||
private final Map<Integer, ModelEntityData> modelEntitiesCache = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<Integer, ModelEntityData> modelEntitiesCache = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
private final ConcurrentHashMap<UUID, Pair<ActiveModel, Mount>> driversCache = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public ModelManager(GeyserModelEngine plugin) {
|
public ModelManager(GeyserModelEngine plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
@@ -36,11 +42,29 @@ public class ModelManager {
|
|||||||
map.put(model, modelEntity);
|
map.put(model, modelEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void processEntities(Entity entity) {
|
||||||
|
if (entitiesCache.containsKey(entity.getEntityId())) return;
|
||||||
|
|
||||||
|
ModeledEntity modeledEntity = ModelEngineAPI.getModeledEntity(entity);
|
||||||
|
if (modeledEntity == null) return;
|
||||||
|
|
||||||
|
Optional<ActiveModel> model = modeledEntity.getModels().values().stream().findFirst();
|
||||||
|
model.ifPresent(m -> create(modeledEntity, m));
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashSet<UUID> getPlayerJoinedCache() {
|
||||||
|
return playerJoinedCache;
|
||||||
|
}
|
||||||
|
|
||||||
public ConcurrentHashMap<Integer, Map<ActiveModel, ModelEntityData>> getEntitiesCache() {
|
public ConcurrentHashMap<Integer, Map<ActiveModel, ModelEntityData>> getEntitiesCache() {
|
||||||
return entitiesCache;
|
return entitiesCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Integer, ModelEntityData> getModelEntitiesCache() {
|
public ConcurrentHashMap<Integer, ModelEntityData> getModelEntitiesCache() {
|
||||||
return modelEntitiesCache;
|
return modelEntitiesCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ConcurrentHashMap<UUID, Pair<ActiveModel, Mount>> getDriversCache() {
|
||||||
|
return driversCache;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;
|
|||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.ticxo.modelengine.api.model.ActiveModel;
|
import com.ticxo.modelengine.api.model.ActiveModel;
|
||||||
import com.ticxo.modelengine.api.model.ModeledEntity;
|
import com.ticxo.modelengine.api.model.ModeledEntity;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import re.imc.geysermodelengine.GeyserModelEngine;
|
import re.imc.geysermodelengine.GeyserModelEngine;
|
||||||
@@ -12,7 +11,6 @@ import re.imc.geysermodelengine.packet.entity.PacketEntity;
|
|||||||
import re.imc.geysermodelengine.runnables.EntityTaskRunnable;
|
import re.imc.geysermodelengine.runnables.EntityTaskRunnable;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
public class ModelEntityData {
|
public class ModelEntityData {
|
||||||
|
|
||||||
@@ -50,7 +48,6 @@ public class ModelEntityData {
|
|||||||
|
|
||||||
public void runEntityTask() {
|
public void runEntityTask() {
|
||||||
entityTask = new EntityTaskRunnable(plugin, this);
|
entityTask = new EntityTaskRunnable(plugin, this);
|
||||||
Bukkit.getAsyncScheduler().runAtFixedRate(plugin, entityTask, 0, 20, TimeUnit.MILLISECONDS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PacketEntity getEntity() {
|
public PacketEntity getEntity() {
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
package re.imc.geysermodelengine.managers.player;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
public class PlayerManager {
|
|
||||||
|
|
||||||
private final HashSet<Player> playerJoinedCache = new HashSet<>();
|
|
||||||
|
|
||||||
public HashSet<Player> getPlayerJoinedCache() {
|
|
||||||
return playerJoinedCache;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package re.imc.geysermodelengine.managers.server;
|
|
||||||
|
|
||||||
import io.papermc.paper.threadedregions.scheduler.ScheduledTask;
|
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
public class ServerData {
|
|
||||||
|
|
||||||
private final ConcurrentHashMap<String, ScheduledTask> activeRunnablesCache = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
public ConcurrentHashMap<String, ScheduledTask> getActiveRunnablesCache() {
|
|
||||||
return activeRunnablesCache;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package re.imc.geysermodelengine.managers.server;
|
|
||||||
|
|
||||||
public class ServerManager {
|
|
||||||
|
|
||||||
private final ServerData serverData;
|
|
||||||
|
|
||||||
public ServerManager() {
|
|
||||||
this.serverData = new ServerData();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ServerData getServerData() {
|
|
||||||
return serverData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -28,13 +28,12 @@ public class BedrockMountControlRunnable implements Consumer<ScheduledTask> {
|
|||||||
if (!FloodgateApi.getInstance().isFloodgatePlayer(player.getUniqueId())) continue;
|
if (!FloodgateApi.getInstance().isFloodgatePlayer(player.getUniqueId())) continue;
|
||||||
|
|
||||||
float pitch = player.getLocation().getPitch();
|
float pitch = player.getLocation().getPitch();
|
||||||
Pair<ActiveModel, Mount> seat = plugin.getBedrockMountControlManager().getDriversCache().get(player);
|
Pair<ActiveModel, Mount> seat = plugin.getModelManager().getDriversCache().get(player.getUniqueId());
|
||||||
|
|
||||||
if (seat == null) continue;
|
if (seat == null) continue;
|
||||||
|
|
||||||
if (pitch < -30) {
|
if (pitch < -30) {
|
||||||
MountController controller = ModelEngineAPI.getMountPairManager()
|
MountController controller = ModelEngineAPI.getMountPairManager().getController(player.getUniqueId());
|
||||||
.getController(player.getUniqueId());
|
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
MountController.MountInput input = controller.getInput();
|
MountController.MountInput input = controller.getInput();
|
||||||
if (input != null) {
|
if (input != null) {
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ import com.ticxo.modelengine.api.generator.blueprint.BlueprintBone;
|
|||||||
import com.ticxo.modelengine.api.model.ActiveModel;
|
import com.ticxo.modelengine.api.model.ActiveModel;
|
||||||
import com.ticxo.modelengine.api.model.ModeledEntity;
|
import com.ticxo.modelengine.api.model.ModeledEntity;
|
||||||
import com.ticxo.modelengine.api.model.bone.ModelBone;
|
import com.ticxo.modelengine.api.model.bone.ModelBone;
|
||||||
import io.papermc.paper.threadedregions.scheduler.ScheduledTask;
|
|
||||||
import me.zimzaza4.geyserutils.spigot.api.EntityUtils;
|
import me.zimzaza4.geyserutils.spigot.api.EntityUtils;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import re.imc.geysermodelengine.GeyserModelEngine;
|
import re.imc.geysermodelengine.GeyserModelEngine;
|
||||||
import re.imc.geysermodelengine.managers.model.data.ModelEntityData;
|
import re.imc.geysermodelengine.managers.model.data.ModelEntityData;
|
||||||
@@ -21,10 +19,10 @@ import java.awt.*;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class EntityTaskRunnable implements Consumer<ScheduledTask> {
|
public class EntityTaskRunnable {
|
||||||
|
|
||||||
private final GeyserModelEngine plugin;
|
private final GeyserModelEngine plugin;
|
||||||
|
|
||||||
@@ -43,16 +41,19 @@ public class EntityTaskRunnable implements Consumer<ScheduledTask> {
|
|||||||
|
|
||||||
private final BooleanPacker booleanPacker = new BooleanPacker();
|
private final BooleanPacker booleanPacker = new BooleanPacker();
|
||||||
|
|
||||||
|
private final ScheduledFuture scheduledFuture;
|
||||||
|
|
||||||
public EntityTaskRunnable(GeyserModelEngine plugin, ModelEntityData model) {
|
public EntityTaskRunnable(GeyserModelEngine plugin, ModelEntityData model) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
||||||
this.model = model;
|
this.model = model;
|
||||||
|
|
||||||
plugin.getEntityTaskManager().sendHitBoxToAll(model);
|
plugin.getEntityTaskManager().sendHitBoxToAll(model);
|
||||||
|
|
||||||
|
scheduledFuture = plugin.getSchedulerPool().scheduleAtFixedRate(this::runAsync, 0, 20, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void runAsync() {
|
||||||
public void accept(ScheduledTask scheduledTask) {
|
|
||||||
plugin.getEntityTaskManager().checkViewers(model, model.getViewers());
|
plugin.getEntityTaskManager().checkViewers(model, model.getViewers());
|
||||||
|
|
||||||
PacketEntity entity = model.getEntity();
|
PacketEntity entity = model.getEntity();
|
||||||
@@ -70,7 +71,7 @@ public class EntityTaskRunnable implements Consumer<ScheduledTask> {
|
|||||||
|
|
||||||
plugin.getModelManager().getEntitiesCache().remove(modeledEntity.getBase().getEntityId());
|
plugin.getModelManager().getEntitiesCache().remove(modeledEntity.getBase().getEntityId());
|
||||||
plugin.getModelManager().getModelEntitiesCache().remove(entity.getEntityId());
|
plugin.getModelManager().getModelEntitiesCache().remove(entity.getEntityId());
|
||||||
scheduledTask.cancel();
|
cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,20 +97,25 @@ public class EntityTaskRunnable implements Consumer<ScheduledTask> {
|
|||||||
plugin.getEntityTaskManager().sendColor(model, viewers, lastColor, false);
|
plugin.getEntityTaskManager().sendColor(model, viewers, lastColor, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void cancel() {
|
||||||
|
scheduledFuture.cancel(true);
|
||||||
|
}
|
||||||
|
|
||||||
public void sendEntityData(ModelEntityData model, Player player, int delay) {
|
public void sendEntityData(ModelEntityData model, Player player, int delay) {
|
||||||
|
//TODO with ModelEngine, you can define the namespace inside the config, make an option to change it here as well? if i'm right about this
|
||||||
EntityUtils.setCustomEntity(player, model.getEntity().getEntityId(), "modelengine:" + model.getActiveModel().getBlueprint().getName().toLowerCase());
|
EntityUtils.setCustomEntity(player, model.getEntity().getEntityId(), "modelengine:" + model.getActiveModel().getBlueprint().getName().toLowerCase());
|
||||||
|
|
||||||
Bukkit.getAsyncScheduler().runDelayed(plugin, scheduledTask -> {
|
plugin.getSchedulerPool().schedule(() -> {
|
||||||
model.getEntity().sendSpawnPacket(Collections.singletonList(player));
|
model.getEntity().sendSpawnPacket(Collections.singletonList(player));
|
||||||
|
|
||||||
Bukkit.getAsyncScheduler().runDelayed(plugin, scheduledTask1 -> {
|
plugin.getSchedulerPool().schedule(() -> {
|
||||||
plugin.getEntityTaskManager().sendHitBox(model, player);
|
plugin.getEntityTaskManager().sendHitBox(model, player);
|
||||||
plugin.getEntityTaskManager().sendScale(model, Collections.singleton(player), lastScale, true);
|
plugin.getEntityTaskManager().sendScale(model, Collections.singleton(player), lastScale, true);
|
||||||
plugin.getEntityTaskManager().sendColor(model, Collections.singleton(player), lastColor, true);
|
plugin.getEntityTaskManager().sendColor(model, Collections.singleton(player), lastColor, true);
|
||||||
|
|
||||||
updateEntityProperties(model, Collections.singleton(player), true);
|
updateEntityProperties(model, Collections.singleton(player), true);
|
||||||
}, 500, TimeUnit.MILLISECONDS);
|
|
||||||
}, delay * 50L, TimeUnit.MILLISECONDS);
|
}, delay * 50L, TimeUnit.MILLISECONDS);
|
||||||
|
}, 500, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateEntityProperties(ModelEntityData model, Collection<Player> players, boolean firstSend, String... forceAnims) {
|
public void updateEntityProperties(ModelEntityData model, Collection<Player> players, boolean firstSend, String... forceAnims) {
|
||||||
@@ -255,4 +261,8 @@ public class EntityTaskRunnable implements Consumer<ScheduledTask> {
|
|||||||
public Cache<String, Boolean> getLastPlayedAnim() {
|
public Cache<String, Boolean> getLastPlayedAnim() {
|
||||||
return lastPlayedAnim;
|
return lastPlayedAnim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ScheduledFuture getScheduledFuture() {
|
||||||
|
return scheduledFuture;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ data-send-delay: 5
|
|||||||
entity-view-distance: 50
|
entity-view-distance: 50
|
||||||
join-send-delay: 20
|
join-send-delay: 20
|
||||||
entity-position-update-period: 35
|
entity-position-update-period: 35
|
||||||
|
thread-pool-size: 4
|
||||||
model-entity-type: BAT # must be a living entity
|
model-entity-type: BAT # must be a living entity
|
||||||
enable-part-visibility-models:
|
enable-part-visibility-models:
|
||||||
- example
|
- example
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ authors:
|
|||||||
- willem.dev
|
- willem.dev
|
||||||
- TheLividaProject
|
- TheLividaProject
|
||||||
|
|
||||||
|
load: STARTUP
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
server:
|
server:
|
||||||
GeyserUtils:
|
GeyserUtils:
|
||||||
|
|||||||
Reference in New Issue
Block a user