Depricate MetaOffsetConverter untill further notice
Some checks failed
Build / build (push) Has been cancelled
Some checks failed
Build / build (push) Has been cancelled
This commit is contained in:
parent
debb91e642
commit
e1477bb599
2 changed files with 32 additions and 23 deletions
|
@ -14,18 +14,13 @@ import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEn
|
|||
import me.tofaa.entitylib.EntityLib;
|
||||
import me.tofaa.entitylib.extras.InvalidVersionException;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import static me.tofaa.entitylib.meta.MetaOffsetConverter.EntityMetaOffsets.*;
|
||||
|
||||
public class EntityMeta implements EntityMetadataProvider {
|
||||
|
||||
private static final MetaConverterRegistry registry = new MetaConverterRegistry();
|
||||
|
@ -145,60 +140,60 @@ public class EntityMeta implements EntityMetadataProvider {
|
|||
}
|
||||
|
||||
public short getAirTicks() {
|
||||
return this.metadata.getIndex(airTicksOffset(), (short) 300);
|
||||
return this.metadata.getIndex((byte)1, (short) 300);
|
||||
}
|
||||
|
||||
public void setAirTicks(short value) {
|
||||
this.metadata.setIndex(airTicksOffset(), EntityDataTypes.SHORT, value);
|
||||
this.metadata.setIndex((byte)1, EntityDataTypes.SHORT, value);
|
||||
}
|
||||
|
||||
public Component getCustomName() {
|
||||
Optional<Component> component = this.metadata.getIndex(customNameOffset(), Optional.empty());
|
||||
Optional<Component> component = this.metadata.getIndex((byte)2, Optional.empty());
|
||||
return component.orElse(null);
|
||||
}
|
||||
|
||||
public void setCustomName(Component value) {
|
||||
this.metadata.setIndex(customNameOffset(), EntityDataTypes.OPTIONAL_ADV_COMPONENT, Optional.ofNullable(value));
|
||||
this.metadata.setIndex((byte)2, EntityDataTypes.OPTIONAL_ADV_COMPONENT, Optional.ofNullable(value));
|
||||
}
|
||||
|
||||
public boolean isCustomNameVisible() {
|
||||
return this.metadata.getIndex(customNameVisibleOffset(), false);
|
||||
return this.metadata.getIndex((byte)3, false);
|
||||
}
|
||||
|
||||
public void setCustomNameVisible(boolean value) {
|
||||
this.metadata.setIndex(customNameVisibleOffset(), EntityDataTypes.BOOLEAN, value);
|
||||
this.metadata.setIndex((byte)3, EntityDataTypes.BOOLEAN, value);
|
||||
}
|
||||
|
||||
public boolean isSilent() {
|
||||
return this.metadata.getIndex(silentOffset(), false);
|
||||
return this.metadata.getIndex((byte)4, false);
|
||||
}
|
||||
|
||||
public void setSilent(boolean value) {
|
||||
this.metadata.setIndex(silentOffset(), EntityDataTypes.BOOLEAN, value);
|
||||
this.metadata.setIndex((byte)4, EntityDataTypes.BOOLEAN, value);
|
||||
}
|
||||
|
||||
public boolean hasNoGravity() {
|
||||
return this.metadata.getIndex(hasNoGravityOffset(), true);
|
||||
return this.metadata.getIndex((byte)5, true);
|
||||
}
|
||||
|
||||
public void setHasNoGravity(boolean value) {
|
||||
this.metadata.setIndex(hasNoGravityOffset(), EntityDataTypes.BOOLEAN, value);
|
||||
this.metadata.setIndex((byte)5, EntityDataTypes.BOOLEAN, value);
|
||||
}
|
||||
|
||||
public EntityPose getPose() {
|
||||
return this.metadata.getIndex(poseOffset(), EntityPose.STANDING);
|
||||
return this.metadata.getIndex((byte)6, EntityPose.STANDING);
|
||||
}
|
||||
|
||||
public void setPose(EntityPose value) {
|
||||
this.metadata.setIndex(poseOffset(), EntityDataTypes.ENTITY_POSE, value);
|
||||
this.metadata.setIndex((byte)6, EntityDataTypes.ENTITY_POSE, value);
|
||||
}
|
||||
|
||||
public int getTicksFrozenInPowderedSnow() {
|
||||
return this.metadata.getIndex(ticksFrozenInPowderedSnowOffset(), 0);
|
||||
return this.metadata.getIndex((byte)7, 0);
|
||||
}
|
||||
|
||||
public void setTicksFrozenInPowderedSnow(int value) {
|
||||
this.metadata.setIndex(ticksFrozenInPowderedSnowOffset(), EntityDataTypes.INT, value);
|
||||
this.metadata.setIndex((byte)7, EntityDataTypes.INT, value);
|
||||
}
|
||||
|
||||
public WrapperPlayServerEntityMetadata createPacket() {
|
||||
|
|
|
@ -8,10 +8,14 @@ import org.jetbrains.annotations.ApiStatus;
|
|||
|
||||
@ApiStatus.Internal
|
||||
@SuppressWarnings("unused")
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
public final class MetaOffsetConverter {
|
||||
private MetaOffsetConverter() {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
public static final class EntityMetaOffsets {
|
||||
private EntityMetaOffsets() {
|
||||
}
|
||||
|
@ -73,6 +77,8 @@ public final class MetaOffsetConverter {
|
|||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
public static final class AreaEffectCloudOffsets {
|
||||
private AreaEffectCloudOffsets() {
|
||||
}
|
||||
|
@ -87,10 +93,10 @@ public final class MetaOffsetConverter {
|
|||
|
||||
public static byte waitingOffset() {
|
||||
int protocolVersion = getApi().getPacketEvents().getServerManager().getVersion().getProtocolVersion();
|
||||
if (protocolVersion >= 769 && protocolVersion <= 757) {
|
||||
return 9;
|
||||
}
|
||||
throw new RuntimeException("Unknown protocol version for this method");
|
||||
// if (protocolVersion >= 769 && protocolVersion <= 757) {
|
||||
// }
|
||||
// throw new RuntimeException("Unknown protocol version for this method");
|
||||
}
|
||||
|
||||
public static byte particleOffset() {
|
||||
|
@ -102,6 +108,8 @@ public final class MetaOffsetConverter {
|
|||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
public static final class AbstractDisplayMetaOffsets {
|
||||
private AbstractDisplayMetaOffsets() {
|
||||
}
|
||||
|
@ -263,6 +271,8 @@ public final class MetaOffsetConverter {
|
|||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
public static final class BlockDisplayMetaOffsets {
|
||||
private BlockDisplayMetaOffsets() {
|
||||
}
|
||||
|
@ -279,6 +289,8 @@ public final class MetaOffsetConverter {
|
|||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
public static final class ItemDisplayMetaOffsets {
|
||||
private ItemDisplayMetaOffsets() {
|
||||
}
|
||||
|
@ -306,6 +318,8 @@ public final class MetaOffsetConverter {
|
|||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
public static final class TextDisplayMetaOffsets {
|
||||
private TextDisplayMetaOffsets() {
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue