mirror of
https://github.com/xSquishyLiam/mc-GeyserModelEngine-plugin.git
synced 2025-12-19 23:09:25 +00:00
Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6425ffa51 | ||
|
|
1c47fe83d2 | ||
|
|
7bbe66928c | ||
|
|
a26ea6e148 | ||
|
|
d1ef89088c | ||
|
|
c98e807827 | ||
|
|
35131c2d58 | ||
|
|
6651ae99f7 | ||
|
|
ca9a54ae71 | ||
|
|
865f5f567c | ||
|
|
b5d9d9b9ca | ||
|
|
31dac482bd | ||
|
|
b2bfa2977e | ||
|
|
84012a23b7 | ||
|
|
3943381b2c | ||
|
|
42d7ea506f | ||
|
|
e177c8af74 | ||
|
|
2c5dba8097 | ||
|
|
2a9fdec8b6 | ||
|
|
94df76b9a6 | ||
|
|
03f27514ef | ||
|
|
4679fa6f2b | ||
|
|
db99b2fe00 | ||
|
|
ffd72b0a56 | ||
|
|
e83caacd2f | ||
|
|
170e67e059 | ||
|
|
d150d7e324 | ||
|
|
db0367537e | ||
|
|
36ea0e5fa0 | ||
|
|
f4c5167ef5 | ||
|
|
dc4e39506d | ||
|
|
5fdf93db1e | ||
|
|
4d75f0615c | ||
|
|
97e5bdefcd |
@@ -8,10 +8,10 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Setup JDK
|
||||
- name: Setup Java JDK
|
||||
@@ -20,19 +20,13 @@ jobs:
|
||||
java-version: 17
|
||||
distribution: 'zulu'
|
||||
|
||||
- name: Restore Maven cache
|
||||
uses: skjolber/maven-cache-github-action@v1
|
||||
with:
|
||||
step: restore
|
||||
|
||||
# Build
|
||||
- name: Build with Maven
|
||||
run: mvn package
|
||||
- name: Make gradlew executable
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build
|
||||
|
||||
- name: Save Maven cache
|
||||
uses: skjolber/maven-cache-github-action@v1
|
||||
with:
|
||||
step: save
|
||||
- name: Auto release
|
||||
uses: "marvinpinto/action-automatic-releases@latest"
|
||||
with:
|
||||
@@ -40,4 +34,4 @@ jobs:
|
||||
automatic_release_tag: latest
|
||||
prerelease: false
|
||||
files: |
|
||||
target/GeyserModelEngine*.jar
|
||||
build/libs/GeyserModelEngine*.jar
|
||||
33
.idea/workspace.xml
generated
33
.idea/workspace.xml
generated
@@ -5,8 +5,7 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<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" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -60,6 +59,7 @@
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="GradleScriptDefinitionsStorage" workingDir="$PROJECT_DIR$" gradleHome="$USER_HOME$/.gradle/wrapper/dists/gradle-8.12-bin/cetblhg4pflnnks72fxwobvgv/gradle-8.12" javaHome="$USER_HOME$/.jdks/openjdk-21.0.1" gradleVersion="8.12" />
|
||||
<component name="MavenRunner">
|
||||
<option name="delegateBuildToMaven" value="true" />
|
||||
</component>
|
||||
@@ -79,6 +79,8 @@
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"Gradle.Download Sources.executor": "Run",
|
||||
"Gradle.GeyserModelEngine [build].executor": "Run",
|
||||
"Gradle.GeyserModelEngine [jar].executor": "Run",
|
||||
"Maven.GeyserModelEngine [install...].executor": "Run",
|
||||
"Maven.GeyserModelEngine [install].executor": "Run",
|
||||
@@ -86,6 +88,7 @@
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"git-widget-placeholder": "main",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_opened_file_path": "D:/Coding/Forks/Minecraft/GeyserModelEngine",
|
||||
"project.structure.last.edited": "Project",
|
||||
"project.structure.proportion": "0.0",
|
||||
@@ -98,10 +101,33 @@
|
||||
<recent name="D:\Coding\Forks\Minecraft\GeyserModelEngine" />
|
||||
</key>
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="D:\Coding\Forks\Minecraft\GeyserModelEngine\.github\workflows" />
|
||||
<recent name="D:\Coding\Forks\Minecraft\GeyserModelEngine\libs" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<component name="RunManager" selected="Gradle.GeyserModelEngine [build]">
|
||||
<configuration name="GeyserModelEngine [build]" 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="build" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" />
|
||||
</ExternalSystemSettings>
|
||||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
|
||||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<RunAsTest>false</RunAsTest>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="GeyserModelEngine [jar]" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
@@ -126,6 +152,7 @@
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Gradle.GeyserModelEngine [build]" />
|
||||
<item itemvalue="Gradle.GeyserModelEngine [jar]" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
|
||||
19
README.md
19
README.md
@@ -20,27 +20,22 @@ Download the following plugins according to what server software you use.
|
||||
- Put `GeyserModelEngine` in the plugins folder (only Spigot or forks of Spigot supported)
|
||||
- Put either `geyserutils-spigot` in your plugins folder aswell (`geyserutils-velocity`/`geyserutils-bungeecord` in your Velocity/Bungeecord plugins folder if you use it)
|
||||
- Put `GeyserModelEnginePackGenerator` and `geyserutils-geyser` into `plugins/[Geyser-Folder]/extensions`
|
||||
- Inside `floodgate` set `send-floodgate-data` to `true` in your Velocity/Bungeecord folder and copy over the key.pem into your backend `floodgate` folders
|
||||
|
||||
Start the server to generate the relevant configuration files, and then shut down the server to convert any models.
|
||||
|
||||
# Convert Models
|
||||
This is old method to convert model:
|
||||
|
||||
`GeyserModelEnginePackGenerator` is capable of generating models all by itself. After generating it will also apply this pack automatically.
|
||||
|
||||
- First go to `plugins/[Geyser-Folder]/extensions/geysermodelenginepackgenerator/input/`
|
||||
- Create a folder in this directory with the ID of the model. (this is the same name as your model within ModelEngine 4.)
|
||||
- Firstly, install [packer plugin](https://github.com/GeyserExtensionists/GeyserModelEngineBlockbenchPacker) for your blockbench.
|
||||
|
||||
- Then, open your bbmodel, go `File -> Export -> Export GeyserModelEngine Model`, you will get a zip, just unzip it to `input` folder.
|
||||
|
||||
<img src="docsimg/example.jpg" width="500">
|
||||
|
||||
> Each model should have a separate model folder
|
||||
> Subfolders are supported if you want to categorize them
|
||||
|
||||
- Now use BlockBench and convert your model to a Bedrock Entity, this will allow you to export the Bedrock Geometry and Animations.
|
||||
- Put the geometry, animations and texture file in this folder you've made.
|
||||
|
||||
<img src="docsimg/example1.jpg" width="500">
|
||||
|
||||
- Restart the server or reload geyser to start generating the resource pack.
|
||||
- Go to `plugins/[Geyser-Folder]/extensions/geysermodelenginepackgenerator`, and you should see your pack generated!
|
||||
|
||||
@@ -49,12 +44,6 @@ This is old method to convert model:
|
||||
- Final step, reload Geyser or restart the server to load the resource pack.
|
||||
- Congratulations, you've completed this tutorial!
|
||||
|
||||
# Model Packer
|
||||
|
||||
This is new way to convert model
|
||||
- Firstly, install [packer plugin](https://github.com/GeyserExtensionists/GeyserModelEngineBlockbenchPacker) for your blockbench.
|
||||
- Then, open your bbmodel, go `File -> Export -> Export GeyserModelEngine Model`, you will get a zip, just unzip it to `input` folder.
|
||||
|
||||
# Tips
|
||||
|
||||
* Pay attention! The pack only regenerates when the number of models changes, you can technically speaking remove the generated_pack folder to force a reload aswell.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id("java")
|
||||
id("io.github.goooler.shadow") version "8.1.7"
|
||||
id("io.github.goooler.shadow") version "8.1.8"
|
||||
}
|
||||
|
||||
group = "re.imc"
|
||||
@@ -28,8 +28,8 @@ dependencies {
|
||||
compileOnly(files("libs/geyserutils-spigot-1.0-SNAPSHOT.jar"))
|
||||
compileOnly("org.geysermc.floodgate:api:2.2.4-SNAPSHOT")
|
||||
|
||||
|
||||
implementation("com.github.retrooper:packetevents-spigot:2.9.3")
|
||||
implementation("com.github.retrooper:packetevents-spigot:2.9.5")
|
||||
implementation("org.bstats:bstats-bukkit:3.0.2")
|
||||
|
||||
implementation("org.reflections:reflections:0.10.2")
|
||||
}
|
||||
@@ -43,11 +43,15 @@ tasks.compileJava {
|
||||
}
|
||||
|
||||
tasks.shadowJar {
|
||||
archiveFileName.set("${rootProject.name}-${version}.jar")
|
||||
|
||||
relocate("dev.jorel.commandapi", "re.imc.geysermodelengine.libs.commandapi")
|
||||
|
||||
relocate("com.github.retrooper", "re.imc.geysermodelengine.libs.com.github.retrooper.packetevents")
|
||||
relocate("io.github.retrooper", "re.imc.geysermodelengine.libs.io.github.retrooper.packetevents")
|
||||
|
||||
relocate("org.bstats", "re.imc.geysermodelengine.libs.bstats")
|
||||
|
||||
relocate("org.reflections", "re.imc.geysermodelengine.libs.reflections")
|
||||
}
|
||||
|
||||
|
||||
152
pom.xml
Normal file
152
pom.xml
Normal file
@@ -0,0 +1,152 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>re.imc</groupId>
|
||||
<artifactId>GeyserModelEngine</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>GeyserModelEngine</name>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>16</source>
|
||||
<target>16</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.4.1</version>
|
||||
<configuration>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com.github.retrooper.packetevents</pattern>
|
||||
<shadedPattern>re.imc.geysermodelengine.libs.com.github.retrooper.packetevents</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>io.github.retrooper.packetevents</pattern>
|
||||
<shadedPattern>re.imc.geysermodelengine.libs.io.github.retrooper.packetevents</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>papermc-repo</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sonatype</id>
|
||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>nexus</id>
|
||||
<name>Lumine Public</name>
|
||||
<url>https://mvn.lumine.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>md_5-public</id>
|
||||
<url>https://repo.md-5.net/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>opencollab-release-repo</id>
|
||||
<url>https://repo.opencollab.dev/maven-releases/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>opencollab-snapshot-repo</id>
|
||||
<url>https://repo.opencollab.dev/maven-snapshots/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>dmulloy2-repo</id>
|
||||
<url>https://repo.dmulloy2.net/repository/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>codemc-releases</id>
|
||||
<url>https://repo.codemc.io/repository/maven-releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>codemc-snapshots</id>
|
||||
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.20.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ticxo.modelengine</groupId>
|
||||
<artifactId>ModelEngine</artifactId>
|
||||
<version>R4.0.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.geyserextensionists</groupId>
|
||||
<artifactId>geyserutils-spigot</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/geyserutils-spigot-1.0-SNAPSHOT.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.geysermc.floodgate</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
<version>2.2.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.retrooper</groupId>
|
||||
<artifactId>packetevents-spigot</artifactId>
|
||||
<version>2.8.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,6 @@
|
||||
package re.imc.geysermodelengine.Events;
|
||||
|
||||
public class GeyserModelEngineModelSpawn {
|
||||
|
||||
//Spawn Event
|
||||
}
|
||||
@@ -2,10 +2,10 @@ package re.imc.geysermodelengine;
|
||||
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.event.PacketListenerPriority;
|
||||
import com.ticxo.modelengine.api.model.ActiveModel;
|
||||
import dev.jorel.commandapi.CommandAPI;
|
||||
import dev.jorel.commandapi.CommandAPIBukkitConfig;
|
||||
import io.github.retrooper.packetevents.factory.spigot.SpigotPacketEventsBuilder;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import re.imc.geysermodelengine.listener.ModelListener;
|
||||
@@ -14,11 +14,9 @@ import re.imc.geysermodelengine.managers.ConfigManager;
|
||||
import re.imc.geysermodelengine.managers.commands.CommandManager;
|
||||
import re.imc.geysermodelengine.managers.model.EntityTaskManager;
|
||||
import re.imc.geysermodelengine.managers.model.ModelManager;
|
||||
import re.imc.geysermodelengine.managers.model.data.ModelEntityData;
|
||||
import re.imc.geysermodelengine.runnables.BedrockMountControlRunnable;
|
||||
import re.imc.geysermodelengine.runnables.UpdateTaskRunnable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
public class GeyserModelEngine extends JavaPlugin {
|
||||
@@ -46,6 +44,8 @@ public class GeyserModelEngine extends JavaPlugin {
|
||||
loadManagers();
|
||||
loadRunnables();
|
||||
|
||||
loadBStats();
|
||||
|
||||
PacketEvents.getAPI().getEventManager().registerListener(new MountPacketListener(this), PacketListenerPriority.NORMAL);
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(new ModelListener(this), this);
|
||||
@@ -55,11 +55,7 @@ public class GeyserModelEngine extends JavaPlugin {
|
||||
public void onDisable() {
|
||||
PacketEvents.getAPI().terminate();
|
||||
|
||||
for (Map<ActiveModel, ModelEntityData> entities : modelManager.getEntitiesCache().values()) {
|
||||
entities.forEach((model, modelEntity) -> {
|
||||
modelEntity.getEntity().remove();
|
||||
});
|
||||
}
|
||||
this.modelManager.removeEntities();
|
||||
|
||||
CommandAPI.onDisable();
|
||||
}
|
||||
@@ -69,6 +65,10 @@ public class GeyserModelEngine extends JavaPlugin {
|
||||
CommandAPI.onEnable();
|
||||
}
|
||||
|
||||
private void loadBStats() {
|
||||
if (configManager.getConfig().getBoolean("bstats", true)) new Metrics(this, 26981);
|
||||
}
|
||||
|
||||
private void loadManagers() {
|
||||
this.configManager = new ConfigManager(this);
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package re.imc.geysermodelengine.listener;
|
||||
|
||||
import com.ticxo.modelengine.api.events.AddModelEvent;
|
||||
import com.ticxo.modelengine.api.events.ModelDismountEvent;
|
||||
import com.ticxo.modelengine.api.events.ModelMountEvent;
|
||||
import com.ticxo.modelengine.api.events.*;
|
||||
import com.ticxo.modelengine.api.model.ActiveModel;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -14,13 +12,11 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
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.managers.model.data.ModelEntityData;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class ModelListener implements Listener {
|
||||
|
||||
@@ -33,7 +29,6 @@ public class ModelListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onAddModel(AddModelEvent event) {
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
plugin.getModelManager().create(event.getTarget(), event.getModel());
|
||||
}
|
||||
|
||||
@@ -56,18 +51,26 @@ public class ModelListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/ xSquishyLiam:
|
||||
/ I'm wondering if we could move this to more of a player loading chunks instead of checking all worlds via PlayerChunkLoadEvent?
|
||||
*/
|
||||
@EventHandler
|
||||
public void onWorldInit(WorldInitEvent event) {
|
||||
World world = event.getWorld();
|
||||
world.getEntities().forEach(entity -> plugin.getModelManager().processEntities(entity));
|
||||
}
|
||||
|
||||
/*
|
||||
/ xSquishyLiam - conclusion:
|
||||
/ I'm assuming when a player joins the server the packet for mob spawning is instant so the client resyncs itself
|
||||
/ hence why the pig is shown instead of going invisible and not displaying the texture of the modeled mob
|
||||
*/
|
||||
@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);
|
||||
Bukkit.getGlobalRegionScheduler().runDelayed(plugin, scheduledTask -> plugin.getModelManager().getPlayerJoinedCache().add(player.getUniqueId()), 10);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
@@ -33,6 +33,6 @@ public class MountPacketListener implements PacketListener {
|
||||
if (seat == null) return;
|
||||
if (action.getAction() != WrapperPlayClientEntityAction.Action.START_SNEAKING) return;
|
||||
|
||||
ModelEngineAPI.getMountPairManager().tryDismount(event.getPlayer());
|
||||
ModelEngineAPI.getMountPairManager().tryDismount(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,6 @@ public class EntityTaskManager {
|
||||
}
|
||||
}
|
||||
|
||||
// Issue here - start: See ModelListener.class and look at function onPlayerJoin
|
||||
private void sendSpawnPacket(ModelEntityData model, Player onlinePlayer) {
|
||||
EntityTaskRunnable task = model.getEntityTask();
|
||||
boolean firstJoined = !plugin.getModelManager().getPlayerJoinedCache().contains(onlinePlayer.getUniqueId());
|
||||
@@ -122,7 +121,6 @@ public class EntityTaskManager {
|
||||
|
||||
return true;
|
||||
}
|
||||
// Issue here - end
|
||||
|
||||
public void sendHitBoxToAll(ModelEntityData model) {
|
||||
for (Player viewer : model.getViewers()) {
|
||||
|
||||
@@ -52,6 +52,12 @@ public class ModelManager {
|
||||
model.ifPresent(m -> create(modeledEntity, m));
|
||||
}
|
||||
|
||||
public void removeEntities() {
|
||||
for (Map<ActiveModel, ModelEntityData> entities : entitiesCache.values()) {
|
||||
entities.forEach((model, modelEntity) -> modelEntity.getEntity().remove());
|
||||
}
|
||||
}
|
||||
|
||||
public HashSet<UUID> getPlayerJoinedCache() {
|
||||
return playerJoinedCache;
|
||||
}
|
||||
|
||||
@@ -102,8 +102,7 @@ public class EntityTaskRunnable {
|
||||
}
|
||||
|
||||
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(), plugin.getConfigManager().getConfig().getString("namespace") + ":" + model.getActiveModel().getBlueprint().getName().toLowerCase());
|
||||
|
||||
plugin.getSchedulerPool().schedule(() -> {
|
||||
model.getEntity().sendSpawnPacket(Collections.singletonList(player));
|
||||
@@ -114,8 +113,8 @@ public class EntityTaskRunnable {
|
||||
plugin.getEntityTaskManager().sendColor(model, Collections.singleton(player), lastColor, true);
|
||||
|
||||
updateEntityProperties(model, Collections.singleton(player), true);
|
||||
}, delay * 50L, TimeUnit.MILLISECONDS);
|
||||
}, 500, TimeUnit.MILLISECONDS);
|
||||
}, 500, TimeUnit.MILLISECONDS);
|
||||
}, delay * 50L, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
public void updateEntityProperties(ModelEntityData model, Collection<Player> players, boolean firstSend, String... forceAnims) {
|
||||
@@ -163,14 +162,15 @@ public class EntityTaskRunnable {
|
||||
|
||||
Map<String, Integer> intUpdates = new HashMap<>();
|
||||
int i = 0;
|
||||
|
||||
for (Integer integer : booleanPacker.mapBooleansToInts(boneUpdates)) {
|
||||
intUpdates.put("modelengine:bone" + i, integer);
|
||||
intUpdates.put(plugin.getConfigManager().getConfig().getString("namespace") + ":bone" + i, integer);
|
||||
i++;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
for (Integer integer : booleanPacker.mapBooleansToInts(animUpdates)) {
|
||||
intUpdates.put("modelengine:anim" + i, integer);
|
||||
intUpdates.put(plugin.getConfigManager().getConfig().getString("namespace") + ":anim" + i, integer);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
bstats: true
|
||||
|
||||
namespace: "modelengine"
|
||||
data-send-delay: 5
|
||||
entity-view-distance: 50
|
||||
join-send-delay: 20
|
||||
@@ -6,4 +9,5 @@ thread-pool-size: 4
|
||||
model-entity-type: BAT # must be a living entity
|
||||
enable-part-visibility-models:
|
||||
- example
|
||||
|
||||
debug: false
|
||||
@@ -6,7 +6,6 @@ api-version: '1.21'
|
||||
authors:
|
||||
- zimzaza4
|
||||
- willem.dev
|
||||
- TheLividaProject
|
||||
|
||||
load: STARTUP
|
||||
|
||||
|
||||
Reference in New Issue
Block a user