Skip to content
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
4 changes: 2 additions & 2 deletions src/main/java/fr/alexdoru/mwe/config/MWEConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ public static void onColoredLeatherArmorSetting() {
public static boolean witherHUDinSidebar = true;

@ConfigProperty(
category = MEGA_WALLS, subCategory = "HUD",
category = MEGA_WALLS, subCategory = "Class-Specific HUD",
name = "Strength HUD",
comment = "Displays the duration of the strength effect when you have it or when you are about to have it with Hunter."
+ " Works with Dreadlord, Herobrine, Hunter and Zombie.")
Expand All @@ -715,7 +715,7 @@ public static void onStrengthHUDSetting() {
}

@ConfigProperty(
category = MEGA_WALLS, subCategory = "HUD",
category = MEGA_WALLS, subCategory = "Class-Specific HUD",
name = "Creeper primed TNT HUD",
comment = "Displays the cooldown of primed TNT when playing Creeper")
public static final GuiPosition creeperTNTHUDPosition = new GuiPosition(true, 0.5d, 8d / 20d);
Expand Down
17 changes: 13 additions & 4 deletions src/main/java/fr/alexdoru/mwe/gui/guiapi/GuiManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
public final class GuiManager {

private static final ArrayList<IRenderer> registeredRenderers = new ArrayList<>();
private static final ArrayList<IRenderer> classSpecificRenderers = new ArrayList<>();
private static final Minecraft mc = Minecraft.getMinecraft();
public static final ArmorHUD armorHUD = new ArmorHUD();
public static final ArrowHitHUD arrowHitHUD = new ArrowHitHUD();
Expand Down Expand Up @@ -48,6 +49,9 @@ public final class GuiManager {
registeredRenderers.add(squadHealthHUD);
registeredRenderers.add(warcryHUD);
registeredRenderers.trimToSize();
classSpecificRenderers.add(creeperPrimedTntHUD);
classSpecificRenderers.add(strengthHUD);
classSpecificRenderers.trimToSize();
}

/**
Expand Down Expand Up @@ -83,13 +87,18 @@ public static IRenderer getRendererFromPosition(GuiPosition guiPosition) {
return null;
}

public static void renderAllDummy() {
/**
* renders the appropriate HUDs for the PositionEditGuiScreen instance
* @param c the renderer which is being positioned in the PositionEditGuiScreen
*/
public static void renderDummiesForPositionEditScreen(IRenderer c) {
final ScaledResolution resolution = new ScaledResolution(mc);
for (final IRenderer renderer : registeredRenderers) {
if (renderer.getGuiPosition().isEnabled()) {
renderer.getGuiPosition().updateAbsolutePosition(resolution);
renderer.renderDummy();
if (!renderer.getGuiPosition().isEnabled() || classSpecificRenderers.contains(renderer) && !renderer.getClass().isInstance(c)) {
continue;
}
renderer.getGuiPosition().updateAbsolutePosition(resolution);
renderer.renderDummy();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.renderCrosshair();
final boolean prevEnabled = this.guiPosition.isEnabled();
this.guiPosition.setEnabled(false);
GuiManager.renderAllDummy();
GuiManager.renderDummiesForPositionEditScreen(renderer);
this.guiPosition.setEnabled(prevEnabled);
super.drawDefaultBackground();
renderer.renderDummy();
Expand Down