Skip to content

Commit

Permalink
feat: 1.20.4 update
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurelien30000 committed Dec 18, 2023
1 parent 3bce5b7 commit 56c879a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 111 deletions.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>uk.antiperson.stackmob</groupId>
<artifactId>StackMob</artifactId>
<version>5.8.8</version>
<version>5.8.9</version>

<build>
<sourceDirectory>src/main/java</sourceDirectory>
Expand Down Expand Up @@ -123,19 +123,19 @@
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.20.2-R0.1-SNAPSHOT</version>
<version>1.20.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>dev.folia</groupId>
<artifactId>folia-api</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<version>1.20.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.20.2-R0.1-SNAPSHOT</version>
<version>1.20.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
19 changes: 2 additions & 17 deletions src/main/java/uk/antiperson/stackmob/packets/NMSHelper.java
Original file line number Diff line number Diff line change
@@ -1,30 +1,15 @@
package uk.antiperson.stackmob.packets;

import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
import net.minecraft.network.syncher.DataWatcher;
import net.minecraft.network.syncher.DataWatcherObject;
import net.minecraft.network.syncher.DataWatcherRegistry;
import net.minecraft.world.entity.EntityLiving;
import net.minecraft.world.entity.boss.wither.EntityWither;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftLivingEntity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;

import java.util.Collections;

public class NMSHelper {

public static void sendVisibilityPacket(Player player, Entity entity, boolean tagVisible) {
DataWatcher.b<Boolean> af = DataWatcher.b.a(new DataWatcherObject<>(3, DataWatcherRegistry.k), tagVisible);
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(entity.getEntityId(), Collections.singletonList(af));
((CraftPlayer) player).getHandle().c.a(packetPlayOutEntityMetadata);
}

public static boolean canCreateWitherRose(LivingEntity entity) {
EntityLiving entityLiving = ((CraftLivingEntity) entity).getHandle();
// EntityLiving#getKillCredit
return entityLiving.eK() instanceof EntityWither;
return entityLiving.eL() instanceof EntityWither;
}
}

This file was deleted.

19 changes: 5 additions & 14 deletions src/main/java/uk/antiperson/stackmob/packets/TagHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import uk.antiperson.stackmob.StackMob;
import uk.antiperson.stackmob.entity.StackEntity;
import uk.antiperson.stackmob.hook.hooks.ProtocolLibHook;
import uk.antiperson.stackmob.utils.Utilities;

public class TagHandler {

Expand All @@ -24,12 +23,8 @@ public TagHandler(StackMob sm, Player player, StackEntity stackEntity) {
}

public void init() {
// TODO Temporary workaround!
if (Utilities.getMinecraftVersion() != Utilities.NMS_VERSION || true) {
this.fakeArmorStand = new ProtocolLibFakeArmorStand(sm, player);
return;
}
this.fakeArmorStand = new NmsFakeArmorStand(player);
// Force protocollib for 1.20.2+
this.fakeArmorStand = new ProtocolLibFakeArmorStand(sm, player);
}

public void newlyInRange() {
Expand Down Expand Up @@ -75,15 +70,11 @@ public void playerOutRange() {
}

private void sendPacket(Entity entity, Player player, boolean tagVisible) {
if (Utilities.getMinecraftVersion() != Utilities.NMS_VERSION) {
ProtocolLibHook protocolLibHook = sm.getHookManager().getProtocolLibHook();
if (protocolLibHook == null) {
return;
}
protocolLibHook.sendPacket(player, entity, tagVisible);
ProtocolLibHook protocolLibHook = sm.getHookManager().getProtocolLibHook();
if (protocolLibHook == null) {
return;
}
NMSHelper.sendVisibilityPacket(player, entity, tagVisible);
protocolLibHook.sendPacket(player, entity, tagVisible);
}

public boolean isTagVisible() {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/uk/antiperson/stackmob/utils/Utilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ public enum MinecraftVersion {
V1_19_R2("v1_19_R2"),
V1_19_R3("v1_19_R3"),
V1_20_R1("v1_20_R1"),
V1_20_R2("v1_20_R2");;
V1_20_R2("v1_20_R2"),
V1_20_R3("v1_20_R3");

final String internalName;

Expand Down

0 comments on commit 56c879a

Please sign in to comment.