| 1 | package net.minecraft.client.renderer.rendertype;
|
| 2 |
|
| 3 | import com.mojang.blaze3d.systems.RenderSystem;
|
| 4 | import com.mojang.renderpearl.api.pipeline.RenderPipeline;
|
| 5 | import com.mojang.renderpearl.api.textures.AddressMode;
|
| 6 | import com.mojang.renderpearl.api.textures.FilterMode;
|
| 7 | import java.util.function.BiFunction;
|
| 8 | import java.util.function.Function;
|
| 9 | import net.fabricmc.api.EnvType;
|
| 10 | import net.fabricmc.api.Environment;
|
| 11 | import net.minecraft.client.Minecraft;
|
| 12 | import net.minecraft.client.renderer.RenderPipelines;
|
| 13 | import net.minecraft.client.renderer.blockentity.AbstractEndPortalRenderer;
|
| 14 | import net.minecraft.client.renderer.feature.ItemFeatureRenderer;
|
| 15 | import net.minecraft.client.renderer.texture.TextureAtlas;
|
| 16 | import net.minecraft.resources.Identifier;
|
| 17 | import net.minecraft.util.Util;
|
| 18 |
|
| 19 | @Environment(EnvType.CLIENT)
|
| 20 | public class RenderTypes {
|
| 21 | static final BiFunction<Identifier, Boolean, RenderType> OUTLINE = Util.memoize(
|
| 22 | (texture, cullState) -> RenderType.create(
|
| 23 | "outline",
|
| 24 | RenderSetup.builder(cullState ? RenderPipelines.OUTLINE_CULL : RenderPipelines.OUTLINE_NO_CULL)
|
| 25 | .withTexture("Sampler0", texture)
|
| 26 | .setOutline(RenderSetup.OutlineProperty.IS_OUTLINE)
|
| 27 | .createRenderSetup()
|
| 28 | )
|
| 29 | );
|
| 30 | private static final RenderType SOLID_MOVING_BLOCK = RenderType.create("solid_moving_block", createMovingBlockSetup(RenderPipelines.SOLID_BLOCK, false));
|
| 31 | private static final RenderType CUTOUT_MOVING_BLOCK = RenderType.create("cutout_moving_block", createMovingBlockSetup(RenderPipelines.CUTOUT_BLOCK, false));
|
| 32 | private static final RenderType TRANSLUCENT_MOVING_BLOCK = RenderType.create(
|
| 33 | "translucent_moving_block", createMovingBlockSetup(RenderPipelines.TRANSLUCENT_BLOCK, true)
|
| 34 | );
|
| 35 | private static final Function<Identifier, RenderType> ARMOR_CUTOUT_NO_CULL = Util.memoize(
|
| 36 | texture -> {
|
| 37 | RenderSetup state = RenderSetup.builder(RenderPipelines.ARMOR_CUTOUT_NO_CULL)
|
| 38 | .withTexture("Sampler0", texture)
|
| 39 | .useLightmap()
|
| 40 | .useOverlay()
|
| 41 | .setLayeringTransform(LayeringTransform.VIEW_OFFSET_Z_LAYERING)
|
| 42 | .affectsCrumbling()
|
| 43 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 44 | .createRenderSetup();
|
| 45 | return RenderType.create("armor_cutout_no_cull", state);
|
| 46 | }
|
| 47 | );
|
| 48 | private static final Function<Identifier, RenderType> ARMOR_CUTOUT_NO_CULL_GLINT = Util.memoize(
|
| 49 | texture -> {
|
| 50 | RenderSetup state = RenderSetup.builder(RenderPipelines.ARMOR_CUTOUT_NO_CULL_GLINT)
|
| 51 | .withTexture("Sampler0", texture)
|
| 52 | .withTexture("GlintSampler", ItemFeatureRenderer.ENCHANTED_GLINT_ARMOR)
|
| 53 | .setTextureTransform(TextureTransform.ARMOR_ENTITY_GLINT_TEXTURING)
|
| 54 | .useLightmap()
|
| 55 | .useOverlay()
|
| 56 | .setLayeringTransform(LayeringTransform.VIEW_OFFSET_Z_LAYERING)
|
| 57 | .affectsCrumbling()
|
| 58 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 59 | .createRenderSetup();
|
| 60 | return RenderType.create("armor_cutout_no_cull_glint", state);
|
| 61 | }
|
| 62 | );
|
| 63 | private static final Function<Identifier, RenderType> ARMOR_TRIM = Util.memoize(
|
| 64 | texture -> {
|
| 65 | RenderSetup state = RenderSetup.builder(RenderPipelines.ARMOR_CUTOUT_NO_CULL)
|
| 66 | .withTexture("Sampler0", texture)
|
| 67 | .useLightmap()
|
| 68 | .useOverlay()
|
| 69 | .setLayeringTransform(LayeringTransform.VIEW_OFFSET_Z_LAYERING)
|
| 70 | .affectsCrumbling()
|
| 71 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 72 | .createRenderSetup();
|
| 73 | return RenderType.create("armor_trim", state);
|
| 74 | }
|
| 75 | );
|
| 76 | private static final Function<Identifier, RenderType> ARMOR_TRIM_DECAL = Util.memoize(
|
| 77 | texture -> {
|
| 78 | RenderSetup state = RenderSetup.builder(RenderPipelines.ARMOR_DECAL_CUTOUT_NO_CULL)
|
| 79 | .withTexture("Sampler0", texture)
|
| 80 | .useLightmap()
|
| 81 | .useOverlay()
|
| 82 | .setLayeringTransform(LayeringTransform.VIEW_OFFSET_Z_LAYERING)
|
| 83 | .affectsCrumbling()
|
| 84 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 85 | .createRenderSetup();
|
| 86 | return RenderType.create("armor_trim_decal", state);
|
| 87 | }
|
| 88 | );
|
| 89 | private static final Function<Identifier, RenderType> WOLF_ARMOR_CRACKS = Util.memoize(
|
| 90 | texture -> {
|
| 91 | RenderSetup state = RenderSetup.builder(RenderPipelines.WOLF_ARMOR_CRACKS)
|
| 92 | .withTexture("Sampler0", texture)
|
| 93 | .useLightmap()
|
| 94 | .useOverlay()
|
| 95 | .setLayeringTransform(LayeringTransform.VIEW_OFFSET_Z_LAYERING)
|
| 96 | .affectsCrumbling()
|
| 97 | .sortOnUpload()
|
| 98 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 99 | .withForcedSolidModelPhase()
|
| 100 | .createRenderSetup();
|
| 101 | return RenderType.create("wolf_armor_cracks", state);
|
| 102 | }
|
| 103 | );
|
| 104 | private static final Function<Identifier, RenderType> ENTITY_SOLID = Util.memoize(
|
| 105 | texture -> {
|
| 106 | RenderSetup state = RenderSetup.builder(RenderPipelines.ENTITY_SOLID)
|
| 107 | .withTexture("Sampler0", texture)
|
| 108 | .useLightmap()
|
| 109 | .useOverlay()
|
| 110 | .affectsCrumbling()
|
| 111 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 112 | .createRenderSetup();
|
| 113 | return RenderType.create("entity_solid", state);
|
| 114 | }
|
| 115 | );
|
| 116 | private static final Function<Identifier, RenderType> ENTITY_SOLID_GLINT = Util.memoize(
|
| 117 | texture -> {
|
| 118 | RenderSetup state = RenderSetup.builder(RenderPipelines.ENTITY_SOLID_GLINT)
|
| 119 | .withTexture("Sampler0", texture)
|
| 120 | .withTexture("GlintSampler", ItemFeatureRenderer.ENCHANTED_GLINT_ITEM)
|
| 121 | .setTextureTransform(TextureTransform.ENTITY_GLINT_TEXTURING)
|
| 122 | .useLightmap()
|
| 123 | .useOverlay()
|
| 124 | .affectsCrumbling()
|
| 125 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 126 | .createRenderSetup();
|
| 127 | return RenderType.create("entity_solid_glint", state);
|
| 128 | }
|
| 129 | );
|
| 130 | private static final Function<Identifier, RenderType> ENTITY_SOLID_Z_OFFSET_FORWARD = Util.memoize(
|
| 131 | texture -> {
|
| 132 | RenderSetup state = RenderSetup.builder(RenderPipelines.ENTITY_SOLID_Z_OFFSET_FORWARD)
|
| 133 | .withTexture("Sampler0", texture)
|
| 134 | .useLightmap()
|
| 135 | .useOverlay()
|
| 136 | .setLayeringTransform(LayeringTransform.VIEW_OFFSET_Z_LAYERING_FORWARD)
|
| 137 | .affectsCrumbling()
|
| 138 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 139 | .createRenderSetup();
|
| 140 | return RenderType.create("entity_solid_z_offset_forward", state);
|
| 141 | }
|
| 142 | );
|
| 143 | private static final Function<Identifier, RenderType> ENTITY_CUTOUT_CULL = Util.memoize(
|
| 144 | texture -> {
|
| 145 | RenderSetup state = RenderSetup.builder(RenderPipelines.ENTITY_CUTOUT_CULL)
|
| 146 | .withTexture("Sampler0", texture)
|
| 147 | .useLightmap()
|
| 148 | .useOverlay()
|
| 149 | .affectsCrumbling()
|
| 150 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 151 | .createRenderSetup();
|
| 152 | return RenderType.create("entity_cutout_cull", state);
|
| 153 | }
|
| 154 | );
|
| 155 | private static final BiFunction<Identifier, Boolean, RenderType> ENTITY_CUTOUT = Util.memoize(
|
| 156 | (texture, affectsOutline) -> {
|
| 157 | RenderSetup state = RenderSetup.builder(RenderPipelines.ENTITY_CUTOUT)
|
| 158 | .withTexture("Sampler0", texture)
|
| 159 | .useLightmap()
|
| 160 | .useOverlay()
|
| 161 | .affectsCrumbling()
|
| 162 | .setOutline(affectsOutline ? RenderSetup.OutlineProperty.AFFECTS_OUTLINE : RenderSetup.OutlineProperty.NONE)
|
| 163 | .createRenderSetup();
|
| 164 | return RenderType.create("entity_cutout", state);
|
| 165 | }
|
| 166 | );
|
| 167 | private static final BiFunction<Identifier, Boolean, RenderType> ENTITY_CUTOUT_Z_OFFSET = Util.memoize(
|
| 168 | (texture, affectsOutline) -> {
|
| 169 | RenderSetup state = RenderSetup.builder(RenderPipelines.ENTITY_CUTOUT_Z_OFFSET)
|
| 170 | .withTexture("Sampler0", texture)
|
| 171 | .useLightmap()
|
| 172 | .useOverlay()
|
| 173 | .setLayeringTransform(LayeringTransform.VIEW_OFFSET_Z_LAYERING)
|
| 174 | .affectsCrumbling()
|
| 175 | .setOutline(affectsOutline ? RenderSetup.OutlineProperty.AFFECTS_OUTLINE : RenderSetup.OutlineProperty.NONE)
|
| 176 | .createRenderSetup();
|
| 177 | return RenderType.create("entity_cutout_z_offset", state);
|
| 178 | }
|
| 179 | );
|
| 180 | private static final BiFunction<Identifier, Identifier, RenderType> ENTITY_CUTOUT_DISSOLVE = Util.memoize(
|
| 181 | (texture, maskTexture) -> {
|
| 182 | RenderSetup state = RenderSetup.builder(RenderPipelines.ENTITY_CUTOUT_DISSOLVE)
|
| 183 | .withTexture("Sampler0", texture)
|
| 184 | .withTexture("DissolveMaskSampler", maskTexture)
|
| 185 | .useLightmap()
|
| 186 | .useOverlay()
|
| 187 | .affectsCrumbling()
|
| 188 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 189 | .createRenderSetup();
|
| 190 | return RenderType.create("entity_cutout_dissolve", state);
|
| 191 | }
|
| 192 | );
|
| 193 | private static final Function<Identifier, RenderType> ENTITY_TRANSLUCENT_CULL = Util.memoize(
|
| 194 | texture -> {
|
| 195 | RenderSetup state = RenderSetup.builder(RenderPipelines.ENTITY_TRANSLUCENT_CULL)
|
| 196 | .setOitPipelines(RenderPipelines.OIT_ENTITY_CULL)
|
| 197 | .withTexture("Sampler0", texture)
|
| 198 | .useLightmap()
|
| 199 | .useOverlay()
|
| 200 | .affectsCrumbling()
|
| 201 | .sortOnUpload()
|
| 202 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 203 | .createRenderSetup();
|
| 204 | return RenderType.create("entity_translucent_cull_item_target", state);
|
| 205 | }
|
| 206 | );
|
| 207 | private static final Function<Identifier, RenderType> ITEM_CUTOUT = Util.memoize(
|
| 208 | texture -> {
|
| 209 | RenderSetup state = RenderSetup.builder(RenderPipelines.ITEM_CUTOUT)
|
| 210 | .withTexture("Sampler0", texture)
|
| 211 | .useLightmap()
|
| 212 | .useOverlay()
|
| 213 | .affectsCrumbling()
|
| 214 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 215 | .createRenderSetup();
|
| 216 | return RenderType.create("item_cutout", state);
|
| 217 | }
|
| 218 | );
|
| 219 | private static final Function<Identifier, RenderType> ITEM_CUTOUT_GLINT = Util.memoize(
|
| 220 | texture -> {
|
| 221 | RenderSetup state = RenderSetup.builder(RenderPipelines.ITEM_CUTOUT_GLINT)
|
| 222 | .withTexture("Sampler0", texture)
|
| 223 | .withTexture("GlintSampler", ItemFeatureRenderer.ENCHANTED_GLINT_ITEM)
|
| 224 | .setTextureTransform(TextureTransform.GLINT_TEXTURING)
|
| 225 | .useLightmap()
|
| 226 | .useOverlay()
|
| 227 | .affectsCrumbling()
|
| 228 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 229 | .createRenderSetup();
|
| 230 | return RenderType.create("item_cutout_glint", state);
|
| 231 | }
|
| 232 | );
|
| 233 | private static final Function<Identifier, RenderType> ITEM_CUTOUT_GLINT_SPECIAL = Util.memoize(
|
| 234 | texture -> {
|
| 235 | RenderSetup state = RenderSetup.builder(RenderPipelines.ITEM_CUTOUT_GLINT_SPECIAL)
|
| 236 | .withTexture("Sampler0", texture)
|
| 237 | .withTexture("GlintSampler", ItemFeatureRenderer.ENCHANTED_GLINT_ITEM)
|
| 238 | .setTextureTransform(TextureTransform.GLINT_TEXTURING)
|
| 239 | .useLightmap()
|
| 240 | .useOverlay()
|
| 241 | .affectsCrumbling()
|
| 242 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 243 | .createRenderSetup();
|
| 244 | return RenderType.create("item_cutout_glint_special", state);
|
| 245 | }
|
| 246 | );
|
| 247 | private static final Function<Identifier, RenderType> ITEM_TRANSLUCENT = Util.memoize(
|
| 248 | texture -> {
|
| 249 | RenderSetup state = RenderSetup.builder(RenderPipelines.ITEM_TRANSLUCENT)
|
| 250 | .setOitPipelines(RenderPipelines.OIT_ITEM)
|
| 251 | .withTexture("Sampler0", texture)
|
| 252 | .useLightmap()
|
| 253 | .useOverlay()
|
| 254 | .affectsCrumbling()
|
| 255 | .sortOnUpload()
|
| 256 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 257 | .createRenderSetup();
|
| 258 | return RenderType.create("item_translucent", state);
|
| 259 | }
|
| 260 | );
|
| 261 | private static final Function<Identifier, RenderType> ITEM_TRANSLUCENT_GLINT = Util.memoize(
|
| 262 | texture -> {
|
| 263 | RenderSetup state = RenderSetup.builder(RenderPipelines.ITEM_TRANSLUCENT_GLINT)
|
| 264 | .setOitPipelines(RenderPipelines.OIT_ITEM_GLINT)
|
| 265 | .withTexture("Sampler0", texture)
|
| 266 | .withTexture("GlintSampler", ItemFeatureRenderer.ENCHANTED_GLINT_ITEM)
|
| 267 | .setTextureTransform(TextureTransform.GLINT_TEXTURING)
|
| 268 | .useLightmap()
|
| 269 | .useOverlay()
|
| 270 | .affectsCrumbling()
|
| 271 | .sortOnUpload()
|
| 272 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 273 | .createRenderSetup();
|
| 274 | return RenderType.create("item_translucent_glint", state);
|
| 275 | }
|
| 276 | );
|
| 277 | private static final Function<Identifier, RenderType> ITEM_TRANSLUCENT_GLINT_SPECIAL = Util.memoize(
|
| 278 | texture -> {
|
| 279 | RenderSetup state = RenderSetup.builder(RenderPipelines.ITEM_TRANSLUCENT_GLINT_SPECIAL)
|
| 280 | .setOitPipelines(RenderPipelines.OIT_ITEM_GLINT_SPECIAL)
|
| 281 | .withTexture("Sampler0", texture)
|
| 282 | .withTexture("GlintSampler", ItemFeatureRenderer.ENCHANTED_GLINT_ITEM)
|
| 283 | .setTextureTransform(TextureTransform.GLINT_TEXTURING)
|
| 284 | .useLightmap()
|
| 285 | .useOverlay()
|
| 286 | .affectsCrumbling()
|
| 287 | .sortOnUpload()
|
| 288 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 289 | .createRenderSetup();
|
| 290 | return RenderType.create("item_translucent_glint_special", state);
|
| 291 | }
|
| 292 | );
|
| 293 | private static final BiFunction<Identifier, Boolean, RenderType> ENTITY_TRANSLUCENT = Util.memoize(
|
| 294 | (texture, affectsOutline) -> {
|
| 295 | RenderSetup state = RenderSetup.builder(RenderPipelines.ENTITY_TRANSLUCENT)
|
| 296 | .setOitPipelines(RenderPipelines.OIT_ENTITY)
|
| 297 | .withTexture("Sampler0", texture)
|
| 298 | .useLightmap()
|
| 299 | .useOverlay()
|
| 300 | .affectsCrumbling()
|
| 301 | .sortOnUpload()
|
| 302 | .setOutline(affectsOutline ? RenderSetup.OutlineProperty.AFFECTS_OUTLINE : RenderSetup.OutlineProperty.NONE)
|
| 303 | .createRenderSetup();
|
| 304 | return RenderType.create("entity_translucent", state);
|
| 305 | }
|
| 306 | );
|
| 307 | private static final BiFunction<Identifier, Boolean, RenderType> ENTITY_TRANSLUCENT_EMISSIVE = Util.memoize(
|
| 308 | (texture, affectsOutline) -> {
|
| 309 | RenderSetup state = RenderSetup.builder(RenderPipelines.ENTITY_TRANSLUCENT_EMISSIVE)
|
| 310 | .setOitPipelines(RenderPipelines.OIT_ENTITY_EMISSIVE)
|
| 311 | .withTexture("Sampler0", texture)
|
| 312 | .useOverlay()
|
| 313 | .affectsCrumbling()
|
| 314 | .sortOnUpload()
|
| 315 | .setOutline(affectsOutline ? RenderSetup.OutlineProperty.AFFECTS_OUTLINE : RenderSetup.OutlineProperty.NONE)
|
| 316 | .createRenderSetup();
|
| 317 | return RenderType.create("entity_translucent_emissive", state);
|
| 318 | }
|
| 319 | );
|
| 320 | private static final Function<Identifier, RenderType> END_CRYSTAL_BEAM = Util.memoize(
|
| 321 | texture -> {
|
| 322 | RenderSetup state = RenderSetup.builder(RenderPipelines.END_CRYSTAL_BEAM)
|
| 323 | .withTexture("Sampler0", texture)
|
| 324 | .useLightmap()
|
| 325 | .setOutline(RenderSetup.OutlineProperty.NONE)
|
| 326 | .createRenderSetup();
|
| 327 | return RenderType.create("end_crystal_beam", state);
|
| 328 | }
|
| 329 | );
|
| 330 | private static final BiFunction<Identifier, Boolean, RenderType> BEACON_BEAM = Util.memoize(
|
| 331 | (texture, translucent) -> {
|
| 332 | RenderSetup.RenderSetupBuilder builder = RenderSetup.builder(translucent ? RenderPipelines.BEACON_BEAM_TRANSLUCENT : RenderPipelines.BEACON_BEAM_OPAQUE)
|
| 333 | .withTexture("Sampler0", texture)
|
| 334 | .sortOnUpload();
|
| 335 | if (translucent) {
|
| 336 | builder.setOitPipelines(RenderPipelines.OIT_BEACON_BEAM);
|
| 337 | }
|
| 338 |
|
| 339 | return RenderType.create("beacon_beam", builder.createRenderSetup());
|
| 340 | }
|
| 341 | );
|
| 342 | private static final Function<Identifier, RenderType> BANNER_PATTERN = Util.memoize(
|
| 343 | texture -> {
|
| 344 | RenderSetup state = RenderSetup.builder(RenderPipelines.BANNER_PATTERN)
|
| 345 | .withTexture("Sampler0", texture)
|
| 346 | .useLightmap()
|
| 347 | .sortOnUpload()
|
| 348 | .withForcedSolidModelPhase()
|
| 349 | .createRenderSetup();
|
| 350 | return RenderType.create("banner_pattern", state);
|
| 351 | }
|
| 352 | );
|
| 353 | private static final Function<Identifier, RenderType> ENTITY_SHADOW = Util.memoize(
|
| 354 | texture -> {
|
| 355 | RenderSetup state = RenderSetup.builder(RenderPipelines.ENTITY_SHADOW)
|
| 356 | .setOitPipelines(RenderPipelines.OIT_ENTITY_SHADOW)
|
| 357 | .withTexture("Sampler0", texture)
|
| 358 | .useLightmap()
|
| 359 | .useOverlay()
|
| 360 | .setLayeringTransform(LayeringTransform.VIEW_OFFSET_Z_LAYERING)
|
| 361 | .createRenderSetup();
|
| 362 | return RenderType.create("entity_shadow", state);
|
| 363 | }
|
| 364 | );
|
| 365 | private static final Function<Identifier, RenderType> EYES = Util.memoize(
|
| 366 | texture -> RenderType.create(
|
| 367 | "eyes",
|
| 368 | RenderSetup.builder(RenderPipelines.EYES).setOitPipelines(RenderPipelines.OIT_EYES).withTexture("Sampler0", texture).sortOnUpload().createRenderSetup()
|
| 369 | )
|
| 370 | );
|
| 371 | private static final RenderType LEASH = RenderType.create("leash", RenderSetup.builder(RenderPipelines.LEASH).useLightmap().createRenderSetup());
|
| 372 | private static final RenderType WATER_MASK = RenderType.create("water_mask", RenderSetup.builder(RenderPipelines.WATER_MASK).createRenderSetup());
|
| 373 | private static final RenderType OIT_WATER_MASK = RenderType.create("oit_water_mask", RenderSetup.builder(RenderPipelines.OIT_WATER_MASK).createRenderSetup());
|
| 374 | private static final RenderType PATTERNED_SHIELD_GLINT = RenderType.create(
|
| 375 | "patterned_shield_glint",
|
| 376 | RenderSetup.builder(RenderPipelines.GLINT)
|
| 377 | .withTexture("Sampler0", ItemFeatureRenderer.ENCHANTED_GLINT_ITEM)
|
| 378 | .setTextureTransform(TextureTransform.ENTITY_GLINT_TEXTURING)
|
| 379 | .withForcedSolidModelPhase()
|
| 380 | .createRenderSetup()
|
| 381 | );
|
| 382 | private static final RenderType TRIMMED_ARMOR_GLINT = RenderType.create(
|
| 383 | "trimmed_armor_glint",
|
| 384 | RenderSetup.builder(RenderPipelines.GLINT)
|
| 385 | .withTexture("Sampler0", ItemFeatureRenderer.ENCHANTED_GLINT_ARMOR)
|
| 386 | .setTextureTransform(TextureTransform.ARMOR_ENTITY_GLINT_TEXTURING)
|
| 387 | .setLayeringTransform(LayeringTransform.VIEW_OFFSET_Z_LAYERING)
|
| 388 | .withForcedSolidModelPhase()
|
| 389 | .createRenderSetup()
|
| 390 | );
|
| 391 | private static final Function<Identifier, RenderType> CRUMBLING = Util.memoize(
|
| 392 | texture -> RenderType.create(
|
| 393 | "crumbling",
|
| 394 | RenderSetup.builder(RenderPipelines.CRUMBLING)
|
| 395 | .setOitPipelines(RenderPipelines.OIT_CRUMBLING)
|
| 396 | .withTexture("Sampler0", texture)
|
| 397 | .sortOnUpload()
|
| 398 | .createRenderSetup()
|
| 399 | )
|
| 400 | );
|
| 401 | private static final Function<Identifier, RenderType> TEXT = Util.memoize(
|
| 402 | texture -> RenderType.create(
|
| 403 | "text",
|
| 404 | RenderSetup.builder(RenderPipelines.TEXT).setOitPipelines(RenderPipelines.OIT_TEXT).withTexture("Sampler0", texture).useLightmap().createRenderSetup()
|
| 405 | )
|
| 406 | );
|
| 407 | private static final Function<Identifier, RenderType> TEXT_GRAYSCALE = Util.memoize(
|
| 408 | texture -> RenderType.create(
|
| 409 | "text_grayscale",
|
| 410 | RenderSetup.builder(RenderPipelines.TEXT_GRAYSCALE)
|
| 411 | .setOitPipelines(RenderPipelines.OIT_TEXT_GRAYSCALE)
|
| 412 | .withTexture("Sampler0", texture)
|
| 413 | .useLightmap()
|
| 414 | .createRenderSetup()
|
| 415 | )
|
| 416 | );
|
| 417 | private static final Function<Identifier, RenderType> TEXT_POLYGON_OFFSET = Util.memoize(
|
| 418 | texture -> RenderType.create(
|
| 419 | "text_polygon_offset",
|
| 420 | RenderSetup.builder(RenderPipelines.TEXT_POLYGON_OFFSET)
|
| 421 | .setOitPipelines(RenderPipelines.OIT_TEXT_POLYGON_OFFSET)
|
| 422 | .withTexture("Sampler0", texture)
|
| 423 | .useLightmap()
|
| 424 | .sortOnUpload()
|
| 425 | .createRenderSetup()
|
| 426 | )
|
| 427 | );
|
| 428 | private static final Function<Identifier, RenderType> TEXT_GRAYSCALE_POLYGON_OFFSET = Util.memoize(
|
| 429 | texture -> RenderType.create(
|
| 430 | "text_grayscale_polygon_offset",
|
| 431 | RenderSetup.builder(RenderPipelines.TEXT_GRAYSCALE_POLYGON_OFFSET)
|
| 432 | .setOitPipelines(RenderPipelines.OIT_TEXT_GRAYSCALE_POLYGON_OFFSET)
|
| 433 | .withTexture("Sampler0", texture)
|
| 434 | .useLightmap()
|
| 435 | .sortOnUpload()
|
| 436 | .createRenderSetup()
|
| 437 | )
|
| 438 | );
|
| 439 | private static final Function<Identifier, RenderType> TEXT_SEE_THROUGH = Util.memoize(
|
| 440 | texture -> RenderType.create(
|
| 441 | "text_see_through", RenderSetup.builder(RenderPipelines.TEXT_SEE_THROUGH).withTexture("Sampler0", texture).useLightmap().createRenderSetup()
|
| 442 | )
|
| 443 | );
|
| 444 | private static final Function<Identifier, RenderType> TEXT_GRAYSCALE_SEE_THROUGH = Util.memoize(
|
| 445 | texture -> RenderType.create(
|
| 446 | "text_grayscale_see_through",
|
| 447 | RenderSetup.builder(RenderPipelines.TEXT_GRAYSCALE_SEE_THROUGH).withTexture("Sampler0", texture).useLightmap().sortOnUpload().createRenderSetup()
|
| 448 | )
|
| 449 | );
|
| 450 | private static final RenderType LIGHTNING = RenderType.create(
|
| 451 | "lightning", RenderSetup.builder(RenderPipelines.LIGHTNING).setOitPipelines(RenderPipelines.OIT_LIGHTNING).sortOnUpload().createRenderSetup()
|
| 452 | );
|
| 453 | private static final RenderType DRAGON_RAYS = RenderType.create(
|
| 454 | "dragon_rays", RenderSetup.builder(RenderPipelines.DRAGON_RAYS).setOitPipelines(RenderPipelines.OIT_DRAGON_RAYS).createRenderSetup()
|
| 455 | );
|
| 456 | private static final RenderType END_PORTAL = RenderType.create(
|
| 457 | "end_portal",
|
| 458 | RenderSetup.builder(RenderPipelines.END_PORTAL)
|
| 459 | .withTexture("Sampler0", AbstractEndPortalRenderer.END_SKY_LOCATION)
|
| 460 | .withTexture("Sampler1", AbstractEndPortalRenderer.END_PORTAL_LOCATION)
|
| 461 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 462 | .createRenderSetup()
|
| 463 | );
|
| 464 | private static final RenderType END_GATEWAY = RenderType.create(
|
| 465 | "end_gateway",
|
| 466 | RenderSetup.builder(RenderPipelines.END_GATEWAY)
|
| 467 | .withTexture("Sampler0", AbstractEndPortalRenderer.END_SKY_LOCATION)
|
| 468 | .withTexture("Sampler1", AbstractEndPortalRenderer.END_PORTAL_LOCATION)
|
| 469 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE)
|
| 470 | .createRenderSetup()
|
| 471 | );
|
| 472 | public static final RenderType LINES = RenderType.create(
|
| 473 | "lines", RenderSetup.builder(RenderPipelines.LINES).setLayeringTransform(LayeringTransform.VIEW_OFFSET_Z_LAYERING).createRenderSetup()
|
| 474 | );
|
| 475 | public static final RenderType LINES_TRANSLUCENT = RenderType.create(
|
| 476 | "lines_translucent",
|
| 477 | RenderSetup.builder(RenderPipelines.LINES_TRANSLUCENT).setLayeringTransform(LayeringTransform.VIEW_OFFSET_Z_LAYERING).createRenderSetup()
|
| 478 | );
|
| 479 | public static final RenderType LINES_TRANSLUCENT_NO_DEPTH_WRITE = RenderType.create(
|
| 480 | "lines_translucent_no_depth_write",
|
| 481 | RenderSetup.builder(RenderPipelines.LINES_TRANSLUCENT_NO_DEPTH_WRITE)
|
| 482 | .setOitPipelines(RenderPipelines.OIT_LINES_TRANSLUCENT)
|
| 483 | .setLayeringTransform(LayeringTransform.VIEW_OFFSET_Z_LAYERING)
|
| 484 | .createRenderSetup()
|
| 485 | );
|
| 486 | public static final RenderType LINES_DEPTH_BIAS = RenderType.create(
|
| 487 | "lines_translucent_depth_bias",
|
| 488 | RenderSetup.builder(RenderPipelines.LINES_DEPTH_BIAS)
|
| 489 | .setOitPipelines(RenderPipelines.OIT_LINES_TRANSLUCENT)
|
| 490 | .setLayeringTransform(LayeringTransform.VIEW_OFFSET_Z_LAYERING)
|
| 491 | .createRenderSetup()
|
| 492 | );
|
| 493 | public static final RenderType SECONDARY_BLOCK_OUTLINE = RenderType.create(
|
| 494 | "secondary_block_outline",
|
| 495 | RenderSetup.builder(RenderPipelines.SECONDARY_BLOCK_OUTLINE).setLayeringTransform(LayeringTransform.VIEW_OFFSET_Z_LAYERING).createRenderSetup()
|
| 496 | );
|
| 497 | private static final RenderType DEBUG_FILLED_BOX = RenderType.create(
|
| 498 | "debug_filled_box",
|
| 499 | RenderSetup.builder(RenderPipelines.DEBUG_FILLED_BOX)
|
| 500 | .setOitPipelines(RenderPipelines.OIT_DEBUG_FILLED_BOX)
|
| 501 | .sortOnUpload()
|
| 502 | .setLayeringTransform(LayeringTransform.VIEW_OFFSET_Z_LAYERING)
|
| 503 | .createRenderSetup()
|
| 504 | );
|
| 505 | private static final RenderType DEBUG_POINT = RenderType.create(
|
| 506 | "debug_point", RenderSetup.builder(RenderPipelines.DEBUG_POINTS).setOitPipelines(RenderPipelines.OIT_DEBUG_POINTS).createRenderSetup()
|
| 507 | );
|
| 508 | private static final RenderType DEBUG_QUADS = RenderType.create(
|
| 509 | "debug_quads", RenderSetup.builder(RenderPipelines.DEBUG_QUADS).setOitPipelines(RenderPipelines.OIT_DEBUG_QUADS).sortOnUpload().createRenderSetup()
|
| 510 | );
|
| 511 | private static final RenderType DEBUG_TRIANGLE_FAN = RenderType.create(
|
| 512 | "debug_triangle_fan", RenderSetup.builder(RenderPipelines.DEBUG_TRIANGLE_FAN).setOitPipelines(RenderPipelines.OIT_DEBUG_TRIANGLE_FAN).createRenderSetup()
|
| 513 | );
|
| 514 | private static final Function<Identifier, RenderType> BLOCK_SCREEN_EFFECT = Util.memoize(
|
| 515 | texture -> RenderType.create(
|
| 516 | "block_screen_effect", RenderSetup.builder(RenderPipelines.BLOCK_SCREEN_EFFECT).withTexture("Sampler0", texture).createRenderSetup()
|
| 517 | )
|
| 518 | );
|
| 519 | private static final Function<Identifier, RenderType> FIRE_SCREEN_EFFECT = Util.memoize(
|
| 520 | texture -> RenderType.create(
|
| 521 | "fire_screen_effect", RenderSetup.builder(RenderPipelines.FIRE_SCREEN_EFFECT).withTexture("Sampler0", texture).createRenderSetup()
|
| 522 | )
|
| 523 | );
|
| 524 |
|
| 525 | private static RenderSetup createMovingBlockSetup(final RenderPipeline pipeline, final boolean translucent) {
|
| 526 | RenderSetup.RenderSetupBuilder setup = RenderSetup.builder(pipeline)
|
| 527 | .useLightmap()
|
| 528 | .withTexture(
|
| 529 | "Sampler0",
|
| 530 | TextureAtlas.LOCATION_BLOCKS,
|
| 531 | () -> RenderSystem.getSamplerCache().getSampler(AddressMode.CLAMP_TO_EDGE, AddressMode.CLAMP_TO_EDGE, FilterMode.LINEAR, FilterMode.NEAREST, true)
|
| 532 | )
|
| 533 | .affectsCrumbling()
|
| 534 | .setOutline(RenderSetup.OutlineProperty.AFFECTS_OUTLINE);
|
| 535 | if (translucent) {
|
| 536 | setup.sortOnUpload().setOitPipelines(RenderPipelines.OIT_TRANSLUCENT_BLOCK);
|
| 537 | }
|
| 538 |
|
| 539 | return setup.createRenderSetup();
|
| 540 | }
|
| 541 |
|
| 542 | public static RenderType solidMovingBlock() {
|
| 543 | return SOLID_MOVING_BLOCK;
|
| 544 | }
|
| 545 |
|
| 546 | public static RenderType cutoutMovingBlock() {
|
| 547 | return CUTOUT_MOVING_BLOCK;
|
| 548 | }
|
| 549 |
|
| 550 | public static RenderType translucentMovingBlock() {
|
| 551 | return TRANSLUCENT_MOVING_BLOCK;
|
| 552 | }
|
| 553 |
|
| 554 | public static RenderType armorCutoutNoCull(final Identifier texture) {
|
| 555 | return ARMOR_CUTOUT_NO_CULL.apply(texture);
|
| 556 | }
|
| 557 |
|
| 558 | public static RenderType armorCutoutNoCullGlint(final Identifier texture) {
|
| 559 | return ARMOR_CUTOUT_NO_CULL_GLINT.apply(texture);
|
| 560 | }
|
| 561 |
|
| 562 | public static RenderType armorTrim(final Identifier texture, final boolean decal) {
|
| 563 | return (decal ? ARMOR_TRIM_DECAL : ARMOR_TRIM).apply(texture);
|
| 564 | }
|
| 565 |
|
| 566 | public static RenderType wolfArmorCracks(final Identifier texture) {
|
| 567 | return WOLF_ARMOR_CRACKS.apply(texture);
|
| 568 | }
|
| 569 |
|
| 570 | public static RenderType entitySolid(final Identifier texture) {
|
| 571 | return ENTITY_SOLID.apply(texture);
|
| 572 | }
|
| 573 |
|
| 574 | public static RenderType entitySolidGlint(final Identifier texture) {
|
| 575 | return ENTITY_SOLID_GLINT.apply(texture);
|
| 576 | }
|
| 577 |
|
| 578 | public static RenderType entitySolidZOffsetForward(final Identifier texture) {
|
| 579 | return ENTITY_SOLID_Z_OFFSET_FORWARD.apply(texture);
|
| 580 | }
|
| 581 |
|
| 582 | public static RenderType entityCutoutCull(final Identifier texture) {
|
| 583 | return ENTITY_CUTOUT_CULL.apply(texture);
|
| 584 | }
|
| 585 |
|
| 586 | public static RenderType entityCutout(final Identifier texture, final boolean affectsOutline) {
|
| 587 | return ENTITY_CUTOUT.apply(texture, affectsOutline);
|
| 588 | }
|
| 589 |
|
| 590 | public static RenderType entityCutout(final Identifier texture) {
|
| 591 | return entityCutout(texture, true);
|
| 592 | }
|
| 593 |
|
| 594 | public static RenderType entityCutoutZOffset(final Identifier texture, final boolean affectsOutline) {
|
| 595 | return ENTITY_CUTOUT_Z_OFFSET.apply(texture, affectsOutline);
|
| 596 | }
|
| 597 |
|
| 598 | public static RenderType entityCutoutZOffset(final Identifier texture) {
|
| 599 | return entityCutoutZOffset(texture, true);
|
| 600 | }
|
| 601 |
|
| 602 | public static RenderType entityCutoutDissolve(final Identifier texture, final Identifier maskTexture) {
|
| 603 | return ENTITY_CUTOUT_DISSOLVE.apply(texture, maskTexture);
|
| 604 | }
|
| 605 |
|
| 606 | public static RenderType entityTranslucentCull(final Identifier texture) {
|
| 607 | return ENTITY_TRANSLUCENT_CULL.apply(texture);
|
| 608 | }
|
| 609 |
|
| 610 | public static RenderType itemCutout(final Identifier texture) {
|
| 611 | return ITEM_CUTOUT.apply(texture);
|
| 612 | }
|
| 613 |
|
| 614 | public static RenderType itemCutoutGlint(final Identifier texture) {
|
| 615 | return ITEM_CUTOUT_GLINT.apply(texture);
|
| 616 | }
|
| 617 |
|
| 618 | public static RenderType itemCutoutGlintSpecial(final Identifier texture) {
|
| 619 | return ITEM_CUTOUT_GLINT_SPECIAL.apply(texture);
|
| 620 | }
|
| 621 |
|
| 622 | public static RenderType itemTranslucent(final Identifier texture) {
|
| 623 | return ITEM_TRANSLUCENT.apply(texture);
|
| 624 | }
|
| 625 |
|
| 626 | public static RenderType itemTranslucentGlint(final Identifier texture) {
|
| 627 | return ITEM_TRANSLUCENT_GLINT.apply(texture);
|
| 628 | }
|
| 629 |
|
| 630 | public static RenderType itemTranslucentGlintSpecial(final Identifier texture) {
|
| 631 | return ITEM_TRANSLUCENT_GLINT_SPECIAL.apply(texture);
|
| 632 | }
|
| 633 |
|
| 634 | public static RenderType entityTranslucent(final Identifier texture, final boolean affectsOutline) {
|
| 635 | return ENTITY_TRANSLUCENT.apply(texture, affectsOutline);
|
| 636 | }
|
| 637 |
|
| 638 | public static RenderType entityTranslucent(final Identifier texture) {
|
| 639 | return entityTranslucent(texture, true);
|
| 640 | }
|
| 641 |
|
| 642 | public static RenderType entityTranslucentEmissive(final Identifier texture) {
|
| 643 | return ENTITY_TRANSLUCENT_EMISSIVE.apply(texture, true);
|
| 644 | }
|
| 645 |
|
| 646 | public static RenderType endCrystalBeam(final Identifier texture) {
|
| 647 | return END_CRYSTAL_BEAM.apply(texture);
|
| 648 | }
|
| 649 |
|
| 650 | public static RenderType beaconBeam(final Identifier texture, final boolean translucent) {
|
| 651 | return BEACON_BEAM.apply(texture, translucent);
|
| 652 | }
|
| 653 |
|
| 654 | public static RenderType bannerPattern(final Identifier texture) {
|
| 655 | return BANNER_PATTERN.apply(texture);
|
| 656 | }
|
| 657 |
|
| 658 | public static RenderType entityShadow(final Identifier texture) {
|
| 659 | return ENTITY_SHADOW.apply(texture);
|
| 660 | }
|
| 661 |
|
| 662 | public static RenderType eyes(final Identifier texture) {
|
| 663 | return EYES.apply(texture);
|
| 664 | }
|
| 665 |
|
| 666 | public static RenderType breezeEyes(final Identifier texture) {
|
| 667 | return ENTITY_TRANSLUCENT_EMISSIVE.apply(texture, false);
|
| 668 | }
|
| 669 |
|
| 670 | public static RenderType breezeWind(final Identifier texture, final float uOffset, final float vOffset) {
|
| 671 | return RenderType.create(
|
| 672 | "breeze_wind",
|
| 673 | RenderSetup.builder(RenderPipelines.BREEZE_WIND)
|
| 674 | .setOitPipelines(RenderPipelines.OIT_BREEZE_WIND)
|
| 675 | .withTexture("Sampler0", texture)
|
| 676 | .setTextureTransform(new TextureTransform.OffsetTextureTransform(uOffset, vOffset))
|
| 677 | .useLightmap()
|
| 678 | .sortOnUpload()
|
| 679 | .createRenderSetup()
|
| 680 | );
|
| 681 | }
|
| 682 |
|
| 683 | public static RenderType energySwirl(final Identifier texture, final float uOffset, final float vOffset) {
|
| 684 | return RenderType.create(
|
| 685 | "energy_swirl",
|
| 686 | RenderSetup.builder(RenderPipelines.ENERGY_SWIRL)
|
| 687 | .setOitPipelines(RenderPipelines.OIT_ENERGY_SWIRL)
|
| 688 | .withTexture("Sampler0", texture)
|
| 689 | .setTextureTransform(new TextureTransform.OffsetTextureTransform(uOffset, vOffset))
|
| 690 | .useLightmap()
|
| 691 | .useOverlay()
|
| 692 | .sortOnUpload()
|
| 693 | .createRenderSetup()
|
| 694 | );
|
| 695 | }
|
| 696 |
|
| 697 | public static RenderType leash() {
|
| 698 | return LEASH;
|
| 699 | }
|
| 700 |
|
| 701 | public static RenderType waterMask() {
|
| 702 | return Minecraft.getInstance().gameRenderer.useImprovedTransparency() ? OIT_WATER_MASK : WATER_MASK;
|
| 703 | }
|
| 704 |
|
| 705 | public static RenderType outline(final Identifier texture) {
|
| 706 | return OUTLINE.apply(texture, false);
|
| 707 | }
|
| 708 |
|
| 709 | public static RenderType patternedShieldGlint() {
|
| 710 | return PATTERNED_SHIELD_GLINT;
|
| 711 | }
|
| 712 |
|
| 713 | public static RenderType trimmedArmorGlint() {
|
| 714 | return TRIMMED_ARMOR_GLINT;
|
| 715 | }
|
| 716 |
|
| 717 | public static RenderType crumbling(final Identifier texture) {
|
| 718 | return CRUMBLING.apply(texture);
|
| 719 | }
|
| 720 |
|
| 721 | public static RenderType text(final Identifier texture) {
|
| 722 | return TEXT.apply(texture);
|
| 723 | }
|
| 724 |
|
| 725 | public static RenderType textGrayscale(final Identifier texture) {
|
| 726 | return TEXT_GRAYSCALE.apply(texture);
|
| 727 | }
|
| 728 |
|
| 729 | public static RenderType textPolygonOffset(final Identifier texture) {
|
| 730 | return TEXT_POLYGON_OFFSET.apply(texture);
|
| 731 | }
|
| 732 |
|
| 733 | public static RenderType textGrayscalePolygonOffset(final Identifier texture) {
|
| 734 | return TEXT_GRAYSCALE_POLYGON_OFFSET.apply(texture);
|
| 735 | }
|
| 736 |
|
| 737 | public static RenderType textSeeThrough(final Identifier texture) {
|
| 738 | return TEXT_SEE_THROUGH.apply(texture);
|
| 739 | }
|
| 740 |
|
| 741 | public static RenderType textGrayscaleSeeThrough(final Identifier texture) {
|
| 742 | return TEXT_GRAYSCALE_SEE_THROUGH.apply(texture);
|
| 743 | }
|
| 744 |
|
| 745 | public static RenderType lightning() {
|
| 746 | return LIGHTNING;
|
| 747 | }
|
| 748 |
|
| 749 | public static RenderType dragonRays() {
|
| 750 | return DRAGON_RAYS;
|
| 751 | }
|
| 752 |
|
| 753 | public static RenderType endPortal() {
|
| 754 | return END_PORTAL;
|
| 755 | }
|
| 756 |
|
| 757 | public static RenderType endGateway() {
|
| 758 | return END_GATEWAY;
|
| 759 | }
|
| 760 |
|
| 761 | public static RenderType lines() {
|
| 762 | return LINES;
|
| 763 | }
|
| 764 |
|
| 765 | public static RenderType linesTranslucent() {
|
| 766 | return LINES_TRANSLUCENT;
|
| 767 | }
|
| 768 |
|
| 769 | public static RenderType linesTranslucentNoDepthWrite() {
|
| 770 | return LINES_TRANSLUCENT_NO_DEPTH_WRITE;
|
| 771 | }
|
| 772 |
|
| 773 | public static RenderType linesDepthBias() {
|
| 774 | return LINES_DEPTH_BIAS;
|
| 775 | }
|
| 776 |
|
| 777 | public static RenderType secondaryBlockOutline() {
|
| 778 | return SECONDARY_BLOCK_OUTLINE;
|
| 779 | }
|
| 780 |
|
| 781 | public static RenderType debugFilledBox() {
|
| 782 | return DEBUG_FILLED_BOX;
|
| 783 | }
|
| 784 |
|
| 785 | public static RenderType debugPoint() {
|
| 786 | return DEBUG_POINT;
|
| 787 | }
|
| 788 |
|
| 789 | public static RenderType debugQuads() {
|
| 790 | return DEBUG_QUADS;
|
| 791 | }
|
| 792 |
|
| 793 | public static RenderType debugTriangleFan() {
|
| 794 | return DEBUG_TRIANGLE_FAN;
|
| 795 | }
|
| 796 |
|
| 797 | public static RenderType blockScreenEffect(final Identifier texture) {
|
| 798 | return BLOCK_SCREEN_EFFECT.apply(texture);
|
| 799 | }
|
| 800 |
|
| 801 | public static RenderType fireScreenEffect(final Identifier texture) {
|
| 802 | return FIRE_SCREEN_EFFECT.apply(texture);
|
| 803 | }
|
| 804 | }
|
| 805 |
|