Record Class UpgradeDataProvider.Upgrade<R extends UpgradeSerialiser<?>>
java.lang.Object
java.lang.Record
dan200.computercraft.api.upgrades.UpgradeDataProvider.Upgrade<R>
- Type Parameters:
- R- The type of upgrade serialiser.
- Record Components:
- id- The ID for this upgrade.
- serialiser- The serialiser which reads and writes this upgrade.
- serialise- Augment the generated JSON with additional fields.
- Enclosing class:
- UpgradeDataProvider<T extends UpgradeBase,R extends UpgradeSerialiser<? extends T>> 
public static record UpgradeDataProvider.Upgrade<R extends UpgradeSerialiser<?>>(net.minecraft.resources.ResourceLocation id, R extends UpgradeSerialiser<?> serialiser, Consumer<com.google.gson.JsonObject> serialise)
extends Record
A constructed upgrade instance, produced 
UpgradeDataProvider.addUpgrades(Consumer).- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidadd(Consumer<UpgradeDataProvider.Upgrade<R>> add) Convenience method for registering an upgrade.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.net.minecraft.resources.ResourceLocationid()Returns the value of theidrecord component.requireMod(String modId) Return a newUpgradeDataProvider.Upgradewhich requires the given mod to be present.Consumer<com.google.gson.JsonObject>Returns the value of theserialiserecord component.Returns the value of theserialiserrecord component.final StringtoString()Returns a string representation of this record class.
- 
Constructor Details- 
Upgradepublic Upgrade(net.minecraft.resources.ResourceLocation id, R serialiser, Consumer<com.google.gson.JsonObject> serialise) Creates an instance of aUpgraderecord class.- Parameters:
- id- the value for the- idrecord component
- serialiser- the value for the- serialiserrecord component
- serialise- the value for the- serialiserecord component
 
 
- 
- 
Method Details- 
addConvenience method for registering an upgrade.- Parameters:
- add- The callback given to- UpgradeDataProvider.addUpgrades(Consumer)
 
- 
requireModReturn a newUpgradeDataProvider.Upgradewhich requires the given mod to be present.This uses mod-loader-specific hooks (Forge's crafting conditions and Fabric's resource conditions). If using this in a multi-loader setup, you must generate resources separately for the two loaders. - Parameters:
- modId- The id of the mod.
- Returns:
- A new upgrade instance.
 
- 
toStringReturns 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.
- 
hashCodepublic 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.
- 
equalsIndicates 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).
- 
idpublic net.minecraft.resources.ResourceLocation id()Returns the value of theidrecord component.- Returns:
- the value of the idrecord component
 
- 
serialiserReturns the value of theserialiserrecord component.- Returns:
- the value of the serialiserrecord component
 
- 
serialiseReturns the value of theserialiserecord component.- Returns:
- the value of the serialiserecord component
 
 
-