new setting and make modular hud the default
This commit is contained in:
		
							parent
							
								
									e5d1d3ef73
								
							
						
					
					
						commit
						b8bb14081e
					
				
					 4 changed files with 42 additions and 5 deletions
				
			
		|  | @ -23,7 +23,7 @@ public class InGameHudMixin { | |||
| 		HUDEnabler hudModule = (HUDEnabler)ModuleManager.INSTANCE.getModuleByName("HUD"); | ||||
| 		if (hudModule.enabled)  | ||||
| 		{ | ||||
| 			if (hudModule.legacyHud.value) LegacyHUD.INSTANCE.render(drawContext, drawContext.getScaledWindowWidth(), drawContext.getScaledWindowHeight()); | ||||
| 			if (hudModule.mode.index == 1) LegacyHUD.INSTANCE.render(drawContext, drawContext.getScaledWindowWidth(), drawContext.getScaledWindowHeight()); | ||||
| 			else HUDRenderer.INSTANCE.render(drawContext); | ||||
| 		} | ||||
| 		if (ModuleManager.INSTANCE.getModuleByName("ModulesList").enabled) ModulesListOverlay.INSTANCE.render(drawContext, drawContext.getScaledWindowWidth(), drawContext.getScaledWindowHeight()); | ||||
|  |  | |||
|  | @ -2,11 +2,11 @@ package me.kawaiizenbo.moonlight.module.modules; | |||
| 
 | ||||
| import me.kawaiizenbo.moonlight.module.Category; | ||||
| import me.kawaiizenbo.moonlight.module.Module; | ||||
| import me.kawaiizenbo.moonlight.module.settings.BooleanSetting; | ||||
| import me.kawaiizenbo.moonlight.module.settings.IndexSetting; | ||||
| 
 | ||||
| public class HUDEnabler extends Module  | ||||
| { | ||||
| 	public BooleanSetting legacyHud = new BooleanSetting("Legacy HUD", true); | ||||
| 	public IndexSetting mode = new IndexSetting("Mode", 0, "Modular", "Legacy"); | ||||
| 	 | ||||
|     public HUDEnabler() | ||||
|     { | ||||
|  | @ -14,6 +14,6 @@ public class HUDEnabler extends Module | |||
|         this.enabled = true; | ||||
|         this.showInModulesList.value = false; | ||||
|         this.showEditButton = true; | ||||
|         settings.add(legacyHud); | ||||
|         settings.add(mode); | ||||
|     }     | ||||
| } | ||||
|  |  | |||
|  | @ -0,0 +1,38 @@ | |||
| package me.kawaiizenbo.moonlight.module.settings; | ||||
| 
 | ||||
| import net.minecraft.client.font.TextRenderer; | ||||
| import net.minecraft.client.gui.DrawContext; | ||||
| import net.minecraft.text.Text; | ||||
| 
 | ||||
| public class IndexSetting extends Setting | ||||
| { | ||||
|     public int index; | ||||
|     public String[] elements; | ||||
| 
 | ||||
|     public IndexSetting(String name, int index, String... elements) | ||||
|     { | ||||
|         this.name = name; | ||||
|         this.index = index; | ||||
|         this.elements = elements; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer)  | ||||
|     { | ||||
|         super.render(drawContext, x, y, mouseX, mouseY, textRenderer); | ||||
|         drawContext.drawTextWithShadow(textRenderer, Text.literal(name), x+2, y+8, 0xFFFFFF); | ||||
|         drawContext.fill(x+96, y+5, x+190, y+19, 0xFFFFFFFF); | ||||
|         drawContext.fill(x+97, y+6, x+189, y+18, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222); | ||||
|         drawContext.drawTextWithShadow(textRenderer, elements[index], x+98, y+8, 0xFFFFFF); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
| 	public void mouseClicked(double mouseX, double mouseY, int button)  | ||||
|     { | ||||
| 		if (hovered((int)mouseX, (int)mouseY) && button == 0)  | ||||
|         { | ||||
| 			if (index >= elements.length-1) index = 0; | ||||
| 			else index++; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | @ -24,7 +24,6 @@ public class ModuleButton | |||
| 		this.y = y; | ||||
| 		drawContext.fill(x, y, x + width, y + height, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222); | ||||
| 		drawContext.drawText(textRenderer, module.name, x+2, y+2, module.enabled ? 0x55FFFF : 0xFFFFFF, false); | ||||
| 		if (!module.settings.isEmpty()) drawContext.drawGuiTexture(Identifier.of("moonlight", "settings"), x+width-12, y, 12, 12); | ||||
| 	} | ||||
| 	 | ||||
| 	public boolean hovered(int mouseX, int mouseY)  | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 kawaiizenbo
						kawaiizenbo