Fix crash on resource reload

- Invalidate contraption renderers on context gathering
This commit is contained in:
JozsefA 2021-06-24 01:21:33 -07:00
parent 1e65e3aee6
commit abf8bc8a4e
3 changed files with 8 additions and 3 deletions

View File

@ -16,7 +16,7 @@ cursegradle_version = 1.4.0
# dependency versions # dependency versions
registrate_version = 1.0.4 registrate_version = 1.0.4
flywheel_version = 1.16-0.0.2.9 flywheel_version = 1.16-0.0.2.10
jei_version = 7.7.0.106 jei_version = 7.7.0.106
# curseforge information # curseforge information

View File

@ -5,8 +5,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.core.AtlasStitcher;
import com.jozufozu.flywheel.core.PartialModel; import com.jozufozu.flywheel.core.PartialModel;
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
@ -79,6 +77,7 @@ public class CreateClient {
modEventBus.addListener(ClientEvents::loadCompleted); modEventBus.addListener(ClientEvents::loadCompleted);
modEventBus.addListener(CreateContexts::flwInit); modEventBus.addListener(CreateContexts::flwInit);
modEventBus.addListener(AllMaterialSpecs::flwInit); modEventBus.addListener(AllMaterialSpecs::flwInit);
modEventBus.addListener(ContraptionRenderDispatcher::invalidateOnGatherContext);
} }
public static void clientInit(FMLClientSetupEvent event) { public static void clientInit(FMLClientSetupEvent event) {

View File

@ -13,6 +13,8 @@ import static org.lwjgl.opengl.GL20.glUseProgram;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import com.jozufozu.flywheel.event.GatherContextEvent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -146,6 +148,10 @@ public class ContraptionRenderDispatcher {
invalidateAll(); invalidateAll();
} }
public static void invalidateOnGatherContext(GatherContextEvent e) {
invalidateAll();
}
public static void render(AbstractContraptionEntity entity, Contraption contraption, public static void render(AbstractContraptionEntity entity, Contraption contraption,
ContraptionMatrices matrices, IRenderTypeBuffer buffers) { ContraptionMatrices matrices, IRenderTypeBuffer buffers) {
World world = entity.world; World world = entity.world;