Skip to content

Commit

Permalink
Merge pull request #510 from KosmX/1.21.1
Browse files Browse the repository at this point in the history
1.21.1
  • Loading branch information
dima-dencep authored Dec 26, 2024
2 parents 793e79a + d52ffa1 commit 4b02d5b
Show file tree
Hide file tree
Showing 136 changed files with 2,779 additions and 2,530 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build:
strategy:
matrix:
java: [17]
java: [21]
os: [ubuntu-latest, windows-latest]

runs-on: ${{ matrix.os }}
Expand All @@ -30,16 +30,16 @@ jobs:
if: ${{ runner.os != 'Windows' }}
run: chmod +x gradlew
- name: Test Gradle buildscript #Test the full gradle buildscript before use it. Useful to catch publish errors.
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
arguments: autoPublish --dry-run
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
arguments: collectArtifacts
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: artifacts
path: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'microsoft'
java-version: '17'
java-version: '21'
cache: 'gradle'

# Initializes the CodeQL tools for scanning.
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ jobs:
return -1
fi
- name: Setup Java JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: 17
java-version: 21
- name: checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: configure gradle
uses: gradle/wrapper-validation-action@v1
- name: Grant execute permission for gradlew
Expand Down
31 changes: 23 additions & 8 deletions blender/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
# Emote emote animation tools
# Player animation tools

`emote_creator.blend` and `emote_creator_bend.blend` are project for [Blender](https://www.blender.org/)
bend can create emotes containing bending, but it's a bit more complicated to use.
The `.blend` files are [Blender](https://www.blender.org/) projects.
To use these, use the 2.83 LTS, or the latest version of Blender.
[Emotecraft wiki](https://kosmx.gitbook.io/emotecraft/tutorial/custom-emotes) if you're stuck.
[Emotecraft wiki](https://kosmx.gitbook.io/emotecraft/tutorial/custom-emotes) if you're stuck.

`.bbmodel` files are models for [Blockbench](https://blockbench.net/) You can use them as well.
To use them, you'll need to install [GeckoLib](https://geckolib.com/) plugin first.

Models labled with `_bend` allow you to bend some bones like in Minecraft Story Mode, and the rest of the labels should be self explanatory.
Keep in mind that the visual for bending is incorrect in Blender/Blockbench, there won't be any gaps created by bending a bone in-game.
All Blockbench models support scaling.

> [!CAUTION]
> BENDING ON THE Z AXIS IS NOT SUPPORTED!!!
> And by Z axis I mean the one facing forward, I need to specify this since Blender uses a different coordinate system than MC.
> Make sure every bone's Z rotation value is always set to 0 in Blockbench and the same for Y rotation values in Blender!
> [!TIP]
> It's possible to add custom bones to a Blockbench model in order to animate player accessories IF it's supported by playerAnimator or another mod.
> For example you can add a bone called elytra to the model and animate the elytra that way!
> Cape rotations are also applied to elytras, but there won't be any bending.
> The elytra bone's priority is greater than cape bone's for animating elytra but both can influence the elytra at the same time.
`model.bbmodel` is a model for [Blockbench](https://blockbench.net/) You can use this as well.
To use it, you'll need to install [GeckoLib](https://geckolib.com/) plugin first.

### If you don't like these
You can create your own program or edit the file by hand
The emote format documentation is [here](https://github.com/KosmX/emotes/wiki/Emote.json)
The emote format documentation is [here](https://github.com/KosmX/emotes/wiki/Emote.json)
[Here](https://github.com/bigguy345/Blender-Minecraft-Animation/tree/main) is a Blender addon that lets you import and save animations + bend limbs on multiple axes.
Binary file removed blender/emote_creator_bend_item.blend
Binary file not shown.
Binary file added blender/emote_creator_bend_item_scale.blend
Binary file not shown.
2 changes: 1 addition & 1 deletion blender/model.bbmodel

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions blender/model_bend.bbmodel

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions blender/model_bend_item.bbmodel

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions blender/model_bend_item_cape.bbmodel

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions blender/model_item.bbmodel

Large diffs are not rendered by default.

19 changes: 12 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
plugins{
id 'java'
id 'dev.architectury.loom' version '1.4.+' apply false //Forge loom :D
id "dev.architectury.loom" version "1.9-SNAPSHOT" apply false
id "architectury-plugin" version "3.4-SNAPSHOT" apply true
id "com.github.johnrengelman.shadow" version "8.1.1" apply false
//id "com.dorongold.task-tree" version "1.5" Current version doesn't support gradle 6.8
id "com.gradleup.shadow" version "8.3.5" apply false

id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id "com.matthewprenger.cursegradle" version "1.4.0" apply false
id "com.github.breadmoirai.github-release" version "2.4.1"
id "com.modrinth.minotaur" version "2.8.4" apply false
}


allprojects {
apply plugin: "java"

group = rootProject.maven_group

Expand All @@ -21,12 +20,12 @@ allprojects {
url = 'https://maven.terraformersmc.com/'
}
maven {
name "KosmX's maven"
url 'https://maven.kosmx.dev/'
url 'https://repo.redlance.org/public'
}
maven {
url "https://libraries.minecraft.net"
}
maven { url "https://maven.neoforged.net/releases" }
}

tasks.withType(JavaCompile).configureEach {
Expand All @@ -53,6 +52,9 @@ allprojects {
options.encoding = 'UTF-8'
}

java {
withSourcesJar()
}
}

//---------------- Publishing ----------------
Expand Down Expand Up @@ -134,6 +136,9 @@ if(keysExists) {
finalizedBy(':emotesAssets:publish')
finalizedBy(':bukkit:publish')

finalizedBy(":bukkit:modrinth")
finalizedBy(":bungee:modrinth")
finalizedBy(":velocity:modrinth")
}
}
else {
Expand Down
50 changes: 28 additions & 22 deletions bukkit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'java'
//id "com.github.johnrengelman.shadow" version "6.1.0"
id 'maven-publish'
id "com.modrinth.minotaur"
}


Expand Down Expand Up @@ -33,20 +34,17 @@ configurations {
}

dependencies {
//testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
//testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
implementation "org.spigotmc:spigot-api:${rootProject.spigot_version}"
implementation "com.comphenix.protocol:ProtocolLib:${rootProject.protocollib_version}"

implementation("org.spigotmc:spigot-api:${project.spigot_api}")
implementation group: "com.comphenix.protocol", name: "ProtocolLib", version: "5.0.0"
compileModule(project(':emotesAPI')) { transitive = false }
compileModule(project(':executor')) { transitive = false }
compileModule(project(':emotesServer')) { transitive = false }
compileModule(project(':emotesAssets')) { transitive = false }

compileModule(project(':emotesAPI')){ transitive = false }
compileModule(project(':executor')){ transitive = false }
compileModule(project(':emotesServer')){ transitive = false }

// Only for built-in resources, code is not used from here.
compileModule(project(':emotesAssets')){ transitive = false }

compileModule("dev.kosmx.player-anim:anim-core:${project.player_anim_core}"){ transitive = false }
compileModule("dev.kosmx.player-anim:anim-core:${rootProject.player_animator_version}") {
transitive false
}
}

processResources{
Expand All @@ -60,15 +58,6 @@ processResources{

}

//shadowJar{
// configurations = [project.configurations.compileModule]
// archiveClassifier.set("bukkit")
//}

compileJava {
dependsOn(':emotesAssets:publicationJar')
}

jar{
from{
configurations.compileModule.collect() {it.isDirectory() ? it : zipTree(it)}
Expand All @@ -80,7 +69,7 @@ task copyArtifacts{
dependsOn('build')
doLast {
copy{
from "${project.layout.buildDirectory}/libs/${project.archives_base_name}-${rootProject.mod_version}-bukkit.jar"
from "${project.buildDir}/libs/${project.archives_base_name}-${rootProject.mod_version}-bukkit.jar"
into "${rootProject.projectDir}/artifacts"
}
}
Expand Down Expand Up @@ -150,3 +139,20 @@ publishing {
}
}
}

if (keysExists) {
modrinth {
versionType = project.cfType
uploadFile = jar

token = project.keys.modrinth_token
projectId = "pZ2wrerK"
versionNumber = "${project.mod_version}+${project.minecraft_version}-bukkit"
versionName = "${project.mod_version}"

gameVersions = ["1.21.1"]
changelog = changes
loaders = ["bukkit", "folia", "paper", "purpur", "spigot"]
failSilently = false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.utility.MinecraftVersion;
import io.github.kosmx.emotes.bukkit.executor.BukkitInstance;
import io.github.kosmx.emotes.bukkit.network.ServerSideEmotePlay;
import io.github.kosmx.emotes.common.CommonData;
Expand Down Expand Up @@ -58,11 +59,15 @@ public void onDisable() {
Bukkit.getMessenger().unregisterIncomingPluginChannel(this, EmotePacket);
}

private static final MinecraftVersion VERSION_1_20_2 = new MinecraftVersion(1, 20, 2);

public void registerProtocolListener() {
protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.NAMED_ENTITY_SPAWN) {
PacketType packetType = VERSION_1_20_2.atOrAbove() ? PacketType.Play.Server.SPAWN_ENTITY : PacketType.Play.Server.NAMED_ENTITY_SPAWN;

protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, packetType) {
@Override
public void onPacketSending(PacketEvent packetEvent) {
if (packetEvent.getPacketType().equals(PacketType.Play.Server.NAMED_ENTITY_SPAWN)) {
if (packetEvent.getPacketType().equals(packetType)) {
//Field trackedField = packetEvent.getPacket().getStructures().getField(2);
UUID tracked = packetEvent.getPacket().getUUIDs().readSafely(0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,29 @@

import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.logging.Level;

public class BukkitInstance extends EmoteInstance {
final java.util.logging.Logger logger;
final BukkitWrapper plugin;
public class BukkitInstance extends EmoteInstance implements Logger {
protected final BukkitWrapper plugin;

public BukkitInstance(BukkitWrapper plugin){
this.logger = plugin.getLogger();
this.plugin = plugin;
}

@Override
public Logger getLogger() {
return this.logger::log;
return this;
}

@Override
public void writeLog(Level level, String msg, Throwable throwable) {
this.plugin.getLogger().log(level, msg, throwable);
}

@Override
public void writeLog(Level level, String msg) {
this.plugin.getLogger().log(level, msg);
}

@Override
public boolean isClient() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.bukkit.entity.Player;

import javax.annotation.Nullable;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.UUID;

Expand All @@ -23,6 +24,16 @@ public EmotePlayTracker getEmoteTracker() {
return this.emotePlayTracker;
}

@Override
public void sendGeyserPacket(ByteBuffer buffer) {
player.sendPluginMessage(bukkitPlugin, "geyser:emote", buffer.array());
}

@Override
public void disconnect(String literal) {
player.kickPlayer(literal);
}

public BukkitNetworkInstance(Player player){
this.player = player;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private void receivePluginMessage(String channel, Player player, byte[] message)
try {
this.receiveMessage(message, player, playerNetwork);
} catch (Exception e) {
e.printStackTrace();
EmoteInstance.instance.getLogger().log(Level.WARNING, e.getMessage(), e);
}
} else {
EmoteInstance.instance.getLogger().log(Level.WARNING, "Player: " + player.getName() + " is not registered");
Expand Down Expand Up @@ -92,7 +92,7 @@ protected void sendForEveryoneElse(GeyserEmotePacket packet, Player player) {
try {
player1.sendPluginMessage(plugin, BukkitWrapper.GeyserPacket, packet.write());
}catch (Exception e){
e.printStackTrace();
EmoteInstance.instance.getLogger().log(Level.WARNING, e.getMessage(), e);
}
}
}
Expand All @@ -112,7 +112,7 @@ protected void sendForEveryoneElse(NetData data, GeyserEmotePacket emotePacket,
}
else if(emotePacket != null) player1.sendPluginMessage(plugin, BukkitWrapper.GeyserPacket, emotePacket.write());
}catch (Exception e){
e.printStackTrace();
EmoteInstance.instance.getLogger().log(Level.WARNING, e.getMessage(), e);
}
}
}
Expand All @@ -135,7 +135,7 @@ protected void sendForPlayer(NetData data, Player player, UUID target) {
packetBuilder.setVersion(getPlayerNetworkInstance(targetPlayer).getRemoteVersions());
targetPlayer.sendPluginMessage(plugin, BukkitWrapper.EmotePacket, packetBuilder.build().write().array());
}catch (Exception e){
e.printStackTrace();
EmoteInstance.instance.getLogger().log(Level.WARNING, e.getMessage(), e);
}
}

Expand Down
2 changes: 1 addition & 1 deletion bukkit/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: emotecraft
description: ${description}
main: io.github.kosmx.emotes.bukkit.BukkitWrapper
version: ${version}
api-version: 1.16
api-version: 1.21
website: https://github.com/KosmX/emotes
authors: [KomsX]
depend: [ProtocolLib]
Expand Down
Loading

0 comments on commit 4b02d5b

Please sign in to comment.