Allow more flexibility when registering BER (#1392)

This commit is contained in:
PepperCode1 2021-04-14 10:40:01 -07:00 committed by GitHub
parent 4b2c998ef4
commit f801c28735
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -40,5 +40,5 @@ public interface BlockEntityRendererRegistry {
* class is already loaded * class is already loaded
* @param <E> the {@link BlockEntity} * @param <E> the {@link BlockEntity}
*/ */
<E extends BlockEntity> void register(BlockEntityType<E> blockEntityType, Function<BlockEntityRenderDispatcher, BlockEntityRenderer<E>> blockEntityRenderer); <E extends BlockEntity> void register(BlockEntityType<E> blockEntityType, Function<BlockEntityRenderDispatcher, BlockEntityRenderer<? super E>> blockEntityRenderer);
} }

View file

@ -32,7 +32,7 @@ public class BlockEntityRendererRegistryImpl implements BlockEntityRendererRegis
private static BiConsumer<BlockEntityType<?>, Function<BlockEntityRenderDispatcher, ? extends BlockEntityRenderer<?>>> handler = (type, function) -> map.put(type, function); private static BiConsumer<BlockEntityType<?>, Function<BlockEntityRenderDispatcher, ? extends BlockEntityRenderer<?>>> handler = (type, function) -> map.put(type, function);
@Override @Override
public <E extends BlockEntity> void register(BlockEntityType<E> blockEntityType, Function<BlockEntityRenderDispatcher, BlockEntityRenderer<E>> blockEntityRenderer) { public <E extends BlockEntity> void register(BlockEntityType<E> blockEntityType, Function<BlockEntityRenderDispatcher, BlockEntityRenderer<? super E>> blockEntityRenderer) {
handler.accept(blockEntityType, blockEntityRenderer); handler.accept(blockEntityType, blockEntityRenderer);
} }