hollow-cube/remove-default-damage-behaviour (#64)

* Remove automatic void damage

* Remove automatic fire damage
This commit is contained in:
GoldenStack 2023-10-07 13:49:16 -05:00 committed by GitHub
parent 30699ec3fd
commit 517b195b5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 37 deletions

View File

@ -558,8 +558,6 @@ public class Entity implements Viewable, Tickable, Schedulable, Snapshotable, Ev
// handle block contacts
touchTick();
handleVoid();
// Call the abstract update method
update(time);
@ -747,16 +745,6 @@ public class Entity implements Viewable, Tickable, Schedulable, Snapshotable, Ev
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.
*

View File

@ -63,11 +63,6 @@ public class LivingEntity extends Entity implements EquipmentHandler {
*/
private long fireExtinguishTime;
/**
* Last time the fire damage was applied
*/
private long lastFireDamageTime;
/**
* Period, in ms, between two fire damage applications
*/
@ -189,15 +184,8 @@ public class LivingEntity extends Entity implements EquipmentHandler {
@Override
public void update(long time) {
if (isOnFire()) {
if (time > fireExtinguishTime) {
setOnFire(false);
} else {
if (time - lastFireDamageTime > fireDamagePeriod) {
damage(DamageType.ON_FIRE, 1.0f);
lastFireDamageTime = time;
}
}
if (isOnFire() && time > fireExtinguishTime) {
setOnFire(false);
}
// Items picking
@ -582,14 +570,6 @@ public class LivingEntity extends Entity implements EquipmentHandler {
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.
*

View File

@ -367,9 +367,7 @@ public abstract class Instance implements Block.Getter, Block.Setter,
public abstract boolean hasEnabledAutoChunkLoad();
/**
* Determines whether a position in the void. If true, entities should take damage and die.
* <p>
* Always returning false allow entities to survive in the void.
* Determines whether a position in the void.
*
* @param point the point in the world
* @return true if the point is inside the void