Minor fixes

- Fix holder refresh
- Fix SuperByteBuffer light calculation
- Remove unused import
This commit is contained in:
PepperBell 2021-05-15 12:15:06 -07:00
parent 67052fd00c
commit f33b08d996
3 changed files with 18 additions and 10 deletions

View File

@ -1,6 +1,5 @@
package com.simibubi.create.content.contraptions.components.actors;
import com.jozufozu.flywheel.backend.Backend;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.content.contraptions.components.saw.SawBlock;
import com.simibubi.create.content.contraptions.components.saw.SawRenderer;

View File

@ -58,7 +58,7 @@ import net.minecraftforge.client.model.data.EmptyModelData;
public class ContraptionRenderDispatcher {
private static final BlockModelRenderer MODEL_RENDERER = new BlockModelRenderer(Minecraft.getInstance().getBlockColors());
private static final BlockModelShapes BLOCK_MODELS = Minecraft.getInstance().getModelManager().getBlockModelShapes();
private static int ticksUntilHolderRefresh;
private static int worldHolderRefreshCounter;
public static final Int2ObjectMap<RenderedContraption> RENDERERS = new Int2ObjectOpenHashMap<>();
public static final Int2ObjectMap<ContraptionWorldHolder> WORLD_HOLDERS = new Int2ObjectOpenHashMap<>();
@ -73,9 +73,10 @@ public class ContraptionRenderDispatcher {
contraption.kinetics.tick();
}
if (ticksUntilHolderRefresh <= 0) {
worldHolderRefreshCounter++;
if (worldHolderRefreshCounter >= 20) {
removeDeadHolders();
ticksUntilHolderRefresh = 20;
worldHolderRefreshCounter = 0;
}
}

View File

@ -150,10 +150,9 @@ public class SuperByteBuffer extends TemplateBuffer {
lightPos.transform(lightTransform);
int worldLight = getLight(Minecraft.getInstance().world, lightPos);
if (light >= 0) {
light = maxLight(worldLight, light);
}
light = maxLight(worldLight, light);
}
if (hybridLight)
builder.light(maxLight(light, getLight(buffer, i)));
else
@ -165,12 +164,22 @@ public class SuperByteBuffer extends TemplateBuffer {
.endVertex();
}
transforms = new MatrixStack();
reset();
}
public SuperByteBuffer reset() {
transforms = new MatrixStack();
spriteShiftFunc = null;
shouldColor = false;
shouldLight = false;
hybridLight = false;
packedLightCoords = 0;
lightTransform = null;
shouldColor = false;
r = 0;
g = 0;
b = 0;
a = 0;
return this;
}
public MatrixStacker matrixStacker() {
@ -263,7 +272,6 @@ public class SuperByteBuffer extends TemplateBuffer {
public SuperByteBuffer light(int packedLightCoords) {
shouldLight = true;
lightTransform = null;
this.packedLightCoords = packedLightCoords;
return this;
}