Skip to content

Commit

Permalink
Handle 1.21.3 update
Browse files Browse the repository at this point in the history
  • Loading branch information
libraryaddict committed Nov 10, 2024
1 parent 2d9e16a commit 292ce91
Show file tree
Hide file tree
Showing 33 changed files with 1,385 additions and 425 deletions.
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ junit-jupiter-version = "5.9.3"
mockito-version = "5.12.0"

net-kyori-adventure-api = "4.17.0"
com-retro-packetevents = "2.5.0-SNAPSHOT"
com-retro-packetevents = "2.6.0"
placeholder-api = "2.11.6"

bungeecord-chat = "1.16-R0.4"
org-spigotmc-spigot = "1.21-R0.1-SNAPSHOT"
io-papermc-paper-api = "1.21.1-R0.1-SNAPSHOT"
org-spigotmc-spigot = "1.21.3-R0.1-SNAPSHOT"
io-papermc-paper-api = "1.21.3-R0.1-SNAPSHOT"


[libraries]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

public class ReflectionManager implements ReflectionManagerAbstract {
private Field dataItemsField;
private final Field trackedEntityField;
private final Field entityTrackerField;
private final AtomicInteger entityCounter;
private final Method entityDefaultSoundMethod;
private final UnsafeValues craftMagicNumbers;
Expand All @@ -101,8 +101,9 @@ public ReflectionManager() {
entityCounter.setAccessible(true);
this.entityCounter = (AtomicInteger) entityCounter.get(null);

trackedEntityField = ChunkMap.TrackedEntity.class.getDeclaredField("b");
trackedEntityField.setAccessible(true);
// Known as PlayerChunkMap in mojang mappings
entityTrackerField = ChunkMap.TrackedEntity.class.getDeclaredField("b");
entityTrackerField.setAccessible(true);

// Default is protected method, 1.0F on EntityLiving.class
entityDefaultSoundMethod = net.minecraft.world.entity.LivingEntity.class.getDeclaredMethod("fa");
Expand Down Expand Up @@ -151,7 +152,7 @@ public net.minecraft.world.entity.Entity createEntityInstance(String entityName)
Optional<net.minecraft.world.entity.EntityType<?>> optional =
net.minecraft.world.entity.EntityType.byString(entityName.toLowerCase(Locale.ENGLISH));

if (!optional.isPresent()) {
if (optional.isEmpty()) {
return null;
}

Expand Down Expand Up @@ -235,7 +236,7 @@ public ServerEntity getEntityTrackerEntry(Entity target) throws Exception {
return null;
}

return (ServerEntity) trackedEntityField.get(trackedEntity);
return (ServerEntity) entityTrackerField.get(trackedEntity);
}

@Override
Expand Down
21 changes: 21 additions & 0 deletions nms/v1_21_R2/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
plugins {
`java-library`
}

apply(from = rootProject.file("nms/nmsModule.gradle"))

extra["craftbukkitVersion"] = "1.21.3-R0.1-SNAPSHOT";

description = "v1_21_R2"

dependencies {
compileOnly(libs.com.mojang.authlib.new)
compileOnly(libs.io.netty.netty.buffer)
compileOnly(libs.it.unimi.dsi.fastutil)
compileOnly(libs.com.mojang.datafixerupper)
}

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
Loading

0 comments on commit 292ce91

Please sign in to comment.