Fix unused meta data

This commit is contained in:
Tofaa 2024-07-16 11:34:36 +04:00
parent 56a6c3cc63
commit aab30e236f
6 changed files with 42 additions and 7 deletions

View file

@ -1,6 +1,7 @@
package me.tofaa.entitylib.meta;
import com.github.retrooper.packetevents.protocol.entity.type.EntityType;
import com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;
import me.tofaa.entitylib.meta.display.BlockDisplayMeta;
import me.tofaa.entitylib.meta.display.ItemDisplayMeta;
import me.tofaa.entitylib.meta.display.TextDisplayMeta;
@ -82,6 +83,7 @@ final class MetaConverterRegistry {
put(ENDERMAN, EndermanMeta.class, EndermanMeta::new);
put(ENDERMITE, EndermiteMeta.class, EndermiteMeta::new);
put(EVOKER, EvokerMeta.class, EvokerMeta::new);
put(EYE_OF_ENDER, EyeOfEnderMeta.class, EyeOfEnderMeta::new);
put(EVOKER_FANGS, EvokerFangsMeta.class, EvokerFangsMeta::new);
put(FALLING_BLOCK, FallingBlockMeta.class, FallingBlockMeta::new);
put(FIREBALL, LargeFireballMeta.class, LargeFireballMeta::new); // TODO: Verify correctness
@ -104,6 +106,7 @@ final class MetaConverterRegistry {
put(IRON_GOLEM, IronGolemMeta.class, IronGolemMeta::new);
put(ITEM_DISPLAY, ItemDisplayMeta.class, ItemDisplayMeta::new);
put(ITEM_FRAME, ItemFrameMeta.class, ItemFrameMeta::new);
put(ITEM, ItemEntityMeta.class, ItemEntityMeta::new);
put(LEASH_KNOT, LeashKnotMeta.class, LeashKnotMeta::new);
put(LIGHTNING_BOLT, LightningBoltMeta.class, LightningBoltMeta::new);
put(LLAMA, LlamaMeta.class, LlamaMeta::new);
@ -114,6 +117,7 @@ final class MetaConverterRegistry {
put(OCELOT, OcelotMeta.class, OcelotMeta::new);
put(PAINTING, PaintingMeta.class, PaintingMeta::new);
put(PANDA, PandaMeta.class, PandaMeta::new);
put(POTION, ThrownPotionMeta.class, ThrownPotionMeta::new);
put(PARROT, ParrotMeta.class, ParrotMeta::new);
put(PIG, PigMeta.class, PigMeta::new);
put(PIGLIN, PiglinMeta.class, PiglinMeta::new);
@ -128,6 +132,7 @@ final class MetaConverterRegistry {
put(RAVAGER, RavagerMeta.class, RavagerMeta::new);
put(SALMON, SalmonMeta.class, SalmonMeta::new);
put(SHEEP, SheepMeta.class, SheepMeta::new);
put(SNOWBALL, SnowballMeta.class, SnowballMeta::new);
put(SHULKER, ShulkerMeta.class, ShulkerMeta::new);
put(SHULKER_BULLET, ShulkerBulletMeta.class, ShulkerBulletMeta::new);
put(SILVERFISH, SilverfishMeta.class, SilverfishMeta::new);
@ -144,6 +149,7 @@ final class MetaConverterRegistry {
put(TADPOLE, LivingEntityMeta.class, LivingEntityMeta::new); // TODO: Implement
put(TEXT_DISPLAY, TextDisplayMeta.class, TextDisplayMeta::new);
put(THROWN_EXP_BOTTLE, ThrownExpBottleMeta.class, ThrownExpBottleMeta::new);
put(ENDER_PEARL, ThrownEnderPearlMeta.class, ThrownEnderPearlMeta::new);
put(TNT_MINECART, TntMinecartMeta.class, TntMinecartMeta::new);
put(TRADER_LLAMA, TraderLlamaMeta.class, TraderLlamaMeta::new);
put(TRIDENT, ThrownTridentMeta.class, ThrownTridentMeta::new);

View file

@ -10,7 +10,7 @@ public class ItemEntityMeta extends ItemContainerMeta implements ObjectData {
public static final byte OFFSET = ItemContainerMeta.MAX_OFFSET;
public static final byte MAX_OFFSET = OFFSET + 0;
protected ItemEntityMeta(int entityId, Metadata metadata) {
public ItemEntityMeta(int entityId, Metadata metadata) {
super(entityId, metadata, ItemStack.EMPTY);
}

View file

@ -11,7 +11,7 @@ public abstract class ItemContainerMeta extends EntityMeta {
private final ItemStack baseItem;
protected ItemContainerMeta(int entityId, Metadata metadata, ItemStack baseItem) {
public ItemContainerMeta(int entityId, Metadata metadata, ItemStack baseItem) {
super(entityId, metadata);
this.baseItem = baseItem;
}

View file

@ -40,8 +40,8 @@ public class WrapperPlayer extends WrapperLivingEntity {
return profile.getTextureProperties();
}
public WrapperPlayServerPlayerInfoRemove tabListRemovePacket() {
return new WrapperPlayServerPlayerInfoRemove(getUuid());
public WrapperPlayServerPlayerInfoUpdate tabListRemovePacket() {
return new WrapperPlayServerPlayerInfoUpdate(EnumSet.of(WrapperPlayServerPlayerInfoUpdate.Action.UPDATE_LISTED), createInfo());
}
public void setGameMode(GameMode gameMode) {
@ -95,9 +95,9 @@ public class WrapperPlayer extends WrapperLivingEntity {
public void setInTablist(boolean tablist) {
this.tablist = tablist;
sendPacketsToViewersIfSpawned(tabListPacket());
if (!tablist) {
sendPacketsToViewersIfSpawned(tabListRemovePacket());
}
// if (!tablist) {
// sendPacketsToViewersIfSpawned(tabListRemovePacket());
// }
}
public int getLatency() {

View file

@ -7,9 +7,18 @@ repositories {
maven {
url = uri("https://mvn.lumine.io/repository/maven-public/")
}
maven("https://jitpack.io")
}
dependencies {
// compileOnly("com.ticxo.modelengine:ModelEngine:R4.0.4")
api(project(":api"))
implementation("commons-io:commons-io:2.11.0")
implementation("org.zeroturnaround:zt-zip:1.8")
implementation("javax.json:javax.json-api:1.1.4")
implementation("org.glassfish:javax.json:1.1.4")
implementation("com.github.hollow-cube.common:mql:2b48ad430f")
}

View file

@ -20,6 +20,9 @@ import java.util.*;
public class TestPlayerCommand extends BukkitCommand {
private static final char UNICODE_EMPTY = '\u2800';
private WrapperPlayer p;
private SkinFetcher sf;
public TestPlayerCommand() {
@ -28,6 +31,22 @@ public class TestPlayerCommand extends BukkitCommand {
@Override
public boolean execute(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) {
Player player = (Player) commandSender;
if (p != null) {
p.setInTablist(!p.isInTablist());
return true;
}
p = new WrapperPlayer(new UserProfile(UUID.randomUUID(), "\u2800"), EntityLib.getPlatform().getEntityIdProvider().provide(UUID.randomUUID(), EntityTypes.PLAYER));
p.setInTablist(true);
p.setTextureProperties(ExtraConversionUtil.getProfileFromBukkitPlayer(player).getTextureProperties());
p.spawn(SpigotConversionUtil.fromBukkitLocation(player.getLocation()));
p.addViewer(player.getUniqueId());
player.sendMessage("Entity spawned");
return true;
}
private boolean legacyProcess(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) {
Player player = (Player) commandSender;
if (strings.length < 1) {
player.sendMessage("Usage: /testplayer <spawn|hello|ping|gamemode|displayname|tablist|remove>");
@ -92,6 +111,7 @@ public class TestPlayerCommand extends BukkitCommand {
return true;
}
@NotNull
@Override
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException {