mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 04:05:50 -07:00
25
paper-api/src/main/java/org/bukkit/entity/BlockDisplay.java
Normal file
25
paper-api/src/main/java/org/bukkit/entity/BlockDisplay.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Represents a block display entity.
|
||||
*/
|
||||
public interface BlockDisplay extends Display {
|
||||
|
||||
/**
|
||||
* Gets the displayed block.
|
||||
*
|
||||
* @return the displayed block
|
||||
*/
|
||||
@NotNull
|
||||
public BlockData getBlock();
|
||||
|
||||
/**
|
||||
* Sets the displayed block.
|
||||
*
|
||||
* @param block the new block
|
||||
*/
|
||||
public void setBlock(@NotNull BlockData block);
|
||||
}
|
@@ -141,6 +141,7 @@ public interface Boat extends Vehicle {
|
||||
BIRCH(Material.BIRCH_PLANKS),
|
||||
JUNGLE(Material.JUNGLE_PLANKS),
|
||||
ACACIA(Material.ACACIA_PLANKS),
|
||||
CHERRY(Material.CHERRY_PLANKS),
|
||||
DARK_OAK(Material.DARK_OAK_PLANKS),
|
||||
MANGROVE(Material.MANGROVE_PLANKS),
|
||||
BAMBOO(Material.BAMBOO_PLANKS),
|
||||
|
267
paper-api/src/main/java/org/bukkit/entity/Display.java
Normal file
267
paper-api/src/main/java/org/bukkit/entity/Display.java
Normal file
@@ -0,0 +1,267 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.util.Transformation;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a display entity which is designed to only have a visual function.
|
||||
*/
|
||||
public interface Display extends Entity {
|
||||
|
||||
/**
|
||||
* Gets the transformation applied to this display.
|
||||
*
|
||||
* @return the transformation
|
||||
*/
|
||||
@NotNull
|
||||
public Transformation getTransformation();
|
||||
|
||||
/**
|
||||
* Sets the transformation applied to this display
|
||||
*
|
||||
* @param transformation the new transformation
|
||||
*/
|
||||
public void setTransformation(@NotNull Transformation transformation);
|
||||
|
||||
/**
|
||||
* Gets the interpolation duration of this display.
|
||||
*
|
||||
* @return interpolation duration
|
||||
*/
|
||||
public int getInterpolationDuration();
|
||||
|
||||
/**
|
||||
* Sets the interpolation duration of this display.
|
||||
*
|
||||
* @param duration new duration
|
||||
*/
|
||||
public void setInterpolationDuration(int duration);
|
||||
|
||||
/**
|
||||
* Gets the view distance/range of this display.
|
||||
*
|
||||
* @return view range
|
||||
*/
|
||||
public float getViewRange();
|
||||
|
||||
/**
|
||||
* Sets the view distance/range of this display.
|
||||
*
|
||||
* @param range new range
|
||||
*/
|
||||
public void setViewRange(float range);
|
||||
|
||||
/**
|
||||
* Gets the shadow radius of this display.
|
||||
*
|
||||
* @return radius
|
||||
*/
|
||||
public float getShadowRadius();
|
||||
|
||||
/**
|
||||
* Sets the shadow radius of this display.
|
||||
*
|
||||
* @param radius new radius
|
||||
*/
|
||||
public void setShadowRadius(float radius);
|
||||
|
||||
/**
|
||||
* Gets the shadow strength of this display.
|
||||
*
|
||||
* @return shadow strength
|
||||
*/
|
||||
public float getShadowStrength();
|
||||
|
||||
/**
|
||||
* Sets the shadow strength of this display.
|
||||
*
|
||||
* @param strength new strength
|
||||
*/
|
||||
public void setShadowStrength(float strength);
|
||||
|
||||
/**
|
||||
* Gets the width of this display.
|
||||
*
|
||||
* @return width
|
||||
*/
|
||||
public float getDisplayWidth();
|
||||
|
||||
/**
|
||||
* Sets the width of this display.
|
||||
*
|
||||
* @param width new width
|
||||
*/
|
||||
public void setDisplayWidth(float width);
|
||||
|
||||
/**
|
||||
* Gets the height of this display.
|
||||
*
|
||||
* @return height
|
||||
*/
|
||||
public float getDisplayHeight();
|
||||
|
||||
/**
|
||||
* Sets the height if this display.
|
||||
*
|
||||
* @param height new height
|
||||
*/
|
||||
public void setDisplayHeight(float height);
|
||||
|
||||
/**
|
||||
* Gets the amount of ticks before client-side interpolation will commence.
|
||||
*
|
||||
* @return interpolation delay ticks
|
||||
*/
|
||||
public int getInterpolationDelay();
|
||||
|
||||
/**
|
||||
* Sets the amount of ticks before client-side interpolation will commence.
|
||||
*
|
||||
* @param ticks interpolation delay ticks
|
||||
*/
|
||||
public void setInterpolationDelay(int ticks);
|
||||
|
||||
/**
|
||||
* Gets the billboard setting of this entity.
|
||||
*
|
||||
* The billboard setting controls the automatic rotation of the entity to
|
||||
* face the player.
|
||||
*
|
||||
* @return billboard setting
|
||||
*/
|
||||
@NotNull
|
||||
public Billboard getBillboard();
|
||||
|
||||
/**
|
||||
* Sets the billboard setting of this entity.
|
||||
*
|
||||
* The billboard setting controls the automatic rotation of the entity to
|
||||
* face the player.
|
||||
*
|
||||
* @param billboard new setting
|
||||
*/
|
||||
@NotNull
|
||||
public void setBillboard(@NotNull Billboard billboard);
|
||||
|
||||
/**
|
||||
* Gets the scoreboard team overridden glow color of this display.
|
||||
*
|
||||
* @return glow color
|
||||
*/
|
||||
@Nullable
|
||||
public Color getGlowColorOverride();
|
||||
|
||||
/**
|
||||
* Sets the scoreboard team overridden glow color of this display.
|
||||
*
|
||||
* @param color new color
|
||||
*/
|
||||
public void setGlowColorOverride(@Nullable Color color);
|
||||
|
||||
/**
|
||||
* Gets the brightness override of the entity.
|
||||
*
|
||||
* @return brightness override, if set
|
||||
*/
|
||||
@Nullable
|
||||
public Brightness getBrightness();
|
||||
|
||||
/**
|
||||
* Sets the brightness override of the entity.
|
||||
*
|
||||
* @param brightness new brightness override
|
||||
*/
|
||||
public void setBrightness(@Nullable Brightness brightness);
|
||||
|
||||
/**
|
||||
* Describes the axes/points around which the entity can pivot.
|
||||
*/
|
||||
public enum Billboard {
|
||||
|
||||
/**
|
||||
* No rotation (default).
|
||||
*/
|
||||
FIXED,
|
||||
/**
|
||||
* Can pivot around vertical axis.
|
||||
*/
|
||||
VERTICAL,
|
||||
/**
|
||||
* Can pivot around horizontal axis.
|
||||
*/
|
||||
HORIZONTAL,
|
||||
/**
|
||||
* Can pivot around center point.
|
||||
*/
|
||||
CENTER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the brightness rendering parameters of the entity.
|
||||
*/
|
||||
public static class Brightness {
|
||||
|
||||
private final int blockLight;
|
||||
private final int skyLight;
|
||||
|
||||
public Brightness(int blockLight, int skyLight) {
|
||||
Preconditions.checkArgument(0 <= blockLight && blockLight <= 15, "Block brightness out of range: %s", blockLight);
|
||||
Preconditions.checkArgument(0 <= skyLight && skyLight <= 15, "Sky brightness out of range: %s", skyLight);
|
||||
|
||||
this.blockLight = blockLight;
|
||||
this.skyLight = skyLight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the block lighting component of this brightness.
|
||||
*
|
||||
* @return block light, between 0-15
|
||||
*/
|
||||
public int getBlockLight() {
|
||||
return this.blockLight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sky lighting component of this brightness.
|
||||
*
|
||||
* @return sky light, between 0-15
|
||||
*/
|
||||
public int getSkyLight() {
|
||||
return this.skyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 47 * hash + this.blockLight;
|
||||
hash = 47 * hash + this.skyLight;
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Brightness other = (Brightness) obj;
|
||||
if (this.blockLight != other.blockLight) {
|
||||
return false;
|
||||
}
|
||||
return this.skyLight == other.skyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Brightness{" + "blockLight=" + this.blockLight + ", skyLight=" + this.skyLight + '}';
|
||||
}
|
||||
}
|
||||
}
|
@@ -279,6 +279,11 @@ public enum EntityType implements Keyed, Translatable {
|
||||
TADPOLE("tadpole", Tadpole.class, -1),
|
||||
WARDEN("warden", Warden.class, -1),
|
||||
CAMEL("camel", Camel.class, -1),
|
||||
BLOCK_DISPLAY("block_display", BlockDisplay.class, -1),
|
||||
INTERACTION("interaction", Interaction.class, -1),
|
||||
ITEM_DISPLAY("item_display", ItemDisplay.class, -1),
|
||||
SNIFFER("sniffer", Sniffer.class, -1),
|
||||
TEXT_DISPLAY("text_display", TextDisplay.class, -1),
|
||||
/**
|
||||
* A fishing line and bobber.
|
||||
*/
|
||||
|
92
paper-api/src/main/java/org/bukkit/entity/Interaction.java
Normal file
92
paper-api/src/main/java/org/bukkit/entity/Interaction.java
Normal file
@@ -0,0 +1,92 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents an entity designed to only record interactions.
|
||||
*/
|
||||
public interface Interaction extends Entity {
|
||||
|
||||
/**
|
||||
* Gets the width of this interaction entity.
|
||||
*
|
||||
* @return width
|
||||
*/
|
||||
public float getInteractionWidth();
|
||||
|
||||
/**
|
||||
* Sets the width of this interaction entity.
|
||||
*
|
||||
* @param width new width
|
||||
*/
|
||||
public void setInteractionWidth(float width);
|
||||
|
||||
/**
|
||||
* Gets the height of this interaction entity.
|
||||
*
|
||||
* @return height
|
||||
*/
|
||||
public float getInteractionHeight();
|
||||
|
||||
/**
|
||||
* Sets the height of this interaction entity.
|
||||
*
|
||||
* @param height new height
|
||||
*/
|
||||
public void setInteractionHeight(float height);
|
||||
|
||||
/**
|
||||
* Gets if this interaction entity should trigger a response when interacted
|
||||
* with.
|
||||
*
|
||||
* @return response setting
|
||||
*/
|
||||
public boolean isResponsive();
|
||||
|
||||
/**
|
||||
* Sets if this interaction entity should trigger a response when interacted
|
||||
* with.
|
||||
*
|
||||
* @param response new setting
|
||||
*/
|
||||
public void setResponsive(boolean response);
|
||||
|
||||
/**
|
||||
* Gets the last attack on this interaction entity.
|
||||
*
|
||||
* @return last attack data, if present
|
||||
*/
|
||||
@Nullable
|
||||
public PreviousInteraction getLastAttack();
|
||||
|
||||
/**
|
||||
* Gets the last interaction on this entity.
|
||||
*
|
||||
* @return last interaction data, if present
|
||||
*/
|
||||
@Nullable
|
||||
public PreviousInteraction getLastInteraction();
|
||||
|
||||
/**
|
||||
* Represents a previous interaction with this entity.
|
||||
*/
|
||||
public interface PreviousInteraction {
|
||||
|
||||
/**
|
||||
* Get the previous interacting player.
|
||||
*
|
||||
* @return interacting player
|
||||
*/
|
||||
@NotNull
|
||||
public OfflinePlayer getPlayer();
|
||||
|
||||
/**
|
||||
* Gets the Unix timestamp at when this interaction occurred.
|
||||
*
|
||||
* @return interaction timestamp
|
||||
*/
|
||||
public long getTimestamp();
|
||||
}
|
||||
}
|
61
paper-api/src/main/java/org/bukkit/entity/ItemDisplay.java
Normal file
61
paper-api/src/main/java/org/bukkit/entity/ItemDisplay.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents an item display entity.
|
||||
*/
|
||||
public interface ItemDisplay extends Display {
|
||||
|
||||
/**
|
||||
* Gets the displayed item stack.
|
||||
*
|
||||
* @return the displayed item stack
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack getItemStack();
|
||||
|
||||
/**
|
||||
* Sets the displayed item stack.
|
||||
*
|
||||
* @param item the new item stack
|
||||
*/
|
||||
void setItemStack(@Nullable ItemStack item);
|
||||
|
||||
/**
|
||||
* Gets the item display transform for this entity.
|
||||
*
|
||||
* Defaults to {@link ItemDisplayTransform#FIXED}.
|
||||
*
|
||||
* @return item display transform
|
||||
*/
|
||||
@NotNull
|
||||
ItemDisplayTransform getItemDisplayTransform();
|
||||
|
||||
/**
|
||||
* Sets the item display transform for this entity.
|
||||
*
|
||||
* Defaults to {@link ItemDisplayTransform#FIXED}.
|
||||
*
|
||||
* @param display new display
|
||||
*/
|
||||
void setItemDisplayTransform(@NotNull ItemDisplayTransform display);
|
||||
|
||||
/**
|
||||
* Represents the item model transform to be applied to the displayed item.
|
||||
*/
|
||||
public enum ItemDisplayTransform {
|
||||
|
||||
NONE,
|
||||
THIRDPERSON_LEFTHAND,
|
||||
THIRDPERSON_RIGHTHAND,
|
||||
FIRSTPERSON_LEFTHAND,
|
||||
FIRSTPERSON_RIGHTHAND,
|
||||
HEAD,
|
||||
GUI,
|
||||
GROUND,
|
||||
FIXED;
|
||||
}
|
||||
}
|
8
paper-api/src/main/java/org/bukkit/entity/Sniffer.java
Normal file
8
paper-api/src/main/java/org/bukkit/entity/Sniffer.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
/**
|
||||
* Represents a Sniffer.
|
||||
*/
|
||||
public interface Sniffer extends Animals {
|
||||
|
||||
}
|
145
paper-api/src/main/java/org/bukkit/entity/TextDisplay.java
Normal file
145
paper-api/src/main/java/org/bukkit/entity/TextDisplay.java
Normal file
@@ -0,0 +1,145 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a text display entity.
|
||||
*/
|
||||
public interface TextDisplay extends Display {
|
||||
|
||||
/**
|
||||
* Gets the displayed text.
|
||||
*
|
||||
* @return the displayed text.
|
||||
*/
|
||||
@Nullable
|
||||
String getText();
|
||||
|
||||
/**
|
||||
* Sets the displayed text.
|
||||
*
|
||||
* @param text the new text
|
||||
*/
|
||||
void setText(@Nullable String text);
|
||||
|
||||
/**
|
||||
* Gets the maximum line width before wrapping.
|
||||
*
|
||||
* @return the line width
|
||||
*/
|
||||
int getLineWidth();
|
||||
|
||||
/**
|
||||
* Sets the maximum line width before wrapping.
|
||||
*
|
||||
* @param width new line width
|
||||
*/
|
||||
void setLineWidth(int width);
|
||||
|
||||
/**
|
||||
* Gets the text background color.
|
||||
*
|
||||
* @return the background color
|
||||
*/
|
||||
@Nullable
|
||||
Color getBackgroundColor();
|
||||
|
||||
/**
|
||||
* Sets the text background color.
|
||||
*
|
||||
* @param color new background color
|
||||
*/
|
||||
void setBackgroundColor(@Nullable Color color);
|
||||
|
||||
/**
|
||||
* Gets the text opacity.
|
||||
*
|
||||
* @return opacity or -1 if not set
|
||||
*/
|
||||
byte getTextOpacity();
|
||||
|
||||
/**
|
||||
* Sets the text opacity.
|
||||
*
|
||||
* @param opacity new opacity or -1 if default
|
||||
*/
|
||||
void setTextOpacity(byte opacity);
|
||||
|
||||
/**
|
||||
* Gets if the text is shadowed.
|
||||
*
|
||||
* @return shadow status
|
||||
*/
|
||||
boolean isShadowed();
|
||||
|
||||
/**
|
||||
* Sets if the text is shadowed.
|
||||
*
|
||||
* @param shadow if shadowed
|
||||
*/
|
||||
void setShadowed(boolean shadow);
|
||||
|
||||
/**
|
||||
* Gets if the text is see through.
|
||||
*
|
||||
* @return see through status
|
||||
*/
|
||||
boolean isSeeThrough();
|
||||
|
||||
/**
|
||||
* Sets if the text is see through.
|
||||
*
|
||||
* @param seeThrough if see through
|
||||
*/
|
||||
void setSeeThrough(boolean seeThrough);
|
||||
|
||||
/**
|
||||
* Gets if the text has its default background.
|
||||
*
|
||||
* @return default background
|
||||
*/
|
||||
boolean isDefaultBackground();
|
||||
|
||||
/**
|
||||
* Sets if the text has its default background.
|
||||
*
|
||||
* @param defaultBackground if default
|
||||
*/
|
||||
void setDefaultBackground(boolean defaultBackground);
|
||||
|
||||
/**
|
||||
* Gets the text alignment for this display.
|
||||
*
|
||||
* @return text alignment
|
||||
*/
|
||||
@NotNull
|
||||
TextAligment getAlignment();
|
||||
|
||||
/**
|
||||
* Sets the text alignment for this display.
|
||||
*
|
||||
* @param alignment new alignment
|
||||
*/
|
||||
void setAlignment(@NotNull TextAligment alignment);
|
||||
|
||||
/**
|
||||
* Represents possible text alignments for this display.
|
||||
*/
|
||||
public enum TextAligment {
|
||||
|
||||
/**
|
||||
* Center aligned text (default).
|
||||
*/
|
||||
CENTER,
|
||||
/**
|
||||
* Left aligned text.
|
||||
*/
|
||||
LEFT,
|
||||
/**
|
||||
* Right aligned text.
|
||||
*/
|
||||
RIGHT;
|
||||
}
|
||||
}
|
@@ -69,6 +69,7 @@ public final class MemoryKey<T> implements Keyed {
|
||||
public static final MemoryKey<Location> LIKED_NOTEBLOCK_POSITION = new MemoryKey<>(NamespacedKey.minecraft("liked_noteblock"), Location.class);
|
||||
public static final MemoryKey<Integer> LIKED_NOTEBLOCK_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("liked_noteblock_cooldown_ticks"), Integer.class);
|
||||
public static final MemoryKey<Integer> ITEM_PICKUP_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("item_pickup_cooldown_ticks"), Integer.class);
|
||||
public static final MemoryKey<Location> SNIFFER_EXPLORED_POSITIONS = new MemoryKey<>(NamespacedKey.minecraft("sniffer_explored_positions"), Location.class);
|
||||
|
||||
/**
|
||||
* Returns a {@link MemoryKey} by a {@link NamespacedKey}.
|
||||
|
Reference in New Issue
Block a user