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
FieldsModifier and TypeFieldDescriptionstatic 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
ConstructorsConstructorDescriptionReactorType(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 aReactorTyperecord class. -
Method Summary
Modifier and TypeMethodDescriptioncasing()Returns the value of thecasingrecord component.catalyst()Returns the value of thecatalystrecord component.Returns the value of thedecoratorrecord component.final booleanIndicates whether some other object is "equal to" this one.static @Nullable ReactorTypefindById(net.minecraft.server.level.ServerLevel level, net.minecraft.resources.Identifier id) Searches for a reactor type by its ID.static @Nullable ReactorTypefindType(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos corePos) Attempts to find a matching reactor type for the current core multiblock structure.intGets the radius for the floor of the tower.intDetermines the height of the new reactor tower.intDetermines the largest radius of all layers, including the decorator layer.static @Nullable net.minecraft.network.chat.ComponentgetReasonNotToGenerate(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 inthashCode()Returns a hash code value for this object.booleanisObstructed(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos reactorCorePos) Checks if the tower itself would be obstructed.layers()Returns the value of thelayersrecord component.loot()Returns the value of thelootrecord component.booleanmatches(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.mobs()Returns the value of themobsrecord component.Map<String, net.minecraft.util.random.WeightedList<net.minecraft.world.level.block.state.BlockState>> palettes()Returns the value of thepalettesrecord component.voidplace(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos reactorCorePos) Places the reactor type into the world.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
PALETTES_CODEC
-
CODEC
-
-
Constructor Details
-
ReactorType
public 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 aReactorTyperecord class.- Parameters:
casing- the value for thecasingrecord componentcatalyst- the value for thecatalystrecord componentpalettes- the value for thepalettesrecord componentlayers- the value for thelayersrecord componentdecorator- the value for thedecoratorrecord componentmobs- the value for themobsrecord componentloot- the value for thelootrecord component
-
-
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
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
casing
-
catalyst
-
palettes
-
layers
-
decorator
-
mobs
-
loot
-