diff --git a/src/main/java/com/jozufozu/flywheel/backend/Backend.java b/src/main/java/com/jozufozu/flywheel/backend/Backend.java index 6bad69303..b406c55d0 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/Backend.java +++ b/src/main/java/com/jozufozu/flywheel/backend/Backend.java @@ -1,25 +1,38 @@ package com.jozufozu.flywheel.backend; +import java.util.Collection; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.lwjgl.opengl.GL; import org.lwjgl.opengl.GLCapabilities; +import com.jozufozu.flywheel.backend.core.BasicInstancedTileRenderer; import com.jozufozu.flywheel.backend.core.ContraptionContext; import com.jozufozu.flywheel.backend.core.EffectsContext; import com.jozufozu.flywheel.backend.core.WorldContext; import com.jozufozu.flywheel.backend.effects.EffectsHandler; +import com.jozufozu.flywheel.backend.gl.shader.GlProgram; import com.jozufozu.flywheel.backend.gl.shader.ProgramSpec; import com.jozufozu.flywheel.backend.gl.versioned.GlCompat; import com.jozufozu.flywheel.backend.instancing.IFlywheelWorld; +import com.jozufozu.flywheel.backend.instancing.InstancedModel; +import com.jozufozu.flywheel.backend.instancing.MaterialSpec; +import com.simibubi.create.CreateClient; +import com.simibubi.create.content.contraptions.KineticDebugger; import com.simibubi.create.foundation.config.AllConfigs; +import com.simibubi.create.foundation.utility.WorldAttached; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.entity.Entity; import net.minecraft.resources.IReloadableResourceManager; import net.minecraft.resources.IResourceManager; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.vector.Matrix4f; import net.minecraft.world.World; @@ -35,12 +48,14 @@ public class Backend { public static GLCapabilities capabilities; public static GlCompat compat; + public static WorldAttached> queuedUpdates = new WorldAttached<>(ConcurrentHashMap::newKeySet); private static boolean instancingAvailable; private static boolean enabled; + static Map> materialRegistry = new HashMap<>(); static final Map> contexts = new HashMap<>(); - static final Map specRegistry = new HashMap<>(); + static final Map programSpecRegistry = new HashMap<>(); static { register(WorldContext.INSTANCE); @@ -57,17 +72,17 @@ public class Backend { */ public static ProgramSpec register(ProgramSpec spec) { ResourceLocation name = spec.name; - if (specRegistry.containsKey(name)) { + if (programSpecRegistry.containsKey(name)) { throw new IllegalStateException("Program spec '" + name + "' already registered."); } - specRegistry.put(name, spec); + programSpecRegistry.put(name, spec); return spec; } /** * Register a shader context. */ - public static ShaderContext register(ShaderContext spec) { + public static

ShaderContext

register(ShaderContext

spec) { ResourceLocation name = spec.getRoot(); if (contexts.containsKey(name)) { throw new IllegalStateException("Program spec '" + name + "' already registered."); @@ -76,6 +91,18 @@ public class Backend { return spec; } + /** + * Register an instancing material. + */ + public static > MaterialSpec register(MaterialSpec spec) { + ResourceLocation name = spec.name; + if (materialRegistry.containsKey(name)) { + throw new IllegalStateException("Material spec '" + name + "' already registered."); + } + materialRegistry.put(name, spec); + return spec; + } + public static boolean isFlywheelWorld(World world) { return world == Minecraft.getInstance().world || (world instanceof IFlywheelWorld && ((IFlywheelWorld) world).supportsFlywheel()); } @@ -129,4 +156,63 @@ public class Backend { effects = new EffectsHandler(); } } + + public static void tick() { + Minecraft mc = Minecraft.getInstance(); + ClientWorld world = mc.world; + + BasicInstancedTileRenderer kineticRenderer = CreateClient.kineticRenderer.get(world); + + Entity renderViewEntity = mc.renderViewEntity; + kineticRenderer.tick(renderViewEntity.getX(), renderViewEntity.getY(), renderViewEntity.getZ()); + + ConcurrentHashMap.KeySetView map = queuedUpdates.get(world); + map + .forEach(te -> { + map.remove(te); + + kineticRenderer.update(te); + }); + } + + public static void renderLayer(RenderType layer, Matrix4f viewProjection, double cameraX, double cameraY, double cameraZ) { + if (!canUseInstancing()) return; + + ClientWorld world = Minecraft.getInstance().world; + BasicInstancedTileRenderer kineticRenderer = CreateClient.kineticRenderer.get(world); + + layer.startDrawing(); + + kineticRenderer.render(layer, viewProjection, cameraX, cameraY, cameraZ); + + layer.endDrawing(); + } + + public static void enqueueUpdate(TileEntity te) { + queuedUpdates.get(te.getWorld()).add(te); + } + + public static void reloadWorldRenderers() { + RenderWork.enqueue(Minecraft.getInstance().worldRenderer::loadRenderers); + } + + public static boolean canUseInstancing(World world) { + return canUseInstancing() && isFlywheelWorld(world); + } + + /** + * TODO: Remove in favor of separate debug programs specified by the SpecLoader/IMultiProgram + */ + @Deprecated + public static int getDebugMode() { + return KineticDebugger.isActive() ? 1 : 0; + } + + public static Collection> allMaterials() { + return materialRegistry.values(); + } + + public static Collection allPrograms() { + return programSpecRegistry.values(); + } } diff --git a/src/main/java/com/jozufozu/flywheel/backend/FastRenderDispatcher.java b/src/main/java/com/jozufozu/flywheel/backend/FastRenderDispatcher.java deleted file mode 100644 index 4f936d889..000000000 --- a/src/main/java/com/jozufozu/flywheel/backend/FastRenderDispatcher.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.jozufozu.flywheel.backend; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import com.jozufozu.flywheel.backend.core.BasicInstancedTileRenderer; -import com.jozufozu.flywheel.backend.core.OrientedModel; -import com.jozufozu.flywheel.backend.core.TransformedModel; -import com.jozufozu.flywheel.backend.instancing.MaterialSpec; -import com.simibubi.create.CreateClient; -import com.simibubi.create.content.contraptions.KineticDebugger; -import com.simibubi.create.content.contraptions.base.KineticRenderMaterials; -import com.simibubi.create.content.contraptions.base.RotatingModel; -import com.simibubi.create.content.contraptions.components.actors.ActorModel; -import com.simibubi.create.content.contraptions.relays.belt.BeltInstancedModel; -import com.simibubi.create.content.logistics.block.FlapModel; -import com.simibubi.create.foundation.render.AllProgramSpecs; -import com.simibubi.create.foundation.utility.WorldAttached; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.entity.Entity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.vector.Matrix4f; -import net.minecraft.world.World; - -public class FastRenderDispatcher { - - public static Map, MaterialSpec> materials = new HashMap<>(); - - static { - registerMaterials(); - } - - public static WorldAttached> queuedUpdates = new WorldAttached<>(ConcurrentHashMap::newKeySet); - - public static void registerMaterials() { - materials.put(MaterialTypes.TRANSFORMED, new MaterialSpec(AllProgramSpecs.MODEL, TransformedModel::new)); - materials.put(MaterialTypes.ORIENTED, new MaterialSpec(AllProgramSpecs.ORIENTED, OrientedModel::new)); - materials.put(KineticRenderMaterials.BELTS, new MaterialSpec(AllProgramSpecs.BELT, BeltInstancedModel::new)); - materials.put(KineticRenderMaterials.ROTATING, new MaterialSpec(AllProgramSpecs.ROTATING, RotatingModel::new)); - materials.put(KineticRenderMaterials.FLAPS, new MaterialSpec(AllProgramSpecs.FLAPS, FlapModel::new)); - materials.put(KineticRenderMaterials.ACTORS, new MaterialSpec(AllProgramSpecs.ACTOR, ActorModel::new)); - } - - public static void enqueueUpdate(TileEntity te) { - queuedUpdates.get(te.getWorld()).add(te); - } - - public static void tick() { - Minecraft mc = Minecraft.getInstance(); - ClientWorld world = mc.world; - - BasicInstancedTileRenderer kineticRenderer = CreateClient.kineticRenderer.get(world); - - Entity renderViewEntity = mc.renderViewEntity; - kineticRenderer.tick(renderViewEntity.getX(), renderViewEntity.getY(), renderViewEntity.getZ()); - - ConcurrentHashMap.KeySetView map = queuedUpdates.get(world); - map - .forEach(te -> { - map.remove(te); - - kineticRenderer.update(te); - }); - } - - public static boolean available() { - return Backend.canUseInstancing(); - } - - public static boolean available(World world) { - return Backend.canUseInstancing() && Backend.isFlywheelWorld(world); - } - - public static int getDebugMode() { - return KineticDebugger.isActive() ? 1 : 0; - } - - public static void refresh() { - RenderWork.enqueue(Minecraft.getInstance().worldRenderer::loadRenderers); - } - - public static void renderLayer(RenderType layer, Matrix4f viewProjection, double cameraX, double cameraY, double cameraZ) { - if (!Backend.canUseInstancing()) return; - - ClientWorld world = Minecraft.getInstance().world; - BasicInstancedTileRenderer kineticRenderer = CreateClient.kineticRenderer.get(world); - - layer.startDrawing(); - - kineticRenderer.render(layer, viewProjection, cameraX, cameraY, cameraZ); - - layer.endDrawing(); - } -} diff --git a/src/main/java/com/jozufozu/flywheel/backend/MaterialType.java b/src/main/java/com/jozufozu/flywheel/backend/MaterialType.java deleted file mode 100644 index 7e55c49d6..000000000 --- a/src/main/java/com/jozufozu/flywheel/backend/MaterialType.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.jozufozu.flywheel.backend; - -import com.jozufozu.flywheel.backend.instancing.InstancedModel; - -public class MaterialType> { - - @Override - public int hashCode() { - return super.hashCode() * 31 * 493286711; - } -} diff --git a/src/main/java/com/jozufozu/flywheel/backend/MaterialTypes.java b/src/main/java/com/jozufozu/flywheel/backend/MaterialTypes.java deleted file mode 100644 index 2ac7fe4d1..000000000 --- a/src/main/java/com/jozufozu/flywheel/backend/MaterialTypes.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.jozufozu.flywheel.backend; - -import com.jozufozu.flywheel.backend.core.ModelData; -import com.jozufozu.flywheel.backend.core.OrientedData; -import com.jozufozu.flywheel.backend.instancing.InstancedModel; - -public class MaterialTypes { - public static final MaterialType> TRANSFORMED = new MaterialType<>(); - public static final MaterialType> ORIENTED = new MaterialType<>(); -} diff --git a/src/main/java/com/jozufozu/flywheel/backend/core/WorldContext.java b/src/main/java/com/jozufozu/flywheel/backend/core/WorldContext.java index 1d354bf00..360d602aa 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/core/WorldContext.java +++ b/src/main/java/com/jozufozu/flywheel/backend/core/WorldContext.java @@ -4,7 +4,7 @@ import java.util.EnumMap; import java.util.Map; import java.util.regex.Pattern; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.ResourceUtil; import com.jozufozu.flywheel.backend.ShaderContext; import com.jozufozu.flywheel.backend.ShaderLoader; @@ -40,7 +40,7 @@ public class WorldContext

extends ShaderContext

{ programs.values().forEach(IMultiProgram::delete); programs.clear(); - FastRenderDispatcher.materials.values() + Backend.allMaterials() .stream() .map(MaterialSpec::getProgramSpec) .forEach(spec -> loadProgramFromSpec(loader, spec)); diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/InstancedTileRenderer.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/InstancedTileRenderer.java index 514549550..b02958d26 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/InstancedTileRenderer.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/InstancedTileRenderer.java @@ -7,14 +7,12 @@ import java.util.Map; import javax.annotation.Nullable; import com.jozufozu.flywheel.backend.Backend; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; -import com.jozufozu.flywheel.backend.MaterialType; -import com.jozufozu.flywheel.backend.MaterialTypes; -import com.jozufozu.flywheel.backend.ShaderContext; import com.jozufozu.flywheel.backend.core.BasicProgram; import com.jozufozu.flywheel.backend.core.ModelData; import com.jozufozu.flywheel.backend.core.OrientedData; +import com.jozufozu.flywheel.backend.core.WorldContext; import com.jozufozu.flywheel.backend.gl.shader.ShaderCallback; +import com.simibubi.create.foundation.render.AllMaterialSpecs; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ActiveRenderInfo; @@ -34,17 +32,19 @@ public abstract class InstancedTileRenderer

{ protected Map tickableInstances = new HashMap<>(); protected Map dynamicInstances = new HashMap<>(); - public final ShaderContext

context; + public final WorldContext

context; - protected Map, RenderMaterial> materials = new HashMap<>(); + protected Map, RenderMaterial> materials = new HashMap<>(); protected int frame; protected int tick; - protected InstancedTileRenderer(ShaderContext

context) { + protected InstancedTileRenderer(WorldContext

context) { this.context = context; - FastRenderDispatcher.materials.forEach((key, value) -> materials.put(key, value.create(this))); + for (MaterialSpec spec : Backend.allMaterials()) { + materials.put(spec, spec.create(this)); + } } public abstract BlockPos getOriginCoordinate(); @@ -115,16 +115,16 @@ public abstract class InstancedTileRenderer

{ } @SuppressWarnings("unchecked") - public > RenderMaterial getMaterial(MaterialType materialType) { + public > RenderMaterial getMaterial(MaterialSpec materialType) { return (RenderMaterial) materials.get(materialType); } public RenderMaterial> getTransformMaterial() { - return getMaterial(MaterialTypes.TRANSFORMED); + return getMaterial(AllMaterialSpecs.TRANSFORMED); } public RenderMaterial> getOrientedMaterial() { - return getMaterial(MaterialTypes.ORIENTED); + return getMaterial(AllMaterialSpecs.ORIENTED); } @SuppressWarnings("unchecked") diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/MaterialSpec.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/MaterialSpec.java index 17f357531..8e319f98d 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/MaterialSpec.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/MaterialSpec.java @@ -3,12 +3,17 @@ package com.jozufozu.flywheel.backend.instancing; import com.jozufozu.flywheel.backend.core.BasicProgram; import com.jozufozu.flywheel.backend.gl.shader.ProgramSpec; -public class MaterialSpec { +import net.minecraft.util.ResourceLocation; + +public class MaterialSpec> { + + public final ResourceLocation name; private final ProgramSpec programSpec; - private final ModelFactory modelFactory; + private final ModelFactory modelFactory; - public MaterialSpec(ProgramSpec programSpec, ModelFactory modelFactory) { + public MaterialSpec(ResourceLocation name, ProgramSpec programSpec, ModelFactory modelFactory) { + this.name = name; this.programSpec = programSpec; this.modelFactory = modelFactory; } @@ -17,11 +22,11 @@ public class MaterialSpec { return programSpec; } - public ModelFactory getModelFactory() { + public ModelFactory getModelFactory() { return modelFactory; } - public

RenderMaterial create(InstancedTileRenderer

renderer) { + public

RenderMaterial create(InstancedTileRenderer

renderer) { return new RenderMaterial<>(renderer, programSpec, modelFactory); } } diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/RenderMaterial.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/RenderMaterial.java index cfbe4affc..7f1e95405 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/RenderMaterial.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/RenderMaterial.java @@ -9,7 +9,7 @@ import org.apache.commons.lang3.tuple.Pair; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.RenderUtil; import com.jozufozu.flywheel.backend.core.BasicProgram; import com.jozufozu.flywheel.backend.core.PartialModel; @@ -62,7 +62,7 @@ public class RenderMaterial

setup) { P program = renderer.context.getProgram(programSpec); - program.bind(viewProjection, camX, camY, camZ, FastRenderDispatcher.getDebugMode()); + program.bind(viewProjection, camX, camY, camZ, Backend.getDebugMode()); if (setup != null) setup.call(program); diff --git a/src/main/java/com/simibubi/create/CreateClient.java b/src/main/java/com/simibubi/create/CreateClient.java index d73a79237..fe230c877 100644 --- a/src/main/java/com/simibubi/create/CreateClient.java +++ b/src/main/java/com/simibubi/create/CreateClient.java @@ -27,6 +27,7 @@ import com.simibubi.create.foundation.item.CustomItemModels; import com.simibubi.create.foundation.item.CustomRenderedItems; import com.simibubi.create.foundation.ponder.content.PonderIndex; import com.simibubi.create.foundation.ponder.elements.WorldSectionElement; +import com.simibubi.create.foundation.render.AllMaterialSpecs; import com.simibubi.create.foundation.render.AllProgramSpecs; import com.simibubi.create.foundation.render.SuperByteBufferCache; import com.simibubi.create.foundation.utility.WorldAttached; @@ -88,6 +89,7 @@ public class CreateClient { public static void clientInit(FMLClientSetupEvent event) { AllProgramSpecs.init(); + AllMaterialSpecs.init(); kineticRenderer = new WorldAttached<>(BasicInstancedTileRenderer::new); schematicSender = new ClientSchematicLoader(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticRenderMaterials.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticRenderMaterials.java deleted file mode 100644 index d71c65ee6..000000000 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticRenderMaterials.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.simibubi.create.content.contraptions.base; - -import com.jozufozu.flywheel.backend.MaterialType; -import com.jozufozu.flywheel.backend.instancing.InstancedModel; -import com.simibubi.create.content.contraptions.components.actors.ActorData; -import com.simibubi.create.content.contraptions.relays.belt.BeltData; -import com.simibubi.create.content.logistics.block.FlapData; - -public class KineticRenderMaterials { - public static final MaterialType> ROTATING = new MaterialType<>(); - public static final MaterialType> BELTS = new MaterialType<>(); - - public static final MaterialType> ACTORS = new MaterialType<>(); - - public static final MaterialType> FLAPS = new MaterialType<>(); -} diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java index 653240307..a3e7dad01 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java @@ -7,7 +7,7 @@ import java.util.List; import javax.annotation.Nullable; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.instancing.IInstanceRendered; import com.simibubi.create.Create; import com.simibubi.create.content.contraptions.KineticNetwork; @@ -257,7 +257,7 @@ public abstract class KineticTileEntity extends SmartTileEntity effects.triggerOverStressedEffect(); if (clientPacket) - FastRenderDispatcher.enqueueUpdate(this); + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> Backend.enqueueUpdate(this)); } public float getGeneratedSpeed() { @@ -552,7 +552,7 @@ public abstract class KineticTileEntity extends SmartTileEntity public void requestModelDataUpdate() { super.requestModelDataUpdate(); if (!this.removed) { - FastRenderDispatcher.enqueueUpdate(this); + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> Backend.enqueueUpdate(this)); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntityRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntityRenderer.java index e86972c03..707679a35 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntityRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.base; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlocks; @@ -39,7 +39,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer extends T } protected final RenderMaterial> getRotatingMaterial() { - return renderer.getMaterial(KineticRenderMaterials.ROTATING); + return renderer.getMaterial(AllMaterialSpecs.ROTATING); } public static BlockState shaft(Direction.Axis axis) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/ShaftlessCogInstance.java b/src/main/java/com/simibubi/create/content/contraptions/base/ShaftlessCogInstance.java index 733c23a01..533b95ece 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/ShaftlessCogInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/ShaftlessCogInstance.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.base; import com.jozufozu.flywheel.backend.instancing.InstancedModel; import com.jozufozu.flywheel.backend.instancing.InstancedTileRenderer; import com.simibubi.create.AllBlockPartials; +import com.simibubi.create.foundation.render.AllMaterialSpecs; public class ShaftlessCogInstance extends SingleRotatingInstance { @@ -12,6 +13,6 @@ public class ShaftlessCogInstance extends SingleRotatingInstance { @Override protected InstancedModel getModel() { - return renderer.getMaterial(KineticRenderMaterials.ROTATING).getModel(AllBlockPartials.SHAFTLESS_COGWHEEL, tile.getBlockState()); + return renderer.getMaterial(AllMaterialSpecs.ROTATING).getModel(AllBlockPartials.SHAFTLESS_COGWHEEL, tile.getBlockState()); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillMovementBehaviour.java index 3eeb3f58b..5ebac5064 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillMovementBehaviour.java @@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.actors; import javax.annotation.Nullable; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; @@ -36,7 +36,7 @@ public class DrillMovementBehaviour extends BlockBreakingMovementBehaviour { @OnlyIn(value = Dist.CLIENT) public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal, IRenderTypeBuffer buffer) { - if (!FastRenderDispatcher.available()) + if (!Backend.canUseInstancing()) DrillRenderer.renderInContraption(context, ms, msLocal, buffer); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java index 83b6a4bcc..88433f8e8 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java @@ -6,7 +6,7 @@ import javax.annotation.Nullable; import org.apache.commons.lang3.mutable.MutableBoolean; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; @@ -54,7 +54,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour { @Override public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal, IRenderTypeBuffer buffers) { - if (!FastRenderDispatcher.available()) + if (!Backend.canUseInstancing()) HarvesterRenderer.renderInContraption(context, ms, msLocal, buffers); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterRenderer.java index b30da5db0..8aa4b126e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterRenderer.java @@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.components.crafter; import static com.simibubi.create.content.contraptions.base.HorizontalKineticBlock.HORIZONTAL_FACING; import static com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer.standardKineticRotationTransform; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.core.PartialModel; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; @@ -156,7 +156,7 @@ public class MechanicalCrafterRenderer extends SafeTileEntityRenderer renderItem(te, partialTicks, ms, buffer, light, overlay); FilteringRenderer.renderOnTileEntity(te, partialTicks, ms, buffer, light, overlay); - if (FastRenderDispatcher.available(te.getWorld())) return; + if (Backend.canUseInstancing(te.getWorld())) return; renderComponents(te, partialTicks, ms, buffer, light, overlay); } @@ -111,7 +111,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer protected void renderComponents(DeployerTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid()); - if (!FastRenderDispatcher.available(te.getWorld())) { + if (!Backend.canUseInstancing(te.getWorld())) { KineticTileEntityRenderer.renderRotatingKineticBlock(te, getRenderedBlockState(te), ms, vb, light); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanRenderer.java index ec49792ae..86bc2274c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanRenderer.java @@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.fan; import static net.minecraft.state.properties.BlockStateProperties.FACING; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -28,7 +28,7 @@ public class EncasedFanRenderer extends KineticTileEntityRenderer { @Override protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { - if (FastRenderDispatcher.available(te.getWorld())) return; + if (Backend.canUseInstancing(te.getWorld())) return; Direction direction = te.getBlockState() .get(FACING); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelRenderer.java index edbe2baae..b4b0370b6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelRenderer.java @@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.flywheel; import static com.simibubi.create.content.contraptions.base.HorizontalKineticBlock.HORIZONTAL_FACING; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -36,7 +36,7 @@ public class FlywheelRenderer extends KineticTileEntityRenderer { int light, int overlay) { super.renderSafe(te, partialTicks, ms, buffer, light, overlay); - if (FastRenderDispatcher.available(te.getWorld())) return; + if (Backend.canUseInstancing(te.getWorld())) return; BlockState blockState = te.getBlockState(); FlywheelTileEntity wte = (FlywheelTileEntity) te; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineRenderer.java index a47c32400..017dd5e10 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.components.flywheel.engine; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.core.PartialModel; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.render.PartialBufferer; @@ -24,10 +24,10 @@ public class EngineRenderer extends SafeTileEntityRe protected void renderSafe(T te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { - if (FastRenderDispatcher.available(te.getWorld())) return; + if (Backend.canUseInstancing(te.getWorld())) return; Block block = te.getBlockState() - .getBlock(); + .getBlock(); if (block instanceof EngineBlock) { EngineBlock engineBlock = (EngineBlock) block; PartialModel frame = engineBlock.getFrameModel(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerRenderer.java index da872236b..e0ab0cbae 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.components.mixer; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -33,7 +33,7 @@ public class MechanicalMixerRenderer extends KineticTileEntityRenderer { protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { - if (FastRenderDispatcher.available(te.getWorld())) return; + if (Backend.canUseInstancing(te.getWorld())) return; BlockState blockState = te.getBlockState(); MechanicalMixerTileEntity mixer = (MechanicalMixerTileEntity) te; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressRenderer.java index 9ce1c3d8c..04a61fecf 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressRenderer.java @@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.press; import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -33,7 +33,7 @@ public class MechanicalPressRenderer extends KineticTileEntityRenderer { int light, int overlay) { super.renderSafe(te, partialTicks, ms, buffer, light, overlay); - if (FastRenderDispatcher.available(te.getWorld())) return; + if (Backend.canUseInstancing(te.getWorld())) return; BlockPos pos = te.getPos(); BlockState blockState = te.getBlockState(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawRenderer.java index 5b267707e..81a646166 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawRenderer.java @@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.saw; import static net.minecraft.state.properties.BlockStateProperties.FACING; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.core.PartialModel; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; @@ -47,7 +47,7 @@ public class SawRenderer extends SafeTileEntityRenderer { renderItems(te, partialTicks, ms, buffer, light, overlay); FilteringRenderer.renderOnTileEntity(te, partialTicks, ms, buffer, light, overlay); - if (FastRenderDispatcher.available(te.getWorld())) return; + if (Backend.canUseInstancing(te.getWorld())) return; renderShaft(te, ms, buffer, light, overlay); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingRenderer.java index 647a3423b..02fd58228 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.components.structureMovement.bearing; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.core.PartialModel; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; @@ -26,7 +26,7 @@ public class BearingRenderer extends KineticTileEntityRenderer { protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { - if (FastRenderDispatcher.available(te.getWorld())) return; + if (Backend.canUseInstancing(te.getWorld())) return; super.renderSafe(te, partialTicks, ms, buffer, light, overlay); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingMovementBehaviour.java index ba09371d2..91b0cf846 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingMovementBehaviour.java @@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.be import javax.annotation.Nullable; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.core.PartialModel; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; @@ -33,7 +33,7 @@ public class StabilizedBearingMovementBehaviour extends MovementBehaviour { @OnlyIn(Dist.CLIENT) public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal, IRenderTypeBuffer buffer) { - if (FastRenderDispatcher.available()) return; + if (Backend.canUseInstancing()) return; Direction facing = context.state.get(BlockStateProperties.FACING); PartialModel top = AllBlockPartials.BEARING_TOP; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerRenderer.java index d100d7e9d..d15365d66 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.components.structureMovement.chassis; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.render.PartialBufferer; @@ -26,7 +26,7 @@ public class StickerRenderer extends SafeTileEntityRenderer { protected void renderSafe(StickerTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { - if (FastRenderDispatcher.available(te.getWorld())) return; + if (Backend.canUseInstancing(te.getWorld())) return; BlockState state = te.getBlockState(); SuperByteBuffer head = PartialBufferer.get(AllBlockPartials.STICKER_HEAD, state); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerTileEntity.java index 0dcb89f85..1b6da372e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerTileEntity.java @@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.ch import java.util.List; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.instancing.IInstanceRendered; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllSoundEvents; @@ -70,7 +70,7 @@ public class StickerTileEntity extends SmartTileEntity implements IInstanceRende DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> playSound(false)); piston.chase(target, .4f, Chaser.LINEAR); - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> FastRenderDispatcher.enqueueUpdate(this)); + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> Backend.enqueueUpdate(this)); } public boolean isAttachedToBlock() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageRenderer.java index cfdeb46b1..a081357f3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.components.structureMovement.gantry; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -32,14 +32,14 @@ public class GantryCarriageRenderer extends KineticTileEntityRenderer { int light, int overlay) { super.renderSafe(te, partialTicks, ms, buffer, light, overlay); - if (FastRenderDispatcher.available(te.getWorld())) return; + if (Backend.canUseInstancing(te.getWorld())) return; BlockState state = te.getBlockState(); Direction facing = state.get(GantryCarriageBlock.FACING); Boolean alongFirst = state.get(GantryCarriageBlock.AXIS_ALONG_FIRST_COORDINATE); Axis rotationAxis = getRotationAxisOf(te); BlockPos visualPos = facing.getAxisDirection() == AxisDirection.POSITIVE ? te.getPos() - : te.getPos() + : te.getPos() .offset(facing.getOpposite()); float angleForTe = getAngleForTe(te, visualPos, rotationAxis); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/AbstractPulleyRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/AbstractPulleyRenderer.java index f1fa89220..13c77dca6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/AbstractPulleyRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/AbstractPulleyRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.components.structureMovement.pulley; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.core.PartialModel; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; @@ -44,7 +44,7 @@ public abstract class AbstractPulleyRenderer extends KineticTileEntityRenderer { protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { - if (FastRenderDispatcher.available(te.getWorld())) return; + if (Backend.canUseInstancing(te.getWorld())) return; super.renderSafe(te, partialTicks, ms, buffer, light, overlay); float offset = getOffset(te, partialTicks); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionKineticRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionKineticRenderer.java index 514aa3b41..ae766a36c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionKineticRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionKineticRenderer.java @@ -12,10 +12,10 @@ import com.jozufozu.flywheel.backend.instancing.InstancedModel; import com.jozufozu.flywheel.backend.instancing.InstancedTileRenderer; import com.jozufozu.flywheel.backend.instancing.RenderMaterial; import com.simibubi.create.AllMovementBehaviours; -import com.simibubi.create.content.contraptions.base.KineticRenderMaterials; import com.simibubi.create.content.contraptions.components.actors.ActorData; import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; +import com.simibubi.create.foundation.render.AllMaterialSpecs; import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.util.math.BlockPos; @@ -67,7 +67,7 @@ public class ContraptionKineticRenderer extends InstancedTileRenderer> getActorMaterial() { - return getMaterial(KineticRenderMaterials.ACTORS); + return getMaterial(AllMaterialSpecs.ACTORS); } public RenderedContraption getContraption() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java index 295bf70b9..e87a6d9ab 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java @@ -9,7 +9,6 @@ import org.lwjgl.opengl.GL13; import org.lwjgl.opengl.GL40; import com.jozufozu.flywheel.backend.Backend; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; import com.jozufozu.flywheel.backend.core.ContraptionContext; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllMovementBehaviours; @@ -83,7 +82,7 @@ public class ContraptionRenderDispatcher { if (Backend.canUseVBOs()) { ContraptionProgram structureShader = ContraptionContext.INSTANCE.getProgram(AllProgramSpecs.STRUCTURE); - structureShader.bind(viewProjection, camX, camY, camZ, FastRenderDispatcher.getDebugMode()); + structureShader.bind(viewProjection, camX, camY, camZ, Backend.getDebugMode()); for (RenderedContraption renderer : renderers.values()) { renderer.doRenderLayer(layer, structureShader); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveRenderer.java index 5ea1d6dc5..af24a5362 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.fluids.pipes; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -28,7 +28,7 @@ public class FluidValveRenderer extends KineticTileEntityRenderer { protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { - if (FastRenderDispatcher.available(te.getWorld())) return; + if (Backend.canUseInstancing(te.getWorld())) return; super.renderSafe(te, partialTicks, ms, buffer, light, overlay); BlockState blockState = te.getBlockState(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerRenderer.java index b3a66b92e..d8bac663e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.relays.advanced; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -32,7 +32,7 @@ public class SpeedControllerRenderer extends SmartTileEntityRenderer { PartialModel beltPartial = BeltRenderer.getBeltPartial(diagonal, start, end, bottom); SpriteShiftEntry spriteShift = BeltRenderer.getSpriteShiftEntry(color, diagonal, bottom); - InstancedModel beltModel = modelManager.getMaterial(KineticRenderMaterials.BELTS).getModel(beltPartial, blockState); + InstancedModel beltModel = modelManager.getMaterial(AllMaterialSpecs.BELTS).getModel(beltPartial, blockState); keys.add(setup(beltModel.createInstance(), bottom, spriteShift)); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java index 076fa64d2..0857cfe60 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java @@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.relays.belt; import java.util.Random; import java.util.function.Supplier; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.core.PartialModel; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; @@ -57,7 +57,7 @@ public class BeltRenderer extends SafeTileEntityRenderer { protected void renderSafe(BeltTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { - if (!FastRenderDispatcher.available(te.getWorld())) { + if (!Backend.canUseInstancing(te.getWorld())) { BlockState blockState = te.getBlockState(); if (!AllBlocks.BELT.has(blockState)) return; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java index ed7028eec..9dbf9e00c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java @@ -12,7 +12,7 @@ import java.util.Map; import java.util.Optional; import java.util.function.Function; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.light.GridAlignedBB; import com.jozufozu.flywheel.backend.light.LightUpdateListener; import com.jozufozu.flywheel.backend.light.LightUpdater; @@ -267,7 +267,7 @@ public class BeltTileEntity extends KineticTileEntity implements LightUpdateList belt.color = Optional.ofNullable(colorIn); belt.markDirty(); belt.sendData(); - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> FastRenderDispatcher.enqueueUpdate(belt)); + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> Backend.enqueueUpdate(belt)); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftRenderer.java index c8016ed47..3997ce182 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.relays.encased; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.IRotate; @@ -28,7 +28,7 @@ public class SplitShaftRenderer extends KineticTileEntityRenderer { @Override protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { - if (FastRenderDispatcher.available(te.getWorld())) return; + if (Backend.canUseInstancing(te.getWorld())) return; Block block = te.getBlockState().getBlock(); final Axis boxAxis = ((IRotate) block).getRotationAxis(te.getBlockState()); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeRenderer.java index 1588b1c77..01a5a7e7f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.relays.gauge; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.core.PartialModel; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; @@ -40,7 +40,7 @@ public class GaugeRenderer extends KineticTileEntityRenderer { @Override protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { - if (FastRenderDispatcher.available(te.getWorld())) return; + if (Backend.canUseInstancing(te.getWorld())) return; super.renderSafe(te, partialTicks, ms, buffer, light, overlay); BlockState gaugeState = te.getBlockState(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxRenderer.java index f0e0c5e5b..fec1c431f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.contraptions.relays.gearbox; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -27,7 +27,7 @@ public class GearboxRenderer extends KineticTileEntityRenderer { @Override protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { - if (FastRenderDispatcher.available(te.getWorld())) return; + if (Backend.canUseInstancing(te.getWorld())) return; final Axis boxAxis = te.getBlockState().get(BlockStateProperties.AXIS); final BlockPos pos = te.getPos(); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelInstance.java index b238d2084..9abe8e68c 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelInstance.java @@ -11,9 +11,9 @@ import com.jozufozu.flywheel.backend.instancing.InstancedModel; import com.jozufozu.flywheel.backend.instancing.InstancedTileRenderer; import com.jozufozu.flywheel.backend.instancing.TileEntityInstance; import com.simibubi.create.AllBlockPartials; -import com.simibubi.create.content.contraptions.base.KineticRenderMaterials; import com.simibubi.create.content.logistics.block.FlapData; import com.simibubi.create.foundation.gui.widgets.InterpolatedValue; +import com.simibubi.create.foundation.render.AllMaterialSpecs; import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.util.Direction; @@ -28,8 +28,8 @@ public class BeltTunnelInstance extends TileEntityInstance tunnelFlaps = new EnumMap<>(Direction.class); - InstancedModel model = modelManager.getMaterial(KineticRenderMaterials.FLAPS) - .getModel(AllBlockPartials.BELT_TUNNEL_FLAP, blockState); + InstancedModel model = modelManager.getMaterial(AllMaterialSpecs.FLAPS) + .getModel(AllBlockPartials.BELT_TUNNEL_FLAP, blockState); int blockLight = world.getLightLevel(LightType.BLOCK, pos); int skyLight = world.getLightLevel(LightType.SKY, pos); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelRenderer.java index 14f7a8ceb..95c00bd70 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.logistics.block.belts.tunnel; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -31,7 +31,7 @@ public class BeltTunnelRenderer extends SmartTileEntityRenderer () -> FastRenderDispatcher.enqueueUpdate(this)); + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> Backend.enqueueUpdate(this)); } public void updateTunnelConnections() { diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorRenderer.java index 3b993fe6b..f6cc74cf3 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.logistics.block.depot; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -45,7 +45,7 @@ public class EjectorRenderer extends KineticTileEntityRenderer { float lidProgress = ((EjectorTileEntity) te).getLidProgress(partialTicks); float angle = lidProgress * 70; - if (!FastRenderDispatcher.available(te.getWorld())) { + if (!Backend.canUseInstancing(te.getWorld())) { SuperByteBuffer model = PartialBufferer.get(AllBlockPartials.EJECTOR_TOP, te.getBlockState()); applyLidAngle(te, angle, model.matrixStacker()); model.light(light) @@ -55,7 +55,7 @@ public class EjectorRenderer extends KineticTileEntityRenderer { MatrixStacker msr = MatrixStacker.of(ms); float maxTime = - (float) (ejector.earlyTarget != null ? ejector.earlyTargetTime : ejector.launcher.getTotalFlyingTicks()); + (float) (ejector.earlyTarget != null ? ejector.earlyTargetTime : ejector.launcher.getTotalFlyingTicks()); for (IntAttached intAttached : ejector.launchedItems) { float time = intAttached.getFirst() + partialTicks; if (time > maxTime) diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelInstance.java index 4c378f3d7..ef501a549 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelInstance.java @@ -9,8 +9,8 @@ import com.jozufozu.flywheel.backend.instancing.InstancedModel; import com.jozufozu.flywheel.backend.instancing.InstancedTileRenderer; import com.jozufozu.flywheel.backend.instancing.TileEntityInstance; import com.simibubi.create.AllBlockPartials; -import com.simibubi.create.content.contraptions.base.KineticRenderMaterials; import com.simibubi.create.content.logistics.block.FlapData; +import com.simibubi.create.foundation.render.AllMaterialSpecs; import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.util.Direction; @@ -27,10 +27,10 @@ public class FunnelInstance extends TileEntityInstance impleme if (!tile.hasFlap()) return; - PartialModel flapPartial = (blockState.getBlock() instanceof FunnelBlock ? AllBlockPartials.FUNNEL_FLAP - : AllBlockPartials.BELT_FUNNEL_FLAP); - InstancedModel model = modelManager.getMaterial(KineticRenderMaterials.FLAPS) - .getModel(flapPartial, blockState); + PartialModel flapPartial = (blockState.getBlock() instanceof FunnelBlock ? AllBlockPartials.FUNNEL_FLAP + : AllBlockPartials.BELT_FUNNEL_FLAP); + InstancedModel model = modelManager.getMaterial(AllMaterialSpecs.FLAPS) + .getModel(flapPartial, blockState); int blockLight = world.getLightLevel(LightType.BLOCK, pos); int skyLight = world.getLightLevel(LightType.SKY, pos); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelRenderer.java index 735749775..1c5a468d6 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.logistics.block.funnel; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.core.PartialModel; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; @@ -30,7 +30,7 @@ public class FunnelRenderer extends SmartTileEntityRenderer { int light, int overlay) { super.renderSafe(te, partialTicks, ms, buffer, light, overlay); - if (!te.hasFlap() || FastRenderDispatcher.available(te.getWorld())) + if (!te.hasFlap() || Backend.canUseInstancing(te.getWorld())) return; BlockState blockState = te.getBlockState(); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelTileEntity.java index ddf7fd424..10cba6b83 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelTileEntity.java @@ -3,7 +3,7 @@ package com.simibubi.create.content.logistics.block.funnel; import java.lang.ref.WeakReference; import java.util.List; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.instancing.IInstanceRendered; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllSoundEvents; @@ -327,7 +327,7 @@ public class FunnelTileEntity extends SmartTileEntity implements IHaveHoveringIn extractionCooldown = compound.getInt("TransferCooldown"); if (clientPacket) - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> FastRenderDispatcher.enqueueUpdate(this)); + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> Backend.enqueueUpdate(this)); } @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmRenderer.java index 82294a44f..711565bbe 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.logistics.block.mechanicalArm; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -42,7 +42,7 @@ public class ArmRenderer extends KineticTileEntityRenderer { super.renderSafe(te, pt, ms, buffer, light, overlay); ArmTileEntity arm = (ArmTileEntity) te; - boolean usingFlywheel = FastRenderDispatcher.available(te.getWorld()); + boolean usingFlywheel = Backend.canUseInstancing(te.getWorld()); ItemStack item = arm.heldItem; boolean hasItem = !item.isEmpty(); @@ -50,7 +50,7 @@ public class ArmRenderer extends KineticTileEntityRenderer { if (usingFlywheel && !hasItem) return; ItemRenderer itemRenderer = Minecraft.getInstance() - .getItemRenderer(); + .getItemRenderer(); boolean isBlockItem = hasItem && (item.getItem() instanceof BlockItem) && itemRenderer.getItemModelWithOverrides(item, Minecraft.getInstance().world, null) diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverRenderer.java index 991560762..50d13a86d 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.content.logistics.block.redstone; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -28,7 +28,7 @@ public class AnalogLeverRenderer extends SafeTileEntityRenderer> cir) { - if (FastRenderDispatcher.available()) { + if (Backend.canUseInstancing()) { List tiles = cir.getReturnValue(); tiles.removeIf(tile -> tile instanceof IInstanceRendered && !((IInstanceRendered) tile).shouldRenderAsTE()); diff --git a/src/main/java/com/simibubi/create/foundation/mixin/RenderHooksMixin.java b/src/main/java/com/simibubi/create/foundation/mixin/RenderHooksMixin.java index f97ba920d..0f44aefa3 100644 --- a/src/main/java/com/simibubi/create/foundation/mixin/RenderHooksMixin.java +++ b/src/main/java/com/simibubi/create/foundation/mixin/RenderHooksMixin.java @@ -8,7 +8,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import com.jozufozu.flywheel.backend.Backend; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; import com.jozufozu.flywheel.backend.OptifineHandler; import com.jozufozu.flywheel.backend.core.BasicInstancedTileRenderer; import com.mojang.blaze3d.matrix.MatrixStack; @@ -52,7 +51,7 @@ public class RenderHooksMixin { Matrix4f viewProjection = view.copy(); viewProjection.multiplyBackward(Backend.projectionMatrix); - FastRenderDispatcher.renderLayer(type, viewProjection, camX, camY, camZ); + Backend.renderLayer(type, viewProjection, camX, camY, camZ); ContraptionRenderDispatcher.renderLayer(type, viewProjection, camX, camY, camZ); diff --git a/src/main/java/com/simibubi/create/foundation/render/AllMaterialSpecs.java b/src/main/java/com/simibubi/create/foundation/render/AllMaterialSpecs.java new file mode 100644 index 000000000..6f0ba694e --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/render/AllMaterialSpecs.java @@ -0,0 +1,45 @@ +package com.simibubi.create.foundation.render; + +import static com.jozufozu.flywheel.backend.Backend.register; + +import com.jozufozu.flywheel.backend.core.ModelData; +import com.jozufozu.flywheel.backend.core.OrientedData; +import com.jozufozu.flywheel.backend.core.OrientedModel; +import com.jozufozu.flywheel.backend.core.TransformedModel; +import com.jozufozu.flywheel.backend.instancing.InstancedModel; +import com.jozufozu.flywheel.backend.instancing.MaterialSpec; +import com.simibubi.create.Create; +import com.simibubi.create.content.contraptions.base.RotatingData; +import com.simibubi.create.content.contraptions.base.RotatingModel; +import com.simibubi.create.content.contraptions.components.actors.ActorData; +import com.simibubi.create.content.contraptions.components.actors.ActorModel; +import com.simibubi.create.content.contraptions.relays.belt.BeltData; +import com.simibubi.create.content.contraptions.relays.belt.BeltInstancedModel; +import com.simibubi.create.content.logistics.block.FlapData; +import com.simibubi.create.content.logistics.block.FlapModel; + +import net.minecraft.util.ResourceLocation; + +public class AllMaterialSpecs { + public static void init() { + // noop, make sure the static field are loaded. + } + + + public static final MaterialSpec> TRANSFORMED = register(new MaterialSpec<>(Locations.MODEL, AllProgramSpecs.MODEL, TransformedModel::new)); + public static final MaterialSpec> ORIENTED = register(new MaterialSpec<>(Locations.ORIENTED, AllProgramSpecs.ORIENTED, OrientedModel::new)); + + public static final MaterialSpec> ROTATING = register(new MaterialSpec<>(Locations.ROTATING, AllProgramSpecs.ROTATING, RotatingModel::new)); + public static final MaterialSpec> BELTS = register(new MaterialSpec<>(Locations.BELTS, AllProgramSpecs.BELT, BeltInstancedModel::new)); + public static final MaterialSpec> ACTORS = register(new MaterialSpec<>(Locations.ACTORS, AllProgramSpecs.ACTOR, ActorModel::new)); + public static final MaterialSpec> FLAPS = register(new MaterialSpec<>(Locations.FLAPS, AllProgramSpecs.FLAPS, FlapModel::new)); + + public static class Locations { + public static final ResourceLocation MODEL = new ResourceLocation("create", "model"); + public static final ResourceLocation ORIENTED = new ResourceLocation("create", "oriented"); + public static final ResourceLocation ROTATING = new ResourceLocation(Create.ID, "rotating"); + public static final ResourceLocation BELTS = new ResourceLocation(Create.ID, "belts"); + public static final ResourceLocation ACTORS = new ResourceLocation(Create.ID, "actors"); + public static final ResourceLocation FLAPS = new ResourceLocation(Create.ID, "flaps"); + } +} diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/renderer/ColoredOverlayTileEntityRenderer.java b/src/main/java/com/simibubi/create/foundation/tileEntity/renderer/ColoredOverlayTileEntityRenderer.java index e64b8fcda..e0b204bc8 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/renderer/ColoredOverlayTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/renderer/ColoredOverlayTileEntityRenderer.java @@ -1,6 +1,6 @@ package com.simibubi.create.foundation.tileEntity.renderer; -import com.jozufozu.flywheel.backend.FastRenderDispatcher; +import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.render.SuperByteBuffer; @@ -19,7 +19,7 @@ public abstract class ColoredOverlayTileEntityRenderer ext protected void renderSafe(T te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { - if (FastRenderDispatcher.available(te.getWorld())) return; + if (Backend.canUseInstancing(te.getWorld())) return; SuperByteBuffer render = render(getOverlayBuffer(te), getColor(te, partialTicks), light); render.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));