mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-29 08:26:37 +01:00
Minor fixes
- Fix holder refresh - Fix SuperByteBuffer light calculation - Remove unused import
This commit is contained in:
parent
67052fd00c
commit
f33b08d996
3 changed files with 18 additions and 10 deletions
|
@ -1,6 +1,5 @@
|
||||||
package com.simibubi.create.content.contraptions.components.actors;
|
package com.simibubi.create.content.contraptions.components.actors;
|
||||||
|
|
||||||
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.saw.SawBlock;
|
import com.simibubi.create.content.contraptions.components.saw.SawBlock;
|
||||||
import com.simibubi.create.content.contraptions.components.saw.SawRenderer;
|
import com.simibubi.create.content.contraptions.components.saw.SawRenderer;
|
||||||
|
|
|
@ -58,7 +58,7 @@ import net.minecraftforge.client.model.data.EmptyModelData;
|
||||||
public class ContraptionRenderDispatcher {
|
public class ContraptionRenderDispatcher {
|
||||||
private static final BlockModelRenderer MODEL_RENDERER = new BlockModelRenderer(Minecraft.getInstance().getBlockColors());
|
private static final BlockModelRenderer MODEL_RENDERER = new BlockModelRenderer(Minecraft.getInstance().getBlockColors());
|
||||||
private static final BlockModelShapes BLOCK_MODELS = Minecraft.getInstance().getModelManager().getBlockModelShapes();
|
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<RenderedContraption> RENDERERS = new Int2ObjectOpenHashMap<>();
|
||||||
public static final Int2ObjectMap<ContraptionWorldHolder> WORLD_HOLDERS = new Int2ObjectOpenHashMap<>();
|
public static final Int2ObjectMap<ContraptionWorldHolder> WORLD_HOLDERS = new Int2ObjectOpenHashMap<>();
|
||||||
|
@ -73,9 +73,10 @@ public class ContraptionRenderDispatcher {
|
||||||
contraption.kinetics.tick();
|
contraption.kinetics.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ticksUntilHolderRefresh <= 0) {
|
worldHolderRefreshCounter++;
|
||||||
|
if (worldHolderRefreshCounter >= 20) {
|
||||||
removeDeadHolders();
|
removeDeadHolders();
|
||||||
ticksUntilHolderRefresh = 20;
|
worldHolderRefreshCounter = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,10 +150,9 @@ public class SuperByteBuffer extends TemplateBuffer {
|
||||||
lightPos.transform(lightTransform);
|
lightPos.transform(lightTransform);
|
||||||
|
|
||||||
int worldLight = getLight(Minecraft.getInstance().world, lightPos);
|
int worldLight = getLight(Minecraft.getInstance().world, lightPos);
|
||||||
if (light >= 0) {
|
light = maxLight(worldLight, light);
|
||||||
light = maxLight(worldLight, light);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hybridLight)
|
if (hybridLight)
|
||||||
builder.light(maxLight(light, getLight(buffer, i)));
|
builder.light(maxLight(light, getLight(buffer, i)));
|
||||||
else
|
else
|
||||||
|
@ -165,12 +164,22 @@ public class SuperByteBuffer extends TemplateBuffer {
|
||||||
.endVertex();
|
.endVertex();
|
||||||
}
|
}
|
||||||
|
|
||||||
transforms = new MatrixStack();
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SuperByteBuffer reset() {
|
||||||
|
transforms = new MatrixStack();
|
||||||
spriteShiftFunc = null;
|
spriteShiftFunc = null;
|
||||||
shouldColor = false;
|
|
||||||
shouldLight = false;
|
shouldLight = false;
|
||||||
hybridLight = false;
|
hybridLight = false;
|
||||||
|
packedLightCoords = 0;
|
||||||
|
lightTransform = null;
|
||||||
|
shouldColor = false;
|
||||||
|
r = 0;
|
||||||
|
g = 0;
|
||||||
|
b = 0;
|
||||||
|
a = 0;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MatrixStacker matrixStacker() {
|
public MatrixStacker matrixStacker() {
|
||||||
|
@ -263,7 +272,6 @@ public class SuperByteBuffer extends TemplateBuffer {
|
||||||
|
|
||||||
public SuperByteBuffer light(int packedLightCoords) {
|
public SuperByteBuffer light(int packedLightCoords) {
|
||||||
shouldLight = true;
|
shouldLight = true;
|
||||||
lightTransform = null;
|
|
||||||
this.packedLightCoords = packedLightCoords;
|
this.packedLightCoords = packedLightCoords;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue