Interface MenschlichesWesen
- All Superinterfaces:
BefehlAbsender
,Berechtigtbar
,Beschaedigbar
,BestaendigeDatenInhaber
,InventarInhaber
,Lebewesen
,MerkmalInhaber
,MetadatenInhaber
,Nennbar
,ProjektilQuelle
,ServerBetreiber
,TierZaehmer
,Wesen
- All Known Subinterfaces:
Spieler
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Force-closes the currently open inventar view for this spieler, if any.boolean
Discover a rezept for this spieler such that it has not already been discovered.int
Discover a collection of recipes for this spieler such that they have not already been discovered.boolean
dropItem
(boolean dropAll) Make the wesen drop the item in their hand.fireworkBoost
(GegenstandsStapel fireworkGegenstandsStapel) Perform a firework boost.float
Gets the current cooldown for a spieler's attack.Gets the location of the bed the spieler is currently sleeping inint
getCooldown
(Material material) Get the cooldown time in ticks remaining for the specified material.Get an immutable set of recipes this wesen has discovered.int
Gets the spieler's current verzauberung seed.Get the spieler's EnderChest inventarfloat
Gets the players current exhaustion level.int
Get the total amount of experience required for the spieler to levelint
Gets the players current food levelGets this human's currentSpielModus
Get the spieler's inventar.Deprecated.Gets the item that the spieler is using (eating food, drawing back a bow, blocking, etc.)Returns the GegenstandsStapel currently on your cursor, can be empty.Gets the spieler's last death location.Gets the spieler's selected main handgetName()
Returns the name of this spielerGets the inventar view the spieler is currently viewing.int
Get the regeneration rate (1 health per x ticks) of the MenschlichesWesen when they have saturation and their food level is >= 20.float
Gets the players current saturation level.Deprecated.There are currently no well defined semantics regarding serialized entities in Eimmer.Deprecated.There are currently no well defined semantics regarding serialized entities in Eimmer.int
Get the sleep ticks of the spieler.int
Get the starvation rate (1 health per x ticks) of the MenschlichesWesen.int
Get the regeneration rate (1 health per x ticks) of the MenschlichesWesen when they have no saturation and their food level is >= 18.boolean
hasCooldown
(Material material) Check whether a cooldown is active on the specified material.boolean
Check whether or not this wesen has discovered the specified rezept.boolean
Check if the spieler is currently blocking (ie with a shield).boolean
Check if the spieler currently has their hand raised (ie about to begin blocking).openEnchanting
(Ort ort, boolean force) Opens an empty enchanting inventar window with the spieler's inventar on the bottom.openInventory
(Inventar inventar) Opens an inventar window with the specified inventar on the top and the spieler's inventar on the bottom.void
openInventory
(InventarAnsicht inventory) Opens an inventar window to the specified inventar view.openMerchant
(Kaufmann kaufmann, boolean force) Starts a trade between the spieler and the kaufmann.openMerchant
(Dorfbewohner trader, boolean force) Starts a trade between the spieler and the villager.openWorkbench
(Ort ort, boolean force) Opens an empty workbench inventar window with the spieler's inventar on the bottom.void
setCooldown
(Material material, int ticks) Set a cooldown on the specified material for a certain amount of ticks.void
setEnchantmentSeed
(int seed) Sets the spieler's verzauberung seed.void
setExhaustion
(float value) Sets the players current exhaustion levelvoid
setFoodLevel
(int value) Sets the players current food levelvoid
setGameMode
(SpielModus mode) Sets this human's currentSpielModus
void
Deprecated.Humans may now dual wield in their off hand, use explicit methods inSpielerInventar
.void
Sets the item to the given GegenstandsStapel, this will replace whatever the user was moving.void
setLastDeathLocation
(Ort ort) Sets the spieler's last death ort.void
setSaturatedRegenRate
(int ticks) Set the regeneration rate (1 health per x ticks) of the MenschlichesWesen when they have saturation and their food level is >= 20.void
setSaturation
(float value) Sets the players current saturation levelvoid
setShoulderEntityLeft
(Wesen wesen) Deprecated.There are currently no well defined semantics regarding serialized entities in Eimmer.void
setShoulderEntityRight
(Wesen wesen) Deprecated.There are currently no well defined semantics regarding serialized entities in Eimmer.void
setStarvationRate
(int ticks) Get the starvation rate (1 health per x ticks) of the MenschlichesWesen.void
setUnsaturatedRegenRate
(int ticks) Get the regeneration rate (1 health per x ticks) of the MenschlichesWesen when they have no saturation and their food level is >= 18.boolean
setWindowProperty
(InventarAnsicht.Property prop, int value) If the spieler currently has an inventar window open, this method will set a property of that window, such as the state of a progress bar.boolean
Attempts to make the wesen sleep at the given ort.boolean
Undiscover a rezept for this spieler such that it has already been discovered.int
Undiscover a collection of recipes for this spieler such that they have already been discovered.void
wakeup
(boolean setSpawnLocation) Causes the spieler to wakeup if they are currently sleeping.Methods inherited from interface de.eimmer.befehl.BefehlAbsender
sendMessage, sendMessage, sendMessage, sendMessage
Methods inherited from interface de.eimmer.berechtigungen.Berechtigtbar
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachment
Methods inherited from interface de.eimmer.wesen.Beschaedigbar
damage, damage, getAbsorptionAmount, getHealth, getMaxHealth, resetMaxHealth, setAbsorptionAmount, setHealth, setMaxHealth
Methods inherited from interface de.eimmer.bestaendigkeit.BestaendigeDatenInhaber
getPersistentDataContainer
Methods inherited from interface de.eimmer.wesen.Lebewesen
addPotionEffect, addPotionEffect, addPotionEffects, attack, canBreatheUnderwater, getActivePotionEffects, getArrowCooldown, getArrowsInBody, getCanPickupItems, getCategory, getCollidableExemptions, getDeathSound, getDrinkingSound, getEatingSound, getEquipment, getEyeHeight, getEyeHeight, getEyeLocation, getFallDamageSound, getFallDamageSoundBig, getFallDamageSoundSmall, getHurtSound, getKiller, getLastDamage, getLastTwoTargetBlocks, getLeashHolder, getLineOfSight, getMaximumAir, getMaximumNoDamageTicks, getMemory, getNoActionTicks, getNoDamageTicks, getPotionEffect, getRemainingAir, getRemoveWhenFarAway, getTargetBlock, getTargetBlockExact, getTargetBlockExact, hasAI, hasLineOfSight, hasPotionEffect, isClimbing, isCollidable, isGliding, isInvisible, isLeashed, isRiptiding, isSleeping, isSwimming, playHurtAnimation, rayTraceBlocks, rayTraceBlocks, removePotionEffect, setAI, setArrowCooldown, setArrowsInBody, setCanPickupItems, setCollidable, setGliding, setInvisible, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, setMemory, setNoActionTicks, setNoDamageTicks, setRemainingAir, setRemoveWhenFarAway, setSwimming, swingMainHand, swingOffHand
Methods inherited from interface de.eimmer.merkmal.MerkmalInhaber
getAttribute
Methods inherited from interface de.eimmer.metadaten.MetadatenInhaber
getMetadata, hasMetadata, removeMetadata, setMetadata
Methods inherited from interface de.eimmer.Nennbar
getCustomName, setCustomName
Methods inherited from interface de.eimmer.projektile.ProjektilQuelle
launchProjectile, launchProjectile
Methods inherited from interface de.eimmer.berechtigungen.ServerBetreiber
isOp, setOp
Methods inherited from interface de.eimmer.wesen.TierZaehmer
getUniqueId
Methods inherited from interface de.eimmer.wesen.Wesen
addPassenger, addScoreboardTag, copy, copy, createSnapshot, eject, getBoundingBox, getEntityId, getFacing, getFallDistance, getFireTicks, getFreezeTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getMaxFreezeTicks, getNearbyEntities, getPassenger, getPassengers, getPistonMoveReaction, getPortalCooldown, getPose, getScoreboardTags, getServer, getSpawnCategory, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTicksLived, getTrackedBy, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, hasGravity, isCustomNameVisible, isDead, isEmpty, isFrozen, isGlowing, isInsideVehicle, isInvulnerable, isInWater, isInWorld, isOnGround, isPersistent, isSilent, isValid, isVisibleByDefault, isVisualFire, leaveVehicle, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setFreezeTicks, setGlowing, setGravity, setInvulnerable, setLastDamageCause, setPassenger, setPersistent, setPortalCooldown, setRotation, setSilent, setTicksLived, setVelocity, setVisibleByDefault, setVisualFire, teleport, teleport, teleport, teleport
-
Method Details
-
getName
Returns the name of this spieler- Specified by:
getName
in interfaceBefehlAbsender
- Specified by:
getName
in interfaceTierZaehmer
- Returns:
- Spieler name
-
getInventory
Get the spieler's inventar.- Specified by:
getInventory
in interfaceInventarInhaber
- Returns:
- The inventar of the spieler, this also contains the armor slots.
-
getEnderChest
Get the spieler's EnderChest inventar- Returns:
- The EnderChest of the spieler
-
getMainHand
Gets the spieler's selected main hand- Returns:
- the players main hand
-
setWindowProperty
If the spieler currently has an inventar window open, this method will set a property of that window, such as the state of a progress bar.- Parameters:
prop
- The property.value
- The value to set the property to.- Returns:
- True if the property was successfully set.
-
getEnchantmentSeed
int getEnchantmentSeed()Gets the spieler's current verzauberung seed. The Seed is used to generate verzauberung options in the enchanting table for the spieler.- Returns:
- the spieler's verzauberung seed
-
setEnchantmentSeed
void setEnchantmentSeed(int seed) Sets the spieler's verzauberung seed. The Seed is used to generate verzauberung options in the enchanting table for the spieler.- Parameters:
seed
- the spieler's new verzauberung seed
-
getOpenInventory
Gets the inventar view the spieler is currently viewing. If they do not have an inventar window open, it returns their internal crafting view.- Returns:
- The inventar view.
-
openInventory
Opens an inventar window with the specified inventar on the top and the spieler's inventar on the bottom.- Parameters:
inventar
- The inventar to open- Returns:
- The newly opened inventar view
-
openWorkbench
Opens an empty workbench inventar window with the spieler's inventar on the bottom.- Parameters:
ort
- The ort to attach it to. If null, the spieler's ort is used.force
- If false, and there is no workbench block at the ort, no inventar will be opened and null will be returned.- Returns:
- The newly opened inventar view, or null if it could not be opened.
-
openEnchanting
Opens an empty enchanting inventar window with the spieler's inventar on the bottom.- Parameters:
ort
- The ort to attach it to. If null, the spieler's ort is used.force
- If false, and there is no enchanting table at the ort, no inventar will be opened and null will be returned.- Returns:
- The newly opened inventar view, or null if it could not be opened.
-
openInventory
Opens an inventar window to the specified inventar view.- Parameters:
inventory
- The view to open
-
openMerchant
Starts a trade between the spieler and the villager. Note that only one spieler may trade with a villager at once. You must use the force parameter for this.- Parameters:
trader
- The merchant to trade with. Cannot be null.force
- whether to force the trade even if another spieler is trading- Returns:
- The newly opened inventar view, or null if it could not be opened.
-
openMerchant
Starts a trade between the spieler and the kaufmann. Note that only one spieler may trade with a kaufmann at once. You must use the force parameter for this.- Parameters:
kaufmann
- The kaufmann to trade with. Cannot be null.force
- whether to force the trade even if another spieler is trading- Returns:
- The newly opened inventar view, or null if it could not be opened.
-
closeInventory
void closeInventory()Force-closes the currently open inventar view for this spieler, if any. -
getItemInHand
Deprecated.Humans may now dual wield in their off hand, use explicit methods inSpielerInventar
.Returns the GegenstandsStapel currently in your hand, can be empty.- Returns:
- The GegenstandsStapel of the item you are currently holding.
-
setItemInHand
Deprecated.Humans may now dual wield in their off hand, use explicit methods inSpielerInventar
.Sets the item to the given GegenstandsStapel, this will replace whatever the user was holding.- Parameters:
item
- The GegenstandsStapel which will end up in the hand
-
getItemOnCursor
Returns the GegenstandsStapel currently on your cursor, can be empty. Will always be empty if the spieler currently has no open window.- Returns:
- The GegenstandsStapel of the item you are currently moving around.
-
setItemOnCursor
Sets the item to the given GegenstandsStapel, this will replace whatever the user was moving. Will always be empty if the spieler currently has no open window.- Parameters:
item
- The GegenstandsStapel which will end up in the hand
-
hasCooldown
Check whether a cooldown is active on the specified material.- Parameters:
material
- the material to check- Returns:
- if a cooldown is active on the material
- Throws:
IllegalArgumentException
- if the material is not an item
-
getCooldown
Get the cooldown time in ticks remaining for the specified material.- Parameters:
material
- the material to check- Returns:
- the remaining cooldown time in ticks
- Throws:
IllegalArgumentException
- if the material is not an item
-
setCooldown
Set a cooldown on the specified material for a certain amount of ticks. ticks. 0 ticks will result in the removal of the cooldown.Cooldowns are used by the server for items such as ender pearls and shields to prevent them from being used repeatedly.
Note that cooldowns will not by themselves stop an item from being used for attacking.
- Parameters:
material
- the material to set the cooldown forticks
- the amount of ticks to set or 0 to remove- Throws:
IllegalArgumentException
- if the material is not an item
-
getSleepTicks
int getSleepTicks()Get the sleep ticks of the spieler. This value may be capped.- Returns:
- slumber ticks
-
sleep
Attempts to make the wesen sleep at the given ort.
The ort must be in the current welt and have a bed placed at the ort. The game may also enforce other requirements such as proximity to bed, monsters, and dimension type if force is not set.- Parameters:
ort
- the ort of the bedforce
- whether to try and sleep at the ort even if not normally possible- Returns:
- whether the sleep was successful
-
wakeup
void wakeup(boolean setSpawnLocation) Causes the spieler to wakeup if they are currently sleeping.- Parameters:
setSpawnLocation
- whether to set their spawn location to the bed they are currently sleeping in- Throws:
IllegalStateException
- if not sleeping
-
getBedLocation
Gets the location of the bed the spieler is currently sleeping in- Returns:
- location
- Throws:
IllegalStateException
- if not sleeping
-
getGameMode
Gets this human's currentSpielModus
- Returns:
- Current game mode
-
setGameMode
Sets this human's currentSpielModus
- Parameters:
mode
- New game mode
-
isBlocking
boolean isBlocking()Check if the spieler is currently blocking (ie with a shield).- Returns:
- Whether they are blocking.
-
isHandRaised
boolean isHandRaised()Check if the spieler currently has their hand raised (ie about to begin blocking).- Returns:
- Whether their hand is raised
-
getItemInUse
Gets the item that the spieler is using (eating food, drawing back a bow, blocking, etc.)- Returns:
- the item being used by the spieler, or null if they are not using an item
-
getExpToLevel
int getExpToLevel()Get the total amount of experience required for the spieler to level- Returns:
- Experience required to level up
-
getAttackCooldown
float getAttackCooldown()Gets the current cooldown for a spieler's attack. This is used to calculate damage, with 1.0 representing a fully charged attack and 0.0 representing a non-charged attack- Returns:
- A float between 0.0-1.0 representing the progress of the charge
-
discoverRecipe
Discover a rezept for this spieler such that it has not already been discovered. This method will add the key's associated rezept to the spieler's rezept book.- Parameters:
recipe
- the key of the rezept to discover- Returns:
- whether or not the rezept was newly discovered
-
discoverRecipes
Discover a collection of recipes for this spieler such that they have not already been discovered. This method will add the keys' associated recipes to the spieler's rezept book. If a rezept in the provided collection has already been discovered, it will be silently ignored.- Parameters:
recipes
- the keys of the recipes to discover- Returns:
- the amount of newly discovered recipes where 0 indicates that
none were newly discovered and a number equal to
recipes.size()
indicates that all were new
-
undiscoverRecipe
Undiscover a rezept for this spieler such that it has already been discovered. This method will remove the key's associated rezept from the spieler's rezept book.- Parameters:
recipe
- the key of the rezept to undiscover- Returns:
- whether or not the rezept was successfully undiscovered (i.e. it was previously discovered)
-
undiscoverRecipes
Undiscover a collection of recipes for this spieler such that they have already been discovered. This method will remove the keys' associated recipes from the spieler's rezept book. If a rezept in the provided collection has not yet been discovered, it will be silently ignored.- Parameters:
recipes
- the keys of the recipes to undiscover- Returns:
- the amount of undiscovered recipes where 0 indicates that none
were undiscovered and a number equal to
recipes.size()
indicates that all were undiscovered
-
hasDiscoveredRecipe
Check whether or not this wesen has discovered the specified rezept.- Parameters:
recipe
- the key of the rezept to check- Returns:
- true if discovered, false otherwise
-
getDiscoveredRecipes
Get an immutable set of recipes this wesen has discovered.- Returns:
- all discovered recipes
-
getShoulderEntityLeft
Deprecated.There are currently no well defined semantics regarding serialized entities in Eimmer. Use with care.Gets the wesen currently perched on the left shoulder or null if no wesen.
The returned wesen will not be spawned within the welt, so most operations are invalid unless the wesen is first spawned in.- Returns:
- left shoulder wesen
-
setShoulderEntityLeft
Deprecated.There are currently no well defined semantics regarding serialized entities in Eimmer. Use with care.Sets the wesen currently perched on the left shoulder, or null to remove. This method will remove the wesen from the welt.
Note that only a copy of the wesen will be set to display on the shoulder.
Also note that the client will currently only renderPapagei
entities.- Parameters:
wesen
- left shoulder wesen
-
getShoulderEntityRight
Deprecated.There are currently no well defined semantics regarding serialized entities in Eimmer. Use with care.Gets the wesen currently perched on the right shoulder or null if no wesen.
The returned wesen will not be spawned within the welt, so most operations are invalid unless the wesen is first spawned in.- Returns:
- right shoulder wesen
-
setShoulderEntityRight
Deprecated.There are currently no well defined semantics regarding serialized entities in Eimmer. Use with care.Sets the wesen currently perched on the right shoulder, or null to remove. This method will remove the wesen from the welt.
Note that only a copy of the wesen will be set to display on the shoulder.
Also note that the client will currently only renderPapagei
entities.- Parameters:
wesen
- right shoulder wesen
-
dropItem
boolean dropItem(boolean dropAll) Make the wesen drop the item in their hand.
This will force the wesen to drop the item they are holding with an option to drop the entireGegenstandsStapel
or just 1 of the items.- Parameters:
dropAll
- True to drop entire stack, false to drop 1 of the stack- Returns:
- True if item was dropped successfully
-
getExhaustion
float getExhaustion()Gets the players current exhaustion level.Exhaustion controls how fast the food level drops. While you have a certain amount of exhaustion, your saturation will drop to zero, and then your food will drop to zero.
- Returns:
- Exhaustion level
-
setExhaustion
void setExhaustion(float value) Sets the players current exhaustion level- Parameters:
value
- Exhaustion level
-
getSaturation
float getSaturation()Gets the players current saturation level.Saturation is a buffer for food level. Your food level will not drop if you are saturated > 0.
- Returns:
- Saturation level
-
setSaturation
void setSaturation(float value) Sets the players current saturation level- Parameters:
value
- Saturation level
-
getFoodLevel
int getFoodLevel()Gets the players current food level- Returns:
- Food level
-
setFoodLevel
void setFoodLevel(int value) Sets the players current food level- Parameters:
value
- New food level
-
getSaturatedRegenRate
int getSaturatedRegenRate()Get the regeneration rate (1 health per x ticks) of the MenschlichesWesen when they have saturation and their food level is >= 20. Default is 10.- Returns:
- the regeneration rate
-
setSaturatedRegenRate
void setSaturatedRegenRate(int ticks) Set the regeneration rate (1 health per x ticks) of the MenschlichesWesen when they have saturation and their food level is >= 20. Default is 10. Not affected if the welt's difficulty is peaceful.- Parameters:
ticks
- the amount of ticks to gain 1 health.
-
getUnsaturatedRegenRate
int getUnsaturatedRegenRate()Get the regeneration rate (1 health per x ticks) of the MenschlichesWesen when they have no saturation and their food level is >= 18. Default is 80.- Returns:
- the regeneration rate
-
setUnsaturatedRegenRate
void setUnsaturatedRegenRate(int ticks) Get the regeneration rate (1 health per x ticks) of the MenschlichesWesen when they have no saturation and their food level is >= 18. Default is 80. Not affected if the welt's difficulty is peaceful.- Parameters:
ticks
- the amount of ticks to gain 1 health.
-
getStarvationRate
int getStarvationRate()Get the starvation rate (1 health per x ticks) of the MenschlichesWesen. Default is 80.- Returns:
- the starvation rate
-
setStarvationRate
void setStarvationRate(int ticks) Get the starvation rate (1 health per x ticks) of the MenschlichesWesen. Default is 80.- Parameters:
ticks
- the amount of ticks to lose 1 health
-
getLastDeathLocation
Gets the spieler's last death location.- Returns:
- the last death location if it exists, otherwise null.
-
setLastDeathLocation
Sets the spieler's last death ort.
Note: This data is updated in the spieler's client only when the spieler respawns.- Parameters:
ort
- where to set the last death spieler ort
-
fireworkBoost
Perform a firework boost.This method will only work such that
Lebewesen.isGliding()
is true and the wesen is actively gliding with an elytra. Additionally, the suppliedfireworkGegenstandsStapel
must be a firework rocket. The power of the boost will directly correlate toFeuerwerkMeta.getPower()
.- Parameters:
fireworkGegenstandsStapel
- the firework item stack to use to glide- Returns:
- the attached
Feuerwerk
, or null if the wesen could not be boosted - Throws:
IllegalArgumentException
- if the fireworkGegenstandsStapel is not a firework
-
SpielerInventar
.