HyCodeYourTale
classpublicPriority 3

Edge

com.hypixel.hytale.server.core.asset.type.trail.config.Edge

4

Methods

4

Public Methods

1

Fields

1

Constructors

Constants

BuilderCodec<Edge>CODEC= BuilderCodec.builder(Edge.class, Edge::new) .appendInherited( new KeyedCodec<>("Wi...

Constructors

public
Edge()

Methods

Public Methods (4)

public
ColorAlpha getColor()
public
float getWidth()
public
com.hypixel.hytale.protocol.Edge toPacket()
@Nonnull
public
String toString()
@Nonnull@Override

Fields

Private/Package Fields (1)

privatefloat width

Related Classes

Source Code

package com.hypixel.hytale.server.core.asset.type.trail.config;

import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.protocol.ColorAlpha;
import com.hypixel.hytale.server.core.codec.ProtocolCodecs;
import javax.annotation.Nonnull;

public class Edge {
   public static final BuilderCodec<Edge> CODEC = BuilderCodec.builder(Edge.class, Edge::new)
      .appendInherited(
         new KeyedCodec<>("Width", Codec.DOUBLE),
         (edge, d) -> edge.width = d.floatValue(),
         edge -> (double)edge.width,
         (edge, parent) -> edge.width = parent.width
      )
      .add()
      .appendInherited(
         new KeyedCodec<>("Color", ProtocolCodecs.COLOR_AlPHA), (edge, o) -> edge.color = o, edge -> edge.color, (edge, parent) -> edge.color = parent.color
      )
      .add()
      .build();
   private float width;
   private ColorAlpha color = new ColorAlpha((byte)-1, (byte)-1, (byte)-1, (byte)-1);

   public Edge() {
   }

   @Nonnull
   public com.hypixel.hytale.protocol.Edge toPacket() {
      com.hypixel.hytale.protocol.Edge packet = new com.hypixel.hytale.protocol.Edge();
      packet.color = this.color;
      packet.width = this.width;
      return packet;
   }

   public float getWidth() {
      return this.width;
   }

   public ColorAlpha getColor() {
      return this.color;
   }

   @Nonnull
   @Override
   public String toString() {
      return "Edge{width=" + this.width + ", color='" + this.color + "'}";
   }
}