Fix issue with missing banner pattern textures

Fixes #12

What the heck

CrumblingRenderer gets classloaded early because of its event listener.

CrumblingRenderer had an innocent static reference to a member of ModelBakery.

This caused ModelBakery to classload before additional enums could be injected into BannerPattern.

¯\_(ツ)_/¯
This commit is contained in:
Jozufozu 2021-07-29 18:50:47 -07:00
parent d69ff7054e
commit 0183451a06
2 changed files with 7 additions and 4 deletions

View File

@ -53,8 +53,6 @@ public class CrumblingRenderer {
INVALIDATOR = state.getSecond();
}
private static final RenderType crumblingLayer = ModelBakery.DESTROY_TYPES.get(0);
public static void renderBreaking(ClientWorld world, Matrix4f viewProjection, double cameraX, double cameraY, double cameraZ) {
if (!Backend.getInstance()
.canUseInstancing(world)) return;
@ -64,6 +62,7 @@ public class CrumblingRenderer {
if (activeStages.isEmpty()) return;
State state = STATE.get();
RenderType layer = ModelBakery.DESTROY_TYPES.get(0);
InstanceManager<TileEntity> renderer = state.instanceManager;
@ -71,7 +70,7 @@ public class CrumblingRenderer {
ActiveRenderInfo info = Minecraft.getInstance().gameRenderer.getMainCamera();
MaterialManager<CrumblingProgram> materials = state.materialManager;
crumblingLayer.setupRenderState();
layer.setupRenderState();
for (Int2ObjectMap.Entry<List<TileEntity>> stage : activeStages.int2ObjectEntrySet()) {
int i = stage.getIntKey();
@ -92,7 +91,7 @@ public class CrumblingRenderer {
}
crumblingLayer.clearRenderState();
layer.clearRenderState();
GlTextureUnit.T0.makeActive();
Texture breaking = textureManager.getTexture(ModelBakery.BREAKING_LOCATIONS.get(0));

View File

@ -36,6 +36,10 @@ public class Lazy<T> {
return Pair.of(lazy, killSwitch);
}
public static <T> Lazy<T> of(NonNullSupplier<T> factory) {
return new Lazy<>(factory);
}
public static class KillSwitch<T> {
private final Lazy<T> lazy;