Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace magic numbers with EntityStatuses #5152

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading