|
10 | 10 | import net.minecraft.resources.ResourceLocation; |
11 | 11 |
|
12 | 12 | public class RenderTypeStore { |
13 | | - public static final ResourceLocation MAIN_TARGET = ResourceLocation.fromNamespaceAndPath("gander", "main"); |
14 | | - |
15 | | - private static final Map<RenderStateShard.OutputStateShard, String> BLOCK_RENDER_TARGET_MAP = Map.of( |
16 | | - RenderStateShard.OutputStateShard.MAIN_TARGET, "main", |
17 | | - RenderStateShard.OutputStateShard.OUTLINE_TARGET, "entity", |
18 | | - RenderStateShard.OutputStateShard.TRANSLUCENT_TARGET, "translucent", |
19 | | - RenderStateShard.OutputStateShard.PARTICLES_TARGET, "particles", |
20 | | - RenderStateShard.OutputStateShard.WEATHER_TARGET, "weather", |
21 | | - RenderStateShard.OutputStateShard.CLOUDS_TARGET, "clouds", |
22 | | - RenderStateShard.OutputStateShard.ITEM_ENTITY_TARGET, "item_entity" |
23 | | - ); |
24 | | - |
25 | | - private static final Map<RenderStateShard.OutputStateShard, String> FLUID_RENDER_TARGET_MAP = Map.of( |
26 | | - RenderStateShard.OutputStateShard.MAIN_TARGET, "main", |
27 | | - RenderStateShard.OutputStateShard.OUTLINE_TARGET, "entity", |
28 | | - RenderStateShard.OutputStateShard.TRANSLUCENT_TARGET, "water", |
29 | | - RenderStateShard.OutputStateShard.PARTICLES_TARGET, "particles", |
30 | | - RenderStateShard.OutputStateShard.WEATHER_TARGET, "weather", |
31 | | - RenderStateShard.OutputStateShard.CLOUDS_TARGET, "clouds", |
32 | | - RenderStateShard.OutputStateShard.ITEM_ENTITY_TARGET, "item_entity" |
33 | | - ); |
34 | | - |
35 | | - private final TranslucencyChain translucencyChain; |
36 | | - private final Map<RenderType, RenderType> REMAPPED_BLOCK_RENDER_TYPES = new Reference2ObjectOpenHashMap<>(); |
37 | | - private final Map<RenderType, RenderType> REMAPPED_FLUID_RENDER_TYPES = new Reference2ObjectOpenHashMap<>(); |
38 | | - |
39 | | - public RenderTypeStore(TranslucencyChain translucencyChain) { |
40 | | - this.translucencyChain = translucencyChain; |
41 | | - } |
42 | | - |
43 | | - public RenderType redirectedBlockRenderType(RenderType desiredType) { |
44 | | - final var crying = GanderCompositeRenderType.of(desiredType); |
45 | | - final var remappedQuestionMark = Gander.asResource(BLOCK_RENDER_TARGET_MAP.get(crying.state().outputState)); |
46 | | - |
47 | | - if (remappedQuestionMark == null) |
48 | | - return desiredType; |
49 | | - |
50 | | - final var AAAAAAAA = REMAPPED_BLOCK_RENDER_TYPES.computeIfAbsent(desiredType, type -> GanderCompositeRenderType.of(type) |
51 | | - .targetingTranslucentRenderTarget( |
52 | | - translucencyChain.getRenderTarget(remappedQuestionMark), |
53 | | - translucencyChain.getRenderTarget(MAIN_TARGET))); |
54 | | - |
55 | | - return AAAAAAAA; |
56 | | - } |
57 | | - |
58 | | - public RenderType redirectedFluidRenderType(RenderType desiredType) { |
59 | | - final var crying = GanderCompositeRenderType.of(desiredType); |
60 | | - final var remappedQuestionMark = Gander.asResource(FLUID_RENDER_TARGET_MAP.get(crying.state().outputState)); |
61 | | - |
62 | | - if (remappedQuestionMark == null) |
63 | | - return desiredType; |
64 | | - |
65 | | - final var AAAAAAAA = REMAPPED_FLUID_RENDER_TYPES.computeIfAbsent(desiredType, type -> GanderCompositeRenderType.of(type) |
66 | | - .targetingTranslucentRenderTarget( |
67 | | - translucencyChain.getRenderTarget(remappedQuestionMark), |
68 | | - translucencyChain.getRenderTarget(MAIN_TARGET))); |
69 | | - |
70 | | - return AAAAAAAA; |
71 | | - } |
72 | | - |
73 | | - public void dispose() { |
74 | | - REMAPPED_BLOCK_RENDER_TYPES.clear(); |
75 | | - REMAPPED_FLUID_RENDER_TYPES.clear(); |
76 | | - } |
| 13 | + public static final ResourceLocation MAIN_TARGET = ResourceLocation.fromNamespaceAndPath("gander", "main"); |
| 14 | + |
| 15 | + private static final Map<RenderStateShard.OutputStateShard, String> BLOCK_RENDER_TARGET_MAP = Map.of( |
| 16 | + RenderStateShard.OutputStateShard.MAIN_TARGET, "main", |
| 17 | + RenderStateShard.OutputStateShard.OUTLINE_TARGET, "entity", |
| 18 | + RenderStateShard.OutputStateShard.TRANSLUCENT_TARGET, "translucent", |
| 19 | + RenderStateShard.OutputStateShard.PARTICLES_TARGET, "particles", |
| 20 | + RenderStateShard.OutputStateShard.WEATHER_TARGET, "weather", |
| 21 | + RenderStateShard.OutputStateShard.CLOUDS_TARGET, "clouds", |
| 22 | + RenderStateShard.OutputStateShard.ITEM_ENTITY_TARGET, "item_entity" |
| 23 | + ); |
| 24 | + |
| 25 | + private static final Map<RenderStateShard.OutputStateShard, String> FLUID_RENDER_TARGET_MAP = Map.of( |
| 26 | + RenderStateShard.OutputStateShard.MAIN_TARGET, "main", |
| 27 | + RenderStateShard.OutputStateShard.OUTLINE_TARGET, "entity", |
| 28 | + RenderStateShard.OutputStateShard.TRANSLUCENT_TARGET, "water", |
| 29 | + RenderStateShard.OutputStateShard.PARTICLES_TARGET, "particles", |
| 30 | + RenderStateShard.OutputStateShard.WEATHER_TARGET, "weather", |
| 31 | + RenderStateShard.OutputStateShard.CLOUDS_TARGET, "clouds", |
| 32 | + RenderStateShard.OutputStateShard.ITEM_ENTITY_TARGET, "item_entity" |
| 33 | + ); |
| 34 | + |
| 35 | + private final TranslucencyChain translucencyChain; |
| 36 | + private final Map<RenderType, RenderType> REMAPPED_BLOCK_RENDER_TYPES = new Reference2ObjectOpenHashMap<>(); |
| 37 | + private final Map<RenderType, RenderType> REMAPPED_FLUID_RENDER_TYPES = new Reference2ObjectOpenHashMap<>(); |
| 38 | + |
| 39 | + public RenderTypeStore(TranslucencyChain translucencyChain) { |
| 40 | + this.translucencyChain = translucencyChain; |
| 41 | + } |
| 42 | + |
| 43 | + public RenderType redirectedRenderType(RenderType desiredType, Map<RenderStateShard.OutputStateShard, String> map, Map<RenderType, RenderType> renderTypeMap) { |
| 44 | + try { |
| 45 | + final var crying = GanderCompositeRenderType.of(desiredType); |
| 46 | + final var remappedQuestionMark = Gander.asResource(map.get(crying.state().outputState)); |
| 47 | + |
| 48 | + final var AAAAAAAA = renderTypeMap.computeIfAbsent(desiredType, type -> GanderCompositeRenderType.of(type) |
| 49 | + .targetingTranslucentRenderTarget( |
| 50 | + translucencyChain.getRenderTarget(remappedQuestionMark), |
| 51 | + translucencyChain.getRenderTarget(MAIN_TARGET))); |
| 52 | + |
| 53 | + return AAAAAAAA; |
| 54 | + } catch (Exception ex) { |
| 55 | + return desiredType; |
| 56 | + } |
| 57 | + } |
| 58 | + |
| 59 | + public RenderType redirectedBlockRenderType(RenderType renderType) { |
| 60 | + return redirectedRenderType(renderType, BLOCK_RENDER_TARGET_MAP, REMAPPED_BLOCK_RENDER_TYPES); |
| 61 | + } |
| 62 | + |
| 63 | + public RenderType redirectedFluidRenderType(RenderType desiredType) { |
| 64 | + return redirectedRenderType(desiredType, FLUID_RENDER_TARGET_MAP, REMAPPED_FLUID_RENDER_TYPES); |
| 65 | + } |
| 66 | + |
| 67 | + public void dispose() { |
| 68 | + REMAPPED_BLOCK_RENDER_TYPES.clear(); |
| 69 | + REMAPPED_FLUID_RENDER_TYPES.clear(); |
| 70 | + } |
77 | 71 | } |
0 commit comments