implement display and interaction meta (i forgor)
This commit is contained in:
parent
243413dcce
commit
0867fdd335
29 changed files with 400 additions and 21 deletions
|
@ -107,6 +107,7 @@ Once this list is complete, i will release a stable version of the library.
|
|||
- [ ] WrapperEntities must seamlessly send packet updates to viewers, currently they are not.
|
||||
- [ ] Add support for more actions using WrapperEntities.
|
||||
- [ ] More javadocs.
|
||||
- [ ] Make ObjectData actually useful.
|
||||
|
||||
### Credits
|
||||
- PacketEvents for providing the API and retrooper being a cool guy in general
|
||||
|
|
|
@ -21,6 +21,16 @@ import java.util.UUID;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
/**
|
||||
* Base API class for EntityLib, contains all the methods to interact with the library.
|
||||
* <p>
|
||||
* Initialization should be done before PacketEvents. After PE is initialized, call {@link EntityLib#init(PacketEventsAPI)} to initialize EntityLib.
|
||||
* <br>
|
||||
* To enable entity interactions, call {@link EntityLib#enableEntityInteractions()}. these will help you interact with a {@link WrapperEntity} object.
|
||||
* <br>
|
||||
* By default, EntityLib does not persistently store data, this is planned for a future feature but for now you must store your own data if you want it to persist after restart.
|
||||
* <p>
|
||||
*/
|
||||
public final class EntityLib {
|
||||
|
||||
private EntityLib() {}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
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.*;
|
||||
|
@ -22,16 +23,15 @@ import me.tofaa.entitylib.meta.mobs.monster.zombie.*;
|
|||
import me.tofaa.entitylib.meta.mobs.passive.*;
|
||||
import me.tofaa.entitylib.meta.mobs.water.*;
|
||||
import me.tofaa.entitylib.meta.mobs.minecart.*;
|
||||
import me.tofaa.entitylib.meta.mobs.other.*;
|
||||
import me.tofaa.entitylib.meta.mobs.tameable.CatMeta;
|
||||
import me.tofaa.entitylib.meta.mobs.tameable.ParrotMeta;
|
||||
import me.tofaa.entitylib.meta.mobs.tameable.WolfMeta;
|
||||
import me.tofaa.entitylib.meta.mobs.villager.VillagerMeta;
|
||||
import me.tofaa.entitylib.meta.mobs.villager.WanderingTraderMeta;
|
||||
import me.tofaa.entitylib.meta.other.*;
|
||||
import me.tofaa.entitylib.meta.projectile.*;
|
||||
import me.tofaa.entitylib.meta.types.PlayerMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -45,6 +45,10 @@ final class MetaConverterRegistry {
|
|||
private final Map<EntityType, Class<? extends EntityMeta>> metaClasses = new HashMap<>();
|
||||
|
||||
MetaConverterRegistry() {
|
||||
put(INTERACTION, InteractionMeta.class, InteractionMeta::new);
|
||||
put(BLOCK_DISPLAY, BlockDisplayMeta.class, BlockDisplayMeta::new);
|
||||
put(ITEM_DISPLAY, ItemDisplayMeta.class, ItemDisplayMeta::new);
|
||||
put(TEXT_DISPLAY, TextDisplayMeta.class, TextDisplayMeta::new);
|
||||
put(AREA_EFFECT_CLOUD, AreaEffectCloudMeta.class, AreaEffectCloudMeta::new);
|
||||
put(ARMOR_STAND, ArmorStandMeta.class, ArmorStandMeta::new);
|
||||
put(BOAT, BoatMeta.class, BoatMeta::new);
|
||||
|
|
|
@ -138,6 +138,14 @@ public class EntityMeta implements EntityMetadataProvider {
|
|||
this.metadata.setIndex(offset(OFFSET, 6), EntityDataTypes.ENTITY_POSE, value);
|
||||
}
|
||||
|
||||
public int getTicksFrozenInPowderedSnow() {
|
||||
return this.metadata.getIndex(offset(OFFSET, 7), 0);
|
||||
}
|
||||
|
||||
public void setTicksFrozenInPowderedSnow(int value) {
|
||||
this.metadata.setIndex(offset(OFFSET, 7), EntityDataTypes.INT, value);
|
||||
}
|
||||
|
||||
public WrapperPlayServerEntityMetadata createPacket() {
|
||||
return metadata.createPacket();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import me.tofaa.entitylib.meta.EntityMeta;
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import com.github.retrooper.packetevents.util.Vector3f;
|
|
@ -0,0 +1,24 @@
|
|||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
||||
import me.tofaa.entitylib.meta.types.DisplayMeta;
|
||||
|
||||
public class BlockDisplayMeta extends DisplayMeta {
|
||||
|
||||
public static final byte OFFSET = DisplayMeta.MAX_OFFSET;
|
||||
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||
|
||||
public BlockDisplayMeta(int entityId, Metadata metadata) {
|
||||
super(entityId, metadata);
|
||||
}
|
||||
|
||||
public int getBlockId() {
|
||||
return super.metadata.getIndex(OFFSET, 0);
|
||||
}
|
||||
|
||||
public void setBlockId(int blockId) {
|
||||
super.metadata.setIndex(OFFSET, EntityDataTypes.INT, blockId);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import me.tofaa.entitylib.meta.EntityMeta;
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import com.github.retrooper.packetevents.util.Vector3i;
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import me.tofaa.entitylib.meta.EntityMeta;
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import com.github.retrooper.packetevents.util.Vector3i;
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import com.github.retrooper.packetevents.protocol.item.ItemStack;
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import me.tofaa.entitylib.meta.EntityMeta;
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import me.tofaa.entitylib.meta.EntityMeta;
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
||||
|
||||
public class InteractionMeta extends EntityMeta {
|
||||
|
||||
public static final byte OFFSET = EntityMeta.MAX_OFFSET;
|
||||
public static final byte MAX_OFFSET = OFFSET + 3;
|
||||
|
||||
public InteractionMeta(int entityId, Metadata metadata) {
|
||||
super(entityId, metadata);
|
||||
}
|
||||
|
||||
public float getWidth() {
|
||||
return super.metadata.getIndex(OFFSET, 1.0F);
|
||||
}
|
||||
|
||||
public void setWidth(float value) {
|
||||
super.metadata.setIndex(OFFSET, EntityDataTypes.FLOAT, value);
|
||||
}
|
||||
|
||||
public float getHeight() {
|
||||
return super.metadata.getIndex(offset(OFFSET, 1), 1.0F);
|
||||
}
|
||||
|
||||
public void setHeight(float value) {
|
||||
super.metadata.setIndex(offset(OFFSET, 1), EntityDataTypes.FLOAT, value);
|
||||
}
|
||||
|
||||
public boolean isResponsive() {
|
||||
return super.metadata.getIndex(offset(OFFSET, 2), false);
|
||||
}
|
||||
|
||||
public void setResponsive(boolean value) {
|
||||
super.metadata.setIndex(offset(OFFSET, 2), EntityDataTypes.BOOLEAN, value);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
||||
import me.tofaa.entitylib.meta.types.DisplayMeta;
|
||||
|
||||
public class ItemDisplayMeta extends DisplayMeta {
|
||||
|
||||
public static final byte OFFSET = DisplayMeta.MAX_OFFSET;
|
||||
public static final byte MAX_OFFSET = OFFSET + 1;
|
||||
|
||||
|
||||
public ItemDisplayMeta(int entityId, Metadata metadata) {
|
||||
super(entityId, metadata);
|
||||
}
|
||||
|
||||
public DisplayType getDisplayType() {
|
||||
return DisplayType.VALUES[super.metadata.getIndex(OFFSET, 0)];
|
||||
}
|
||||
|
||||
public void setDisplayType(DisplayType displayType) {
|
||||
super.metadata.setIndex(OFFSET, EntityDataTypes.BYTE, (byte) displayType.ordinal());
|
||||
}
|
||||
|
||||
public enum DisplayType {
|
||||
NONE,
|
||||
THIRD_PERSON_LEFT_HAND,
|
||||
THIRD_PERSON_RIGHT_HAND,
|
||||
FIRST_PERSON_LEFT_HAND,
|
||||
FIRST_PERSON_RIGHT_HAND,
|
||||
HEAD,
|
||||
GUI,
|
||||
GROUND,
|
||||
FIXED;
|
||||
|
||||
private static final DisplayType[] VALUES = values();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import com.github.retrooper.packetevents.protocol.item.ItemStack;
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import me.tofaa.entitylib.meta.EntityMeta;
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import me.tofaa.entitylib.meta.EntityMeta;
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import me.tofaa.entitylib.meta.EntityMeta;
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import me.tofaa.entitylib.meta.EntityMeta;
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.world.Direction;
|
||||
import me.tofaa.entitylib.meta.EntityMeta;
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import me.tofaa.entitylib.meta.EntityMeta;
|
|
@ -0,0 +1,96 @@
|
|||
package me.tofaa.entitylib.meta.other;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
||||
import me.tofaa.entitylib.meta.types.DisplayMeta;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
|
||||
public class TextDisplayMeta extends DisplayMeta {
|
||||
|
||||
public static final byte OFFSET = DisplayMeta.MAX_OFFSET;
|
||||
public static final byte MAX_OFFSET = OFFSET + 5;
|
||||
|
||||
private static final byte SHADOW = 1;
|
||||
private static final byte SEE_THROUGH = 2;
|
||||
private static final byte USE_DEFAULT_BACKGROUND = 4;
|
||||
private static final byte ALIGN_LEFT = 8;
|
||||
private static final byte ALIGN_RIGHT = 16;
|
||||
|
||||
public TextDisplayMeta(int entityId, Metadata metadata) {
|
||||
super(entityId, metadata);
|
||||
}
|
||||
|
||||
|
||||
public Component getText() {
|
||||
return metadata.getIndex(OFFSET, Component.empty());
|
||||
}
|
||||
|
||||
public void setComponent(Component component) {
|
||||
metadata.setIndex(OFFSET, EntityDataTypes.COMPONENT, GsonComponentSerializer.gson().serialize(component));
|
||||
}
|
||||
|
||||
public int getLineWidth() {
|
||||
return metadata.getIndex(offset(OFFSET, 1), 200);
|
||||
}
|
||||
|
||||
public void setLineWidth(int value) {
|
||||
metadata.setIndex(offset(OFFSET, 1), EntityDataTypes.INT, value);
|
||||
}
|
||||
|
||||
public int getBackgroundColor() {
|
||||
return metadata.getIndex(offset(OFFSET, 2), 0);
|
||||
}
|
||||
|
||||
public void setBackgroundColor(int value) {
|
||||
metadata.setIndex(offset(OFFSET, 2), EntityDataTypes.INT, value);
|
||||
}
|
||||
|
||||
public byte getTextOpacity() {
|
||||
return metadata.getIndex(offset(OFFSET, 3), (byte) -1);
|
||||
}
|
||||
|
||||
public void setTextOpacity(byte value) {
|
||||
metadata.setIndex(offset(OFFSET, 3), EntityDataTypes.BYTE, value);
|
||||
}
|
||||
|
||||
public boolean isShadow() {
|
||||
return getMaskBit(offset(OFFSET, 4), SHADOW);
|
||||
}
|
||||
|
||||
public void setShadow(boolean value) {
|
||||
setMaskBit(offset(OFFSET, 4), SHADOW, value);
|
||||
}
|
||||
|
||||
public boolean isSeeThrough() {
|
||||
return getMaskBit(offset(OFFSET, 4), SEE_THROUGH);
|
||||
}
|
||||
|
||||
public void setSeeThrough(boolean value) {
|
||||
setMaskBit(offset(OFFSET, 4), SEE_THROUGH, value);
|
||||
}
|
||||
|
||||
public boolean isUseDefaultBackground() {
|
||||
return getMaskBit(offset(OFFSET, 4), USE_DEFAULT_BACKGROUND);
|
||||
}
|
||||
|
||||
public void setUseDefaultBackground(boolean value) {
|
||||
setMaskBit(offset(OFFSET, 4), USE_DEFAULT_BACKGROUND, value);
|
||||
}
|
||||
|
||||
public boolean isAlignLeft() {
|
||||
return getMaskBit(offset(OFFSET, 4), ALIGN_LEFT);
|
||||
}
|
||||
|
||||
public void setAlignLeft(boolean value) {
|
||||
setMaskBit(OFFSET + 4, ALIGN_LEFT, value);
|
||||
}
|
||||
|
||||
public boolean isAlignRight() {
|
||||
return getMaskBit(offset(OFFSET, 4), ALIGN_RIGHT);
|
||||
}
|
||||
|
||||
public void setAlignRight(boolean value) {
|
||||
setMaskBit(offset(OFFSET, 4), ALIGN_RIGHT, value);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.projectile;
|
||||
|
||||
import me.tofaa.entitylib.meta.EntityMeta;
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
|
@ -1,4 +1,4 @@
|
|||
package me.tofaa.entitylib.meta.mobs.other;
|
||||
package me.tofaa.entitylib.meta.projectile;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import me.tofaa.entitylib.meta.EntityMeta;
|
148
src/main/java/me/tofaa/entitylib/meta/types/DisplayMeta.java
Normal file
148
src/main/java/me/tofaa/entitylib/meta/types/DisplayMeta.java
Normal file
|
@ -0,0 +1,148 @@
|
|||
package me.tofaa.entitylib.meta.types;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import com.github.retrooper.packetevents.util.Quaternion4f;
|
||||
import com.github.retrooper.packetevents.util.Vector3f;
|
||||
import me.tofaa.entitylib.meta.EntityMeta;
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
||||
|
||||
public class DisplayMeta extends EntityMeta {
|
||||
|
||||
public static final byte OFFSET = EntityMeta.MAX_OFFSET;
|
||||
public static final byte MAX_OFFSET = OFFSET + 13;
|
||||
|
||||
public DisplayMeta(int entityId, Metadata metadata) {
|
||||
super(entityId, metadata);
|
||||
}
|
||||
|
||||
public int getInterpolationDelay() {
|
||||
return super.metadata.getIndex(OFFSET, 0);
|
||||
}
|
||||
|
||||
public void setInterpolationDelay(int value) {
|
||||
super.metadata.setIndex(OFFSET, EntityDataTypes.INT, value);
|
||||
}
|
||||
|
||||
public int getTransformationInterpolationDuration() {
|
||||
return super.metadata.getIndex(offset(OFFSET, 1), 0);
|
||||
}
|
||||
|
||||
public void setTransformationInterpolationDuration(int value) {
|
||||
super.metadata.setIndex(offset(OFFSET, 1), EntityDataTypes.INT, value);
|
||||
}
|
||||
|
||||
public int getPositionRotationInterpolationDuration() {
|
||||
return super.metadata.getIndex(offset(OFFSET, 2), 0);
|
||||
}
|
||||
|
||||
public void setPositionRotationInterpolationDuration(int value) {
|
||||
super.metadata.setIndex(offset(OFFSET, 2), EntityDataTypes.INT, value);
|
||||
}
|
||||
|
||||
public Vector3f getTranslation() {
|
||||
return super.metadata.getIndex(offset(OFFSET, 3), Vector3f.zero());
|
||||
}
|
||||
|
||||
public void setTranslation(Vector3f value) {
|
||||
super.metadata.setIndex(offset(OFFSET, 3), EntityDataTypes.VECTOR3F, value);
|
||||
}
|
||||
|
||||
public Vector3f getScale() {
|
||||
return super.metadata.getIndex(offset(OFFSET, 4), new Vector3f(1.0f, 1.0f, 1.0f));
|
||||
}
|
||||
|
||||
public void setScale(Vector3f value) {
|
||||
super.metadata.setIndex(offset(OFFSET, 4), EntityDataTypes.VECTOR3F, value);
|
||||
}
|
||||
|
||||
public Quaternion4f getLeftRotation() {
|
||||
return super.metadata.getIndex(offset(OFFSET, 5), new Quaternion4f(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
}
|
||||
|
||||
public void setLeftRotation(Quaternion4f value) {
|
||||
super.metadata.setIndex(offset(OFFSET, 5), EntityDataTypes.QUATERNION, value);
|
||||
}
|
||||
|
||||
public Quaternion4f getRightRotation() {
|
||||
return super.metadata.getIndex(offset(OFFSET, 6), new Quaternion4f(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
}
|
||||
|
||||
public void setRightRotation(Quaternion4f value) {
|
||||
super.metadata.setIndex(offset(OFFSET, 6), EntityDataTypes.QUATERNION, value);
|
||||
}
|
||||
|
||||
public BillboardConstraints getBillboardConstraints() {
|
||||
return BillboardConstraints.VALUES[super.metadata.getIndex(offset(OFFSET, 7), (byte) 0)];
|
||||
}
|
||||
|
||||
public void setBillboardConstraints(BillboardConstraints value) {
|
||||
super.metadata.setIndex(offset(OFFSET, 7), EntityDataTypes.BYTE, (byte) value.ordinal());
|
||||
}
|
||||
|
||||
//(blockLight << 4 | skyLight << 20)
|
||||
public int getBrightnessOverride() {
|
||||
return super.metadata.getIndex(offset(OFFSET, 8), -1);
|
||||
}
|
||||
|
||||
public void setBrightnessOverride(int value) {
|
||||
super.metadata.setIndex(offset(OFFSET, 8), EntityDataTypes.INT, value);
|
||||
}
|
||||
|
||||
public float getViewRange() {
|
||||
return super.metadata.getIndex(offset(OFFSET, 9), 1.0f);
|
||||
}
|
||||
|
||||
public void setViewRange(float value) {
|
||||
super.metadata.setIndex(offset(OFFSET, 9), EntityDataTypes.FLOAT, value);
|
||||
}
|
||||
|
||||
public float getShadowRadius() {
|
||||
return super.metadata.getIndex(offset(OFFSET, 10), 0.0f);
|
||||
}
|
||||
|
||||
public void setShadowRadius(float value) {
|
||||
super.metadata.setIndex(offset(OFFSET, 10), EntityDataTypes.FLOAT, value);
|
||||
}
|
||||
|
||||
public float getShadowStrength() {
|
||||
return super.metadata.getIndex(offset(OFFSET, 11), 1.0f);
|
||||
}
|
||||
|
||||
public void setShadowStrength(float value) {
|
||||
super.metadata.setIndex(offset(OFFSET, 11), EntityDataTypes.FLOAT, value);
|
||||
}
|
||||
|
||||
public float getWidth() {
|
||||
return super.metadata.getIndex(offset(OFFSET, 12), 0.0f);
|
||||
}
|
||||
|
||||
public void setWidth(float value) {
|
||||
super.metadata.setIndex(offset(OFFSET, 12), EntityDataTypes.FLOAT, value);
|
||||
}
|
||||
|
||||
public float getHeight() {
|
||||
return super.metadata.getIndex(offset(OFFSET, 13), 0.0f);
|
||||
}
|
||||
|
||||
public void setHeight(float value) {
|
||||
super.metadata.setIndex(offset(OFFSET, 13), EntityDataTypes.FLOAT, value);
|
||||
}
|
||||
|
||||
public int getGlowColorOverride() {
|
||||
return super.metadata.getIndex(offset(OFFSET, 14), -1);
|
||||
}
|
||||
|
||||
public void setGlowColorOverride(int value) {
|
||||
super.metadata.setIndex(offset(OFFSET, 14), EntityDataTypes.INT, value);
|
||||
}
|
||||
|
||||
public enum BillboardConstraints {
|
||||
FIXED,
|
||||
VERTICAL,
|
||||
HORIZONTAL,
|
||||
CENTER;
|
||||
|
||||
private static final BillboardConstraints[] VALUES = values();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,13 @@
|
|||
package me.tofaa.entitylib;
|
||||
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.protocol.player.InteractionHand;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;
|
||||
import me.tofaa.entitylib.entity.EntityInteractionProcessor;
|
||||
import me.tofaa.entitylib.entity.WrapperEntity;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class EntityLibPlugin extends JavaPlugin {
|
||||
|
||||
|
@ -10,6 +16,8 @@ public final class EntityLibPlugin extends JavaPlugin {
|
|||
@Override
|
||||
public void onEnable() {
|
||||
EntityLib.init(PacketEvents.getAPI());
|
||||
EntityLib.enableEntityInteractions();
|
||||
EntityLib.setInteractionProcessor((entity, action, hand, user) -> user.sendMessage("Hello World"));
|
||||
getCommand("testapi").setExecutor(new TestCommand());
|
||||
getCommand("testentity").setExecutor(new TestEntityCommand());
|
||||
instance = this;
|
||||
|
|
Loading…
Reference in a new issue