mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-11 18:02:08 +01:00
Deprecated net.minestom.server.entity.ItemEntity.setPickupDelay(long, java.time.temporal.TemporalUnit)
This commit is contained in:
parent
bcc1132ed7
commit
157eb6357a
@ -228,7 +228,7 @@ public class ItemEntity extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the pickup delay in milliseconds, defined by {@link #setPickupDelay(long, TemporalUnit)}.
|
||||
* Gets the pickup delay in milliseconds, defined by {@link #setPickupDelay(Duration)}.
|
||||
*
|
||||
* @return the pickup delay
|
||||
*/
|
||||
@ -241,9 +241,21 @@ public class ItemEntity extends Entity {
|
||||
*
|
||||
* @param delay the pickup delay
|
||||
* @param temporalUnit the unit of the delay
|
||||
*
|
||||
* @deprecated Replaced by {@link #setPickupDelay(Duration)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void setPickupDelay(long delay, @NotNull TemporalUnit temporalUnit) {
|
||||
this.pickupDelay = TimeUnit.getMillis(delay, temporalUnit);
|
||||
setPickupDelay(Duration.of(delay, temporalUnit));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the pickup delay of the ItemEntity.
|
||||
*
|
||||
* @param delay the pickup delay
|
||||
*/
|
||||
public void setPickupDelay(Duration delay) {
|
||||
this.pickupDelay = delay.toMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,6 +36,7 @@ import net.minestom.server.utils.Vector;
|
||||
import net.minestom.server.utils.time.TimeUnit;
|
||||
import net.minestom.server.world.DimensionType;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Collection;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
@ -77,7 +78,7 @@ public class PlayerInit {
|
||||
|
||||
Position position = player.getPosition().clone().add(0, 1.5f, 0);
|
||||
ItemEntity itemEntity = new ItemEntity(droppedItem, position);
|
||||
itemEntity.setPickupDelay(500, TimeUnit.MILLISECOND);
|
||||
itemEntity.setPickupDelay(Duration.of(500, TimeUnit.MILLISECOND));
|
||||
itemEntity.setInstance(player.getInstance());
|
||||
Vector velocity = player.getPosition().clone().getDirection().multiply(6);
|
||||
itemEntity.setVelocity(velocity);
|
||||
|
Loading…
Reference in New Issue
Block a user