2021-12-27 01:15:48 +01:00
|
|
|
package com.minelittlepony.unicopia.entity;
|
|
|
|
|
|
|
|
import net.minecraft.entity.Entity;
|
2022-01-01 18:14:37 +01:00
|
|
|
import net.minecraft.entity.EntityType;
|
|
|
|
import net.minecraft.world.World;
|
2021-12-27 01:15:48 +01:00
|
|
|
|
2022-01-01 18:14:37 +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
|
|
|
|
2022-01-01 18:14:37 +01:00
|
|
|
public LightEmittingEntity(EntityType<?> type, World world) {
|
|
|
|
super(type, world);
|
|
|
|
}
|
2021-12-27 01:15:48 +01:00
|
|
|
|
2022-01-01 18:14:37 +01:00
|
|
|
@Override
|
|
|
|
public void tick() {
|
|
|
|
super.tick();
|
|
|
|
emitter.tick();
|
|
|
|
}
|
2021-12-27 01:15:48 +01:00
|
|
|
|
2022-01-01 18:14:37 +01:00
|
|
|
@Override
|
|
|
|
public void setRemoved(RemovalReason reason) {
|
|
|
|
super.setRemoved(reason);
|
|
|
|
emitter.remove();
|
|
|
|
}
|
2021-12-27 01:15:48 +01:00
|
|
|
|
2022-01-01 18:14:37 +01:00
|
|
|
@Override
|
|
|
|
public void onRemoved() {
|
|
|
|
super.onRemoved();
|
|
|
|
emitter.remove();
|
2021-12-27 01:15:48 +01:00
|
|
|
}
|
|
|
|
}
|