Interface IAspect<V extends IValue,T extends IValueType<V>>
- Type Parameters:
V
- The value type.T
- The value type type.
- All Known Subinterfaces:
IAspectRead<V,
,T> IAspectWrite<V,
T>
- All Known Implementing Classes:
AspectBase
,AspectReadBase
,AspectWriteBase
public interface IAspect<V extends IValue,T extends IValueType<V>>
An element that can be used inside parts to access a specific aspect of something to read/write.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Use this comparator for any comparisons with aspects. -
Method Summary
Modifier and TypeMethodDescription<P extends IPartType<P,
S>, S extends IPartState<P>>
IAspectPropertiesgetProperties
(P partType, PartTarget target, S state) Get the current properties of this aspect in the given part.net.minecraft.world.MenuProvider
This will only be called if this aspect has properties.These are the properties that are supported for this aspect.net.minecraft.resources.ResourceLocation
<P extends IPartType<P,
S>, S extends IPartState<P>>
booleanvoid
loadTooltip
(List<net.minecraft.network.chat.Component> lines, boolean appendOptionalInfo) Add tooltip lines for this aspect when hovered in a gui.<P extends IPartType<P,
S>, S extends IPartState<P>>
voidsetProperties
(P partType, PartTarget target, S state, IAspectProperties properties) Set the new properties of this aspect in the given part.<P extends IPartType<P,
S>, S extends IPartState<P>>
voidupdate
(INetwork network, IPartNetwork partNetwork, P partType, PartTarget target, S state) Called inside part types for updating a part on a block.
-
Method Details
-
getUniqueName
net.minecraft.resources.ResourceLocation getUniqueName()- Returns:
- The unique name for this aspecy, only used for internal storage.
-
getTranslationKey
String getTranslationKey()- Returns:
- The unique unlocalized name for this aspect.
-
loadTooltip
Add tooltip lines for this aspect when hovered in a gui.- Parameters:
lines
- The list to add lines to.appendOptionalInfo
- If shift-to-show info should be added.
-
getValueType
T getValueType()- Returns:
- The type of value this aspect can handle.
-
update
<P extends IPartType<P,S>, void updateS extends IPartState<P>> (INetwork network, IPartNetwork partNetwork, P partType, PartTarget target, S state) Called inside part types for updating a part on a block.- Type Parameters:
P
- The part type type.S
- The part state.- Parameters:
network
- The network to update in.partNetwork
- The part network to update in.partType
- The part type.target
- The position that is targeted by the given part.state
- The current state of the given part.
-
hasProperties
- Type Parameters:
P
- The part type typeS
- The part state type- Returns:
- If this aspect supports additional properties.
-
getProperties
<P extends IPartType<P,S>, IAspectProperties getPropertiesS extends IPartState<P>> (P partType, PartTarget target, S state) Get the current properties of this aspect in the given part.- Type Parameters:
P
- The part type type.S
- The part state.- Parameters:
partType
- The part type.target
- The position that is targeted by the given part.state
- The current state of the given part.- Returns:
- The current properties.
-
setProperties
<P extends IPartType<P,S>, void setPropertiesS extends IPartState<P>> (P partType, PartTarget target, S state, IAspectProperties properties) Set the new properties of this aspect in the given part.- Type Parameters:
P
- The part type type.S
- The part state.- Parameters:
partType
- The part type.target
- The position that is targeted by the given part.state
- The current state of the given part.properties
- The new properties.
-
getDefaultProperties
- Returns:
- The default properties for this aspect.
-
getPropertyTypes
Collection<IAspectPropertyTypeInstance> getPropertyTypes()These are the properties that are supported for this aspect. It is possible that some deprecated properties are available inside the retrieved properties, so use this to iterate over the values.- Returns:
- The types that are available for this aspect.
-
getPropertiesContainerProvider
This will only be called if this aspect has properties.- Parameters:
pos
- The part position.- Returns:
- The container type for the screen to configure the properties.
-