mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-07 00:48:28 +01:00
hollow-cube/remove-default-damage-behaviour (#64)
* Remove automatic void damage
* Remove automatic fire damage
(cherry picked from commit 517b195b5e
)
This commit is contained in:
parent
7174ce2b21
commit
061c2c98f1
@ -558,8 +558,6 @@ public class Entity implements Viewable, Tickable, Schedulable, Snapshotable, Ev
|
|||||||
// handle block contacts
|
// handle block contacts
|
||||||
touchTick();
|
touchTick();
|
||||||
|
|
||||||
handleVoid();
|
|
||||||
|
|
||||||
// Call the abstract update method
|
// Call the abstract update method
|
||||||
update(time);
|
update(time);
|
||||||
|
|
||||||
@ -747,16 +745,6 @@ public class Entity implements Viewable, Tickable, Schedulable, Snapshotable, Ev
|
|||||||
return ticks;
|
return ticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* How does this entity handle being in the void?
|
|
||||||
*/
|
|
||||||
protected void handleVoid() {
|
|
||||||
// Kill if in void
|
|
||||||
if (getInstance().isInVoid(this.position)) {
|
|
||||||
remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Each entity has an unique id (server-wide) which will change after a restart.
|
* Each entity has an unique id (server-wide) which will change after a restart.
|
||||||
*
|
*
|
||||||
|
@ -63,11 +63,6 @@ public class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
*/
|
*/
|
||||||
private long fireExtinguishTime;
|
private long fireExtinguishTime;
|
||||||
|
|
||||||
/**
|
|
||||||
* Last time the fire damage was applied
|
|
||||||
*/
|
|
||||||
private long lastFireDamageTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Period, in ms, between two fire damage applications
|
* Period, in ms, between two fire damage applications
|
||||||
*/
|
*/
|
||||||
@ -189,15 +184,8 @@ public class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(long time) {
|
public void update(long time) {
|
||||||
if (isOnFire()) {
|
if (isOnFire() && time > fireExtinguishTime) {
|
||||||
if (time > fireExtinguishTime) {
|
setOnFire(false);
|
||||||
setOnFire(false);
|
|
||||||
} else {
|
|
||||||
if (time - lastFireDamageTime > fireDamagePeriod) {
|
|
||||||
damage(DamageType.ON_FIRE, 1.0f);
|
|
||||||
lastFireDamageTime = time;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Items picking
|
// Items picking
|
||||||
@ -582,14 +570,6 @@ public class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
return new EntityPropertiesPacket(getEntityId(), List.copyOf(attributeModifiers.values()));
|
return new EntityPropertiesPacket(getEntityId(), List.copyOf(attributeModifiers.values()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void handleVoid() {
|
|
||||||
// Kill if in void
|
|
||||||
if (getInstance().isInVoid(this.position)) {
|
|
||||||
damage(DamageType.VOID, 10f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the time in ms between two fire damage applications.
|
* Gets the time in ms between two fire damage applications.
|
||||||
*
|
*
|
||||||
|
@ -367,9 +367,7 @@ public abstract class Instance implements Block.Getter, Block.Setter,
|
|||||||
public abstract boolean hasEnabledAutoChunkLoad();
|
public abstract boolean hasEnabledAutoChunkLoad();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether a position in the void. If true, entities should take damage and die.
|
* Determines whether a position in the void.
|
||||||
* <p>
|
|
||||||
* Always returning false allow entities to survive in the void.
|
|
||||||
*
|
*
|
||||||
* @param point the point in the world
|
* @param point the point in the world
|
||||||
* @return true if the point is inside the void
|
* @return true if the point is inside the void
|
||||||
|
Loading…
Reference in New Issue
Block a user