-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathICCBlockRenderer.java
More file actions
151 lines (139 loc) · 6.18 KB
/
ICCBlockRenderer.java
File metadata and controls
151 lines (139 loc) · 6.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
package codechicken.lib.render.block;
import codechicken.lib.render.CCRenderState;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.FluidState;
import net.neoforged.neoforge.client.model.data.ModelData;
import org.jetbrains.annotations.ApiStatus.ScheduledForRemoval;
import org.jetbrains.annotations.Nullable;
/**
* Capable of rendering Blocks and Fluids directly to the chunk buffer.
* <p>
* Created by covers1624 on 8/09/2016.
*
* @see BlockRenderingRegistry
* @deprecated Unfortunately, this has become a maintenance and compatability burden. Mods like Sodium
* are in every single modpack, and we can't realistically tell people not to use it. It's possible
* a Neo api may pop up that allows features similar to this API. But I'm not going to hold my breath.
* If someone still requires the functionality that this system provides, they should implement mixins
* themselves, or Sodium/Embeddium compatability.
*/
@Deprecated (forRemoval = true)
@ScheduledForRemoval (inVersion = "mc 1.21.2+")
public interface ICCBlockRenderer {
//region Block
/**
* Called to evaluate weather this ICCBlockRenderer will be called for the specified BlockState.
*
* @param world The world.
* @param pos The pos.
* @param blockState The BlockState.
* @param renderType The {@link RenderType}, {@code null} for breaking.
* @return If you wish to render the BlockState.
*/
@Deprecated
boolean canHandleBlock(BlockAndTintGetter world, BlockPos pos, BlockState blockState, @Nullable RenderType renderType);
/**
* Called to render your block in world.
* You MUST use the provided {@link VertexConsumer}.
* THE BUFFER IS ALREADY DRAWING!
* YOU MAY BE FIRED ON THE CHUNK BATCHING THREAD!
*
* @param state Your state.
* @param pos Position.
* @param world World.
* @param mStack The {@link PoseStack}.
* @param builder The {@link VertexConsumer} to add quads to.
* @param random Position seeded Random for this block position.
* @param data Any ModelData.
* @param renderType The {@link RenderType}, {@code null} for breaking.
*/
@Deprecated
void renderBlock(BlockState state, BlockPos pos, BlockAndTintGetter world, PoseStack mStack, VertexConsumer builder, RandomSource random, ModelData data, @Nullable RenderType renderType);
/**
* Called when vanilla is rendering breaking texture over your block.
* Usually just render out your normal quads.
*
* @param state Your state.
* @param pos Position.
* @param world World.
* @param mStack The {@link PoseStack}.
* @param builder The {@link VertexConsumer} to add quads to.
* @param data Any ModelData.
*/
@Deprecated
default void renderBreaking(BlockState state, BlockPos pos, BlockAndTintGetter world, PoseStack mStack, VertexConsumer builder, ModelData data) {
CCRenderState ccrs = CCRenderState.instance();
ccrs.overlay = OverlayTexture.NO_OVERLAY;
ccrs.brightness = LevelRenderer.getLightColor(world, state, pos);
mStack.pushPose();
renderBlock(state, pos, world, mStack, builder, RandomSource.create(), data, null);
mStack.popPose();
}
//endregion
//region Rendering from an entity, Minecarts, enderman, etc.
/**
* Called to evaluate weather this ICCBlockRenderer will be called to handle
* {@link #renderEntity} for the given BlockState.
*
* @param state The state.
* @return If you wish to render this block.
*/
@Deprecated // No replacement. Use a mixin.
default boolean canHandleEntity(BlockState state) {
return false;
}
/**
* Called for misc entities holding or have blocks as part of their model.
* IronGolems, Enderman, Mooshroom, Minecarts, TNT.
*
* @param state The BlockState to render.
* @param nStack The {@link PoseStack}.
* @param builder The {@link MultiBufferSource}
* @param packedLight The {@link LightTexture} packed coords.
* @param packedOverlay The {@link OverlayTexture} packed coords.
* @param data Any ModelData.
* @param renderType The {@link RenderType} may be {@code null}.
*/
@Deprecated // No replacement. Use a mixin.
default void renderEntity(BlockState state, PoseStack nStack, MultiBufferSource builder, int packedLight, int packedOverlay, ModelData data, @Nullable RenderType renderType) { }
//endregion
//region Fluids
/**
* Called to evaluate weather this ICCBlockRenderer will be called for the specified IFluidState.
*
* @param world The world.
* @param pos The pos.
* @param blockState The {@link BlockState}
* @param fluidState The {@link FluidState}.
* @return If you wish to render the {@link FluidState}.
*/
@Deprecated // No replacement. Use a mixin.
default boolean canHandleFluid(BlockAndTintGetter world, BlockPos pos, BlockState blockState, FluidState fluidState) {
return false;
}
/**
* Called to render your fluid in world.
* You MUST use the provided {@link VertexConsumer}.
* THE BUFFER IS ALREADY DRAWING!
* YOU MAY BE FIRED ON THE CHUNK BATCHING THREAD!
*
* @param pos Position.
* @param world World.
* @param builder The {@link VertexConsumer}.
* @param blockState The {@link BlockState}
* @param fluidState The {@link FluidState}
*/
@Deprecated // No replacement. Use a mixin.
default void renderFluid(BlockPos pos, BlockAndTintGetter world, VertexConsumer builder, BlockState blockState, FluidState fluidState) { }
//endregion
}