Skip to content

Commit d6ef893

Browse files
committed
Prepare for 1.21.9
1 parent 1089ac4 commit d6ef893

File tree

10 files changed

+25
-20
lines changed

10 files changed

+25
-20
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ jobs:
2222
uses: actions/upload-artifact@v4.6.2
2323
with:
2424
name: PexNPC
25-
path: build/libs/PexNPC-2.1.jar
25+
path: build/libs/PexNPC-2.2.jar

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group = "de.pascalpex"
7-
version = "2.1"
7+
version = "2.2"
88

99
repositories {
1010
mavenCentral()
@@ -19,7 +19,7 @@ dependencies {
1919
testImplementation(platform("org.junit:junit-bom:5.13.4"))
2020
testImplementation("org.junit.jupiter:junit-jupiter")
2121
compileOnly("me.clip:placeholderapi:2.11.6")
22-
paperweight.paperDevBundle("1.21.8-R0.1-SNAPSHOT")
22+
paperweight.paperDevBundle("1.21.9-pre2-R0.1-SNAPSHOT")
2323
}
2424

2525
java {

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/de/pascalpex/pexnpc/commands/subcommands/ListSubcommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class ListSubcommand implements Command<CommandSourceStack> {
1919
public int run(CommandContext<CommandSourceStack> context) {
2020
CommandSender sender = context.getSource().getSender();
2121

22-
sender.sendMessage(MessageHandler.basicMessage("All loaded NPCs:"));
22+
sender.sendMessage(MessageHandler.prefixedMini("All loaded NPCs (<gold>" + PexNPC.getPlacedNpcs().size() + "<aqua>):"));
2323
for (PlaceableNPC placeableNPC : PexNPC.getPlacedNpcs()) {
2424
NPC npc = placeableNPC.getNpc();
2525
String name = npc.getName();

src/main/java/de/pascalpex/pexnpc/npc/NPCSender.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import net.minecraft.network.syncher.SynchedEntityData;
1414
import net.minecraft.server.level.ServerPlayer;
1515
import net.minecraft.server.network.ServerGamePacketListenerImpl;
16+
import net.minecraft.world.entity.Avatar;
1617
import net.minecraft.world.entity.player.PlayerModelPart;
1718
import net.minecraft.world.phys.Vec3;
1819
import net.minecraft.world.scores.PlayerTeam;
@@ -101,7 +102,7 @@ private static List<Packet<?>> buildNPCPackets(PlaceableNPC placeableNPC) {
101102

102103
SynchedEntityData entityData = serverPlayer.getEntityData();
103104
if (!entityData.isDirty()) {
104-
entityData.markDirty(new EntityDataAccessor<>(17, EntityDataSerializers.BYTE));
105+
entityData.markDirty(new EntityDataAccessor<>(Avatar.DATA_PLAYER_MODE_CUSTOMISATION.id(), EntityDataSerializers.BYTE));
105106
}
106107
List<SynchedEntityData.DataValue<?>> dirtyEntityData = entityData.packDirty();
107108
if (dirtyEntityData != null) {

src/main/java/de/pascalpex/pexnpc/npc/PlaceableNPC.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package de.pascalpex.pexnpc.npc;
22

3+
import com.google.common.collect.ImmutableMultimap;
4+
import com.google.common.collect.Multimap;
35
import com.mojang.authlib.GameProfile;
46
import com.mojang.authlib.properties.Property;
7+
import com.mojang.authlib.properties.PropertyMap;
58
import de.pascalpex.pexnpc.files.Config;
69
import net.minecraft.network.syncher.EntityDataAccessor;
710
import net.minecraft.network.syncher.EntityDataSerializers;
@@ -10,6 +13,7 @@
1013
import net.minecraft.server.level.ClientInformation;
1114
import net.minecraft.server.level.ServerLevel;
1215
import net.minecraft.server.level.ServerPlayer;
16+
import net.minecraft.world.entity.Avatar;
1317
import org.bukkit.Bukkit;
1418
import org.bukkit.Location;
1519
import org.bukkit.craftbukkit.CraftServer;
@@ -51,9 +55,13 @@ public PlaceableNPC(NPC npc) {
5155
builder.append(suffix);
5256
suffix = builder.toString();
5357

54-
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), actualName);
5558
NPCSkin skin = npc.getSkin();
56-
gameProfile.getProperties().put("textures", new Property("textures", skin.texture(), skin.signature()));
59+
Multimap<String, Property> profileProperties = new ImmutableMultimap.Builder<String, Property>()
60+
.put("textures", new Property("textures", skin.texture(), skin.signature()))
61+
.build();
62+
63+
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), actualName, new PropertyMap(profileProperties));
64+
5765

5866
Location loc = npc.getLocation();
5967
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
@@ -67,10 +75,10 @@ public PlaceableNPC(NPC npc) {
6775
int skinMode = Config.getSkinMode();
6876
switch (skinMode) {
6977
case 2:
70-
watcher.set(new EntityDataAccessor<>(17, EntityDataSerializers.BYTE), (byte) 126);
78+
watcher.set(new EntityDataAccessor<>(Avatar.DATA_PLAYER_MODE_CUSTOMISATION.id(), EntityDataSerializers.BYTE), (byte) 126);
7179
break;
7280
case 3:
73-
watcher.set(new EntityDataAccessor<>(17, EntityDataSerializers.BYTE), (byte) 127);
81+
watcher.set(new EntityDataAccessor<>(Avatar.DATA_PLAYER_MODE_CUSTOMISATION.id(), EntityDataSerializers.BYTE), (byte) 127);
7482
break;
7583
default:
7684
break;

src/main/java/de/pascalpex/pexnpc/util/SkinDownloader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public static NPCSkin downloadSkin(String playerName) throws IOException, URISyn
3434
public static NPCSkin downloadSKin(Player player) {
3535
ServerPlayer p = ((CraftPlayer) player).getHandle();
3636
GameProfile profile = p.getGameProfile();
37-
Property property = profile.getProperties().get("textures").iterator().next();
38-
String texture = property.value();
39-
String signature = property.signature();
37+
Property property = profile.properties().get("textures").iterator().next();
38+
String texture = property == null ? "" : property.value();
39+
String signature = property == null ? "" : property.signature();
4040

4141
return new NPCSkin(texture, signature);
4242
}

src/main/resources/paper-plugin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: PexNPC
2-
version: '2.1'
2+
version: '2.2'
33
author: Pascalpex
44
prefix: PexNPC
55
main: de.pascalpex.pexnpc.PexNPC
66
description: Lightweight, packet based NPC plugin with fast updates
7-
api-version: '1.21.8'
7+
api-version: '1.21.9'
88
bootstrapper: de.pascalpex.pexnpc.PexNPCBootstrap
99
loader: de.pascalpex.pexnpc.PexNPCLoader
1010
dependencies:

0 commit comments

Comments
 (0)