mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-10 20:45:59 +01:00
Add accessor to BlockEntityRenderer map.
This commit is contained in:
parent
365a15b308
commit
231e79984a
@ -0,0 +1,16 @@
|
||||
package com.jozufozu.flywheel.mixin;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
||||
@Mixin(BlockEntityRenderDispatcher.class)
|
||||
public interface BlockEntityRenderDispatcherAccessor {
|
||||
@Accessor("renderers")
|
||||
Map<BlockEntityType<?>, BlockEntityRenderer<?>> flywheel$getRenderers();
|
||||
}
|
@ -1,9 +1,25 @@
|
||||
package com.jozufozu.flywheel.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import com.jozufozu.flywheel.mixin.BlockEntityRenderDispatcherAccessor;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
||||
public class FlwUtil {
|
||||
|
||||
/**
|
||||
* Get the (effectively global) map of BlockEntityTypes to Renderers.
|
||||
* @return An immutable map of BlockEntityTypes to BlockEntityRenderers.
|
||||
*/
|
||||
public static Map<BlockEntityType<?>, BlockEntityRenderer<?>> getBlockEntityRenderers() {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
return ((BlockEntityRenderDispatcherAccessor) mc.getBlockEntityRenderDispatcher()).flywheel$getRenderers();
|
||||
}
|
||||
|
||||
public static String repeatChar(char c, int n) {
|
||||
char[] arr = new char[n];
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"refmap": "flywheel.refmap.json",
|
||||
"client": [
|
||||
"BlockEntityRenderDispatcherAccessor",
|
||||
"BlockEntityTypeMixin",
|
||||
"BufferBuilderMixin",
|
||||
"BufferUploaderMixin",
|
||||
|
Loading…
Reference in New Issue
Block a user