Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix map overlay caches not clearing when they should #2744

Open
wants to merge 1 commit into
base: 1.20.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public static void clearCaches() {
for (IClientCache cache : caches.keySet()) {
cache.clear();
}
GroupingMapRenderer.getInstance().clear();
}

public static void saveCaches() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ public abstract boolean addMarker(String name, String id, ResourceKey<Level> dim
public abstract boolean doShowLayer(String name);

public abstract void setLayerActive(String name, boolean active);

public abstract void clear();
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,11 @@ public void setLayerActive(String name, boolean active) {
renderer.setLayerActive(name, active);
}
}

@Override
public void clear() {
for (GenericMapRenderer renderer : rendererList) {
renderer.clear();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,10 @@ public boolean doShowLayer(String name) {
public void setLayerActive(String name, boolean active) {
FTBChunksOptions.toggleLayer(name, active);
}

@Override
public void clear() {
oreElements.clear();
fluidElements.clear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ public void setLayerActive(String name, boolean active) {
JourneyMapPlugin.getOptions().toggleLayer(name, active);
}

@Override
public void clear() {
var api = JourneyMapPlugin.getJmApi();
markers.forEach((id, marker) -> api.remove(marker));
markers.clear();
}

private MarkerOverlay createMarker(String name, String id, ResourceKey<Level> dim, GeneratedVeinMetadata vein) {
BlockPos center = vein.center();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,10 @@ public boolean doShowLayer(String name) {
public void setLayerActive(String name, boolean active) {
XaerosMapPlugin.toggleOption(name, active);
}

@Override
public void clear() {
oreElements.clear();
fluidElements.clear();
}
}
Loading