Enum Class ApplicableUpgradesDB
- All Implemented Interfaces:
Serializable,Comparable<ApplicableUpgradesDB>,Constable,IUpgradeRegistry
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>Nested classes/interfaces inherited from interface me.desht.pneumaticcraft.api.upgrade.IUpgradeRegistry
IUpgradeRegistry.Builder -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionvoidaddApplicableUpgrades(net.minecraft.world.entity.EntityType<?> type, IUpgradeRegistry.Builder builder) Register the given upgrade builder with the given entity type.voidaddApplicableUpgrades(net.minecraft.world.item.Item item, IUpgradeRegistry.Builder builder) Register the given upgrade builder with the given item.voidaddApplicableUpgrades(net.minecraft.world.level.block.entity.BlockEntityType<?> type, IUpgradeRegistry.Builder builder) Register the given upgrade builder with the given block entity type.voidaddUpgradeTooltip(PNCUpgrade upgrade, List<net.minecraft.network.chat.Component> tooltip) Convenience method which adds a list of the items which accept the given upgrade to the upgrade item's tooltip.getApplicableUpgrades(net.minecraft.world.entity.Entity e) getApplicableUpgrades(net.minecraft.world.item.Item item) getApplicableUpgrades(net.minecraft.world.level.block.entity.BlockEntity te) static ApplicableUpgradesDBnet.minecraft.resources.ResourceLocationgetItemRegistryName(PNCUpgrade upgrade, int tier) Get the registry name for the corresponding item for this upgrade, given a tier.Collection<net.minecraft.world.item.Item>getItemsWhichAccept(PNCUpgrade upgrade) Retrieve an unmodifiable collection of all known registered upgrade objectsintgetMaxUpgrades(net.minecraft.world.entity.Entity entity, PNCUpgrade upgrade) Get the maximum number of upgrades of the given type accepted by the given entityintgetMaxUpgrades(net.minecraft.world.item.Item item, PNCUpgrade upgrade) Get the maximum number of upgrades of the given type accepted by the given block entityintgetMaxUpgrades(net.minecraft.world.level.block.entity.BlockEntity te, PNCUpgrade upgrade) Get the maximum number of upgrades of the given type accepted by the given block entitygetUpgradeById(net.minecraft.resources.ResourceLocation upgradeId) Retrieve an upgrade by its IDintgetUpgradeCount(net.minecraft.world.item.ItemStack stack, PNCUpgrade upgrade) Helper method to get the number of the given upgrade which is installed in the given itemstack.getUpgradesInItem(net.minecraft.world.item.ItemStack stack) Helper method to get all the upgrades currently installed in the given itemstacknet.minecraft.world.item.ItemmakeUpgradeItem(PNCUpgrade upgrade, int tier) Convenience method to create an Item implementing theIUpgradeIteminterface, which can be used as a PneumaticCraft upgrade.net.minecraft.world.item.ItemmakeUpgradeItem(PNCUpgrade upgrade, int tier, net.minecraft.world.item.Item.Properties properties) Same asIUpgradeRegistry.makeUpgradeItem(PNCUpgrade, int)but allows a custom item properties object to be supplied for use when theItemis created.registerUpgrade(net.minecraft.resources.ResourceLocation id, int maxTier, String... depModIds) Register an upgrade.static ApplicableUpgradesDBReturns the enum constant of this class with the specified name.static ApplicableUpgradesDB[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfMethods inherited from interface me.desht.pneumaticcraft.api.upgrade.IUpgradeRegistry
getAllUpgrades, registerUpgrade
-
Enum Constant Details
-
INSTANCE
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getInstance
-
addApplicableUpgrades
public void addApplicableUpgrades(net.minecraft.world.level.block.entity.BlockEntityType<?> type, IUpgradeRegistry.Builder builder) Description copied from interface:IUpgradeRegistryRegister the given upgrade builder with the given block entity type. Note that the upgrades in the given builder will overwrite and/or augment any upgrades already registered for the block entity.- Specified by:
addApplicableUpgradesin interfaceIUpgradeRegistry- Parameters:
type- the block entity typebuilder- the builder helper object
-
addApplicableUpgrades
public void addApplicableUpgrades(net.minecraft.world.entity.EntityType<?> type, IUpgradeRegistry.Builder builder) Description copied from interface:IUpgradeRegistryRegister the given upgrade builder with the given entity type. Note that the upgrades in the given builder will overwrite and/or augment any upgrades already registered for the entity.- Specified by:
addApplicableUpgradesin interfaceIUpgradeRegistry- Parameters:
type- the entity typebuilder- the builder helper object
-
addApplicableUpgrades
public void addApplicableUpgrades(net.minecraft.world.item.Item item, IUpgradeRegistry.Builder builder) Description copied from interface:IUpgradeRegistryRegister the given upgrade builder with the given item. Note that the upgrades in the given builder will overwrite and/or augment any upgrades already registered for the item.- Specified by:
addApplicableUpgradesin interfaceIUpgradeRegistry- Parameters:
item- the itembuilder- the builder helper object
-
getMaxUpgrades
public int getMaxUpgrades(net.minecraft.world.level.block.entity.BlockEntity te, PNCUpgrade upgrade) Description copied from interface:IUpgradeRegistryGet the maximum number of upgrades of the given type accepted by the given block entity- Specified by:
getMaxUpgradesin interfaceIUpgradeRegistry- Parameters:
te- the block entityupgrade- the upgrade to check- Returns:
- maximum number of that upgrade which can be installed
-
getMaxUpgrades
Description copied from interface:IUpgradeRegistryGet the maximum number of upgrades of the given type accepted by the given entity- Specified by:
getMaxUpgradesin interfaceIUpgradeRegistry- Parameters:
entity- the entityupgrade- the upgrade to check- Returns:
- maximum number of that upgrade which can be installed
-
getMaxUpgrades
Description copied from interface:IUpgradeRegistryGet the maximum number of upgrades of the given type accepted by the given block entity- Specified by:
getMaxUpgradesin interfaceIUpgradeRegistry- Parameters:
item- the itemupgrade- the upgrade to check- Returns:
- maximum number of that upgrade which can be installed
-
addUpgradeTooltip
public void addUpgradeTooltip(PNCUpgrade upgrade, List<net.minecraft.network.chat.Component> tooltip) Description copied from interface:IUpgradeRegistryConvenience method which adds a list of the items which accept the given upgrade to the upgrade item's tooltip. This list is intended to be displayed while Shift is held down while hovering over the upgrade item, and will scroll if larger than 12 lines.This is automatically used by custom upgrades created via
IUpgradeRegistry.makeUpgradeItem(PNCUpgrade, int). You can also call this yourself on the client only for custom upgrades that you create (i.e. items which implementIUpgradeItem).- Specified by:
addUpgradeTooltipin interfaceIUpgradeRegistry- Parameters:
upgrade- the upgradetooltip- the tooltip to append to
-
registerUpgrade
public PNCUpgrade registerUpgrade(net.minecraft.resources.ResourceLocation id, int maxTier, String... depModIds) Description copied from interface:IUpgradeRegistryRegister an upgrade. Note: this is a not a Forge or Minecraft registry object. It's OK to register upgrades during item registration, i.e. when you register your upgrade item(s).- Specified by:
registerUpgradein interfaceIUpgradeRegistry- Parameters:
id- the unique upgrade IDmaxTier- the maximum tier of this upgradedepModIds- zero or more mod ID which must be present for this upgrade to be relevant- Returns:
- an upgrade object
-
getUpgradeById
Description copied from interface:IUpgradeRegistryRetrieve an upgrade by its ID- Specified by:
getUpgradeByIdin interfaceIUpgradeRegistry- Parameters:
upgradeId- the upgrade ID, as used to register id- Returns:
- the registered upgrade, or null if the id is not known
-
getKnownUpgrades
Description copied from interface:IUpgradeRegistryRetrieve an unmodifiable collection of all known registered upgrade objects- Specified by:
getKnownUpgradesin interfaceIUpgradeRegistry- Returns:
- all known upgrades
-
makeUpgradeItem
Description copied from interface:IUpgradeRegistryConvenience method to create an Item implementing theIUpgradeIteminterface, which can be used as a PneumaticCraft upgrade. This item has the default PneumaticCraft tooltip behaviour in thatIUpgradeRegistry.addUpgradeTooltip(PNCUpgrade, List)is called when Shift is held while hovering over the item.You can use this method when registering upgrade items as an alternative to creating an Item which implements
IUpgradeItemyourself.The item created by this method will be in the PneumaticCraft creative tab and have no other special item properties; see
IUpgradeRegistry.makeUpgradeItem(PNCUpgrade, int, Item.Properties)if you need custom behaviour here.- Specified by:
makeUpgradeItemin interfaceIUpgradeRegistry- Parameters:
upgrade- the upgrade object, as returned byIUpgradeRegistry.registerUpgrade(ResourceLocation)tier- upgrade tier of this item- Returns:
- an item, which should be registered in the usual way
-
makeUpgradeItem
public net.minecraft.world.item.Item makeUpgradeItem(PNCUpgrade upgrade, int tier, net.minecraft.world.item.Item.Properties properties) Description copied from interface:IUpgradeRegistrySame asIUpgradeRegistry.makeUpgradeItem(PNCUpgrade, int)but allows a custom item properties object to be supplied for use when theItemis created.- Specified by:
makeUpgradeItemin interfaceIUpgradeRegistry- Parameters:
upgrade- a supplier for the upgrade object, which will not yet be registeredtier- upgrade tier of this itemproperties- an item properties object- Returns:
- an item, which should be registered in the usual way
-
getUpgradeCount
Description copied from interface:IUpgradeRegistryHelper method to get the number of the given upgrade which is installed in the given itemstack.- Specified by:
getUpgradeCountin interfaceIUpgradeRegistry- Parameters:
stack- the item holding the upgradesupgrade- the upgrade to check for- Returns:
- the number of that upgrade installed in the item
-
getUpgradesInItem
Description copied from interface:IUpgradeRegistryHelper method to get all the upgrades currently installed in the given itemstack- Specified by:
getUpgradesInItemin interfaceIUpgradeRegistry- Parameters:
stack- the item holding the upgrades- Returns:
- an immutable map of (upgrade->count)
-
getItemRegistryName
Description copied from interface:IUpgradeRegistryGet the registry name for the corresponding item for this upgrade, given a tier. Do not use this before the upgrade itself has been registered!The default naming strategy is to take the upgrade's registry name and simply append "_upgrade" to it (along with the tier number if it's a multitier upgrade). You can override this strategy by extending this class and overriding this method if you need to.
- Specified by:
getItemRegistryNamein interfaceIUpgradeRegistry- Parameters:
upgrade- the upgrade in questiontier- tier of the upgrade (ignored if the upgrade has only one tier)- Returns:
- an item registry name
-
getItemsWhichAccept
-
getApplicableUpgrades
public Map<PNCUpgrade,Integer> getApplicableUpgrades(net.minecraft.world.level.block.entity.BlockEntity te) -
getApplicableUpgrades
-
getApplicableUpgrades
-