HyCodeYourTale
classpublicPriority 3

NBufferType

com.hypixel.hytale.builtin.hytalegenerator.newsystem.bufferbundle.buffers.type.NBufferType

4

Methods

4

Public Methods

4

Fields

1

Constructors

Constructors

public
NBufferType(String name, int index, Class bufferClass, Supplier<NBuffer> bufferSupplier)

Methods

Public Methods (4)

public
boolean equals(Object o)
@Override
public
int hashCode()
@Override
public
boolean isValid(NBuffer buffer)
public
boolean isValidType(Class bufferClass)

Fields

Public Fields (4)

publicfinalClass bufferClass
publicfinalSupplier<NBuffer> bufferSupplier
publicfinalint index
publicfinalString name

Inheritance

Parent
Current
Interface
Child

Use mouse wheel to zoom, drag to pan. Click nodes to navigate.

Related Classes

Used By

Source Code

package com.hypixel.hytale.builtin.hytalegenerator.newsystem.bufferbundle.buffers.type;

import com.hypixel.hytale.builtin.hytalegenerator.newsystem.bufferbundle.buffers.NBuffer;
import java.util.function.Supplier;
import javax.annotation.Nonnull;

public class NBufferType {
   public final Class bufferClass;
   public final int index;
   public final Supplier<NBuffer> bufferSupplier;
   public final String name;

   public NBufferType(@Nonnull String name, int index, @Nonnull Class bufferClass, @Nonnull Supplier<NBuffer> bufferSupplier) {
      this.name = name;
      this.index = index;
      this.bufferClass = bufferClass;
      this.bufferSupplier = bufferSupplier;
   }

   @Override
   public boolean equals(Object o) {
      return !(o instanceof NBufferType that)
         ? false
         : this.index == that.index && this.bufferClass.equals(that.bufferClass) && this.bufferSupplier.equals(that.bufferSupplier);
   }

   public boolean isValidType(@Nonnull Class bufferClass) {
      return this.bufferClass.equals(bufferClass);
   }

   public boolean isValid(@Nonnull NBuffer buffer) {
      return this.bufferClass.isInstance(buffer);
   }

   @Override
   public int hashCode() {
      int result = this.bufferClass.hashCode();
      result = 31 * result + this.index;
      return 31 * result + this.bufferSupplier.hashCode();
   }
}