mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-16 16:03:40 +01:00
MaterialSpecs act alone
- No more awkward MaterialType/MaterialSpec business - MaterialTypes are registered directly - FastRenderDispatcher merged with backend
This commit is contained in:
parent
b6f13aa7ff
commit
55e3f50f64
59 changed files with 270 additions and 267 deletions
|
@ -1,25 +1,38 @@
|
||||||
package com.jozufozu.flywheel.backend;
|
package com.jozufozu.flywheel.backend;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.lwjgl.opengl.GL;
|
import org.lwjgl.opengl.GL;
|
||||||
import org.lwjgl.opengl.GLCapabilities;
|
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.ContraptionContext;
|
||||||
import com.jozufozu.flywheel.backend.core.EffectsContext;
|
import com.jozufozu.flywheel.backend.core.EffectsContext;
|
||||||
import com.jozufozu.flywheel.backend.core.WorldContext;
|
import com.jozufozu.flywheel.backend.core.WorldContext;
|
||||||
import com.jozufozu.flywheel.backend.effects.EffectsHandler;
|
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.shader.ProgramSpec;
|
||||||
import com.jozufozu.flywheel.backend.gl.versioned.GlCompat;
|
import com.jozufozu.flywheel.backend.gl.versioned.GlCompat;
|
||||||
import com.jozufozu.flywheel.backend.instancing.IFlywheelWorld;
|
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.config.AllConfigs;
|
||||||
|
import com.simibubi.create.foundation.utility.WorldAttached;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
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.IReloadableResourceManager;
|
||||||
import net.minecraft.resources.IResourceManager;
|
import net.minecraft.resources.IResourceManager;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.vector.Matrix4f;
|
import net.minecraft.util.math.vector.Matrix4f;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -35,12 +48,14 @@ public class Backend {
|
||||||
|
|
||||||
public static GLCapabilities capabilities;
|
public static GLCapabilities capabilities;
|
||||||
public static GlCompat compat;
|
public static GlCompat compat;
|
||||||
|
public static WorldAttached<ConcurrentHashMap.KeySetView<TileEntity, Boolean>> queuedUpdates = new WorldAttached<>(ConcurrentHashMap::newKeySet);
|
||||||
|
|
||||||
private static boolean instancingAvailable;
|
private static boolean instancingAvailable;
|
||||||
private static boolean enabled;
|
private static boolean enabled;
|
||||||
|
|
||||||
|
static Map<ResourceLocation, MaterialSpec<?>> materialRegistry = new HashMap<>();
|
||||||
static final Map<ResourceLocation, ShaderContext<?>> contexts = new HashMap<>();
|
static final Map<ResourceLocation, ShaderContext<?>> contexts = new HashMap<>();
|
||||||
static final Map<ResourceLocation, ProgramSpec> specRegistry = new HashMap<>();
|
static final Map<ResourceLocation, ProgramSpec> programSpecRegistry = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
register(WorldContext.INSTANCE);
|
register(WorldContext.INSTANCE);
|
||||||
|
@ -57,17 +72,17 @@ public class Backend {
|
||||||
*/
|
*/
|
||||||
public static ProgramSpec register(ProgramSpec spec) {
|
public static ProgramSpec register(ProgramSpec spec) {
|
||||||
ResourceLocation name = spec.name;
|
ResourceLocation name = spec.name;
|
||||||
if (specRegistry.containsKey(name)) {
|
if (programSpecRegistry.containsKey(name)) {
|
||||||
throw new IllegalStateException("Program spec '" + name + "' already registered.");
|
throw new IllegalStateException("Program spec '" + name + "' already registered.");
|
||||||
}
|
}
|
||||||
specRegistry.put(name, spec);
|
programSpecRegistry.put(name, spec);
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a shader context.
|
* Register a shader context.
|
||||||
*/
|
*/
|
||||||
public static ShaderContext<?> register(ShaderContext<?> spec) {
|
public static <P extends GlProgram> ShaderContext<P> register(ShaderContext<P> spec) {
|
||||||
ResourceLocation name = spec.getRoot();
|
ResourceLocation name = spec.getRoot();
|
||||||
if (contexts.containsKey(name)) {
|
if (contexts.containsKey(name)) {
|
||||||
throw new IllegalStateException("Program spec '" + name + "' already registered.");
|
throw new IllegalStateException("Program spec '" + name + "' already registered.");
|
||||||
|
@ -76,6 +91,18 @@ public class Backend {
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register an instancing material.
|
||||||
|
*/
|
||||||
|
public static <M extends InstancedModel<?>> MaterialSpec<M> register(MaterialSpec<M> 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) {
|
public static boolean isFlywheelWorld(World world) {
|
||||||
return world == Minecraft.getInstance().world || (world instanceof IFlywheelWorld && ((IFlywheelWorld) world).supportsFlywheel());
|
return world == Minecraft.getInstance().world || (world instanceof IFlywheelWorld && ((IFlywheelWorld) world).supportsFlywheel());
|
||||||
}
|
}
|
||||||
|
@ -129,4 +156,63 @@ public class Backend {
|
||||||
effects = new EffectsHandler();
|
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<TileEntity, Boolean> 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<MaterialSpec<?>> allMaterials() {
|
||||||
|
return materialRegistry.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Collection<ProgramSpec> allPrograms() {
|
||||||
|
return programSpecRegistry.values();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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<MaterialType<?>, MaterialSpec> materials = new HashMap<>();
|
|
||||||
|
|
||||||
static {
|
|
||||||
registerMaterials();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static WorldAttached<ConcurrentHashMap.KeySetView<TileEntity, Boolean>> 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<TileEntity, Boolean> 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();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
package com.jozufozu.flywheel.backend;
|
|
||||||
|
|
||||||
import com.jozufozu.flywheel.backend.instancing.InstancedModel;
|
|
||||||
|
|
||||||
public class MaterialType<M extends InstancedModel<?>> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return super.hashCode() * 31 * 493286711;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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<InstancedModel<ModelData>> TRANSFORMED = new MaterialType<>();
|
|
||||||
public static final MaterialType<InstancedModel<OrientedData>> ORIENTED = new MaterialType<>();
|
|
||||||
}
|
|
|
@ -4,7 +4,7 @@ import java.util.EnumMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.regex.Pattern;
|
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.ResourceUtil;
|
||||||
import com.jozufozu.flywheel.backend.ShaderContext;
|
import com.jozufozu.flywheel.backend.ShaderContext;
|
||||||
import com.jozufozu.flywheel.backend.ShaderLoader;
|
import com.jozufozu.flywheel.backend.ShaderLoader;
|
||||||
|
@ -40,7 +40,7 @@ public class WorldContext<P extends BasicProgram> extends ShaderContext<P> {
|
||||||
programs.values().forEach(IMultiProgram::delete);
|
programs.values().forEach(IMultiProgram::delete);
|
||||||
programs.clear();
|
programs.clear();
|
||||||
|
|
||||||
FastRenderDispatcher.materials.values()
|
Backend.allMaterials()
|
||||||
.stream()
|
.stream()
|
||||||
.map(MaterialSpec::getProgramSpec)
|
.map(MaterialSpec::getProgramSpec)
|
||||||
.forEach(spec -> loadProgramFromSpec(loader, spec));
|
.forEach(spec -> loadProgramFromSpec(loader, spec));
|
||||||
|
|
|
@ -7,14 +7,12 @@ import java.util.Map;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.backend.Backend;
|
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.BasicProgram;
|
||||||
import com.jozufozu.flywheel.backend.core.ModelData;
|
import com.jozufozu.flywheel.backend.core.ModelData;
|
||||||
import com.jozufozu.flywheel.backend.core.OrientedData;
|
import com.jozufozu.flywheel.backend.core.OrientedData;
|
||||||
|
import com.jozufozu.flywheel.backend.core.WorldContext;
|
||||||
import com.jozufozu.flywheel.backend.gl.shader.ShaderCallback;
|
import com.jozufozu.flywheel.backend.gl.shader.ShaderCallback;
|
||||||
|
import com.simibubi.create.foundation.render.AllMaterialSpecs;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||||
|
@ -34,17 +32,19 @@ public abstract class InstancedTileRenderer<P extends BasicProgram> {
|
||||||
protected Map<TileEntity, ITickableInstance> tickableInstances = new HashMap<>();
|
protected Map<TileEntity, ITickableInstance> tickableInstances = new HashMap<>();
|
||||||
protected Map<TileEntity, IDynamicInstance> dynamicInstances = new HashMap<>();
|
protected Map<TileEntity, IDynamicInstance> dynamicInstances = new HashMap<>();
|
||||||
|
|
||||||
public final ShaderContext<P> context;
|
public final WorldContext<P> context;
|
||||||
|
|
||||||
protected Map<MaterialType<?>, RenderMaterial<P, ?>> materials = new HashMap<>();
|
protected Map<MaterialSpec<?>, RenderMaterial<P, ?>> materials = new HashMap<>();
|
||||||
|
|
||||||
protected int frame;
|
protected int frame;
|
||||||
protected int tick;
|
protected int tick;
|
||||||
|
|
||||||
protected InstancedTileRenderer(ShaderContext<P> context) {
|
protected InstancedTileRenderer(WorldContext<P> context) {
|
||||||
this.context = 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();
|
public abstract BlockPos getOriginCoordinate();
|
||||||
|
@ -115,16 +115,16 @@ public abstract class InstancedTileRenderer<P extends BasicProgram> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <M extends InstancedModel<?>> RenderMaterial<P, M> getMaterial(MaterialType<M> materialType) {
|
public <M extends InstancedModel<?>> RenderMaterial<P, M> getMaterial(MaterialSpec<M> materialType) {
|
||||||
return (RenderMaterial<P, M>) materials.get(materialType);
|
return (RenderMaterial<P, M>) materials.get(materialType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RenderMaterial<P, InstancedModel<ModelData>> getTransformMaterial() {
|
public RenderMaterial<P, InstancedModel<ModelData>> getTransformMaterial() {
|
||||||
return getMaterial(MaterialTypes.TRANSFORMED);
|
return getMaterial(AllMaterialSpecs.TRANSFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RenderMaterial<P, InstancedModel<OrientedData>> getOrientedMaterial() {
|
public RenderMaterial<P, InstancedModel<OrientedData>> getOrientedMaterial() {
|
||||||
return getMaterial(MaterialTypes.ORIENTED);
|
return getMaterial(AllMaterialSpecs.ORIENTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -3,12 +3,17 @@ package com.jozufozu.flywheel.backend.instancing;
|
||||||
import com.jozufozu.flywheel.backend.core.BasicProgram;
|
import com.jozufozu.flywheel.backend.core.BasicProgram;
|
||||||
import com.jozufozu.flywheel.backend.gl.shader.ProgramSpec;
|
import com.jozufozu.flywheel.backend.gl.shader.ProgramSpec;
|
||||||
|
|
||||||
public class MaterialSpec {
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class MaterialSpec<M extends InstancedModel<?>> {
|
||||||
|
|
||||||
|
public final ResourceLocation name;
|
||||||
|
|
||||||
private final ProgramSpec programSpec;
|
private final ProgramSpec programSpec;
|
||||||
private final ModelFactory<?> modelFactory;
|
private final ModelFactory<M> modelFactory;
|
||||||
|
|
||||||
public MaterialSpec(ProgramSpec programSpec, ModelFactory<?> modelFactory) {
|
public MaterialSpec(ResourceLocation name, ProgramSpec programSpec, ModelFactory<M> modelFactory) {
|
||||||
|
this.name = name;
|
||||||
this.programSpec = programSpec;
|
this.programSpec = programSpec;
|
||||||
this.modelFactory = modelFactory;
|
this.modelFactory = modelFactory;
|
||||||
}
|
}
|
||||||
|
@ -17,11 +22,11 @@ public class MaterialSpec {
|
||||||
return programSpec;
|
return programSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelFactory<?> getModelFactory() {
|
public ModelFactory<M> getModelFactory() {
|
||||||
return modelFactory;
|
return modelFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public <P extends BasicProgram> RenderMaterial<P, ?> create(InstancedTileRenderer<P> renderer) {
|
public <P extends BasicProgram> RenderMaterial<P, M> create(InstancedTileRenderer<P> renderer) {
|
||||||
return new RenderMaterial<>(renderer, programSpec, modelFactory);
|
return new RenderMaterial<>(renderer, programSpec, modelFactory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
import com.google.common.cache.CacheBuilder;
|
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.RenderUtil;
|
||||||
import com.jozufozu.flywheel.backend.core.BasicProgram;
|
import com.jozufozu.flywheel.backend.core.BasicProgram;
|
||||||
import com.jozufozu.flywheel.backend.core.PartialModel;
|
import com.jozufozu.flywheel.backend.core.PartialModel;
|
||||||
|
@ -62,7 +62,7 @@ public class RenderMaterial<P extends BasicProgram, MODEL extends InstancedModel
|
||||||
|
|
||||||
public void render(RenderType layer, Matrix4f viewProjection, double camX, double camY, double camZ, ShaderCallback<P> setup) {
|
public void render(RenderType layer, Matrix4f viewProjection, double camX, double camY, double camZ, ShaderCallback<P> setup) {
|
||||||
P program = renderer.context.getProgram(programSpec);
|
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);
|
if (setup != null) setup.call(program);
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import com.simibubi.create.foundation.item.CustomItemModels;
|
||||||
import com.simibubi.create.foundation.item.CustomRenderedItems;
|
import com.simibubi.create.foundation.item.CustomRenderedItems;
|
||||||
import com.simibubi.create.foundation.ponder.content.PonderIndex;
|
import com.simibubi.create.foundation.ponder.content.PonderIndex;
|
||||||
import com.simibubi.create.foundation.ponder.elements.WorldSectionElement;
|
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.AllProgramSpecs;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBufferCache;
|
import com.simibubi.create.foundation.render.SuperByteBufferCache;
|
||||||
import com.simibubi.create.foundation.utility.WorldAttached;
|
import com.simibubi.create.foundation.utility.WorldAttached;
|
||||||
|
@ -88,6 +89,7 @@ public class CreateClient {
|
||||||
|
|
||||||
public static void clientInit(FMLClientSetupEvent event) {
|
public static void clientInit(FMLClientSetupEvent event) {
|
||||||
AllProgramSpecs.init();
|
AllProgramSpecs.init();
|
||||||
|
AllMaterialSpecs.init();
|
||||||
kineticRenderer = new WorldAttached<>(BasicInstancedTileRenderer::new);
|
kineticRenderer = new WorldAttached<>(BasicInstancedTileRenderer::new);
|
||||||
|
|
||||||
schematicSender = new ClientSchematicLoader();
|
schematicSender = new ClientSchematicLoader();
|
||||||
|
|
|
@ -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<InstancedModel<RotatingData>> ROTATING = new MaterialType<>();
|
|
||||||
public static final MaterialType<InstancedModel<BeltData>> BELTS = new MaterialType<>();
|
|
||||||
|
|
||||||
public static final MaterialType<InstancedModel<ActorData>> ACTORS = new MaterialType<>();
|
|
||||||
|
|
||||||
public static final MaterialType<InstancedModel<FlapData>> FLAPS = new MaterialType<>();
|
|
||||||
}
|
|
|
@ -7,7 +7,7 @@ import java.util.List;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
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.jozufozu.flywheel.backend.instancing.IInstanceRendered;
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
import com.simibubi.create.content.contraptions.KineticNetwork;
|
import com.simibubi.create.content.contraptions.KineticNetwork;
|
||||||
|
@ -257,7 +257,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
||||||
effects.triggerOverStressedEffect();
|
effects.triggerOverStressedEffect();
|
||||||
|
|
||||||
if (clientPacket)
|
if (clientPacket)
|
||||||
FastRenderDispatcher.enqueueUpdate(this);
|
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> Backend.enqueueUpdate(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getGeneratedSpeed() {
|
public float getGeneratedSpeed() {
|
||||||
|
@ -552,7 +552,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
||||||
public void requestModelDataUpdate() {
|
public void requestModelDataUpdate() {
|
||||||
super.requestModelDataUpdate();
|
super.requestModelDataUpdate();
|
||||||
if (!this.removed) {
|
if (!this.removed) {
|
||||||
FastRenderDispatcher.enqueueUpdate(this);
|
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> Backend.enqueueUpdate(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.content.contraptions.base;
|
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.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
|
@ -39,7 +39,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
|
||||||
@Override
|
@Override
|
||||||
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
if (FastRenderDispatcher.available(te.getWorld())) return;
|
if (Backend.canUseInstancing(te.getWorld())) return;
|
||||||
|
|
||||||
for (RenderType type : RenderType.getBlockLayers())
|
for (RenderType type : RenderType.getBlockLayers())
|
||||||
if (RenderTypeLookup.canRenderInLayer(te.getBlockState(), type))
|
if (RenderTypeLookup.canRenderInLayer(te.getBlockState(), type))
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.jozufozu.flywheel.backend.instancing.TileEntityInstance;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel;
|
import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel;
|
||||||
import com.simibubi.create.content.contraptions.relays.elementary.ShaftBlock;
|
import com.simibubi.create.content.contraptions.relays.elementary.ShaftBlock;
|
||||||
|
import com.simibubi.create.foundation.render.AllMaterialSpecs;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
|
@ -85,7 +86,7 @@ public abstract class KineticTileInstance<T extends KineticTileEntity> extends T
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final RenderMaterial<?, InstancedModel<RotatingData>> getRotatingMaterial() {
|
protected final RenderMaterial<?, InstancedModel<RotatingData>> getRotatingMaterial() {
|
||||||
return renderer.getMaterial(KineticRenderMaterials.ROTATING);
|
return renderer.getMaterial(AllMaterialSpecs.ROTATING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockState shaft(Direction.Axis axis) {
|
public static BlockState shaft(Direction.Axis axis) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.base;
|
||||||
import com.jozufozu.flywheel.backend.instancing.InstancedModel;
|
import com.jozufozu.flywheel.backend.instancing.InstancedModel;
|
||||||
import com.jozufozu.flywheel.backend.instancing.InstancedTileRenderer;
|
import com.jozufozu.flywheel.backend.instancing.InstancedTileRenderer;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
import com.simibubi.create.foundation.render.AllMaterialSpecs;
|
||||||
|
|
||||||
public class ShaftlessCogInstance extends SingleRotatingInstance {
|
public class ShaftlessCogInstance extends SingleRotatingInstance {
|
||||||
|
|
||||||
|
@ -12,6 +13,6 @@ public class ShaftlessCogInstance extends SingleRotatingInstance {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected InstancedModel<RotatingData> getModel() {
|
protected InstancedModel<RotatingData> getModel() {
|
||||||
return renderer.getMaterial(KineticRenderMaterials.ROTATING).getModel(AllBlockPartials.SHAFTLESS_COGWHEEL, tile.getBlockState());
|
return renderer.getMaterial(AllMaterialSpecs.ROTATING).getModel(AllBlockPartials.SHAFTLESS_COGWHEEL, tile.getBlockState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.actors;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.backend.FastRenderDispatcher;
|
import com.jozufozu.flywheel.backend.Backend;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
||||||
|
@ -36,7 +36,7 @@ public class DrillMovementBehaviour extends BlockBreakingMovementBehaviour {
|
||||||
@OnlyIn(value = Dist.CLIENT)
|
@OnlyIn(value = Dist.CLIENT)
|
||||||
public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
|
public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
|
||||||
IRenderTypeBuffer buffer) {
|
IRenderTypeBuffer buffer) {
|
||||||
if (!FastRenderDispatcher.available())
|
if (!Backend.canUseInstancing())
|
||||||
DrillRenderer.renderInContraption(context, ms, msLocal, buffer);
|
DrillRenderer.renderInContraption(context, ms, msLocal, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.apache.commons.lang3.mutable.MutableBoolean;
|
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.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
|
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||||
|
@ -54,7 +54,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
|
||||||
@Override
|
@Override
|
||||||
public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
|
public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
|
||||||
IRenderTypeBuffer buffers) {
|
IRenderTypeBuffer buffers) {
|
||||||
if (!FastRenderDispatcher.available())
|
if (!Backend.canUseInstancing())
|
||||||
HarvesterRenderer.renderInContraption(context, ms, msLocal, buffers);
|
HarvesterRenderer.renderInContraption(context, ms, msLocal, buffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.HorizontalKineticBlock.HORIZONTAL_FACING;
|
||||||
import static com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer.standardKineticRotationTransform;
|
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.jozufozu.flywheel.backend.core.PartialModel;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
|
@ -156,7 +156,7 @@ public class MechanicalCrafterRenderer extends SafeTileEntityRenderer<Mechanical
|
||||||
BlockState blockState = te.getBlockState();
|
BlockState blockState = te.getBlockState();
|
||||||
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
||||||
|
|
||||||
if (!FastRenderDispatcher.available(te.getWorld())) {
|
if (!Backend.canUseInstancing(te.getWorld())) {
|
||||||
SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.SHAFTLESS_COGWHEEL, blockState);
|
SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.SHAFTLESS_COGWHEEL, blockState);
|
||||||
standardKineticRotationTransform(superBuffer, te, light);
|
standardKineticRotationTransform(superBuffer, te, light);
|
||||||
superBuffer.rotateCentered(Direction.UP, (float) (blockState.get(HORIZONTAL_FACING).getAxis() != Direction.Axis.X ? 0 : Math.PI / 2));
|
superBuffer.rotateCentered(Direction.UP, (float) (blockState.get(HORIZONTAL_FACING).getAxis() != Direction.Axis.X ? 0 : Math.PI / 2));
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.crank;
|
||||||
|
|
||||||
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
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.jozufozu.flywheel.backend.core.PartialModel;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
|
@ -28,7 +28,7 @@ public class HandCrankRenderer extends KineticTileEntityRenderer {
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
super.renderSafe(te, partialTicks, ms, buffer, light, 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();
|
BlockState state = te.getBlockState();
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
|
|
|
@ -10,13 +10,13 @@ import com.jozufozu.flywheel.backend.instancing.RenderMaterial;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.content.contraptions.base.IRotate;
|
import com.simibubi.create.content.contraptions.base.IRotate;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticRenderMaterials;
|
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileInstance;
|
import com.simibubi.create.content.contraptions.base.KineticTileInstance;
|
||||||
import com.simibubi.create.content.contraptions.base.RotatingData;
|
import com.simibubi.create.content.contraptions.base.RotatingData;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionKineticRenderer;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionKineticRenderer;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionProgram;
|
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionProgram;
|
||||||
|
import com.simibubi.create.foundation.render.AllMaterialSpecs;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
import com.simibubi.create.foundation.utility.MatrixStacker;
|
import com.simibubi.create.foundation.utility.MatrixStacker;
|
||||||
|
@ -63,9 +63,9 @@ public class DeployerActorInstance extends ActorInstance {
|
||||||
hand = mat.getModel(handPose, state).createInstance();
|
hand = mat.getModel(handPose, state).createInstance();
|
||||||
|
|
||||||
Direction.Axis axis = ((IRotate) state.getBlock()).getRotationAxis(state);
|
Direction.Axis axis = ((IRotate) state.getBlock()).getRotationAxis(state);
|
||||||
shaft = modelManager.getMaterial(KineticRenderMaterials.ROTATING)
|
shaft = modelManager.getMaterial(AllMaterialSpecs.ROTATING)
|
||||||
.getModel(KineticTileInstance.shaft(axis))
|
.getModel(KineticTileInstance.shaft(axis))
|
||||||
.createInstance();
|
.createInstance();
|
||||||
|
|
||||||
int blockLight = localBlockLight();
|
int blockLight = localBlockLight();
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.backend.FastRenderDispatcher;
|
import com.jozufozu.flywheel.backend.Backend;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.AllItems;
|
import com.simibubi.create.AllItems;
|
||||||
|
@ -256,7 +256,7 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
|
||||||
@Override
|
@Override
|
||||||
public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
|
public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
|
||||||
IRenderTypeBuffer buffers) {
|
IRenderTypeBuffer buffers) {
|
||||||
if (!FastRenderDispatcher.available())
|
if (!Backend.canUseInstancing())
|
||||||
DeployerRenderer.renderInContraption(context, ms, msLocal, buffers);
|
DeployerRenderer.renderInContraption(context, ms, msLocal, buffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.components.deployer;
|
||||||
import static com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE;
|
import static com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE;
|
||||||
import static com.simibubi.create.content.contraptions.base.DirectionalKineticBlock.FACING;
|
import static com.simibubi.create.content.contraptions.base.DirectionalKineticBlock.FACING;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.backend.FastRenderDispatcher;
|
import com.jozufozu.flywheel.backend.Backend;
|
||||||
import com.jozufozu.flywheel.backend.core.PartialModel;
|
import com.jozufozu.flywheel.backend.core.PartialModel;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
|
@ -52,7 +52,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
||||||
renderItem(te, partialTicks, ms, buffer, light, overlay);
|
renderItem(te, partialTicks, ms, buffer, light, overlay);
|
||||||
FilteringRenderer.renderOnTileEntity(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);
|
renderComponents(te, partialTicks, ms, buffer, light, overlay);
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
||||||
protected void renderComponents(DeployerTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
protected void renderComponents(DeployerTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
||||||
if (!FastRenderDispatcher.available(te.getWorld())) {
|
if (!Backend.canUseInstancing(te.getWorld())) {
|
||||||
KineticTileEntityRenderer.renderRotatingKineticBlock(te, getRenderedBlockState(te), ms, vb, light);
|
KineticTileEntityRenderer.renderRotatingKineticBlock(te, getRenderedBlockState(te), ms, vb, light);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.fan;
|
||||||
|
|
||||||
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
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.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
@ -28,7 +28,7 @@ public class EncasedFanRenderer extends KineticTileEntityRenderer {
|
||||||
@Override
|
@Override
|
||||||
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
if (FastRenderDispatcher.available(te.getWorld())) return;
|
if (Backend.canUseInstancing(te.getWorld())) return;
|
||||||
|
|
||||||
Direction direction = te.getBlockState()
|
Direction direction = te.getBlockState()
|
||||||
.get(FACING);
|
.get(FACING);
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.flywheel;
|
||||||
|
|
||||||
import static com.simibubi.create.content.contraptions.base.HorizontalKineticBlock.HORIZONTAL_FACING;
|
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.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
@ -36,7 +36,7 @@ public class FlywheelRenderer extends KineticTileEntityRenderer {
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
super.renderSafe(te, partialTicks, ms, buffer, light, 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();
|
BlockState blockState = te.getBlockState();
|
||||||
FlywheelTileEntity wte = (FlywheelTileEntity) te;
|
FlywheelTileEntity wte = (FlywheelTileEntity) te;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.content.contraptions.components.flywheel.engine;
|
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.jozufozu.flywheel.backend.core.PartialModel;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
|
@ -24,10 +24,10 @@ public class EngineRenderer<T extends EngineTileEntity> extends SafeTileEntityRe
|
||||||
protected void renderSafe(T te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light,
|
protected void renderSafe(T te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light,
|
||||||
int overlay) {
|
int overlay) {
|
||||||
|
|
||||||
if (FastRenderDispatcher.available(te.getWorld())) return;
|
if (Backend.canUseInstancing(te.getWorld())) return;
|
||||||
|
|
||||||
Block block = te.getBlockState()
|
Block block = te.getBlockState()
|
||||||
.getBlock();
|
.getBlock();
|
||||||
if (block instanceof EngineBlock) {
|
if (block instanceof EngineBlock) {
|
||||||
EngineBlock engineBlock = (EngineBlock) block;
|
EngineBlock engineBlock = (EngineBlock) block;
|
||||||
PartialModel frame = engineBlock.getFrameModel();
|
PartialModel frame = engineBlock.getFrameModel();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.content.contraptions.components.mixer;
|
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.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
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,
|
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
|
|
||||||
if (FastRenderDispatcher.available(te.getWorld())) return;
|
if (Backend.canUseInstancing(te.getWorld())) return;
|
||||||
|
|
||||||
BlockState blockState = te.getBlockState();
|
BlockState blockState = te.getBlockState();
|
||||||
MechanicalMixerTileEntity mixer = (MechanicalMixerTileEntity) te;
|
MechanicalMixerTileEntity mixer = (MechanicalMixerTileEntity) te;
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.press;
|
||||||
|
|
||||||
import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING;
|
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.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
|
@ -33,7 +33,7 @@ public class MechanicalPressRenderer extends KineticTileEntityRenderer {
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
super.renderSafe(te, partialTicks, ms, buffer, light, 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();
|
BlockPos pos = te.getPos();
|
||||||
BlockState blockState = te.getBlockState();
|
BlockState blockState = te.getBlockState();
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.saw;
|
||||||
|
|
||||||
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
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.jozufozu.flywheel.backend.core.PartialModel;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
@ -47,7 +47,7 @@ public class SawRenderer extends SafeTileEntityRenderer<SawTileEntity> {
|
||||||
renderItems(te, partialTicks, ms, buffer, light, overlay);
|
renderItems(te, partialTicks, ms, buffer, light, overlay);
|
||||||
FilteringRenderer.renderOnTileEntity(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);
|
renderShaft(te, ms, buffer, light, overlay);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.content.contraptions.components.structureMovement.bearing;
|
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.jozufozu.flywheel.backend.core.PartialModel;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
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,
|
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
|
|
||||||
if (FastRenderDispatcher.available(te.getWorld())) return;
|
if (Backend.canUseInstancing(te.getWorld())) return;
|
||||||
|
|
||||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.be
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
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.jozufozu.flywheel.backend.core.PartialModel;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
@ -33,7 +33,7 @@ public class StabilizedBearingMovementBehaviour extends MovementBehaviour {
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
|
public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
|
||||||
IRenderTypeBuffer buffer) {
|
IRenderTypeBuffer buffer) {
|
||||||
if (FastRenderDispatcher.available()) return;
|
if (Backend.canUseInstancing()) return;
|
||||||
|
|
||||||
Direction facing = context.state.get(BlockStateProperties.FACING);
|
Direction facing = context.state.get(BlockStateProperties.FACING);
|
||||||
PartialModel top = AllBlockPartials.BEARING_TOP;
|
PartialModel top = AllBlockPartials.BEARING_TOP;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.content.contraptions.components.structureMovement.chassis;
|
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.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||||
|
@ -26,7 +26,7 @@ public class StickerRenderer extends SafeTileEntityRenderer<StickerTileEntity> {
|
||||||
protected void renderSafe(StickerTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
protected void renderSafe(StickerTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
|
|
||||||
if (FastRenderDispatcher.available(te.getWorld())) return;
|
if (Backend.canUseInstancing(te.getWorld())) return;
|
||||||
|
|
||||||
BlockState state = te.getBlockState();
|
BlockState state = te.getBlockState();
|
||||||
SuperByteBuffer head = PartialBufferer.get(AllBlockPartials.STICKER_HEAD, state);
|
SuperByteBuffer head = PartialBufferer.get(AllBlockPartials.STICKER_HEAD, state);
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.ch
|
||||||
|
|
||||||
import java.util.List;
|
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.jozufozu.flywheel.backend.instancing.IInstanceRendered;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.AllSoundEvents;
|
import com.simibubi.create.AllSoundEvents;
|
||||||
|
@ -70,7 +70,7 @@ public class StickerTileEntity extends SmartTileEntity implements IInstanceRende
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> playSound(false));
|
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> playSound(false));
|
||||||
piston.chase(target, .4f, Chaser.LINEAR);
|
piston.chase(target, .4f, Chaser.LINEAR);
|
||||||
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> FastRenderDispatcher.enqueueUpdate(this));
|
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> Backend.enqueueUpdate(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAttachedToBlock() {
|
public boolean isAttachedToBlock() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.content.contraptions.components.structureMovement.gantry;
|
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.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
|
@ -32,14 +32,14 @@ public class GantryCarriageRenderer extends KineticTileEntityRenderer {
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
super.renderSafe(te, partialTicks, ms, buffer, light, 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();
|
BlockState state = te.getBlockState();
|
||||||
Direction facing = state.get(GantryCarriageBlock.FACING);
|
Direction facing = state.get(GantryCarriageBlock.FACING);
|
||||||
Boolean alongFirst = state.get(GantryCarriageBlock.AXIS_ALONG_FIRST_COORDINATE);
|
Boolean alongFirst = state.get(GantryCarriageBlock.AXIS_ALONG_FIRST_COORDINATE);
|
||||||
Axis rotationAxis = getRotationAxisOf(te);
|
Axis rotationAxis = getRotationAxisOf(te);
|
||||||
BlockPos visualPos = facing.getAxisDirection() == AxisDirection.POSITIVE ? te.getPos()
|
BlockPos visualPos = facing.getAxisDirection() == AxisDirection.POSITIVE ? te.getPos()
|
||||||
: te.getPos()
|
: te.getPos()
|
||||||
.offset(facing.getOpposite());
|
.offset(facing.getOpposite());
|
||||||
float angleForTe = getAngleForTe(te, visualPos, rotationAxis);
|
float angleForTe = getAngleForTe(te, visualPos, rotationAxis);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.content.contraptions.components.structureMovement.pulley;
|
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.jozufozu.flywheel.backend.core.PartialModel;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
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,
|
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
|
|
||||||
if (FastRenderDispatcher.available(te.getWorld())) return;
|
if (Backend.canUseInstancing(te.getWorld())) return;
|
||||||
|
|
||||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||||
float offset = getOffset(te, partialTicks);
|
float offset = getOffset(te, partialTicks);
|
||||||
|
|
|
@ -12,10 +12,10 @@ import com.jozufozu.flywheel.backend.instancing.InstancedModel;
|
||||||
import com.jozufozu.flywheel.backend.instancing.InstancedTileRenderer;
|
import com.jozufozu.flywheel.backend.instancing.InstancedTileRenderer;
|
||||||
import com.jozufozu.flywheel.backend.instancing.RenderMaterial;
|
import com.jozufozu.flywheel.backend.instancing.RenderMaterial;
|
||||||
import com.simibubi.create.AllMovementBehaviours;
|
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.actors.ActorData;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
|
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
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.client.renderer.ActiveRenderInfo;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -67,7 +67,7 @@ public class ContraptionKineticRenderer extends InstancedTileRenderer<Contraptio
|
||||||
}
|
}
|
||||||
|
|
||||||
public RenderMaterial<?, InstancedModel<ActorData>> getActorMaterial() {
|
public RenderMaterial<?, InstancedModel<ActorData>> getActorMaterial() {
|
||||||
return getMaterial(KineticRenderMaterials.ACTORS);
|
return getMaterial(AllMaterialSpecs.ACTORS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RenderedContraption getContraption() {
|
public RenderedContraption getContraption() {
|
||||||
|
|
|
@ -9,7 +9,6 @@ import org.lwjgl.opengl.GL13;
|
||||||
import org.lwjgl.opengl.GL40;
|
import org.lwjgl.opengl.GL40;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.backend.Backend;
|
import com.jozufozu.flywheel.backend.Backend;
|
||||||
import com.jozufozu.flywheel.backend.FastRenderDispatcher;
|
|
||||||
import com.jozufozu.flywheel.backend.core.ContraptionContext;
|
import com.jozufozu.flywheel.backend.core.ContraptionContext;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllMovementBehaviours;
|
import com.simibubi.create.AllMovementBehaviours;
|
||||||
|
@ -83,7 +82,7 @@ public class ContraptionRenderDispatcher {
|
||||||
|
|
||||||
if (Backend.canUseVBOs()) {
|
if (Backend.canUseVBOs()) {
|
||||||
ContraptionProgram structureShader = ContraptionContext.INSTANCE.getProgram(AllProgramSpecs.STRUCTURE);
|
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()) {
|
for (RenderedContraption renderer : renderers.values()) {
|
||||||
renderer.doRenderLayer(layer, structureShader);
|
renderer.doRenderLayer(layer, structureShader);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.content.contraptions.fluids.pipes;
|
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.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
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,
|
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
|
|
||||||
if (FastRenderDispatcher.available(te.getWorld())) return;
|
if (Backend.canUseInstancing(te.getWorld())) return;
|
||||||
|
|
||||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||||
BlockState blockState = te.getBlockState();
|
BlockState blockState = te.getBlockState();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.content.contraptions.relays.advanced;
|
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.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
@ -32,7 +32,7 @@ public class SpeedControllerRenderer extends SmartTileEntityRenderer<SpeedContro
|
||||||
super.renderSafe(tileEntityIn, partialTicks, ms, buffer, light, overlay);
|
super.renderSafe(tileEntityIn, partialTicks, ms, buffer, light, overlay);
|
||||||
|
|
||||||
IVertexBuilder builder = buffer.getBuffer(RenderType.getSolid());
|
IVertexBuilder builder = buffer.getBuffer(RenderType.getSolid());
|
||||||
if (!FastRenderDispatcher.available(tileEntityIn.getWorld())) {
|
if (!Backend.canUseInstancing(tileEntityIn.getWorld())) {
|
||||||
KineticTileEntityRenderer.renderRotatingBuffer(tileEntityIn, getRotatedModel(tileEntityIn), ms, builder, light);
|
KineticTileEntityRenderer.renderRotatingBuffer(tileEntityIn, getRotatedModel(tileEntityIn), ms, builder, light);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,10 @@ import com.jozufozu.flywheel.backend.instancing.InstancedTileRenderer;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticRenderMaterials;
|
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileInstance;
|
import com.simibubi.create.content.contraptions.base.KineticTileInstance;
|
||||||
import com.simibubi.create.content.contraptions.base.RotatingData;
|
import com.simibubi.create.content.contraptions.base.RotatingData;
|
||||||
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
|
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
|
||||||
|
import com.simibubi.create.foundation.render.AllMaterialSpecs;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
import com.simibubi.create.foundation.utility.MatrixStacker;
|
import com.simibubi.create.foundation.utility.MatrixStacker;
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public class BeltInstance extends KineticTileInstance<BeltTileEntity> {
|
||||||
PartialModel beltPartial = BeltRenderer.getBeltPartial(diagonal, start, end, bottom);
|
PartialModel beltPartial = BeltRenderer.getBeltPartial(diagonal, start, end, bottom);
|
||||||
SpriteShiftEntry spriteShift = BeltRenderer.getSpriteShiftEntry(color, diagonal, bottom);
|
SpriteShiftEntry spriteShift = BeltRenderer.getSpriteShiftEntry(color, diagonal, bottom);
|
||||||
|
|
||||||
InstancedModel<BeltData> beltModel = modelManager.getMaterial(KineticRenderMaterials.BELTS).getModel(beltPartial, blockState);
|
InstancedModel<BeltData> beltModel = modelManager.getMaterial(AllMaterialSpecs.BELTS).getModel(beltPartial, blockState);
|
||||||
|
|
||||||
keys.add(setup(beltModel.createInstance(), bottom, spriteShift));
|
keys.add(setup(beltModel.createInstance(), bottom, spriteShift));
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.relays.belt;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.function.Supplier;
|
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.jozufozu.flywheel.backend.core.PartialModel;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
|
@ -57,7 +57,7 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
||||||
protected void renderSafe(BeltTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
protected void renderSafe(BeltTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
|
|
||||||
if (!FastRenderDispatcher.available(te.getWorld())) {
|
if (!Backend.canUseInstancing(te.getWorld())) {
|
||||||
|
|
||||||
BlockState blockState = te.getBlockState();
|
BlockState blockState = te.getBlockState();
|
||||||
if (!AllBlocks.BELT.has(blockState)) return;
|
if (!AllBlocks.BELT.has(blockState)) return;
|
||||||
|
|
|
@ -12,7 +12,7 @@ import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Function;
|
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.GridAlignedBB;
|
||||||
import com.jozufozu.flywheel.backend.light.LightUpdateListener;
|
import com.jozufozu.flywheel.backend.light.LightUpdateListener;
|
||||||
import com.jozufozu.flywheel.backend.light.LightUpdater;
|
import com.jozufozu.flywheel.backend.light.LightUpdater;
|
||||||
|
@ -267,7 +267,7 @@ public class BeltTileEntity extends KineticTileEntity implements LightUpdateList
|
||||||
belt.color = Optional.ofNullable(colorIn);
|
belt.color = Optional.ofNullable(colorIn);
|
||||||
belt.markDirty();
|
belt.markDirty();
|
||||||
belt.sendData();
|
belt.sendData();
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> FastRenderDispatcher.enqueueUpdate(belt));
|
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> Backend.enqueueUpdate(belt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.content.contraptions.relays.encased;
|
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.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.content.contraptions.base.IRotate;
|
import com.simibubi.create.content.contraptions.base.IRotate;
|
||||||
|
@ -28,7 +28,7 @@ public class SplitShaftRenderer extends KineticTileEntityRenderer {
|
||||||
@Override
|
@Override
|
||||||
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
if (FastRenderDispatcher.available(te.getWorld())) return;
|
if (Backend.canUseInstancing(te.getWorld())) return;
|
||||||
|
|
||||||
Block block = te.getBlockState().getBlock();
|
Block block = te.getBlockState().getBlock();
|
||||||
final Axis boxAxis = ((IRotate) block).getRotationAxis(te.getBlockState());
|
final Axis boxAxis = ((IRotate) block).getRotationAxis(te.getBlockState());
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.content.contraptions.relays.gauge;
|
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.jozufozu.flywheel.backend.core.PartialModel;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
|
@ -40,7 +40,7 @@ public class GaugeRenderer extends KineticTileEntityRenderer {
|
||||||
@Override
|
@Override
|
||||||
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
if (FastRenderDispatcher.available(te.getWorld())) return;
|
if (Backend.canUseInstancing(te.getWorld())) return;
|
||||||
|
|
||||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||||
BlockState gaugeState = te.getBlockState();
|
BlockState gaugeState = te.getBlockState();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.content.contraptions.relays.gearbox;
|
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.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
|
@ -27,7 +27,7 @@ public class GearboxRenderer extends KineticTileEntityRenderer {
|
||||||
@Override
|
@Override
|
||||||
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int light, int overlay) {
|
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 Axis boxAxis = te.getBlockState().get(BlockStateProperties.AXIS);
|
||||||
final BlockPos pos = te.getPos();
|
final BlockPos pos = te.getPos();
|
||||||
|
|
|
@ -11,9 +11,9 @@ import com.jozufozu.flywheel.backend.instancing.InstancedModel;
|
||||||
import com.jozufozu.flywheel.backend.instancing.InstancedTileRenderer;
|
import com.jozufozu.flywheel.backend.instancing.InstancedTileRenderer;
|
||||||
import com.jozufozu.flywheel.backend.instancing.TileEntityInstance;
|
import com.jozufozu.flywheel.backend.instancing.TileEntityInstance;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
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.content.logistics.block.FlapData;
|
||||||
import com.simibubi.create.foundation.gui.widgets.InterpolatedValue;
|
import com.simibubi.create.foundation.gui.widgets.InterpolatedValue;
|
||||||
|
import com.simibubi.create.foundation.render.AllMaterialSpecs;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
|
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
|
@ -28,8 +28,8 @@ public class BeltTunnelInstance extends TileEntityInstance<BeltTunnelTileEntity>
|
||||||
|
|
||||||
tunnelFlaps = new EnumMap<>(Direction.class);
|
tunnelFlaps = new EnumMap<>(Direction.class);
|
||||||
|
|
||||||
InstancedModel<FlapData> model = modelManager.getMaterial(KineticRenderMaterials.FLAPS)
|
InstancedModel<FlapData> model = modelManager.getMaterial(AllMaterialSpecs.FLAPS)
|
||||||
.getModel(AllBlockPartials.BELT_TUNNEL_FLAP, blockState);
|
.getModel(AllBlockPartials.BELT_TUNNEL_FLAP, blockState);
|
||||||
|
|
||||||
int blockLight = world.getLightLevel(LightType.BLOCK, pos);
|
int blockLight = world.getLightLevel(LightType.BLOCK, pos);
|
||||||
int skyLight = world.getLightLevel(LightType.SKY, pos);
|
int skyLight = world.getLightLevel(LightType.SKY, pos);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.content.logistics.block.belts.tunnel;
|
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.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
@ -31,7 +31,7 @@ public class BeltTunnelRenderer extends SmartTileEntityRenderer<BeltTunnelTileEn
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||||
|
|
||||||
if (FastRenderDispatcher.available(te.getWorld())) return;
|
if (Backend.canUseInstancing(te.getWorld())) return;
|
||||||
|
|
||||||
SuperByteBuffer flapBuffer = PartialBufferer.get(AllBlockPartials.BELT_TUNNEL_FLAP, te.getBlockState());
|
SuperByteBuffer flapBuffer = PartialBufferer.get(AllBlockPartials.BELT_TUNNEL_FLAP, te.getBlockState());
|
||||||
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
||||||
|
|
|
@ -9,7 +9,7 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.backend.FastRenderDispatcher;
|
import com.jozufozu.flywheel.backend.Backend;
|
||||||
import com.jozufozu.flywheel.backend.instancing.IInstanceRendered;
|
import com.jozufozu.flywheel.backend.instancing.IInstanceRendered;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelBlock.Shape;
|
import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelBlock.Shape;
|
||||||
|
@ -103,7 +103,7 @@ public class BeltTunnelTileEntity extends SmartTileEntity implements IInstanceRe
|
||||||
sides.addAll(flaps.keySet());
|
sides.addAll(flaps.keySet());
|
||||||
super.fromTag(state, compound, clientPacket);
|
super.fromTag(state, compound, clientPacket);
|
||||||
if (clientPacket)
|
if (clientPacket)
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> FastRenderDispatcher.enqueueUpdate(this));
|
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> Backend.enqueueUpdate(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTunnelConnections() {
|
public void updateTunnelConnections() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.content.logistics.block.depot;
|
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.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
@ -45,7 +45,7 @@ public class EjectorRenderer extends KineticTileEntityRenderer {
|
||||||
float lidProgress = ((EjectorTileEntity) te).getLidProgress(partialTicks);
|
float lidProgress = ((EjectorTileEntity) te).getLidProgress(partialTicks);
|
||||||
float angle = lidProgress * 70;
|
float angle = lidProgress * 70;
|
||||||
|
|
||||||
if (!FastRenderDispatcher.available(te.getWorld())) {
|
if (!Backend.canUseInstancing(te.getWorld())) {
|
||||||
SuperByteBuffer model = PartialBufferer.get(AllBlockPartials.EJECTOR_TOP, te.getBlockState());
|
SuperByteBuffer model = PartialBufferer.get(AllBlockPartials.EJECTOR_TOP, te.getBlockState());
|
||||||
applyLidAngle(te, angle, model.matrixStacker());
|
applyLidAngle(te, angle, model.matrixStacker());
|
||||||
model.light(light)
|
model.light(light)
|
||||||
|
@ -55,7 +55,7 @@ public class EjectorRenderer extends KineticTileEntityRenderer {
|
||||||
MatrixStacker msr = MatrixStacker.of(ms);
|
MatrixStacker msr = MatrixStacker.of(ms);
|
||||||
|
|
||||||
float maxTime =
|
float maxTime =
|
||||||
(float) (ejector.earlyTarget != null ? ejector.earlyTargetTime : ejector.launcher.getTotalFlyingTicks());
|
(float) (ejector.earlyTarget != null ? ejector.earlyTargetTime : ejector.launcher.getTotalFlyingTicks());
|
||||||
for (IntAttached<ItemStack> intAttached : ejector.launchedItems) {
|
for (IntAttached<ItemStack> intAttached : ejector.launchedItems) {
|
||||||
float time = intAttached.getFirst() + partialTicks;
|
float time = intAttached.getFirst() + partialTicks;
|
||||||
if (time > maxTime)
|
if (time > maxTime)
|
||||||
|
|
|
@ -9,8 +9,8 @@ import com.jozufozu.flywheel.backend.instancing.InstancedModel;
|
||||||
import com.jozufozu.flywheel.backend.instancing.InstancedTileRenderer;
|
import com.jozufozu.flywheel.backend.instancing.InstancedTileRenderer;
|
||||||
import com.jozufozu.flywheel.backend.instancing.TileEntityInstance;
|
import com.jozufozu.flywheel.backend.instancing.TileEntityInstance;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
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.content.logistics.block.FlapData;
|
||||||
|
import com.simibubi.create.foundation.render.AllMaterialSpecs;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
|
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
|
@ -27,10 +27,10 @@ public class FunnelInstance extends TileEntityInstance<FunnelTileEntity> impleme
|
||||||
|
|
||||||
if (!tile.hasFlap()) return;
|
if (!tile.hasFlap()) return;
|
||||||
|
|
||||||
PartialModel flapPartial = (blockState.getBlock() instanceof FunnelBlock ? AllBlockPartials.FUNNEL_FLAP
|
PartialModel flapPartial = (blockState.getBlock() instanceof FunnelBlock ? AllBlockPartials.FUNNEL_FLAP
|
||||||
: AllBlockPartials.BELT_FUNNEL_FLAP);
|
: AllBlockPartials.BELT_FUNNEL_FLAP);
|
||||||
InstancedModel<FlapData> model = modelManager.getMaterial(KineticRenderMaterials.FLAPS)
|
InstancedModel<FlapData> model = modelManager.getMaterial(AllMaterialSpecs.FLAPS)
|
||||||
.getModel(flapPartial, blockState);
|
.getModel(flapPartial, blockState);
|
||||||
|
|
||||||
int blockLight = world.getLightLevel(LightType.BLOCK, pos);
|
int blockLight = world.getLightLevel(LightType.BLOCK, pos);
|
||||||
int skyLight = world.getLightLevel(LightType.SKY, pos);
|
int skyLight = world.getLightLevel(LightType.SKY, pos);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.content.logistics.block.funnel;
|
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.jozufozu.flywheel.backend.core.PartialModel;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
|
@ -30,7 +30,7 @@ public class FunnelRenderer extends SmartTileEntityRenderer<FunnelTileEntity> {
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||||
|
|
||||||
if (!te.hasFlap() || FastRenderDispatcher.available(te.getWorld()))
|
if (!te.hasFlap() || Backend.canUseInstancing(te.getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BlockState blockState = te.getBlockState();
|
BlockState blockState = te.getBlockState();
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.logistics.block.funnel;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.List;
|
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.jozufozu.flywheel.backend.instancing.IInstanceRendered;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.AllSoundEvents;
|
import com.simibubi.create.AllSoundEvents;
|
||||||
|
@ -327,7 +327,7 @@ public class FunnelTileEntity extends SmartTileEntity implements IHaveHoveringIn
|
||||||
extractionCooldown = compound.getInt("TransferCooldown");
|
extractionCooldown = compound.getInt("TransferCooldown");
|
||||||
|
|
||||||
if (clientPacket)
|
if (clientPacket)
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> FastRenderDispatcher.enqueueUpdate(this));
|
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> Backend.enqueueUpdate(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.content.logistics.block.mechanicalArm;
|
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.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
@ -42,7 +42,7 @@ public class ArmRenderer extends KineticTileEntityRenderer {
|
||||||
super.renderSafe(te, pt, ms, buffer, light, overlay);
|
super.renderSafe(te, pt, ms, buffer, light, overlay);
|
||||||
ArmTileEntity arm = (ArmTileEntity) te;
|
ArmTileEntity arm = (ArmTileEntity) te;
|
||||||
|
|
||||||
boolean usingFlywheel = FastRenderDispatcher.available(te.getWorld());
|
boolean usingFlywheel = Backend.canUseInstancing(te.getWorld());
|
||||||
|
|
||||||
ItemStack item = arm.heldItem;
|
ItemStack item = arm.heldItem;
|
||||||
boolean hasItem = !item.isEmpty();
|
boolean hasItem = !item.isEmpty();
|
||||||
|
@ -50,7 +50,7 @@ public class ArmRenderer extends KineticTileEntityRenderer {
|
||||||
if (usingFlywheel && !hasItem) return;
|
if (usingFlywheel && !hasItem) return;
|
||||||
|
|
||||||
ItemRenderer itemRenderer = Minecraft.getInstance()
|
ItemRenderer itemRenderer = Minecraft.getInstance()
|
||||||
.getItemRenderer();
|
.getItemRenderer();
|
||||||
|
|
||||||
boolean isBlockItem = hasItem && (item.getItem() instanceof BlockItem)
|
boolean isBlockItem = hasItem && (item.getItem() instanceof BlockItem)
|
||||||
&& itemRenderer.getItemModelWithOverrides(item, Minecraft.getInstance().world, null)
|
&& itemRenderer.getItemModelWithOverrides(item, Minecraft.getInstance().world, null)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.content.logistics.block.redstone;
|
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.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
@ -28,7 +28,7 @@ public class AnalogLeverRenderer extends SafeTileEntityRenderer<AnalogLeverTileE
|
||||||
protected void renderSafe(AnalogLeverTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
protected void renderSafe(AnalogLeverTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
|
|
||||||
if (FastRenderDispatcher.available(te.getWorld())) return;
|
if (Backend.canUseInstancing(te.getWorld())) return;
|
||||||
|
|
||||||
BlockState leverState = te.getBlockState();
|
BlockState leverState = te.getBlockState();
|
||||||
int lightCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), leverState, te.getPos());
|
int lightCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), leverState, te.getPos());
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.content.schematics.block;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.backend.FastRenderDispatcher;
|
import com.jozufozu.flywheel.backend.Backend;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
@ -46,7 +46,7 @@ public class SchematicannonRenderer extends SafeTileEntityRenderer<Schematicanno
|
||||||
if (blocksLaunching)
|
if (blocksLaunching)
|
||||||
renderLaunchedBlocks(tileEntityIn, partialTicks, ms, buffer, light, overlay);
|
renderLaunchedBlocks(tileEntityIn, partialTicks, ms, buffer, light, overlay);
|
||||||
|
|
||||||
if (FastRenderDispatcher.available(tileEntityIn.getWorld())) return;
|
if (Backend.canUseInstancing(tileEntityIn.getWorld())) return;
|
||||||
|
|
||||||
BlockPos pos = tileEntityIn.getPos();
|
BlockPos pos = tileEntityIn.getPos();
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.events;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.backend.FastRenderDispatcher;
|
import com.jozufozu.flywheel.backend.Backend;
|
||||||
import com.jozufozu.flywheel.backend.RenderWork;
|
import com.jozufozu.flywheel.backend.RenderWork;
|
||||||
import com.jozufozu.flywheel.backend.core.BasicInstancedTileRenderer;
|
import com.jozufozu.flywheel.backend.core.BasicInstancedTileRenderer;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
@ -98,7 +98,7 @@ public class ClientEvents {
|
||||||
|
|
||||||
SoundScapes.tick();
|
SoundScapes.tick();
|
||||||
AnimationTickHolder.tick();
|
AnimationTickHolder.tick();
|
||||||
FastRenderDispatcher.tick();
|
Backend.tick();
|
||||||
ScrollValueHandler.tick();
|
ScrollValueHandler.tick();
|
||||||
|
|
||||||
CreateClient.schematicSender.tick();
|
CreateClient.schematicSender.tick();
|
||||||
|
|
|
@ -5,7 +5,7 @@ import java.util.function.Supplier;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.backend.FastRenderDispatcher;
|
import com.jozufozu.flywheel.backend.Backend;
|
||||||
import com.jozufozu.flywheel.backend.OptifineHandler;
|
import com.jozufozu.flywheel.backend.OptifineHandler;
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
import com.simibubi.create.content.contraptions.goggles.GoggleConfigScreen;
|
import com.simibubi.create.content.contraptions.goggles.GoggleConfigScreen;
|
||||||
|
@ -129,12 +129,12 @@ public class ConfigureConfigPacket extends SimplePacketBase {
|
||||||
AllConfigs.CLIENT.experimentalRendering.set(parsedBoolean);
|
AllConfigs.CLIENT.experimentalRendering.set(parsedBoolean);
|
||||||
|
|
||||||
ITextComponent text = boolToText(AllConfigs.CLIENT.experimentalRendering.get())
|
ITextComponent text = boolToText(AllConfigs.CLIENT.experimentalRendering.get())
|
||||||
.append(new StringTextComponent(" Experimental Rendering").formatted(TextFormatting.WHITE));
|
.append(new StringTextComponent(" Experimental Rendering").formatted(TextFormatting.WHITE));
|
||||||
ITextComponent error = new StringTextComponent("Experimental Rendering does not support Optifine Shaders")
|
ITextComponent error = new StringTextComponent("Experimental Rendering does not support Optifine Shaders")
|
||||||
.formatted(TextFormatting.RED);
|
.formatted(TextFormatting.RED);
|
||||||
|
|
||||||
player.sendStatusMessage(cannotUseER ? error : text, false);
|
player.sendStatusMessage(cannotUseER ? error : text, false);
|
||||||
FastRenderDispatcher.refresh();
|
Backend.reloadWorldRenderers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
|
|
@ -7,7 +7,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.backend.FastRenderDispatcher;
|
import com.jozufozu.flywheel.backend.Backend;
|
||||||
import com.jozufozu.flywheel.backend.instancing.IInstanceRendered;
|
import com.jozufozu.flywheel.backend.instancing.IInstanceRendered;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher;
|
import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher;
|
||||||
|
@ -27,7 +27,7 @@ public class CancelTileEntityRenderMixin {
|
||||||
*/
|
*/
|
||||||
@Inject(at = @At("RETURN"), method = "getTileEntities", cancellable = true)
|
@Inject(at = @At("RETURN"), method = "getTileEntities", cancellable = true)
|
||||||
private void noRenderInstancedTiles(CallbackInfoReturnable<List<TileEntity>> cir) {
|
private void noRenderInstancedTiles(CallbackInfoReturnable<List<TileEntity>> cir) {
|
||||||
if (FastRenderDispatcher.available()) {
|
if (Backend.canUseInstancing()) {
|
||||||
List<TileEntity> tiles = cir.getReturnValue();
|
List<TileEntity> tiles = cir.getReturnValue();
|
||||||
|
|
||||||
tiles.removeIf(tile -> tile instanceof IInstanceRendered && !((IInstanceRendered) tile).shouldRenderAsTE());
|
tiles.removeIf(tile -> tile instanceof IInstanceRendered && !((IInstanceRendered) tile).shouldRenderAsTE());
|
||||||
|
|
|
@ -8,7 +8,6 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.backend.Backend;
|
import com.jozufozu.flywheel.backend.Backend;
|
||||||
import com.jozufozu.flywheel.backend.FastRenderDispatcher;
|
|
||||||
import com.jozufozu.flywheel.backend.OptifineHandler;
|
import com.jozufozu.flywheel.backend.OptifineHandler;
|
||||||
import com.jozufozu.flywheel.backend.core.BasicInstancedTileRenderer;
|
import com.jozufozu.flywheel.backend.core.BasicInstancedTileRenderer;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
@ -52,7 +51,7 @@ public class RenderHooksMixin {
|
||||||
Matrix4f viewProjection = view.copy();
|
Matrix4f viewProjection = view.copy();
|
||||||
viewProjection.multiplyBackward(Backend.projectionMatrix);
|
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);
|
ContraptionRenderDispatcher.renderLayer(type, viewProjection, camX, camY, camZ);
|
||||||
|
|
||||||
|
|
|
@ -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<InstancedModel<ModelData>> TRANSFORMED = register(new MaterialSpec<>(Locations.MODEL, AllProgramSpecs.MODEL, TransformedModel::new));
|
||||||
|
public static final MaterialSpec<InstancedModel<OrientedData>> ORIENTED = register(new MaterialSpec<>(Locations.ORIENTED, AllProgramSpecs.ORIENTED, OrientedModel::new));
|
||||||
|
|
||||||
|
public static final MaterialSpec<InstancedModel<RotatingData>> ROTATING = register(new MaterialSpec<>(Locations.ROTATING, AllProgramSpecs.ROTATING, RotatingModel::new));
|
||||||
|
public static final MaterialSpec<InstancedModel<BeltData>> BELTS = register(new MaterialSpec<>(Locations.BELTS, AllProgramSpecs.BELT, BeltInstancedModel::new));
|
||||||
|
public static final MaterialSpec<InstancedModel<ActorData>> ACTORS = register(new MaterialSpec<>(Locations.ACTORS, AllProgramSpecs.ACTOR, ActorModel::new));
|
||||||
|
public static final MaterialSpec<InstancedModel<FlapData>> 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");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
package com.simibubi.create.foundation.tileEntity.renderer;
|
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.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public abstract class ColoredOverlayTileEntityRenderer<T extends TileEntity> ext
|
||||||
protected void renderSafe(T te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
protected void renderSafe(T te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int light, int overlay) {
|
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);
|
SuperByteBuffer render = render(getOverlayBuffer(te), getColor(te, partialTicks), light);
|
||||||
render.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
|
render.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
|
||||||
|
|
Loading…
Reference in a new issue