Skip to content

Commit

Permalink
2.8.0 for MC 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jun 13, 2023
1 parent ed4ea4b commit c5ffaf6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -24,7 +24,7 @@ Sentinel NPCs: Combat NPCs for Spigot!

![AnimatedSentinel](https://i.imgur.com/VDwTzrs.gif)

**Version 2.7.3**: Compatible with Spigot 1.8.8 through 1.19.4 (Primarily targeted at 1.19.4) - see 'Common Issues' section below if on older supported versions)
**Version 2.8.0**: Compatible with Spigot 1.8.8 through 1.20.1 (Primarily targeted at 1.20.1) - see 'Common Issues' section below if on older supported versions)

### Downloads

Expand Down Expand Up @@ -346,7 +346,7 @@ If you're building a separate plugin you would like to integrate into Sentinel,
<dependency>
<groupId>org.mcmonkey</groupId>
<artifactId>sentinel</artifactId>
<version>2.7.3-SNAPSHOT</version>
<version>2.8.0-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
<exclusions>
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Expand Up @@ -7,14 +7,14 @@
<groupId>org.mcmonkey</groupId>
<artifactId>sentinel</artifactId>
<packaging>jar</packaging>
<version>2.7.3-SNAPSHOT</version>
<version>2.8.0-SNAPSHOT</version>
<name>Sentinel</name>
<description>Combat NPCs for Spigot</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<bukkit.version>1.19.4-R0.1-SNAPSHOT</bukkit.version>
<citizens.version>2.0.31-SNAPSHOT</citizens.version>
<bukkit.version>1.20.1-R0.1-SNAPSHOT</bukkit.version>
<citizens.version>2.0.32-SNAPSHOT</citizens.version>
<BUILD_NUMBER>Unknown</BUILD_NUMBER>
</properties>

Expand Down
Expand Up @@ -43,7 +43,15 @@ public static void init() {
nmsLivingEntity = Class.forName("net.minecraft.world.entity.EntityLiving");
String attackStrengthField = null;
boolean isCompat = false;
if (SentinelVersionCompat.v1_19 && !SentinelVersionCompat.vFuture) { // 1.19.4 names
if (SentinelVersionCompat.v1_20 && !SentinelVersionCompat.vFuture) { // 1.20 names
// https://minidigger.github.io/MiniMappingViewer/#/mojang/server/1.20
endermanAngryField = "bV"; // net.minecraft.world.entity.monster.EnderMan#DATA_CREEPY
attackStrengthField = "aQ"; // net.minecraft.world.entity.LivingEntity#attackStrengthTicker
broadcastEffectMethod = "a"; // net.minecraft.world.level.Level#broadcastEntityEvent(Entity,byte)
dataWatcherSet = "a"; // net.minecraft.network.syncher.SynchedEntityData#set
isCompat = true;
}
else if (SentinelVersionCompat.v1_19 && !SentinelVersionCompat.v1_20) { // 1.19.4 names
// https://minidigger.github.io/MiniMappingViewer/#/mojang/server/1.19.4
endermanAngryField = "bU"; // net.minecraft.world.entity.monster.EnderMan#DATA_CREEPY
attackStrengthField = "aO"; // net.minecraft.world.entity.LivingEntity#attackStrengthTicker
Expand Down
Expand Up @@ -49,12 +49,13 @@ public class SentinelVersionCompat {
/**
* Boolean indicating if the server version is >= the named version.
*/
public static final boolean v1_8, v1_9, v1_10, v1_11, v1_12, v1_13, v1_14, v1_15, v1_16, v1_17, v1_18, v1_19, vFuture;
public static final boolean v1_8, v1_9, v1_10, v1_11, v1_12, v1_13, v1_14, v1_15, v1_16, v1_17, v1_18, v1_19, v1_20, vFuture;

static {
String vers = Bukkit.getBukkitVersion(); // Returns in format like: 1.12.2-R0.1-SNAPSHOT
vFuture = vers.startsWith("1.20") || vers.startsWith("1.21") || vers.startsWith("1.22");
v1_19 = vers.startsWith("1.19") || vFuture;
vFuture = vers.startsWith("1.21") || vers.startsWith("1.22") || vers.startsWith("1.23");
v1_20 = vers.startsWith("1.20") || vFuture;
v1_19 = vers.startsWith("1.19") || v1_20;
v1_18 = vers.startsWith("1.18") || v1_19;
v1_17 = vers.startsWith("1.17") || v1_18;
v1_16 = vers.startsWith("1.16") || v1_17;
Expand Down Expand Up @@ -193,7 +194,13 @@ public class SentinelVersionCompat {
// ignore: 1.19.2 lacked camels, 1.19.3 lacked sniffers.
}
}
if (v1_19) { // && !v1_20
if (v1_19 && !v1_20) {
SentinelTarget.PASSIVE_MOBS = new SentinelTarget(v1_19_passive(), passiveNames());
SentinelTarget.MOBS = new SentinelTarget(combine(v1_19_passive(), v1_19_monsters()), "MOB");
SentinelTarget.MONSTERS = new SentinelTarget(v1_19_monsters(), "MONSTER");
}
// 1.20 didn't add new mobs
if (v1_20) { // && !v1_21
SentinelTarget.PASSIVE_MOBS = new SentinelTarget(v1_19_passive(), passiveNames());
SentinelTarget.MOBS = new SentinelTarget(combine(v1_19_passive(), v1_19_monsters()), "MOB");
SentinelTarget.MONSTERS = new SentinelTarget(v1_19_monsters(), "MONSTER");
Expand Down

0 comments on commit c5ffaf6

Please sign in to comment.