0.2.0 work in progress
This commit is contained in:
		
							parent
							
								
									08031c32ba
								
							
						
					
					
						commit
						c68631010d
					
				
					 24 changed files with 89 additions and 14 deletions
				
			
		|  | @ -24,7 +24,7 @@ public class Moonlight implements ModInitializer | |||
| 	public static final Moonlight INSTANCE = new Moonlight(); | ||||
| 	public static final Logger LOGGER = LoggerFactory.getLogger("Moonlight"); | ||||
| 	public static final String clientTag = ColorUtils.aqua + "Moonlight Meadows"; | ||||
| 	public static final String versionTag = ColorUtils.magenta + "v0.1.1"; | ||||
| 	public static final String versionTag = ColorUtils.magenta + "v0.2.0"; | ||||
| 	public static Config CONFIG = new Config(); | ||||
| 	public static int uiColorA = 0xFF55FFFF; | ||||
| 	public static int uiColor = 0x55FFFF; | ||||
|  |  | |||
|  | @ -30,6 +30,8 @@ public class CommandManager | |||
|         add(new Toggle()); | ||||
|         add(new Teleport()); | ||||
|         add(new SettingCommand()); | ||||
|         add(new Reset()); | ||||
|         add(new DeathPos()); | ||||
|         commands.sort(Comparator.comparing(Command::getName)); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -0,0 +1,44 @@ | |||
| package me.kawaiizenbo.moonlight.command.commands; | ||||
| 
 | ||||
| import com.mojang.brigadier.builder.LiteralArgumentBuilder; | ||||
| 
 | ||||
| import me.kawaiizenbo.moonlight.command.Command; | ||||
| import me.kawaiizenbo.moonlight.command.CommandManager; | ||||
| import me.kawaiizenbo.moonlight.util.ChatUtils; | ||||
| import me.kawaiizenbo.moonlight.util.ColorUtils; | ||||
| import net.minecraft.command.CommandSource; | ||||
| import net.minecraft.util.math.GlobalPos; | ||||
| 
 | ||||
| public class DeathPos extends Command | ||||
| { | ||||
|     public DeathPos()  | ||||
|     { | ||||
| 		super("deathpos", "Shows your last death position."); | ||||
| 	} | ||||
|      | ||||
|     @Override | ||||
|     public void build(LiteralArgumentBuilder<CommandSource> builder)  | ||||
|     { | ||||
|         builder.executes(context ->  | ||||
|         { | ||||
|             GlobalPos pos = null; | ||||
|             try  | ||||
|             { | ||||
|                 pos = mc.player.getLastDeathPos().get(); | ||||
|                 if (pos == null) throw new Exception(); | ||||
|             }  | ||||
|             catch (Exception e)  | ||||
|             { | ||||
|                 ChatUtils.sendMsg(ColorUtils.reset + "You have not died in this world."); | ||||
|                 return SINGLE_SUCCESS; | ||||
|             } | ||||
|              | ||||
| 			ChatUtils.sendMsg(ColorUtils.reset + "You last died at: " +  | ||||
|             ColorUtils.aqua + " X: " + ColorUtils.gray + pos.getPos().getX() +  | ||||
|             ColorUtils.aqua + " Y: " + ColorUtils.gray + pos.getPos().getY() + | ||||
|             ColorUtils.aqua + " Z: " + ColorUtils.gray + pos.getPos().getZ() | ||||
|             ); | ||||
| 			return SINGLE_SUCCESS; | ||||
| 		});  | ||||
|     } | ||||
| } | ||||
|  | @ -14,19 +14,19 @@ public class Help extends Command | |||
|     { | ||||
| 		super("help", "Gives you a list of all of the commands"); | ||||
| 	} | ||||
| 
 | ||||
|      | ||||
|     @Override | ||||
|     public void build(LiteralArgumentBuilder<CommandSource> builder)  | ||||
|     { | ||||
|         builder.executes(context ->  | ||||
|         { | ||||
| 			for (Command cmd : CommandManager.get().getAll()) { | ||||
| 			for (Command cmd : CommandManager.get().getAll())  | ||||
|             { | ||||
| 				ChatUtils.sendMsg(ColorUtils.aqua + "Command: " + ColorUtils.gray + cmd.getName()); | ||||
| 				ChatUtils.sendMsg(ColorUtils.gray + cmd.getDescription()); | ||||
|                 ChatUtils.sendMsg(ColorUtils.gray + ""); | ||||
| 			} | ||||
| 			return SINGLE_SUCCESS; | ||||
| 		}); | ||||
|          | ||||
| 		});  | ||||
|     } | ||||
|      | ||||
| } | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder; | |||
| import me.kawaiizenbo.moonlight.command.Command; | ||||
| import me.kawaiizenbo.moonlight.module.ModuleManager; | ||||
| import me.kawaiizenbo.moonlight.module.Module; | ||||
| import net.minecraft.client.MinecraftClient; | ||||
| import net.minecraft.command.CommandSource; | ||||
| 
 | ||||
| public class Toggle extends Command | ||||
|  | @ -13,7 +14,7 @@ public class Toggle extends Command | |||
| 
 | ||||
|     public Toggle()  | ||||
|     { | ||||
|         super("toggle", "Toggle a module."); | ||||
|         super("toggle", "Toggle a module on or off."); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|  | @ -24,7 +25,7 @@ public class Toggle extends Command | |||
|         { | ||||
|             String m = context.getArgument("module", String.class); | ||||
|             Module module = ModuleManager.INSTANCE.getModuleByName(m); | ||||
|             module.toggle(); | ||||
|             MinecraftClient.getInstance().send(() -> module.toggle()); | ||||
| 
 | ||||
|             return SINGLE_SUCCESS; | ||||
|         })); | ||||
|  |  | |||
|  | @ -25,7 +25,7 @@ public abstract class KeyboardMixin | |||
|         if (key == GLFW.GLFW_KEY_RIGHT_ALT) MinecraftClient.getInstance().setScreen(ClickGUIScreen.INSTANCE); | ||||
|         for (Module m : ModuleManager.INSTANCE.modules) | ||||
|         { | ||||
|             if (key == m.keybind.value && action == GLFW.GLFW_PRESS) | ||||
|             if (key == m.keybind.value && action == GLFW.GLFW_PRESS && MinecraftClient.getInstance().currentScreen == null) | ||||
|             { | ||||
|                 m.toggle(); | ||||
|             } | ||||
|  |  | |||
|  | @ -7,7 +7,8 @@ public enum Category | |||
| 	RENDER("Render", 0xFF5555FF), | ||||
| 	WORLD("World", 0xFF55FF55),  | ||||
| 	PLAYER("Player", 0xFF00AAAA), | ||||
| 	CHAT("Chat", 0xFFFFAA00); | ||||
| 	CHAT("Chat", 0xFFFFAA00), | ||||
| 	SPECIAL("Special", 0xFFFFFFFF); | ||||
| 	 | ||||
| 	public String name; | ||||
| 	public int color; | ||||
|  |  | |||
|  | @ -0,0 +1,20 @@ | |||
| package me.kawaiizenbo.moonlight.module.modules; | ||||
| 
 | ||||
| import me.kawaiizenbo.moonlight.module.Category; | ||||
| import me.kawaiizenbo.moonlight.module.Module; | ||||
| 
 | ||||
| public class Reach extends Module | ||||
| { | ||||
|     public Reach() | ||||
|     { | ||||
|         super("Reach", "Extends player reach.", Category.PLAYER); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void onEnable() | ||||
|     { | ||||
|         super.onEnable(); | ||||
|         // this will be completed in 1.20.5, as a new attribute will be added to make this trivial. | ||||
|         // mc.player.getAbilities(). | ||||
|     } | ||||
| } | ||||
|  | @ -9,10 +9,12 @@ import net.minecraft.util.math.Vec3d; | |||
| 
 | ||||
| public class Speed extends Module  | ||||
| { | ||||
|     float oldSpeed; | ||||
| 
 | ||||
|     DoubleSetting speed = new DoubleSetting("Speed", 2, 0.1, 10, 1); | ||||
|     public Speed()  | ||||
|     { | ||||
|         super("Speed", "Allows you to move faster.", Category.MOVEMENT); | ||||
|         super("Speed", "Allows you to move faster. (Deprecated)", Category.MOVEMENT); | ||||
|         settings.add(speed); | ||||
|     } | ||||
|      | ||||
|  |  | |||
|  | @ -7,6 +7,7 @@ import me.kawaiizenbo.moonlight.module.ModuleManager; | |||
| import me.kawaiizenbo.moonlight.module.Module; | ||||
| import net.minecraft.client.font.TextRenderer; | ||||
| import net.minecraft.client.gui.DrawContext; | ||||
| import net.minecraft.util.Identifier; | ||||
| 
 | ||||
| public class CategoryPane  | ||||
| { | ||||
|  | @ -16,6 +17,7 @@ public class CategoryPane | |||
|     boolean dragging = false; | ||||
|     public boolean collapsed = false; | ||||
|     ArrayList<ModuleButton> moduleButtons; | ||||
|     Identifier icon; | ||||
| 
 | ||||
|     public CategoryPane(Category category, int initialX, int initialY, boolean collapsed) | ||||
|     { | ||||
|  | @ -24,6 +26,7 @@ public class CategoryPane | |||
|         this.y = initialY; | ||||
|         this.collapsed = collapsed; | ||||
|         moduleButtons = new ArrayList<ModuleButton>(); | ||||
|         icon = new Identifier("moonlight", category.name.toLowerCase()); | ||||
|         for (Module m : ModuleManager.INSTANCE.getModulesByCategory(category)) | ||||
|         { | ||||
|             moduleButtons.add(new ModuleButton(m)); | ||||
|  | @ -41,7 +44,8 @@ public class CategoryPane | |||
|         } | ||||
|         drawContext.fill(x, y, x+width, collapsed ? y+16 : y+height, category.color); | ||||
|         drawContext.fill(x+2, y+2, x+(width-2), y+14, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222); | ||||
|         drawContext.drawText(textRenderer, category.name, x+4, y+4, 0xFFFFFFFF, false); | ||||
|         drawContext.drawGuiTexture(icon, x+2, y+2, 12, 12); | ||||
|         drawContext.drawText(textRenderer, category.name, x+16, y+4, 0xFFFFFFFF, false); | ||||
|         if (!collapsed) | ||||
|         { | ||||
|             int buttonYOffset = y+16; | ||||
|  |  | |||
|  | @ -22,6 +22,7 @@ public class ClickGUIScreen extends Screen | |||
| 		Map<String, Object> panePos = ((Map<String, Object>)Moonlight.CONFIG.config.get("panes")); | ||||
| 		for (Category category : Category.values()) | ||||
| 		{  | ||||
| 			if(category.name == "Special") continue; | ||||
| 			int xOffset = MathUtils.d2iSafe(((Map<String, Object>)panePos.get(category.name)).get("x")); | ||||
| 			int yOffset = MathUtils.d2iSafe(((Map<String, Object>)panePos.get(category.name)).get("y")); | ||||
| 			boolean collapsed = (boolean)((Map<String, Object>)panePos.get(category.name)).get("collapsed"); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 kawaiizenbo
						kawaiizenbo