Record Class CapItemMediaHolder
java.lang.Object
java.lang.Record
at.petrak.hexcasting.forge.cap.adimpl.CapItemMediaHolder
- All Implemented Interfaces:
at.petrak.hexcasting.api.addldata.ADMediaHolder
public record CapItemMediaHolder(at.petrak.hexcasting.api.item.MediaHolderItem holder, net.minecraft.world.item.ItemStack stack)
extends Record
implements at.petrak.hexcasting.api.addldata.ADMediaHolder
Things that read/write media amounts from an itemstack
-
Field Summary
Fields inherited from interface at.petrak.hexcasting.api.addldata.ADMediaHolder
AMETHYST_DUST_PRIORITY, AMETHYST_SHARD_PRIORITY, BATTERY_PRIORITY, CHARGED_AMETHYST_PRIORITY, QUENCHED_ALLAY_PRIORITY, QUENCHED_SHARD_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionCapItemMediaHolder(at.petrak.hexcasting.api.item.MediaHolderItem holder, net.minecraft.world.item.ItemStack stack) Creates an instance of aCapItemMediaHolderrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanbooleanfinal booleanIndicates whether some other object is "equal to" this one.intlonglonggetMedia()final inthashCode()Returns a hash code value for this object.at.petrak.hexcasting.api.item.MediaHolderItemholder()Returns the value of theholderrecord component.longinsertMedia(long amount, boolean simulate) voidsetMedia(long media) net.minecraft.world.item.ItemStackstack()Returns the value of thestackrecord component.final StringtoString()Returns a string representation of this record class.longwithdrawMedia(long cost, boolean simulate)
-
Constructor Details
-
CapItemMediaHolder
public CapItemMediaHolder(at.petrak.hexcasting.api.item.MediaHolderItem holder, net.minecraft.world.item.ItemStack stack) Creates an instance of aCapItemMediaHolderrecord class.- Parameters:
holder- the value for theholderrecord componentstack- the value for thestackrecord component
-
-
Method Details
-
getMedia
public long getMedia()- Specified by:
getMediain interfaceat.petrak.hexcasting.api.addldata.ADMediaHolder
-
getMaxMedia
public long getMaxMedia()- Specified by:
getMaxMediain interfaceat.petrak.hexcasting.api.addldata.ADMediaHolder
-
setMedia
public void setMedia(long media) - Specified by:
setMediain interfaceat.petrak.hexcasting.api.addldata.ADMediaHolder
-
canRecharge
public boolean canRecharge()- Specified by:
canRechargein interfaceat.petrak.hexcasting.api.addldata.ADMediaHolder
-
canProvide
public boolean canProvide()- Specified by:
canProvidein interfaceat.petrak.hexcasting.api.addldata.ADMediaHolder
-
getConsumptionPriority
public int getConsumptionPriority()- Specified by:
getConsumptionPriorityin interfaceat.petrak.hexcasting.api.addldata.ADMediaHolder
-
canConstructBattery
public boolean canConstructBattery()- Specified by:
canConstructBatteryin interfaceat.petrak.hexcasting.api.addldata.ADMediaHolder
-
withdrawMedia
public long withdrawMedia(long cost, boolean simulate) - Specified by:
withdrawMediain interfaceat.petrak.hexcasting.api.addldata.ADMediaHolder
-
insertMedia
public long insertMedia(long amount, boolean simulate) - Specified by:
insertMediain interfaceat.petrak.hexcasting.api.addldata.ADMediaHolder
-
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. -
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. -
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). -
holder
public at.petrak.hexcasting.api.item.MediaHolderItem holder()Returns the value of theholderrecord component.- Returns:
- the value of the
holderrecord component
-
stack
public net.minecraft.world.item.ItemStack stack()Returns the value of thestackrecord component.- Returns:
- the value of the
stackrecord component
-