update to pe 2.2.0

This commit is contained in:
Tofaa 2023-12-14 16:17:58 +03:00
parent 5539f5cd8b
commit 6648f2dab2
8 changed files with 14 additions and 17 deletions

View file

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<list size="1">

View file

@ -36,6 +36,6 @@ allprojects {
dependencies {
compileOnlyApi("com.github.retrooper.packetevents:spigot:2.1.0")
compileOnlyApi("com.github.retrooper.packetevents:spigot:2.2.0")
}

View file

@ -6,7 +6,6 @@ import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.entity.type.EntityType;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;
import me.tofaa.entitylib.entity.EntityInteractionProcessor;

View file

@ -1,7 +1,6 @@
package me.tofaa.entitylib;
import com.github.retrooper.packetevents.protocol.entity.type.EntityType;
import com.sun.org.apache.bcel.internal.generic.PUTFIELD;
import me.tofaa.entitylib.meta.EntityMeta;
import me.tofaa.entitylib.meta.Metadata;
import me.tofaa.entitylib.meta.mobs.*;
@ -39,6 +38,7 @@ import java.util.function.BiFunction;
import static com.github.retrooper.packetevents.protocol.entity.type.EntityTypes.*;
@SuppressWarnings("unchecked")
final class MetaConverterRegistry {
private final Map<EntityType, BiFunction<Integer, Metadata, EntityMeta>> converters = new HashMap<>();

View file

@ -61,7 +61,6 @@ public class WrapperEntity {
rotateHead(location.getYaw(), location.getPitch());
}
public void remove() {
if (!spawned) return;
spawned = false;
@ -85,9 +84,7 @@ public class WrapperEntity {
}
public void sendPacketToViewers(PacketWrapper<?> packet) {
viewers.forEach(uuid -> {
EntityLib.sendPacket(uuid, packet);
});
viewers.forEach(uuid -> EntityLib.sendPacket(uuid, packet));
}
public boolean addViewer(UUID uuid) {

View file

@ -19,11 +19,11 @@ public enum Rotation {
*/
CLOCKWISE_135,
/**
* Flipped upside-down, a 180 degree rotation
* Flipped upside-down, a 180-degree rotation
*/
FLIPPED,
/**
* Flipped upside-down + 45 degree rotation
* Flipped upside-down + 45-degree rotation
*/
FLIPPED_45,
/**

View file

@ -6,6 +6,7 @@ import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
import com.github.retrooper.packetevents.protocol.entity.data.EntityMetadataProvider;
import com.github.retrooper.packetevents.protocol.entity.pose.EntityPose;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityMetadata;
import me.tofaa.entitylib.EntityLib;
import me.tofaa.entitylib.exception.InvalidVersionException;
@ -200,11 +201,16 @@ public class EntityMeta implements EntityMetadataProvider {
if (value) {
mask |= bit;
} else {
mask &= ~bit;
mask &= (byte) ~bit;
}
setMask((byte)index, mask);
}
@Override
public List<EntityData> entityData(ClientVersion clientVersion) {
return metadata.getEntries(); // TODO: Atm this is useless cause of the way the api works. Might change in the future
}
@Override
public List<EntityData> entityData() {
return metadata.getEntries();

View file

@ -33,10 +33,10 @@ public class TestEntityCommand implements CommandExecutor {
return false;
}
entity.addViewer(player.getUniqueId());
entity.spawn(fromBukkit(player.getLocation()));
entity.spawn(SpigotConversionUtil.fromBukkitLocation(player.getLocation()));
}
ItemStack held = player.getInventory().getItemInMainHand();
if (held != null && held.getType() != Material.AIR) {
if (held != null && !held.getType().isAir()) {
entity.getEquipment().setBoots(SpigotConversionUtil.fromBukkitItemStack(held));
}
EntityMeta meta = entity.getMeta();
@ -49,8 +49,4 @@ public class TestEntityCommand implements CommandExecutor {
return false;
}
public static Location fromBukkit(org.bukkit.Location location) {
return new Location(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
}
}