mirror of
https://github.com/GeyserExtensionists/GeyserUtils.git
synced 2025-12-19 15:09:24 +00:00
add variant data
This commit is contained in:
@@ -5,8 +5,6 @@ import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Getter
|
||||
@@ -17,5 +15,6 @@ public class CustomEntityDataPacket extends CustomPayloadPacket {
|
||||
private Float width;
|
||||
private Float scale;
|
||||
private Integer color;
|
||||
private Integer variant;
|
||||
|
||||
}
|
||||
|
||||
@@ -470,6 +470,8 @@ public class GeyserUtils implements Extension {
|
||||
if (customEntityDataPacket.getScale() != null) entity.getDirtyMetadata().put(EntityDataTypes.SCALE, customEntityDataPacket.getScale());
|
||||
if (customEntityDataPacket.getColor() != null)
|
||||
entity.getDirtyMetadata().put(EntityDataTypes.COLOR, Byte.parseByte(String.valueOf(getColor(customEntityDataPacket.getColor()))));
|
||||
if (customEntityDataPacket.getVariant() != null)
|
||||
entity.getDirtyMetadata().put(EntityDataTypes.VARIANT, customEntityDataPacket.getVariant());
|
||||
entity.updateBedrockMetadata();
|
||||
}
|
||||
} else if (customPacket instanceof EntityPropertyPacket entityPropertyPacket) {
|
||||
|
||||
@@ -36,6 +36,15 @@ public class EntityUtils {
|
||||
|
||||
}
|
||||
|
||||
public static void sendVariant(Player player, int id, int variant) {
|
||||
CustomEntityDataPacket packet = new CustomEntityDataPacket();
|
||||
packet.setEntityId(id);
|
||||
packet.setVariant(variant);
|
||||
player.sendPluginMessage(GeyserUtils.getInstance(), GeyserUtilsChannels.MAIN, GeyserUtils.getPacketManager().encodePacket(packet));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void setCustomEntity(Player player, int entityId, String def) {
|
||||
CustomEntityPacket packet = new CustomEntityPacket(entityId, def);
|
||||
player.sendPluginMessage(GeyserUtils.getInstance(), GeyserUtilsChannels.MAIN, GeyserUtils.getPacketManager().encodePacket(packet));
|
||||
|
||||
Reference in New Issue
Block a user