Package software.bluelib.mixin.variant
Class LivingEntityMixin
java.lang.Object
software.bluelib.mixin.variant.LivingEntityMixin
- All Implemented Interfaces:
IVariantAccessor
A
public Mixin class that injects functionality into the LivingEntity class to
provide variant management support within the BlueLib framework.
This mixin adds functionality to define, save, and retrieve an entity's variant information
using NBT (Named Binary Tag) data. It implements the IVariantAccessor interface, which
allows setting and getting the variant name of a LivingEntity.
Key Methods:
bluelib$setVariantName(String)- Sets the variant name of the entity.bluelib$getVariantName()- Retrieves the variant name of the entity.
- Since:
- 1.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAdditionalSaveData(@NotNull net.minecraft.nbt.CompoundTag pCompound, org.spongepowered.asm.mixin.injection.callback.CallbackInfo pCi) Apublic voidthat injects into theaddAdditionalSaveDatamethod ofLivingEntityto store the entity's variant in NBT data when saving the entity.ApublicStringmethod that retrieves the entity's current variant name.voidbluelib$setVariantName(String pName) Apublic voidmethod that sets the entity's variant name.protected voiddefineSynchedData(@NotNull net.minecraft.network.syncher.SynchedEntityData.Builder pBuilder, org.spongepowered.asm.mixin.injection.callback.CallbackInfo pCi) Apublic voidthat injects into thedefineSynchedDatamethod ofLivingEntityto define the synchronized data that will hold the entity's variant information.ApublicStringmethod that retrieves the variant name of the entity.voidreadAdditionalSaveData(@NotNull net.minecraft.nbt.CompoundTag pCompound, org.spongepowered.asm.mixin.injection.callback.CallbackInfo pCi) Apublic voidthat injects into thereadAdditionalSaveDatamethod ofLivingEntityto read the entity's variant from NBT data when loading the entity.voidsetEntityVariantName(String pVariantName) Apublic voidmethod that sets the variant name of the entity.
-
Constructor Details
-
LivingEntityMixin
public LivingEntityMixin()
-
-
Method Details
-
defineSynchedData
protected void defineSynchedData(@NotNull net.minecraft.network.syncher.SynchedEntityData.Builder pBuilder, org.spongepowered.asm.mixin.injection.callback.CallbackInfo pCi) Apublic voidthat injects into thedefineSynchedDatamethod ofLivingEntityto define the synchronized data that will hold the entity's variant information.- Parameters:
pBuilder-SynchedEntityData.Builder- The builder to define entity data.pCi-CallbackInfo- Callback information for the injection process.- Since:
- 1.0.0
-
addAdditionalSaveData
public void addAdditionalSaveData(@NotNull @NotNull net.minecraft.nbt.CompoundTag pCompound, org.spongepowered.asm.mixin.injection.callback.CallbackInfo pCi) Apublic voidthat injects into theaddAdditionalSaveDatamethod ofLivingEntityto store the entity's variant in NBT data when saving the entity.- Parameters:
pCompound-CompoundTag- The NBT tag to save the entity's variant information.pCi-CallbackInfo- Callback information for the injection process.- Since:
- 1.0.0
-
readAdditionalSaveData
public void readAdditionalSaveData(@NotNull @NotNull net.minecraft.nbt.CompoundTag pCompound, org.spongepowered.asm.mixin.injection.callback.CallbackInfo pCi) Apublic voidthat injects into thereadAdditionalSaveDatamethod ofLivingEntityto read the entity's variant from NBT data when loading the entity.- Parameters:
pCompound-CompoundTag- The NBT tag containing the entity's variant information.pCi-CallbackInfo- Callback information for the injection process.- Since:
- 1.0.0
-
bluelib$setVariantName
Apublic voidmethod that sets the entity's variant name.- Parameters:
pName-String- The variant name to assign to the entity.- Since:
- 1.0.0
-
bluelib$getVariantName
ApublicStringmethod that retrieves the entity's current variant name.- Returns:
- The current variant name of the entity as a
String. - Since:
- 1.0.0
-
setEntityVariantName
Apublic voidmethod that sets the variant name of the entity. This method overrides theIVariantAccessor.setEntityVariantName(String)interface method.- Specified by:
setEntityVariantNamein interfaceIVariantAccessor- Parameters:
pVariantName-String- The variant name to set for the entity.- Since:
- 1.0.0
-
getEntityVariantName
ApublicStringmethod that retrieves the variant name of the entity. This method overrides theIVariantAccessor.getEntityVariantName()interface method.- Specified by:
getEntityVariantNamein interfaceIVariantAccessor- Returns:
- The current variant name of the entity as a
String. - Since:
- 1.0.0
-