Small tidying

- Move RenderTypeExtension to util
 - Avoid creating unnecessary material objects in Shuklers
 - Remove vestigial classes
This commit is contained in:
Jozufozu 2022-07-19 10:59:29 -07:00
parent 0b228b9db9
commit dca2ba7605
6 changed files with 8 additions and 42 deletions

View file

@ -1,32 +0,0 @@
package com.jozufozu.flywheel.backend;
import org.lwjgl.opengl.GL43;
import org.lwjgl.opengl.GLDebugMessageCallback;
import com.mojang.blaze3d.platform.GlDebug;
public class FlywheelDebug {
//
// public static void setup() {
// GLDebugMessageCallback.create()
// GL43.glDebugMessageCallback();
// }
//
// private static void printDebugLog(int p_84039_, int p_84040_, int p_84041_, int p_84042_, int p_84043_, long p_84044_, long p_84045_) {
// String s = GLDebugMessageCallback.getMessage(p_84043_, p_84044_);
// GlDebug.LogEntry gldebug$logentry;
// synchronized(MESSAGE_BUFFER) {
// gldebug$logentry = lastEntry;
// if (gldebug$logentry != null && gldebug$logentry.isSame(p_84039_, p_84040_, p_84041_, p_84042_, s)) {
// ++gldebug$logentry.count;
// } else {
// gldebug$logentry = new GlDebug.LogEntry(p_84039_, p_84040_, p_84041_, p_84042_, s);
// MESSAGE_BUFFER.add(gldebug$logentry);
// lastEntry = gldebug$logentry;
// }
// }
//
// LOGGER.info("OpenGL debug message: {}", (Object)gldebug$logentry);
// }
}

View file

@ -5,6 +5,7 @@ import java.util.Set;
import com.jozufozu.flywheel.backend.model.BufferBuilderExtension;
import com.jozufozu.flywheel.backend.model.DirectVertexConsumer;
import com.jozufozu.flywheel.util.RenderTypeExtension;
import com.mojang.blaze3d.vertex.BufferBuilder;
import net.minecraft.client.renderer.RenderType;

View file

@ -1,6 +0,0 @@
package com.jozufozu.flywheel.backend.instancing;
@FunctionalInterface
public interface Renderable {
void draw();
}

View file

@ -5,7 +5,7 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import com.jozufozu.flywheel.backend.instancing.DrawBuffer;
import com.jozufozu.flywheel.backend.instancing.RenderTypeExtension;
import com.jozufozu.flywheel.util.RenderTypeExtension;
import net.minecraft.client.renderer.RenderType;

View file

@ -1,4 +1,6 @@
package com.jozufozu.flywheel.backend.instancing;
package com.jozufozu.flywheel.util;
import com.jozufozu.flywheel.backend.instancing.DrawBuffer;
import net.minecraft.client.renderer.RenderType;

View file

@ -31,8 +31,9 @@ import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity;
public class ShulkerBoxInstance extends BlockEntityInstance<ShulkerBoxBlockEntity> implements DynamicInstance {
private static final Function<TextureAtlasSprite, BasicModelSupplier> BASE = Util.memoize(it -> new BasicModelSupplier(() -> makeBaseModel(it), new Material(RenderType.entityCutoutNoCull(Sheets.SHULKER_SHEET), MaterialShaders.SHADED_VERTEX, MaterialShaders.DEFAULT_FRAGMENT)));
private static final Function<TextureAtlasSprite, BasicModelSupplier> LID = Util.memoize(it -> new BasicModelSupplier(() -> makeLidModel(it), new Material(RenderType.entityCutoutNoCull(Sheets.SHULKER_SHEET), MaterialShaders.SHADED_VERTEX, MaterialShaders.DEFAULT_FRAGMENT)));
private static final Material SHULKER_BOX_MATERIAL = new Material(RenderType.entityCutoutNoCull(Sheets.SHULKER_SHEET), MaterialShaders.SHADED_VERTEX, MaterialShaders.DEFAULT_FRAGMENT);
private static final Function<TextureAtlasSprite, BasicModelSupplier> BASE = Util.memoize(it -> new BasicModelSupplier(() -> makeBaseModel(it), SHULKER_BOX_MATERIAL));
private static final Function<TextureAtlasSprite, BasicModelSupplier> LID = Util.memoize(it -> new BasicModelSupplier(() -> makeLidModel(it), SHULKER_BOX_MATERIAL));
private final TextureAtlasSprite texture;