Skip to content

Commit

Permalink
Workaround for MCreator#3964 (not sure what FS cache still holds the …
Browse files Browse the repository at this point in the history
…file present) (MCreator#3966)
  • Loading branch information
KlemenDEV committed Jun 18, 2023
1 parent 99bd829 commit 514d157
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/main/java/net/mcreator/ui/modgui/ModElementGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ public void setModElementCreatedListener(ModElementCreatedListener<GE> modElemen
}

@Override public ImageIcon getViewIcon() {
if (!editingMode)
return modElement.getType().getIcon();

ImageIcon modIcon = modElement.getElementIcon();
if (modIcon != null && modIcon.getImage() != null && modIcon.getIconWidth() > 0 && modIcon.getIconHeight() > 0
&& modIcon != MCItem.DEFAULT_ICON)
Expand Down Expand Up @@ -565,18 +568,19 @@ private void finishModCreation(boolean closeTab) {

changed = false;

if (this.tabIn != null && closeTab)
mcreator.mcreatorTabs.closeTab(tabIn);
else
mcreator.mcreatorTabs.getTabs().stream().filter(e -> e.getContent() == this)
.forEach(e -> e.setIcon(((ModElementGUI<?>) e.getContent()).getViewIcon()));

if (!editingMode && modElementCreatedListener
!= null) // only call this event if listener is registered and we are not in editing mode
modElementCreatedListener.modElementCreated(element);

// at this point, ME is stored so if session was not marked as editingMode before, now it is
editingMode = true;

// handle tab changes
if (this.tabIn != null && closeTab)
mcreator.mcreatorTabs.closeTab(tabIn);
else
mcreator.mcreatorTabs.getTabs().stream().filter(e -> e.getContent() == this)
.forEach(e -> e.setIcon(((ModElementGUI<?>) e.getContent()).getViewIcon()));
}

public @Nonnull ModElement getModElement() {
Expand Down

0 comments on commit 514d157

Please sign in to comment.