Skip to content

Commit

Permalink
Replace magic numbers with EntityStatuses
Browse files Browse the repository at this point in the history
  • Loading branch information
Big-Iron-Cheems authored and Wide-Cat committed Jan 24, 2025
1 parent 669aaa3 commit b7a0468
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import meteordevelopment.orbit.EventHandler;
import meteordevelopment.orbit.EventPriority;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityStatuses;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.Items;
import net.minecraft.network.packet.s2c.play.EntityStatusS2CPacket;
Expand Down Expand Up @@ -105,7 +106,7 @@ else if (ticks >= delay.get()) {
@EventHandler(priority = EventPriority.HIGH)
private void onReceivePacket(PacketEvent.Receive event) {
if (!(event.packet instanceof EntityStatusS2CPacket p)) return;
if (p.getStatus() != 35) return;
if (p.getStatus() != EntityStatuses.USE_TOTEM_OF_UNDYING) return;

Entity entity = p.getEntity(mc.world);
if (entity == null || !(entity.equals(mc.player))) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import meteordevelopment.orbit.EventHandler;
import net.minecraft.client.network.PlayerListEntry;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityStatuses;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.thrown.EnderPearlEntity;
Expand Down Expand Up @@ -306,7 +307,7 @@ private void onReceivePacket(PacketEvent.Receive event) {
case PlayerRemoveS2CPacket packet when joinsLeavesMode.get().equals(JoinLeaveModes.Both) || joinsLeavesMode.get().equals(JoinLeaveModes.Leaves) ->
createLeaveNotification(packet);

case EntityStatusS2CPacket packet when totemPops.get() && packet.getStatus() == 35 && packet.getEntity(mc.world) instanceof PlayerEntity entity -> {
case EntityStatusS2CPacket packet when totemPops.get() && packet.getStatus() == EntityStatuses.USE_TOTEM_OF_UNDYING && packet.getEntity(mc.world) instanceof PlayerEntity entity -> {
if ((entity.equals(mc.player) && totemsIgnoreOwn.get())
|| (Friends.get().isFriend(entity) && totemsIgnoreOthers.get())
|| (!Friends.get().isFriend(entity) && totemsIgnoreFriends.get())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityStatuses;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.packet.s2c.play.EntityStatusS2CPacket;

Expand Down Expand Up @@ -103,7 +104,7 @@ public void onDeactivate() {
@EventHandler
private void onReceivePacket(PacketEvent.Receive event) {
if (!(event.packet instanceof EntityStatusS2CPacket p)) return;
if (p.getStatus() != 35) return;
if (p.getStatus() != EntityStatuses.USE_TOTEM_OF_UNDYING) return;

Entity entity = p.getEntity(mc.world);
if (!(entity instanceof PlayerEntity player) || entity == mc.player) return;
Expand Down

0 comments on commit b7a0468

Please sign in to comment.