接口 IAttachmentHolder
- 所有已知实现类:
AbstractArrow
,AbstractBoat
,AbstractChestBoat
,AbstractChestedHorse
,AbstractCow
,AbstractFish
,AbstractFurnaceBlockEntity
,AbstractGolem
,AbstractHorse
,AbstractHurtingProjectile
,AbstractIllager
,AbstractMinecart
,AbstractMinecartContainer
,AbstractPiglin
,AbstractSchoolingFish
,AbstractSkeleton
,AbstractThrownPotion
,AbstractVillager
,AbstractWindCharge
,AgeableMob
,AgeableWaterCreature
,Allay
,AmbientCreature
,Animal
,AreaEffectCloud
,Armadillo
,ArmorStand
,Arrow
,AttachmentHolder
,AttachmentHolder.AsField
,Axolotl
,BannerBlockEntity
,BarrelBlockEntity
,BaseContainerBlockEntity
,Bat
,BeaconBlockEntity
,BedBlockEntity
,Bee
,BeehiveBlockEntity
,BellBlockEntity
,BlastFurnaceBlockEntity
,Blaze
,BlockAttachedEntity
,BlockEntity
,BlockPropertyTests.LightBlockEntity
,Boat
,Bogged
,Breeze
,BreezeWindCharge
,BrewingStandBlockEntity
,BrushableBlockEntity
,CalibratedSculkSensorBlockEntity
,Camel
,CampfireBlockEntity
,Cat
,CaveSpider
,ChestBlockEntity
,ChestBoat
,ChestRaft
,Chicken
,ChiseledBookShelfBlockEntity
,ChunkAccess
,Cod
,CommandBlockEntity
,ComparatorBlockEntity
,ConduitBlockEntity
,Cow
,CrafterBlockEntity
,Creaking
,CreakingHeartBlockEntity
,Creeper
,CustomHeadTest.CustomSkullBlockEntity
,CustomItemDisplayContextTest.ItemHangerBlockEntity
,CustomSignsTest.CustomHangingSignBlockEntity
,CustomSignsTest.CustomSignBlockEntity
,DaylightDetectorBlockEntity
,DecoratedPotBlockEntity
,DispenserBlockEntity
,Display
,Display.BlockDisplay
,Display.ItemDisplay
,Display.TextDisplay
,Dolphin
,Donkey
,DragonFireball
,DropperBlockEntity
,Drowned
,ElderGuardian
,EmptyLevelChunk
,EnchantingTableBlockEntity
,EndCrystal
,EnderChestBlockEntity
,EnderDragon
,EnderDragonPart
,EnderMan
,Endermite
,Entity
,EntityDataSerializerTest.TestEntity
,EntityRendererEventsTest.MyEntity
,EntityTests.AdaptedSpawnEntity
,EntityTests.CustomComplexSpawnEntity
,EntityTests.SimpleEntity
,Evoker
,EvokerFangs
,ExperienceOrb
,EyeOfEnder
,FakePlayer
,FallingBlockEntity
,Fireball
,FireworkRocketEntity
,FishingHook
,Fox
,Frog
,FullPotsAccessorDemo.DioriteFlowerPotBlockEntity
,FurnaceBlockEntity
,GameTestPlayer
,Ghast
,Giant
,GlowItemFrame
,GlowSquid
,Goat
,Guardian
,HangingEntity
,HangingSignBlockEntity
,HappyGhast
,Hoglin
,HopperBlockEntity
,Horse
,Husk
,Illusioner
,ImposterProtoChunk
,Interaction
,IronGolem
,ItemEntity
,ItemFrame
,JigsawBlockEntity
,JukeboxBlockEntity
,LargeFireball
,LeashFenceKnotEntity
,LecternBlockEntity
,Level
,LevelChunk
,LightningBolt
,LivingEntity
,Llama
,LlamaSpit
,MagmaCube
,Marker
,MegaModelTest.TestBlock.Entity
,Minecart
,MinecartChest
,MinecartCommandBlock
,MinecartFurnace
,MinecartHopper
,MinecartSpawner
,MinecartTNT
,Mob
,Monster
,Mule
,MushroomCow
,Ocelot
,OminousItemSpawner
,Painting
,Panda
,Parrot
,PartEntity
,PartEntityTest.TestEntity
,PartEntityTest.TestEntityPart
,PathfinderMob
,PatrollingMonster
,Phantom
,Pig
,Piglin
,PiglinBrute
,Pillager
,PistonMovingBlockEntity
,Player
,PolarBear
,PrimedTnt
,Projectile
,ProtoChunk
,Pufferfish
,Rabbit
,Raft
,Raider
,RandomizableContainerBlockEntity
,Ravager
,Salmon
,SculkCatalystBlockEntity
,SculkSensorBlockEntity
,SculkShriekerBlockEntity
,ServerLevel
,ServerPlayer
,Sheep
,ShoulderRidingEntity
,Shulker
,ShulkerBoxBlockEntity
,ShulkerBullet
,SignBlockEntity
,Silverfish
,Skeleton
,SkeletonHorse
,SkullBlockEntity
,Slime
,SmallFireball
,SmokerBlockEntity
,Sniffer
,Snowball
,SnowGolem
,SpawnerBlockEntity
,SpectralArrow
,SpellcasterIllager
,Spider
,Squid
,Stray
,Strider
,StructureBlockEntity
,Tadpole
,TamableAnimal
,TestBlockEntity
,TestInstanceBlockEntity
,TheEndGatewayBlockEntity
,TheEndPortalBlockEntity
,ThrowableItemProjectile
,ThrowableProjectile
,ThrownEgg
,ThrownEnderpearl
,ThrownExperienceBottle
,ThrownLingeringPotion
,ThrownSplashPotion
,ThrownTrident
,TraderLlama
,TrappedChestBlockEntity
,TrialSpawnerBlockEntity
,TropicalFish
,Turtle
,VaultBlockEntity
,VehicleEntity
,Vex
,Villager
,Vindicator
,WanderingTrader
,Warden
,WaterAnimal
,WindCharge
,Witch
,WitherBoss
,WitherSkeleton
,WitherSkull
,Wolf
,Zoglin
,Zombie
,ZombieHorse
,ZombieVillager
,ZombifiedPiglin
public interface IAttachmentHolder
An object that can hold data attachments.
-
方法概要
修饰符和类型方法说明default <T> T
getData
(Supplier<AttachmentType<T>> type) 返回 the data attachment of the given type。<T> T
getData
(AttachmentType<T> type) 返回 the data attachment of the given type。default <T> Optional
<T> getExistingData
(Supplier<AttachmentType<T>> type) 返回 an optional possibly containing a data attachment value of the given type。default <T> Optional
<T> getExistingData
(AttachmentType<T> type) 返回 an optional possibly containing a data attachment value of the given type。default <T> T
getExistingDataOrNull
(Supplier<AttachmentType<T>> type) <T> T
getExistingDataOrNull
(AttachmentType<T> type) boolean
Returnstrue
if there is any data attachments,false
otherwise.default <T> boolean
hasData
(Supplier<AttachmentType<T>> type) Returnstrue
if there is a data attachment of the give type,false
otherwise.boolean
hasData
(AttachmentType<?> type) Returnstrue
if there is a data attachment of the give type,false
otherwise.default <T> T
removeData
(Supplier<AttachmentType<T>> type) Removes the data attachment of the given type.<T> T
removeData
(AttachmentType<T> type) Removes the data attachment of the given type.default <T> T
setData
(Supplier<AttachmentType<T>> type, T data) Sets the data attachment of the given type.<T> T
setData
(AttachmentType<T> type, T data) Sets the data attachment of the given type.
-
方法详细资料
-
hasAttachments
boolean hasAttachments()Returnstrue
if there is any data attachments,false
otherwise. -
hasData
Returnstrue
if there is a data attachment of the give type,false
otherwise. -
hasData
Returnstrue
if there is a data attachment of the give type,false
otherwise. -
getData
返回 the data attachment of the given type。If there is no data attachment of the given type, the default value is stored in this holder and returned.
- 返回:
- the data attachment of the given type
-
getData
返回 the data attachment of the given type。If there is no data attachment of the given type, the default value is stored in this holder and returned.
- 返回:
- the data attachment of the given type
-
getExistingData
返回 an optional possibly containing a data attachment value of the given type。If there is no data attachment of the given type, an empty optional is returned.
- 返回:
- an optional possibly containing a data attachment value of the given type
-
getExistingData
返回 an optional possibly containing a data attachment value of the given type。If there is no data attachment of the given type, an empty optional is returned.
- 返回:
- an optional possibly containing a data attachment value of the given type
-
getExistingDataOrNull
- 返回:
- an existing data attachment value of the given type, or null if there is no data attachment of the given type
-
getExistingDataOrNull
- 返回:
- an existing data attachment value of the given type, or null if there is no data attachment of the given type
-
setData
Sets the data attachment of the given type.- 返回:
- the previous value for that attachment type, if any, or
null
if there was none
-
setData
Sets the data attachment of the given type.- 返回:
- the previous value for that attachment type, if any, or
null
if there was none
-
removeData
Removes the data attachment of the given type.- 返回:
- the previous value for that attachment type, if any, or
null
if there was none
-
removeData
Removes the data attachment of the given type.- 返回:
- the previous value for that attachment type, if any, or
null
if there was none
-