Record Class ReactorType

java.lang.Object
java.lang.Record
net.darkhax.retroreactors.common.data.reactor.ReactorType
Record Components:
casing - The majority of the reactor is made of casing blocks. These are the blocks that form the cross on the first and third layer, and the corners of the second layer.
catalyst - The catalyst blocks are in the lower four corners of the structure.
palettes - A map of block palettes to use when generating the tower.
layers - Definitions for the different layers of the tower.
decorator - Optional decorator for blocks placed on the floor of the tower.
mobs - Optional mob spawning logic.
loot - Optional loot tables to generate all over the tower.

public record ReactorType(ReactorPiece casing, ReactorPiece catalyst, Map<String, net.minecraft.util.random.WeightedList<net.minecraft.world.level.block.state.BlockState>> palettes, List<ReactorLayer> layers, Optional<ReactorDecorator> decorator, Optional<ReactorMobs> mobs, Optional<ReactorLoot> loot) extends Record
Defines a type of dimensional reactor. All reactor types use the same core block and use different casing/catalyst combinations to select which tower generates.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<ReactorType>
     
    static final com.mojang.serialization.Codec<Map<String, net.minecraft.util.random.WeightedList<net.minecraft.world.level.block.state.BlockState>>>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ReactorType(ReactorPiece casing, ReactorPiece catalyst, Map<String, net.minecraft.util.random.WeightedList<net.minecraft.world.level.block.state.BlockState>> palettes, List<ReactorLayer> layers, Optional<ReactorDecorator> decorator, Optional<ReactorMobs> mobs, Optional<ReactorLoot> loot)
    Creates an instance of a ReactorType record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the casing record component.
    Returns the value of the catalyst record component.
    Returns the value of the decorator record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    static @Nullable ReactorType
    findById(net.minecraft.server.level.ServerLevel level, net.minecraft.resources.Identifier id)
    Searches for a reactor type by its ID.
    static @Nullable ReactorType
    findType(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos corePos)
    Attempts to find a matching reactor type for the current core multiblock structure.
    int
    Gets the radius for the floor of the tower.
    int
    Determines the height of the new reactor tower.
    int
    Determines the largest radius of all layers, including the decorator layer.
    static @Nullable net.minecraft.network.chat.Component
    getReasonNotToGenerate(net.minecraft.server.level.ServerLevel level, @Nullable ReactorType actType, net.minecraft.core.BlockPos pos)
    Determines if the reactor is unable to generate, and provides a reason.
    final int
    Returns a hash code value for this object.
    boolean
    isObstructed(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos reactorCorePos)
    Checks if the tower itself would be obstructed.
    Returns the value of the layers record component.
    Returns the value of the loot record component.
    boolean
    matches(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos.MutableBlockPos cursor)
    Checks if a given position has a valid reactor multiblock structure to activate this reactor type.
    Returns the value of the mobs record component.
    Map<String, net.minecraft.util.random.WeightedList<net.minecraft.world.level.block.state.BlockState>>
    Returns the value of the palettes record component.
    void
    place(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos reactorCorePos)
    Places the reactor type into the world.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • PALETTES_CODEC

      public static final com.mojang.serialization.Codec<Map<String, net.minecraft.util.random.WeightedList<net.minecraft.world.level.block.state.BlockState>>> PALETTES_CODEC
    • CODEC

      public static final com.mojang.serialization.Codec<ReactorType> CODEC
  • Constructor Details

  • Method Details

    • findType

      public static @Nullable ReactorType findType(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos corePos)
      Attempts to find a matching reactor type for the current core multiblock structure.
      Parameters:
      level - The current server-side level.
      corePos - The position of the core.
      Returns:
      The first ReactorType that matches, or none.
    • findById

      public static @Nullable ReactorType findById(net.minecraft.server.level.ServerLevel level, net.minecraft.resources.Identifier id)
      Searches for a reactor type by its ID.
      Parameters:
      level - The level the tower would be in, this provides the registry.
      id - The ID to search up.
      Returns:
      The type associated with the ID.
    • getReasonNotToGenerate

      public static @Nullable net.minecraft.network.chat.Component getReasonNotToGenerate(net.minecraft.server.level.ServerLevel level, @Nullable ReactorType actType, net.minecraft.core.BlockPos pos)
      Determines if the reactor is unable to generate, and provides a reason.
      Parameters:
      level - The level to generate the tower in.
      actType - The type of reactor.
      pos - The position of the reactor core.
      Returns:
      The reason the reactor could not generate. If this is null, the tower is allowed to generate.
    • matches

      public boolean matches(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos.MutableBlockPos cursor)
      Checks if a given position has a valid reactor multiblock structure to activate this reactor type.
      Parameters:
      level - The server level to check within.
      cursor - A mutable position pointing to the reactor core position.
      Returns:
      True if the reactor type is valid for the current multiblock structure.
    • place

      public void place(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos reactorCorePos)
      Places the reactor type into the world.
      Parameters:
      level - The server level to summon the reactor tower in.
      reactorCorePos - The position of the reactor core.
    • isObstructed

      public boolean isObstructed(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos reactorCorePos)
      Checks if the tower itself would be obstructed.
      Parameters:
      level - The level to try and generate the tower in.
      reactorCorePos - The position of the reactor core.
      Returns:
      If there are blocks in the way this will return true.
    • getHeight

      public int getHeight()
      Determines the height of the new reactor tower.
      Returns:
      The height of all layers combined.
    • getLargestRadius

      public int getLargestRadius()
      Determines the largest radius of all layers, including the decorator layer.
      Returns:
      The largest radius of the generated tower.
    • getFloorRadius

      public int getFloorRadius()
      Gets the radius for the floor of the tower.
      Returns:
      The radius of the tower floor.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • casing

      public ReactorPiece casing()
      Returns the value of the casing record component.
      Returns:
      the value of the casing record component
    • catalyst

      public ReactorPiece catalyst()
      Returns the value of the catalyst record component.
      Returns:
      the value of the catalyst record component
    • palettes

      public Map<String, net.minecraft.util.random.WeightedList<net.minecraft.world.level.block.state.BlockState>> palettes()
      Returns the value of the palettes record component.
      Returns:
      the value of the palettes record component
    • layers

      public List<ReactorLayer> layers()
      Returns the value of the layers record component.
      Returns:
      the value of the layers record component
    • decorator

      public Optional<ReactorDecorator> decorator()
      Returns the value of the decorator record component.
      Returns:
      the value of the decorator record component
    • mobs

      public Optional<ReactorMobs> mobs()
      Returns the value of the mobs record component.
      Returns:
      the value of the mobs record component
    • loot

      public Optional<ReactorLoot> loot()
      Returns the value of the loot record component.
      Returns:
      the value of the loot record component