Class DroppedItem
- java.lang.Object
-
- net.egartley.beyondorigins.core.abstracts.Renderable
-
- net.egartley.beyondorigins.core.abstracts.Entity
-
- net.egartley.beyondorigins.core.abstracts.StaticEntity
-
- net.egartley.beyondorigins.entities.DroppedItem
-
- All Implemented Interfaces:
Tickable
public class DroppedItem extends StaticEntity
An item that was dropped from the player's inventory (by the user or programatically)
-
-
Field Summary
Fields Modifier and Type Field Description boolean
canPickup
boolean
isPlayerOver
ItemStack
itemStack
private static double
LIFETIME_DELAY
How long it takes for a dropped item to "despawn" after being droppedprivate DelayedEvent
lifetimeDelay
private static double
PICKUP_DELAY
How long it takes for a dropped item to be able to be picked up again after being dropped.-
Fields inherited from class net.egartley.beyondorigins.core.abstracts.Entity
boundaries, canCollide, defaultBoundary, deltaX, deltaY, DIRECTION_DOWN, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, firstLayer, health, image, interactions, inventory, isAllowedToMoveDownwards, isAllowedToMoveLeftwards, isAllowedToMoveRightwards, isAllowedToMoveUpwards, isAnimated, isCollided, isDualRendered, isMovingDownwards, isMovingLeftwards, isMovingRightwards, isMovingUpwards, isSectorSpecific, isTraversable, lastCollision, lastCollisionEvent, maximumHealth, name, secondLayer, sheets, speed, sprite, sprites, uuid
-
-
Constructor Summary
Constructors Constructor Description DroppedItem(ItemStack stack, int x, int y)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
destroy()
Removes the dropped item from the current sector's entities, and then kills itprivate boolean
pickup()
Attempt to pickup the dropped itemprotected void
setBoundaries()
Sets the entity's boundariesvoid
setCollisions()
Sets the entity's collisionsprotected void
setInteractions()
Sets the entity's interactionsvoid
tick()
Ticks boundaries and interactions-
Methods inherited from class net.egartley.beyondorigins.core.abstracts.Entity
allowAllMovement, drawDebug, drawFirstLayer, drawSecondLayer, move, onMove, onSectorEnter, onSectorLeave, render, setPosition, setSprite, setSprite, setSprites, toString, x, x, y, y
-
Methods inherited from class net.egartley.beyondorigins.core.abstracts.Renderable
x, y
-
-
-
-
Field Detail
-
PICKUP_DELAY
private static final double PICKUP_DELAY
How long it takes for a dropped item to be able to be picked up again after being dropped. This prevents the item from going immediately back into the player's inventory if dropped on it- See Also:
- Constant Field Values
-
LIFETIME_DELAY
private static final double LIFETIME_DELAY
How long it takes for a dropped item to "despawn" after being dropped- See Also:
- Constant Field Values
-
lifetimeDelay
private final DelayedEvent lifetimeDelay
-
canPickup
public boolean canPickup
-
isPlayerOver
public boolean isPlayerOver
-
itemStack
public ItemStack itemStack
-
-
Constructor Detail
-
DroppedItem
public DroppedItem(ItemStack stack, int x, int y)
-
-
Method Detail
-
destroy
private void destroy()
Removes the dropped item from the current sector's entities, and then kills it
-
pickup
private boolean pickup()
Attempt to pickup the dropped item- Returns:
- Whether or not the dropped item was successfully picked up by the player
-
tick
public void tick()
Description copied from class:Entity
Ticks boundaries and interactions- Specified by:
tick
in interfaceTickable
- Overrides:
tick
in classEntity
- See Also:
Entity.boundaries
-
setBoundaries
protected void setBoundaries()
Description copied from class:Entity
Sets the entity's boundaries- Specified by:
setBoundaries
in classEntity
- See Also:
Entity.boundaries
-
setCollisions
public void setCollisions()
Description copied from class:Entity
Sets the entity's collisions- Specified by:
setCollisions
in classEntity
- See Also:
Entity.boundaries
-
setInteractions
protected void setInteractions()
Description copied from class:Entity
Sets the entity's interactions- Specified by:
setInteractions
in classEntity
- See Also:
Entity.interactions
-
-