mirror of
https://github.com/xSquishyLiam/mc-GeyserModelEngine-plugin.git
synced 2025-12-19 14:59:19 +00:00
just sorting my build to match the main build
This commit is contained in:
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@@ -4,7 +4,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- bettermodel-support-dev
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|||||||
4
.idea/workspace.xml
generated
4
.idea/workspace.xml
generated
@@ -11,7 +11,7 @@
|
|||||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="DarkyenusTimeTracker">
|
<component name="DarkyenusTimeTracker">
|
||||||
<option name="totalTimeSeconds" value="24424" />
|
<option name="totalTimeSeconds" value="32226" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ExternalProjectsData">
|
<component name="ExternalProjectsData">
|
||||||
<projectState path="$PROJECT_DIR$">
|
<projectState path="$PROJECT_DIR$">
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
"git-widget-placeholder": "main",
|
"git-widget-placeholder": "main",
|
||||||
"ignore.virus.scanning.warn.message": "true",
|
"ignore.virus.scanning.warn.message": "true",
|
||||||
"kotlin-language-version-configured": "true",
|
"kotlin-language-version-configured": "true",
|
||||||
"last_opened_file_path": "D:/Coding/Forks/Minecraft/GeyserModelEngine/geyser",
|
"last_opened_file_path": "D:/Coding/Minecraft/GeyserExtensionists/GeyserModelEngine",
|
||||||
"project.structure.last.edited": "Project",
|
"project.structure.last.edited": "Project",
|
||||||
"project.structure.proportion": "0.0",
|
"project.structure.proportion": "0.0",
|
||||||
"project.structure.side.proportion": "0.2",
|
"project.structure.side.proportion": "0.2",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "re.imc"
|
group = "re.imc"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@@ -59,3 +59,12 @@ tasks.shadowJar {
|
|||||||
tasks.build {
|
tasks.build {
|
||||||
dependsOn("shadowJar")
|
dependsOn("shadowJar")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.processResources {
|
||||||
|
val props = mapOf("version" to version)
|
||||||
|
inputs.properties(props)
|
||||||
|
filteringCharset = "UTF-8"
|
||||||
|
filesMatching("paper-plugin.yml") {
|
||||||
|
expand(props)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import io.github.retrooper.packetevents.factory.spigot.SpigotPacketEventsBuilder
|
|||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import re.imc.geysermodelengine.hooks.FloodgateAPIHook;
|
||||||
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;
|
||||||
@@ -34,6 +35,7 @@ public class GeyserModelEngine extends JavaPlugin {
|
|||||||
PacketEvents.getAPI().load();
|
PacketEvents.getAPI().load();
|
||||||
|
|
||||||
// CommandAPI.onLoad(new CommandAPIPaperConfig(this));
|
// CommandAPI.onLoad(new CommandAPIPaperConfig(this));
|
||||||
|
preLoadManagers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -59,16 +61,19 @@ public class GeyserModelEngine extends JavaPlugin {
|
|||||||
|
|
||||||
private void loadHooks() {
|
private void loadHooks() {
|
||||||
PacketEvents.getAPI().init();
|
PacketEvents.getAPI().init();
|
||||||
|
FloodgateAPIHook.loadHook(this);
|
||||||
// CommandAPI.onEnable();
|
// CommandAPI.onEnable();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadBStats() {
|
private void loadBStats() {
|
||||||
if (configManager.getConfig().getBoolean("metrics.bstats", true)) new Metrics(this, 26981);
|
if (this.configManager.getConfig().getBoolean("metrics.bstats", true)) new Metrics(this, 26981);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void preLoadManagers() {
|
||||||
|
this.configManager = new ConfigManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadManagers() {
|
private void loadManagers() {
|
||||||
this.configManager = new ConfigManager(this);
|
|
||||||
|
|
||||||
this.commandManager = new CommandManager(this);
|
this.commandManager = new CommandManager(this);
|
||||||
|
|
||||||
this.modelManager = new ModelManager(this);
|
this.modelManager = new ModelManager(this);
|
||||||
@@ -77,9 +82,8 @@ public class GeyserModelEngine extends JavaPlugin {
|
|||||||
|
|
||||||
private void loadRunnables() {
|
private void loadRunnables() {
|
||||||
this.schedulerPool = Executors.newScheduledThreadPool(configManager.getConfig().getInt("models.thread-pool-size", 4));
|
this.schedulerPool = Executors.newScheduledThreadPool(configManager.getConfig().getInt("models.thread-pool-size", 4));
|
||||||
|
this.schedulerPool.scheduleAtFixedRate(new UpdateTaskRunnable(this), 10, configManager.getConfig().getLong("models.entity-position-update-period", 35), TimeUnit.MILLISECONDS);
|
||||||
schedulerPool.scheduleAtFixedRate(new UpdateTaskRunnable(this), 10, configManager.getConfig().getLong("models.entity-position-update-period", 35), TimeUnit.MILLISECONDS);
|
this.schedulerPool.scheduleAtFixedRate(new BedrockMountControlRunnable(this), 1, 1, TimeUnit.MILLISECONDS);
|
||||||
schedulerPool.scheduleAtFixedRate(new BedrockMountControlRunnable(this), 1, 1, TimeUnit.MILLISECONDS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigManager getConfigManager() {
|
public ConfigManager getConfigManager() {
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package re.imc.geysermodelengine.hooks;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.geysermc.floodgate.api.FloodgateApi;
|
||||||
|
import re.imc.geysermodelengine.GeyserModelEngine;
|
||||||
|
|
||||||
|
public class FloodgateAPIHook {
|
||||||
|
|
||||||
|
private static FloodgateApi floodgateAPI;
|
||||||
|
|
||||||
|
public static void loadHook(GeyserModelEngine plugin) {
|
||||||
|
if (Bukkit.getPluginManager().getPlugin("floodgate") == null || !plugin.getConfigManager().getConfig().getBoolean("options.hooks.floodgate", true)) {
|
||||||
|
plugin.getLogger().info("Floodgate hook disabled!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
floodgateAPI = FloodgateApi.getInstance();
|
||||||
|
plugin.getLogger().info("Floodgate hook enabled!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FloodgateApi getAPI() {
|
||||||
|
return floodgateAPI;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,7 +41,7 @@ public class EntityTaskManager {
|
|||||||
|
|
||||||
public void checkViewers(EntityData model, Set<Player> viewers) {
|
public void checkViewers(EntityData model, Set<Player> viewers) {
|
||||||
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
|
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
|
||||||
if (!BedrockUtils.isBedrockPlayer(onlinePlayer)) return;
|
if (!BedrockUtils.isBedrockPlayer(onlinePlayer)) continue;
|
||||||
|
|
||||||
if (canSee(onlinePlayer, model.getEntity())) {
|
if (canSee(onlinePlayer, model.getEntity())) {
|
||||||
if (!viewers.contains(onlinePlayer)) {
|
if (!viewers.contains(onlinePlayer)) {
|
||||||
|
|||||||
@@ -134,9 +134,7 @@ public class BetterModelPropertyHandler implements PropertyHandler {
|
|||||||
List<String> list = new ArrayList<>(boneUpdates.keySet());
|
List<String> list = new ArrayList<>(boneUpdates.keySet());
|
||||||
Collections.sort(list);
|
Collections.sort(list);
|
||||||
|
|
||||||
for (Player player : players) {
|
players.forEach(player -> EntityUtils.sendIntProperties(player, entity, intUpdates));
|
||||||
EntityUtils.sendIntProperties(player, entity, intUpdates);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String unstripName(RenderedBone bone) {
|
public String unstripName(RenderedBone bone) {
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ public class ModelEnginePropertyHandler implements PropertyHandler {
|
|||||||
if (anim.isOverride() && anim.getLoopMode() == BlueprintAnimation.LoopMode.ONCE) {
|
if (anim.isOverride() && anim.getLoopMode() == BlueprintAnimation.LoopMode.ONCE) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plugin.getLogger().info(animId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,8 +123,8 @@ public class ModelEnginePropertyHandler implements PropertyHandler {
|
|||||||
if (boneUpdates.isEmpty() && animUpdates.isEmpty()) return;
|
if (boneUpdates.isEmpty() && animUpdates.isEmpty()) return;
|
||||||
|
|
||||||
Map<String, Integer> intUpdates = new HashMap<>();
|
Map<String, Integer> intUpdates = new HashMap<>();
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
for (Integer integer : BooleanPacker.mapBooleansToInts(boneUpdates)) {
|
for (Integer integer : BooleanPacker.mapBooleansToInts(boneUpdates)) {
|
||||||
intUpdates.put(plugin.getConfigManager().getConfig().getString("models.namespace") + ":bone" + i, integer);
|
intUpdates.put(plugin.getConfigManager().getConfig().getString("models.namespace") + ":bone" + i, integer);
|
||||||
i++;
|
i++;
|
||||||
@@ -172,8 +174,8 @@ public class ModelEnginePropertyHandler implements PropertyHandler {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color calculateCurrentColor(ModelEngineEntityData data) {
|
private Color calculateCurrentColor(ModelEngineEntityData modelEngineEntityData) {
|
||||||
if (data.getActiveModel().isMarkedHurt()) return new Color(data.getActiveModel().getDamageTint().asARGB());
|
if (modelEngineEntityData.getActiveModel().isMarkedHurt()) return new Color(modelEngineEntityData.getActiveModel().getDamageTint().asARGB());
|
||||||
return new Color(data.getActiveModel().getDefaultTint().asARGB());
|
return new Color(modelEngineEntityData.getActiveModel().getDefaultTint().asARGB());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,17 +2,16 @@ package re.imc.geysermodelengine.util;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.geysermc.floodgate.api.FloodgateApi;
|
import org.geysermc.floodgate.api.FloodgateApi;
|
||||||
|
import re.imc.geysermodelengine.hooks.FloodgateAPIHook;
|
||||||
|
|
||||||
public class BedrockUtils {
|
public class BedrockUtils {
|
||||||
|
|
||||||
private static FloodgateApi FLOODGATE_API;
|
private static final FloodgateApi floodgateAPIHook = FloodgateAPIHook.getAPI();
|
||||||
|
|
||||||
public static boolean isBedrockPlayer(Player player) {
|
public static boolean isBedrockPlayer(Player player) {
|
||||||
if (FLOODGATE_API != null) return FLOODGATE_API.isFloodgatePlayer(player.getUniqueId());
|
if (floodgateAPIHook != null) return floodgateAPIHook.isFloodgatePlayer(player.getUniqueId());
|
||||||
return player.getClientBrandName().contains("Geyser");
|
String clientBrand = player.getClientBrandName();
|
||||||
}
|
if (clientBrand == null) return false;
|
||||||
|
return clientBrand.contains("Geyser");
|
||||||
public static FloodgateApi getFloodgateApi() {
|
|
||||||
return FLOODGATE_API;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,3 +11,5 @@ models:
|
|||||||
|
|
||||||
options:
|
options:
|
||||||
debug: false
|
debug: false
|
||||||
|
hooks:
|
||||||
|
floodgate: true # Recommended method
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
main: re.imc.geysermodelengine.GeyserModelEngine
|
main: re.imc.geysermodelengine.GeyserModelEngine
|
||||||
name: GeyserModelEngine
|
name: GeyserModelEngine
|
||||||
version: '1.0.0'
|
version: '${version}'
|
||||||
api-version: '1.21'
|
api-version: '1.21'
|
||||||
|
|
||||||
authors:
|
authors:
|
||||||
|
|||||||
Reference in New Issue
Block a user