Unicopia/src/main/java/com/minelittlepony/unicopia/entity/LightEmittingEntity.java

32 lines
746 B
Java
Raw Normal View History

2021-12-27 01:15:48 +01:00
package com.minelittlepony.unicopia.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.world.World;
2021-12-27 01:15:48 +01:00
public abstract class LightEmittingEntity extends Entity implements DynamicLightSource {
private final LightEmitter<?> emitter = new LightEmitter<>(this);
2021-12-27 01:15:48 +01:00
public LightEmittingEntity(EntityType<?> type, World world) {
super(type, world);
}
2021-12-27 01:15:48 +01:00
@Override
public void tick() {
super.tick();
emitter.tick();
}
2021-12-27 01:15:48 +01:00
@Override
public void setRemoved(RemovalReason reason) {
super.setRemoved(reason);
emitter.remove();
}
2021-12-27 01:15:48 +01:00
@Override
public void onRemoved() {
super.onRemoved();
emitter.remove();
2021-12-27 01:15:48 +01:00
}
}