EntityBlock .java

net.minecraft.world.level.block.EntityBlock (interface): members: getListener, getTicker, newBlockEntity. imports: GameEventListener, BlockEntityTicker.

net.minecraft.world.level.blockinterface24 linescommon1.0 KB

API Surface (0)

No public/protected methods detected (fields or constants only).

Full Source

EntityBlock.java24 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.block;
2
3
import net.minecraft.core.BlockPos;
4
import net.minecraft.server.level.ServerLevel;
5
import net.minecraft.world.level.Level;
6
import net.minecraft.world.level.block.entity.BlockEntity;
7
import net.minecraft.world.level.block.entity.BlockEntityTicker;
8
import net.minecraft.world.level.block.entity.BlockEntityType;
9
import net.minecraft.world.level.block.state.BlockState;
10
import net.minecraft.world.level.gameevent.GameEventListener;
11
import org.jspecify.annotations.Nullable;
12
13
public interface EntityBlock {
14
	@Nullable BlockEntity newBlockEntity(BlockPos worldPosition, BlockState blockState);
15
16
	default <T extends BlockEntity> @Nullable BlockEntityTicker<T> getTicker(final Level level, final BlockState blockState, final BlockEntityType<T> type) {
17
		return null;
18
	}
19
20
	default <T extends BlockEntity> @Nullable GameEventListener getListener(final ServerLevel level, final T blockEntity) {
21
		return blockEntity instanceof GameEventListener.Provider<?> provider ? provider.getListener() : null;
22
	}
23
}
24

Decompiled Minecraft 26.3 source of EntityBlock (net/minecraft/world/level/block/EntityBlock.java) with Mojang official mappings, stored verbatim on the site.