NaturesAura/src/main/java/de/ellpeck/naturesaura/blocks/tiles/ITickableBlockEntity.java

15 lines
551 B
Java
Raw Normal View History

2021-12-04 19:17:21 +01:00
package de.ellpeck.naturesaura.blocks.tiles;
2021-12-19 15:32:45 +01:00
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
2021-12-04 19:17:21 +01:00
public interface ITickableBlockEntity {
void tick();
2021-12-19 15:32:45 +01:00
static <E extends BlockEntity, A extends BlockEntity> BlockEntityTicker<A> createTickerHelper(BlockEntityType<A> actual, BlockEntityType<E> expected) {
return expected == actual ? (l, p, s, e) -> ((ITickableBlockEntity) e).tick() : null;
}
2021-12-04 19:17:21 +01:00
}