repair old modules, get ready for stringsetting
This commit is contained in:
		
							parent
							
								
									430ff443a6
								
							
						
					
					
						commit
						72eb688172
					
				
					 5 changed files with 22 additions and 52 deletions
				
			
		|  | @ -3,6 +3,7 @@ package me.kawaiizenbo.moonlight.module.modules; | |||
| import me.kawaiizenbo.moonlight.module.Category; | ||||
| import me.kawaiizenbo.moonlight.module.Module; | ||||
| import me.kawaiizenbo.moonlight.module.settings.DoubleSetting; | ||||
| import me.kawaiizenbo.moonlight.util.MathUtils; | ||||
| import net.minecraft.entity.MovementType; | ||||
| import net.minecraft.util.math.Vec3d; | ||||
| 
 | ||||
|  | @ -12,13 +13,28 @@ public class Speed extends Module | |||
|     public Speed()  | ||||
|     { | ||||
|         super("Speed", "Allows you to move faster.", Category.MOVEMENT); | ||||
|         settings.add(speed); | ||||
|     } | ||||
|      | ||||
|     @Override | ||||
|     public void onMotion(MovementType type, Vec3d movement) | ||||
|     { | ||||
|         // ??? | ||||
|         mc.player.addVelocity(movement); | ||||
|         // this is a little janky but it works, will find a better solution later | ||||
|         if (mc.player.forwardSpeed == 0 && mc.player.sidewaysSpeed == 0 && mc.player.isOnGround()) | ||||
|         { | ||||
|             mc.player.setVelocity(0, 0, 0); | ||||
|         } | ||||
|         Vec3d move = new Vec3d(mc.player.getX() - mc.player.prevX, 0, mc.player.getZ() - mc.player.prevZ).multiply(20); | ||||
|         double mps = Math.abs(MathUtils.length2D(move)); | ||||
|         double normal = mc.player.isSprinting() ? 5.61 : 4.31; | ||||
|         if (mps > normal * speed.value) | ||||
|         { | ||||
|             return; | ||||
|         } | ||||
|         if (mc.player.isOnGround()) | ||||
|         { | ||||
|             mc.player.setVelocity(mc.player.getVelocity().x * speed.value, 0, mc.player.getVelocity().z * speed.value); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -24,6 +24,6 @@ public class Step extends Module | |||
|     public void onDisable() | ||||
|     { | ||||
|         super.onDisable(); | ||||
|         mc.player.setStepHeight(0.5f); | ||||
|         mc.player.setStepHeight(0.6f); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -1,45 +0,0 @@ | |||
| package me.kawaiizenbo.moonlight.module.settings; | ||||
| 
 | ||||
| import me.kawaiizenbo.moonlight.util.ColorUtils; | ||||
| import net.minecraft.client.font.TextRenderer; | ||||
| import net.minecraft.client.gui.DrawContext; | ||||
| import net.minecraft.text.Text; | ||||
| 
 | ||||
| public class ColorSetting extends Setting | ||||
| { | ||||
|     // this is unfinished, please use 3 DoubleSettings instead | ||||
|     public int value; | ||||
|     public int r; | ||||
|     public int g; | ||||
|     public int b; | ||||
|      | ||||
| 
 | ||||
|     public ColorSetting(String name, int value) | ||||
|     { | ||||
|         this.name = name; | ||||
|         this.value = value; | ||||
|         this.height = 64; | ||||
|         this.r = (value >> 16) & 0xFF; | ||||
|         this.g = (value >> 8) & 0xFF; | ||||
|         this.b = value & 0xFF; | ||||
|     } | ||||
| 
 | ||||
|     @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+2, 0xFFFFFF); | ||||
|         int redDisplayStartColor = ColorUtils.rgbaToInt(0, g, b, 255); | ||||
|         int redDisplayEndColor = ColorUtils.rgbaToInt(255, g, b, 255); | ||||
|         int greenDisplayStartColor = ColorUtils.rgbaToInt(r, 0, b, 255); | ||||
|         int greenDisplayEndColor = ColorUtils.rgbaToInt(r, 255, b, 255); | ||||
|         int blueDisplayStartColor = ColorUtils.rgbaToInt(r, g, 0, 255); | ||||
|         int blueDisplayEndColor = ColorUtils.rgbaToInt(r, g, 255, 255); | ||||
|         drawContext.fillGradient(x+80, y+2, x+92, y+62, redDisplayEndColor, redDisplayStartColor, 0); | ||||
|         drawContext.fillGradient(x+95, y+2, x+107, y+62, greenDisplayEndColor, greenDisplayStartColor, 0); | ||||
|         drawContext.fillGradient(x+110, y+2, x+122, y+62, blueDisplayEndColor, blueDisplayStartColor, 0); | ||||
|         drawContext.drawTextWithShadow(textRenderer, Text.literal("Red: " + r), x+130, y+10, 0xFFFFFFFF); | ||||
|         drawContext.drawTextWithShadow(textRenderer, Text.literal("Green: " + g), x+130, y+26, 0xFFFFFFFF); | ||||
|         drawContext.drawTextWithShadow(textRenderer, Text.literal("Blue: " + b), x+130, y+42, 0xFFFFFFFF); | ||||
|     } | ||||
| } | ||||
|  | @ -6,14 +6,13 @@ import net.minecraft.client.gui.DrawContext; | |||
| public class Setting  | ||||
| { | ||||
|     public String name; | ||||
|     public int height = 24; | ||||
| 
 | ||||
|     int x = 0, y = 0; | ||||
|     public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer) | ||||
|     {  | ||||
|         this.x = x; | ||||
|         this.y = y; | ||||
|         drawContext.fill(x, y, x+192, y+height, hovered(mouseX, mouseY) ? 0xFF444444: 0xFF222222); | ||||
|         drawContext.fill(x, y, x+192, y+24, hovered(mouseX, mouseY) ? 0xFF444444: 0xFF222222); | ||||
|          | ||||
|     } | ||||
| 
 | ||||
|  | @ -25,6 +24,6 @@ public class Setting | |||
| 
 | ||||
|     protected boolean hovered(int mouseX, int mouseY)  | ||||
|     { | ||||
| 		return mouseX >= x && mouseX <= x + 192 && mouseY >= y && mouseY <= y + height; | ||||
| 		return mouseX >= x && mouseX <= x + 192 && mouseY >= y && mouseY <= y + 24; | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -44,7 +44,7 @@ public class SettingsScreen extends Screen | |||
| 		for (Setting setting : module.settings) | ||||
| 		{ | ||||
| 			setting.render(drawContext, x+16, yOffset, mouseX, mouseY, textRenderer); | ||||
| 			yOffset += setting.height + 1; | ||||
| 			yOffset += 25; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 kawaiizenbo
						kawaiizenbo