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