mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-27 07:26:48 +01:00
Add accessor to BlockEntityRenderer map.
This commit is contained in:
parent
26ea6bd315
commit
2638e79aa2
3 changed files with 33 additions and 0 deletions
|
@ -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;
|
package com.jozufozu.flywheel.util;
|
||||||
|
|
||||||
import java.util.Arrays;
|
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 {
|
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) {
|
public static String repeatChar(char c, int n) {
|
||||||
char[] arr = new char[n];
|
char[] arr = new char[n];
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"refmap": "flywheel.refmap.json",
|
"refmap": "flywheel.refmap.json",
|
||||||
"client": [
|
"client": [
|
||||||
|
"BlockEntityRenderDispatcherAccessor",
|
||||||
"BlockEntityTypeMixin",
|
"BlockEntityTypeMixin",
|
||||||
"BufferBuilderMixin",
|
"BufferBuilderMixin",
|
||||||
"BufferUploaderMixin",
|
"BufferUploaderMixin",
|
||||||
|
|
Loading…
Reference in a new issue