HyCodeYourTale
classpublicPriority 3

ImportedAssignmentsAsset

com.hypixel.hytale.builtin.hytalegenerator.assets.propassignments.ImportedAssignmentsAsset

extends AssignmentsAsset

1

Methods

1

Public Methods

1

Fields

1

Constructors

Constants

BuilderCodec<ImportedAssignmentsAsset>CODEC= BuilderCodec.builder( ImportedAssignmentsAsset.class, ImportedAssignmentsAsset::new, Ass...

Constructors

public
ImportedAssignmentsAsset()

Methods

Public Methods (1)

public
Assignments build(AssignmentsAsset.Argument argument)
@Override

Fields

Private/Package Fields (1)

privateString name

Inheritance

Parent
Current
Interface
Child

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

Related Classes

Source Code

package com.hypixel.hytale.builtin.hytalegenerator.assets.propassignments;

import com.hypixel.hytale.builtin.hytalegenerator.LoggerUtil;
import com.hypixel.hytale.builtin.hytalegenerator.propdistributions.Assignments;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import javax.annotation.Nonnull;

public class ImportedAssignmentsAsset extends AssignmentsAsset {
   public static final BuilderCodec<ImportedAssignmentsAsset> CODEC = BuilderCodec.builder(
         ImportedAssignmentsAsset.class, ImportedAssignmentsAsset::new, AssignmentsAsset.ABSTRACT_CODEC
      )
      .append(new KeyedCodec<>("Name", Codec.STRING, true), (asset, v) -> asset.name = v, asset -> asset.name)
      .add()
      .build();
   private String name = "";

   public ImportedAssignmentsAsset() {
   }

   @Override
   public Assignments build(@Nonnull AssignmentsAsset.Argument argument) {
      if (super.skip()) {
         return Assignments.noPropDistribution(argument.runtime);
      } else {
         AssignmentsAsset asset = getExportedAsset(this.name);
         if (asset == null) {
            LoggerUtil.getLogger().warning("Couldn't find Assignments asset exported with name: '" + this.name + "'.");
            return Assignments.noPropDistribution(argument.runtime);
         } else {
            return asset.build(argument);
         }
      }
   }
}