refactor kerosene to library mod
This commit is contained in:
		
							parent
							
								
									183c81258a
								
							
						
					
					
						commit
						2dea11d4db
					
				
					 81 changed files with 352 additions and 1376 deletions
				
			
		|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum; | ||||
| package pm.j4.kerosene; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.Arrays; | ||||
|  | @ -12,15 +12,15 @@ import net.fabricmc.loader.api.metadata.ModMetadata; | |||
| import net.minecraft.client.MinecraftClient; | ||||
| import net.minecraft.client.options.KeyBinding; | ||||
| import net.minecraft.server.integrated.IntegratedServer; | ||||
| import pm.j4.petroleum.modules.ExampleModule; | ||||
| import pm.j4.petroleum.modules.bindings.BindingManager; | ||||
| import pm.j4.petroleum.modules.list.ModList; | ||||
| import pm.j4.petroleum.modules.menu.ModMenu; | ||||
| import pm.j4.petroleum.modules.splash.SplashText; | ||||
| import pm.j4.petroleum.modules.xray.Xray; | ||||
| import pm.j4.petroleum.util.config.ConfigHolder; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.modules.ExampleModule; | ||||
| import pm.j4.kerosene.modules.bindings.BindingManager; | ||||
| import pm.j4.kerosene.modules.list.ModList; | ||||
| import pm.j4.kerosene.modules.menu.ModMenu; | ||||
| import pm.j4.kerosene.modules.splash.SplashText; | ||||
| import pm.j4.kerosene.modules.xray.Xray; | ||||
| import pm.j4.kerosene.util.config.ConfigHolder; | ||||
| import pm.j4.kerosene.util.config.ConfigManager; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| 
 | ||||
| //TODO: | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.gui; | ||||
| package pm.j4.kerosene.gui; | ||||
| 
 | ||||
| import com.mojang.blaze3d.systems.RenderSystem; | ||||
| import java.util.Map; | ||||
|  | @ -9,10 +9,10 @@ import net.minecraft.client.render.VertexFormats; | |||
| import net.minecraft.client.util.math.MatrixStack; | ||||
| import net.minecraft.text.LiteralText; | ||||
| import net.minecraft.text.TranslatableText; | ||||
| import pm.j4.petroleum.modules.menu.ModMenu; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.data.ButtonInformation; | ||||
| import pm.j4.petroleum.util.data.Category; | ||||
| import pm.j4.kerosene.modules.menu.ModMenu; | ||||
| import pm.j4.kerosene.util.config.ConfigManager; | ||||
| import pm.j4.kerosene.util.data.ButtonInformation; | ||||
| import pm.j4.kerosene.util.data.Category; | ||||
| 
 | ||||
| /** | ||||
|  * The type P mod menu screen. | ||||
|  |  | |||
|  | @ -1,13 +1,13 @@ | |||
| package pm.j4.petroleum.gui; | ||||
| package pm.j4.kerosene.gui; | ||||
| 
 | ||||
| import net.minecraft.client.MinecraftClient; | ||||
| import net.minecraft.client.gui.widget.EntryListWidget; | ||||
| import net.minecraft.client.util.math.MatrixStack; | ||||
| import net.minecraft.text.LiteralText; | ||||
| import net.minecraft.text.Text; | ||||
| import pm.j4.petroleum.util.module.option.BooleanOption; | ||||
| import pm.j4.petroleum.util.module.option.ConfigurationOption; | ||||
| import pm.j4.petroleum.util.module.option.ListOption; | ||||
| import pm.j4.kerosene.util.module.option.BooleanOption; | ||||
| import pm.j4.kerosene.util.module.option.ConfigurationOption; | ||||
| import pm.j4.kerosene.util.module.option.ListOption; | ||||
| 
 | ||||
| /** | ||||
|  * The type P module config entry. | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.gui; | ||||
| package pm.j4.kerosene.gui; | ||||
| 
 | ||||
| import com.mojang.blaze3d.platform.GlStateManager; | ||||
| import com.mojang.blaze3d.systems.RenderSystem; | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.gui; | ||||
| package pm.j4.kerosene.gui; | ||||
| 
 | ||||
| import com.mojang.blaze3d.systems.RenderSystem; | ||||
| import java.util.HashSet; | ||||
|  | @ -13,8 +13,8 @@ import net.minecraft.client.render.VertexFormats; | |||
| import net.minecraft.client.util.math.MatrixStack; | ||||
| import net.minecraft.util.math.MathHelper; | ||||
| import net.minecraft.util.math.Matrix4f; | ||||
| import pm.j4.petroleum.mixin.EntryListWidgetAccessor; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.mixin.EntryListWidgetAccessor; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type P module configuration widget. | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.gui; | ||||
| package pm.j4.kerosene.gui; | ||||
| 
 | ||||
| import com.mojang.blaze3d.systems.RenderSystem; | ||||
| import java.util.List; | ||||
|  | @ -13,9 +13,9 @@ import net.minecraft.text.LiteralText; | |||
| import net.minecraft.text.TranslatableText; | ||||
| import net.minecraft.util.math.MathHelper; | ||||
| import net.minecraft.util.math.Matrix4f; | ||||
| import pm.j4.petroleum.modules.menu.ModMenu; | ||||
| import pm.j4.petroleum.util.data.ButtonInformation; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.modules.menu.ModMenu; | ||||
| import pm.j4.kerosene.util.data.ButtonInformation; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type P movable button. | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.gui; | ||||
| package pm.j4.kerosene.gui; | ||||
| 
 | ||||
| import com.mojang.blaze3d.systems.RenderSystem; | ||||
| import net.minecraft.client.MinecraftClient; | ||||
|  | @ -9,7 +9,7 @@ import net.minecraft.text.StringVisitable; | |||
| import net.minecraft.text.Text; | ||||
| import net.minecraft.text.TranslatableText; | ||||
| import net.minecraft.util.Language; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type P option entry. | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.gui; | ||||
| package pm.j4.kerosene.gui; | ||||
| 
 | ||||
| import com.mojang.blaze3d.systems.RenderSystem; | ||||
| import java.util.ArrayList; | ||||
|  | @ -18,9 +18,9 @@ import net.minecraft.text.LiteralText; | |||
| import net.minecraft.text.StringVisitable; | ||||
| import net.minecraft.text.Text; | ||||
| import net.minecraft.text.TranslatableText; | ||||
| import pm.j4.petroleum.PetroleumMod; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.PetroleumMod; | ||||
| import pm.j4.kerosene.util.config.ConfigManager; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type P options screen. | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.mixin; | ||||
| package pm.j4.kerosene.mixin; | ||||
| 
 | ||||
| import java.util.List; | ||||
| import java.util.Optional; | ||||
|  | @ -9,9 +9,9 @@ import org.spongepowered.asm.mixin.injection.At; | |||
| import org.spongepowered.asm.mixin.injection.Inject; | ||||
| import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||||
| import org.spongepowered.asm.mixin.injection.callback.LocalCapture; | ||||
| import pm.j4.petroleum.modules.splash.SplashText; | ||||
| import pm.j4.petroleum.util.config.ConfigHolder; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.kerosene.modules.splash.SplashText; | ||||
| import pm.j4.kerosene.util.config.ConfigHolder; | ||||
| import pm.j4.kerosene.util.config.ConfigManager; | ||||
| 
 | ||||
| /** | ||||
|  * The type Debug hud mixin. | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.mixin; | ||||
| package pm.j4.kerosene.mixin; | ||||
| 
 | ||||
| import net.minecraft.client.gui.widget.EntryListWidget; | ||||
| import org.spongepowered.asm.mixin.Mixin; | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.mixin; | ||||
| package pm.j4.kerosene.mixin; | ||||
| 
 | ||||
| 
 | ||||
| import java.util.List; | ||||
|  | @ -15,10 +15,10 @@ import org.spongepowered.asm.mixin.Shadow; | |||
| import org.spongepowered.asm.mixin.injection.At; | ||||
| import org.spongepowered.asm.mixin.injection.Inject; | ||||
| import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||||
| import pm.j4.petroleum.modules.list.ModList; | ||||
| import pm.j4.petroleum.util.config.ConfigHolder; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.modules.list.ModList; | ||||
| import pm.j4.kerosene.util.config.ConfigHolder; | ||||
| import pm.j4.kerosene.util.config.ConfigManager; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Mod list mixin. | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.mixin; | ||||
| package pm.j4.kerosene.mixin; | ||||
| 
 | ||||
| import net.minecraft.client.gui.screen.Screen; | ||||
| import net.minecraft.client.gui.screen.options.OptionsScreen; | ||||
|  | @ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.Mixin; | |||
| import org.spongepowered.asm.mixin.injection.At; | ||||
| import org.spongepowered.asm.mixin.injection.Inject; | ||||
| import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||||
| import pm.j4.petroleum.gui.POptionsScreen; | ||||
| import pm.j4.kerosene.gui.POptionsScreen; | ||||
| 
 | ||||
| /** | ||||
|  * The type Options menu mixin. | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.mixin; | ||||
| package pm.j4.kerosene.mixin; | ||||
| 
 | ||||
| import java.util.Optional; | ||||
| import net.minecraft.client.gui.screen.Screen; | ||||
|  | @ -10,9 +10,9 @@ import org.spongepowered.asm.mixin.injection.At; | |||
| import org.spongepowered.asm.mixin.injection.Inject; | ||||
| import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||||
| import org.spongepowered.asm.mixin.injection.callback.LocalCapture; | ||||
| import pm.j4.petroleum.modules.splash.SplashText; | ||||
| import pm.j4.petroleum.util.config.ConfigHolder; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.kerosene.modules.splash.SplashText; | ||||
| import pm.j4.kerosene.util.config.ConfigHolder; | ||||
| import pm.j4.kerosene.util.config.ConfigManager; | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  |  | |||
|  | @ -1,11 +1,11 @@ | |||
| package pm.j4.petroleum.modules; | ||||
| package pm.j4.kerosene.modules; | ||||
| 
 | ||||
| import java.util.HashMap; | ||||
| import java.util.Map; | ||||
| import net.minecraft.client.MinecraftClient; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.petroleum.util.module.option.BooleanOption; | ||||
| import pm.j4.petroleum.util.module.option.ConfigurationOption; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.util.module.option.BooleanOption; | ||||
| import pm.j4.kerosene.util.module.option.ConfigurationOption; | ||||
| 
 | ||||
| /** | ||||
|  * The type Example module. | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.modules.bindings; | ||||
| package pm.j4.kerosene.modules.bindings; | ||||
| 
 | ||||
| import net.minecraft.client.util.InputUtil; | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.modules.bindings; | ||||
| package pm.j4.kerosene.modules.bindings; | ||||
| 
 | ||||
| import java.util.*; | ||||
| import net.minecraft.client.MinecraftClient; | ||||
|  | @ -7,12 +7,12 @@ import net.minecraft.client.util.InputUtil; | |||
| import net.minecraft.client.util.math.MatrixStack; | ||||
| import net.minecraft.text.TranslatableText; | ||||
| import org.lwjgl.glfw.GLFW; | ||||
| import pm.j4.petroleum.PetroleumMod; | ||||
| import pm.j4.petroleum.gui.PModuleConfigEntry; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.config.GlobalConfig; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.petroleum.util.module.option.KeybindOption; | ||||
| import pm.j4.kerosene.PetroleumMod; | ||||
| import pm.j4.kerosene.gui.PModuleConfigEntry; | ||||
| import pm.j4.kerosene.util.config.ConfigManager; | ||||
| import pm.j4.kerosene.util.config.GlobalConfig; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.util.module.option.KeybindOption; | ||||
| 
 | ||||
| /** | ||||
|  * The type Binding manager. | ||||
|  |  | |||
|  | @ -1,13 +1,13 @@ | |||
| package pm.j4.petroleum.modules.list; | ||||
| package pm.j4.kerosene.modules.list; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import java.util.Optional; | ||||
| import jdk.nashorn.internal.runtime.options.Option; | ||||
| import pm.j4.petroleum.PetroleumMod; | ||||
| import pm.j4.petroleum.util.config.ConfigHolder; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.PetroleumMod; | ||||
| import pm.j4.kerosene.util.config.ConfigHolder; | ||||
| import pm.j4.kerosene.util.config.ConfigManager; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Mod list. | ||||
|  |  | |||
|  | @ -1,14 +1,14 @@ | |||
| package pm.j4.petroleum.modules.menu; | ||||
| package pm.j4.kerosene.modules.menu; | ||||
| 
 | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import net.minecraft.client.MinecraftClient; | ||||
| import pm.j4.petroleum.gui.PModMenuScreen; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.data.ButtonInformation; | ||||
| import pm.j4.petroleum.util.data.Category; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.gui.PModMenuScreen; | ||||
| import pm.j4.kerosene.util.config.ConfigManager; | ||||
| import pm.j4.kerosene.util.data.ButtonInformation; | ||||
| import pm.j4.kerosene.util.data.Category; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Mod menu. | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.modules.splash; | ||||
| package pm.j4.kerosene.modules.splash; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
|  | @ -10,13 +10,13 @@ import net.minecraft.client.util.math.MatrixStack; | |||
| import net.minecraft.text.LiteralText; | ||||
| import net.minecraft.text.Text; | ||||
| import net.minecraft.text.TranslatableText; | ||||
| import pm.j4.petroleum.PetroleumMod; | ||||
| import pm.j4.petroleum.gui.PModuleConfigEntry; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.petroleum.util.module.option.BooleanOption; | ||||
| import pm.j4.petroleum.util.module.option.ConfigurationOption; | ||||
| import pm.j4.petroleum.util.module.option.KeybindOption; | ||||
| import pm.j4.kerosene.PetroleumMod; | ||||
| import pm.j4.kerosene.gui.PModuleConfigEntry; | ||||
| import pm.j4.kerosene.util.config.ConfigManager; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.util.module.option.BooleanOption; | ||||
| import pm.j4.kerosene.util.module.option.ConfigurationOption; | ||||
| import pm.j4.kerosene.util.module.option.KeybindOption; | ||||
| 
 | ||||
| /** | ||||
|  * The type Splash text. | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| package pm.j4.petroleum.modules.xray; | ||||
| package pm.j4.kerosene.modules.xray; | ||||
| 
 | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Xray. | ||||
|  |  | |||
|  | @ -1,9 +1,9 @@ | |||
| package pm.j4.petroleum.util.config; | ||||
| package pm.j4.kerosene.util.config; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import pm.j4.petroleum.PetroleumMod; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.PetroleumMod; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Config. | ||||
|  |  | |||
|  | @ -1,10 +1,10 @@ | |||
| package pm.j4.petroleum.util.config; | ||||
| package pm.j4.kerosene.util.config; | ||||
| 
 | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.stream.Collectors; | ||||
| import pm.j4.petroleum.PetroleumMod; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.PetroleumMod; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Config holder. | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.util.config; | ||||
| package pm.j4.kerosene.util.config; | ||||
| 
 | ||||
| import com.google.common.reflect.TypeToken; | ||||
| import com.google.gson.*; | ||||
|  | @ -6,13 +6,13 @@ import java.io.*; | |||
| import java.lang.reflect.Type; | ||||
| import java.util.*; | ||||
| import net.fabricmc.loader.api.FabricLoader; | ||||
| import pm.j4.petroleum.PetroleumMod; | ||||
| import pm.j4.petroleum.modules.bindings.BindingInfo; | ||||
| import pm.j4.petroleum.modules.menu.ModMenu; | ||||
| import pm.j4.petroleum.util.data.ButtonInformation; | ||||
| import pm.j4.petroleum.util.data.ModuleConfig; | ||||
| import pm.j4.petroleum.util.data.OptionSerializiable; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.PetroleumMod; | ||||
| import pm.j4.kerosene.modules.bindings.BindingInfo; | ||||
| import pm.j4.kerosene.modules.menu.ModMenu; | ||||
| import pm.j4.kerosene.util.data.ButtonInformation; | ||||
| import pm.j4.kerosene.util.data.ModuleConfig; | ||||
| import pm.j4.kerosene.util.data.OptionSerializiable; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Config manager. | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.util.config; | ||||
| package pm.j4.kerosene.util.config; | ||||
| 
 | ||||
| import java.util.Collections; | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,15 +1,15 @@ | |||
| package pm.j4.petroleum.util.config; | ||||
| package pm.j4.kerosene.util.config; | ||||
| 
 | ||||
| import java.util.*; | ||||
| import java.util.concurrent.atomic.AtomicBoolean; | ||||
| import net.minecraft.client.options.KeyBinding; | ||||
| import net.minecraft.client.util.InputUtil; | ||||
| import pm.j4.petroleum.PetroleumMod; | ||||
| import pm.j4.petroleum.modules.bindings.BindingInfo; | ||||
| import pm.j4.petroleum.util.data.ButtonInformation; | ||||
| import pm.j4.petroleum.util.data.OptionSerializiable; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.petroleum.util.module.option.ConfigurationOption; | ||||
| import pm.j4.kerosene.PetroleumMod; | ||||
| import pm.j4.kerosene.modules.bindings.BindingInfo; | ||||
| import pm.j4.kerosene.util.data.ButtonInformation; | ||||
| import pm.j4.kerosene.util.data.OptionSerializiable; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.util.module.option.ConfigurationOption; | ||||
| 
 | ||||
| /** | ||||
|  * The type Global config. | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.util.config; | ||||
| package pm.j4.kerosene.util.config; | ||||
| 
 | ||||
| /** | ||||
|  * The type Server config. | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.util.data; | ||||
| package pm.j4.kerosene.util.data; | ||||
| 
 | ||||
| /** | ||||
|  * The type Button information. | ||||
|  |  | |||
|  | @ -1,11 +1,11 @@ | |||
| package pm.j4.petroleum.util.data; | ||||
| package pm.j4.kerosene.util.data; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import pm.j4.petroleum.PetroleumMod; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.PetroleumMod; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Category. | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.util.data; | ||||
| package pm.j4.kerosene.util.data; | ||||
| 
 | ||||
| import java.util.Map; | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.util.data; | ||||
| package pm.j4.kerosene.util.data; | ||||
| 
 | ||||
| import com.google.gson.JsonElement; | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,13 +1,13 @@ | |||
| package pm.j4.petroleum.util.module; | ||||
| package pm.j4.kerosene.util.module; | ||||
| 
 | ||||
| import com.google.gson.JsonElement; | ||||
| import java.util.*; | ||||
| import net.minecraft.client.MinecraftClient; | ||||
| import net.minecraft.text.TranslatableText; | ||||
| import pm.j4.petroleum.gui.PModuleConfigEntry; | ||||
| import pm.j4.petroleum.util.config.ConfigHolder; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.module.option.ConfigurationOption; | ||||
| import pm.j4.kerosene.gui.PModuleConfigEntry; | ||||
| import pm.j4.kerosene.util.config.ConfigHolder; | ||||
| import pm.j4.kerosene.util.config.ConfigManager; | ||||
| import pm.j4.kerosene.util.module.option.ConfigurationOption; | ||||
| 
 | ||||
| /** | ||||
|  * The Basis for all mods, used so that modules all have a common activation point and settings. | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.util.module.option; | ||||
| package pm.j4.kerosene.util.module.option; | ||||
| 
 | ||||
| import com.google.gson.JsonElement; | ||||
| import com.google.gson.JsonPrimitive; | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.util.module.option; | ||||
| package pm.j4.kerosene.util.module.option; | ||||
| 
 | ||||
| import com.google.gson.JsonElement; | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.util.module.option; | ||||
| package pm.j4.kerosene.util.module.option; | ||||
| 
 | ||||
| import com.google.gson.JsonElement; | ||||
| import com.google.gson.JsonPrimitive; | ||||
|  |  | |||
|  | @ -1,11 +1,11 @@ | |||
| package pm.j4.petroleum.util.module.option; | ||||
| package pm.j4.kerosene.util.module.option; | ||||
| 
 | ||||
| import com.google.gson.JsonElement; | ||||
| import net.minecraft.client.options.KeyBinding; | ||||
| import pm.j4.petroleum.modules.bindings.BindingInfo; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.config.GlobalConfig; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.modules.bindings.BindingInfo; | ||||
| import pm.j4.kerosene.util.config.ConfigManager; | ||||
| import pm.j4.kerosene.util.config.GlobalConfig; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Keybind value. | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.util.module.option; | ||||
| package pm.j4.kerosene.util.module.option; | ||||
| 
 | ||||
| import com.google.gson.JsonElement; | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.util.module.option; | ||||
| package pm.j4.kerosene.util.module.option; | ||||
| 
 | ||||
| import com.google.gson.JsonElement; | ||||
| import com.google.gson.JsonPrimitive; | ||||
|  |  | |||
|  | @ -1,7 +1,6 @@ | |||
| package pm.j4.petroleum; | ||||
| package pm.j4.kerosene; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.Arrays; | ||||
| import java.util.List; | ||||
| import java.util.Optional; | ||||
| import net.fabricmc.api.ModInitializer; | ||||
|  | @ -12,33 +11,18 @@ import net.fabricmc.loader.api.metadata.ModMetadata; | |||
| import net.minecraft.client.MinecraftClient; | ||||
| import net.minecraft.client.options.KeyBinding; | ||||
| import net.minecraft.server.integrated.IntegratedServer; | ||||
| import pm.j4.petroleum.modules.ExampleModule; | ||||
| import pm.j4.petroleum.modules.bindings.BindingManager; | ||||
| import pm.j4.petroleum.modules.list.ModList; | ||||
| import pm.j4.petroleum.modules.menu.ModMenu; | ||||
| import pm.j4.petroleum.modules.splash.SplashText; | ||||
| import pm.j4.petroleum.modules.xray.Xray; | ||||
| import pm.j4.petroleum.util.config.ConfigHolder; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.modules.ExampleModule; | ||||
| import pm.j4.kerosene.modules.bindings.BindingManager; | ||||
| import pm.j4.kerosene.util.config.ConfigHolder; | ||||
| import pm.j4.kerosene.util.config.ConfigManager; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| 
 | ||||
| //TODO: | ||||
| // petroleum module checklist | ||||
| // [ ] xray (lol) | ||||
| // [ ] combat stuff. killaura, anti knockback, etc | ||||
| // [ ] render stuff. tracers, nametags | ||||
| // [ ] wurst taco. but a fish | ||||
| // [ ] elytra fly | ||||
| // [ ] movement stuff. nofall, jesus, speed | ||||
| // [ ] elytra bhop | ||||
| // [ ] boatfly | ||||
| // [ ] anti anti cheat | ||||
| 
 | ||||
| /** | ||||
|  * The type Petroleum mod. | ||||
|  * The type Kerosene mod. | ||||
|  */ | ||||
| public class PetroleumMod implements ModInitializer { | ||||
| public class KeroseneMod implements ModInitializer { | ||||
| 	/** | ||||
| 	 * The Mod data. | ||||
| 	 */ | ||||
|  | @ -50,14 +34,14 @@ public class PetroleumMod implements ModInitializer { | |||
| 	/** | ||||
| 	 * The constant activeMods. | ||||
| 	 */ | ||||
| 	private static final List<ModuleBase> activeMods = Arrays.asList( | ||||
| 			new SplashText(), | ||||
| 			new ModMenu(), | ||||
| 			new ModList(), | ||||
| 			new BindingManager(), | ||||
| 			new ExampleModule(), | ||||
| 			new Xray() | ||||
| 	); | ||||
| 	private static List<ModuleBase> registeredMods = new ArrayList<>(); | ||||
| 
 | ||||
| 	public static void registerMod(Class<? extends ModuleBase> mod) throws IllegalAccessException, InstantiationException { | ||||
| 		ModuleBase base = mod.newInstance(); | ||||
| 		if(!registeredMods.contains(base)) { | ||||
| 			registeredMods.add(base); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Is active boolean. | ||||
|  | @ -66,7 +50,7 @@ public class PetroleumMod implements ModInitializer { | |||
| 	 * @return the boolean | ||||
| 	 */ | ||||
| 	public static boolean isActive(String modName) { | ||||
| 		return activeMods.stream().anyMatch(mod -> mod.getModuleName().equals(modName)); | ||||
| 		return registeredMods.stream().anyMatch(mod -> mod.getModuleName().equals(modName)); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
|  | @ -76,7 +60,7 @@ public class PetroleumMod implements ModInitializer { | |||
| 	 * @return the mod | ||||
| 	 */ | ||||
| 	public static Optional<ModuleBase> getMod(String modName) { | ||||
| 		return activeMods.stream().filter(mod -> mod.getModuleName().equals(modName)).findFirst(); | ||||
| 		return registeredMods.stream().filter(mod -> mod.getModuleName().equals(modName)).findFirst(); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
|  | @ -84,8 +68,8 @@ public class PetroleumMod implements ModInitializer { | |||
| 	 * | ||||
| 	 * @return the active mods | ||||
| 	 */ | ||||
| 	public static List<ModuleBase> getActiveMods() { | ||||
| 		return activeMods; | ||||
| 	public static List<ModuleBase> getRegisteredMods() { | ||||
| 		return registeredMods; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
|  | @ -108,8 +92,10 @@ public class PetroleumMod implements ModInitializer { | |||
| 	 * @param b the b | ||||
| 	 */ | ||||
| 	public static void removeBind(KeyBinding b) { | ||||
| 		if(registeredBinds.contains(b)) { | ||||
| 			registeredBinds.remove(b); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Gets active keybinds. | ||||
|  | @ -141,24 +127,32 @@ public class PetroleumMod implements ModInitializer { | |||
| 	@Override | ||||
| 	public void onInitialize() { | ||||
| 
 | ||||
| 		ConfigManager.initConfig(); | ||||
| 		ConfigManager.initConfig("kerosene"); | ||||
| 
 | ||||
| 		// always update mod data | ||||
| 		Optional<ModContainer> modContainer = FabricLoader.getInstance().getModContainer("petroleum"); | ||||
| 		Optional<ModContainer> modContainer = FabricLoader.getInstance().getModContainer("kerosene"); | ||||
| 		modContainer.ifPresent(container -> modData = container.getMetadata()); | ||||
| 
 | ||||
| 		Optional<ConfigHolder> conf = ConfigManager.getConfig(); | ||||
| 		Optional<ConfigHolder> conf = ConfigManager.getConfig("kerosene"); | ||||
| 
 | ||||
| 		try { | ||||
| 			this.registerMod(ExampleModule.class); | ||||
| 			this.registerMod(BindingManager.class); | ||||
| 		} | ||||
| 		catch (Exception e) { | ||||
| 			System.out.println(e); | ||||
| 		} | ||||
| 
 | ||||
| 
 | ||||
| 		//initialize any keybinds, data, etc. | ||||
| 		activeMods.forEach(ModuleBase::init); | ||||
| 		registeredMods.forEach(ModuleBase::init); | ||||
| 
 | ||||
| 		//initialize keybind handler | ||||
| 		conf.ifPresent(configHolder -> ClientTickEvents.END_CLIENT_TICK.register(client -> { | ||||
| 			if (PetroleumMod.client != client) { | ||||
| 				PetroleumMod.client = client; | ||||
| 			if (KeroseneMod.client != client) { | ||||
| 				KeroseneMod.client = client; | ||||
| 			} | ||||
| 			for (KeyBinding b : PetroleumMod.getActiveKeybinds()) { | ||||
| 			for (KeyBinding b : KeroseneMod.getActiveKeybinds()) { | ||||
| 				while (b.wasPressed()) { | ||||
| 					configHolder.globalConfig.bindings.get(b).activate(client); | ||||
| 				} | ||||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.gui; | ||||
| package pm.j4.kerosene.gui; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | @ -12,12 +12,12 @@ import net.minecraft.client.options.KeyBinding; | |||
| import net.minecraft.client.util.math.MatrixStack; | ||||
| import net.minecraft.text.LiteralText; | ||||
| import net.minecraft.text.Text; | ||||
| import pm.j4.petroleum.util.config.ConfigHolder; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.module.option.BooleanOption; | ||||
| import pm.j4.petroleum.util.module.option.ConfigurationOption; | ||||
| import pm.j4.petroleum.util.module.option.KeybindOption; | ||||
| import pm.j4.petroleum.util.module.option.ListOption; | ||||
| import pm.j4.kerosene.util.config.ConfigHolder; | ||||
| import pm.j4.kerosene.util.config.ConfigManager; | ||||
| import pm.j4.kerosene.util.module.option.BooleanOption; | ||||
| import pm.j4.kerosene.util.module.option.ConfigurationOption; | ||||
| import pm.j4.kerosene.util.module.option.KeybindOption; | ||||
| import pm.j4.kerosene.util.module.option.ListOption; | ||||
| 
 | ||||
| /** | ||||
|  * The type P module config entry. | ||||
|  | @ -156,9 +156,9 @@ public class PModuleConfigEntry extends ElementListWidget.Entry<PModuleConfigEnt | |||
| 								//TODO | ||||
| 								if (keyCode != 257 && keyCode != 32 && keyCode != 335) { | ||||
| 									KeybindOption newValue = new KeybindOption(option.getConfigKey(), option.getDescription(), option.getParent()); | ||||
| 									KeyBinding bind = new KeyBinding(((KeybindOption)option).getTranslationKey(), keyCode, "category.petroleum"); | ||||
| 									KeyBinding bind = new KeyBinding(((KeybindOption)option).getTranslationKey(), keyCode, "category." + option.getParent().getParent()); | ||||
| 									newValue.fromKeybind(bind, option.getParent()); | ||||
| 									Optional<ConfigHolder> config = ConfigManager.getConfig(); | ||||
| 									Optional<ConfigHolder> config = ConfigManager.getConfig(option.getParent().getParent()); | ||||
| 									assert config.isPresent(); | ||||
| 									config.get().globalConfig.setBinding(bind, option.getParent()); | ||||
| 									option = newValue; | ||||
|  | @ -1,11 +1,9 @@ | |||
| package pm.j4.petroleum.gui; | ||||
| package pm.j4.kerosene.gui; | ||||
| 
 | ||||
| import com.mojang.blaze3d.platform.GlStateManager; | ||||
| import com.mojang.blaze3d.systems.RenderSystem; | ||||
| import net.minecraft.client.MinecraftClient; | ||||
| import net.minecraft.client.font.TextRenderer; | ||||
| import net.minecraft.client.gui.widget.ElementListWidget; | ||||
| import net.minecraft.client.gui.widget.EntryListWidget; | ||||
| import net.minecraft.client.render.BufferBuilder; | ||||
| import net.minecraft.client.render.Tessellator; | ||||
| import net.minecraft.client.render.VertexFormats; | ||||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.gui; | ||||
| package pm.j4.kerosene.gui; | ||||
| 
 | ||||
| import com.mojang.blaze3d.systems.RenderSystem; | ||||
| import java.util.HashSet; | ||||
|  | @ -13,8 +13,8 @@ import net.minecraft.client.render.VertexFormats; | |||
| import net.minecraft.client.util.math.MatrixStack; | ||||
| import net.minecraft.util.math.MathHelper; | ||||
| import net.minecraft.util.math.Matrix4f; | ||||
| import pm.j4.petroleum.mixin.EntryListWidgetAccessor; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.mixin.EntryListWidgetAccessor; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type P module configuration widget. | ||||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.gui; | ||||
| package pm.j4.kerosene.gui; | ||||
| 
 | ||||
| import com.mojang.blaze3d.systems.RenderSystem; | ||||
| import net.minecraft.client.MinecraftClient; | ||||
|  | @ -9,7 +9,7 @@ import net.minecraft.text.StringVisitable; | |||
| import net.minecraft.text.Text; | ||||
| import net.minecraft.text.TranslatableText; | ||||
| import net.minecraft.util.Language; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type P option entry. | ||||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.gui; | ||||
| package pm.j4.kerosene.gui; | ||||
| 
 | ||||
| import com.mojang.blaze3d.systems.RenderSystem; | ||||
| import java.util.ArrayList; | ||||
|  | @ -15,9 +15,9 @@ import net.minecraft.client.render.Tessellator; | |||
| import net.minecraft.client.render.VertexFormats; | ||||
| import net.minecraft.client.util.math.MatrixStack; | ||||
| import net.minecraft.text.*; | ||||
| import pm.j4.petroleum.PetroleumMod; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.KeroseneMod; | ||||
| import pm.j4.kerosene.util.config.ConfigManager; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type P options screen. | ||||
|  | @ -99,11 +99,9 @@ public class POptionsScreen extends Screen { | |||
| 		this.configPane.setLeftPos(paneWidth); | ||||
| 		this.children.add(this.configPane); | ||||
| 		List<ModuleBase> configurableModules = new ArrayList<>(); | ||||
| 		if (ConfigManager.getConfig().isPresent()) { | ||||
| 			configurableModules.addAll(PetroleumMod.getActiveMods() | ||||
| 		configurableModules.addAll(KeroseneMod.getRegisteredMods() | ||||
| 				.stream().filter(ModuleBase::configurable) | ||||
| 				.collect(Collectors.toList())); | ||||
| 		} | ||||
| 		configurableModules.forEach(module -> this.modules.addEntry(new POptionEntry(module, this.modules))); | ||||
| 		this.addButton(new ButtonWidget(this.width / 2 - 75, this.height - 30, 150, 20, ScreenTexts.DONE, (buttonWidget) -> { | ||||
| 			ConfigManager.saveAllModules(); | ||||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.mixin; | ||||
| package pm.j4.kerosene.mixin; | ||||
| 
 | ||||
| import net.minecraft.client.gui.widget.EntryListWidget; | ||||
| import org.spongepowered.asm.mixin.Mixin; | ||||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.mixin; | ||||
| package pm.j4.kerosene.mixin; | ||||
| 
 | ||||
| import net.minecraft.client.gui.screen.Screen; | ||||
| import net.minecraft.client.gui.screen.options.OptionsScreen; | ||||
|  | @ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.Mixin; | |||
| import org.spongepowered.asm.mixin.injection.At; | ||||
| import org.spongepowered.asm.mixin.injection.Inject; | ||||
| import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||||
| import pm.j4.petroleum.gui.POptionsScreen; | ||||
| import pm.j4.kerosene.gui.POptionsScreen; | ||||
| 
 | ||||
| /** | ||||
|  * The type Options menu mixin. | ||||
|  | @ -34,7 +34,7 @@ public class OptionsMenuMixin extends Screen { | |||
| 	@Inject(at = @At(value = "TAIL"), | ||||
| 			method = "init()V") | ||||
| 	protected void init(CallbackInfo ci) { | ||||
| 		this.addButton(new ButtonWidget(this.width / 2 - 75, this.height / 6 + 140, 150, 20, new TranslatableText("petroleum.options"), (buttonWidget) -> { | ||||
| 		this.addButton(new ButtonWidget(this.width / 2 - 75, this.height / 6 + 140, 150, 20, new TranslatableText("kerosene.options"), (buttonWidget) -> { | ||||
| 			assert this.client != null; | ||||
| 			this.client.openScreen(new POptionsScreen(this)); | ||||
| 		})); | ||||
							
								
								
									
										38
									
								
								src/main/java/pm/j4/kerosene/modules/ExampleModule.java
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								src/main/java/pm/j4/kerosene/modules/ExampleModule.java
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,38 @@ | |||
| package pm.j4.kerosene.modules; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import net.minecraft.client.MinecraftClient; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.util.module.option.BooleanOption; | ||||
| import pm.j4.kerosene.util.module.option.ConfigurationOption; | ||||
| 
 | ||||
| /** | ||||
|  * The type Example module. | ||||
|  */ | ||||
| public class ExampleModule extends ModuleBase { | ||||
| 	/** | ||||
| 	 * example mod | ||||
| 	 */ | ||||
| 	public ExampleModule() { | ||||
| 		super("kerosene", | ||||
| 				"kerosene.example", | ||||
| 				"kerosene.misc", | ||||
| 				true, | ||||
| 				false, | ||||
| 				true); | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public List<ConfigurationOption> getDefaultConfig() { | ||||
| 		List<ConfigurationOption> options = new ArrayList<>(); | ||||
| 		options.add(new BooleanOption("kerosene.example.b_one","example", this)); | ||||
| 		options.add(new BooleanOption("kerosene.example.b_two","example", this)); | ||||
| 		return options; | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public void activate(MinecraftClient client) { | ||||
| 		System.out.println("Example Mod Keybind Activate"); | ||||
| 	} | ||||
| } | ||||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.modules.bindings; | ||||
| package pm.j4.kerosene.modules.bindings; | ||||
| 
 | ||||
| import net.minecraft.client.util.InputUtil; | ||||
| 
 | ||||
|  | @ -1,20 +1,18 @@ | |||
| package pm.j4.petroleum.modules.bindings; | ||||
| package pm.j4.kerosene.modules.bindings; | ||||
| 
 | ||||
| import java.util.*; | ||||
| import net.minecraft.client.MinecraftClient; | ||||
| import net.minecraft.client.options.KeyBinding; | ||||
| import net.minecraft.client.util.InputUtil; | ||||
| import net.minecraft.client.util.math.MatrixStack; | ||||
| import net.minecraft.text.TranslatableText; | ||||
| import org.lwjgl.glfw.GLFW; | ||||
| import pm.j4.petroleum.PetroleumMod; | ||||
| import pm.j4.petroleum.gui.PModuleConfigEntry; | ||||
| import pm.j4.petroleum.gui.PModuleConfigPane; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.config.GlobalConfig; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.petroleum.util.module.option.ConfigurationOption; | ||||
| import pm.j4.petroleum.util.module.option.KeybindOption; | ||||
| import pm.j4.kerosene.KeroseneMod; | ||||
| import pm.j4.kerosene.gui.PModuleConfigEntry; | ||||
| import pm.j4.kerosene.gui.PModuleConfigPane; | ||||
| import pm.j4.kerosene.util.config.ConfigHolder; | ||||
| import pm.j4.kerosene.util.config.ConfigManager; | ||||
| import pm.j4.kerosene.util.config.GlobalConfig; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.util.module.option.KeybindOption; | ||||
| 
 | ||||
| /** | ||||
|  * The type Binding manager. | ||||
|  | @ -25,8 +23,9 @@ public class BindingManager extends ModuleBase { | |||
| 	 * Parameters should be constant across restarts. | ||||
| 	 */ | ||||
| 	public BindingManager() { | ||||
| 		super("petroleum.bindings", | ||||
| 				"petroleum.misc", | ||||
| 		super("kerosene", | ||||
| 				"kerosene.bindings", | ||||
| 				"kerosene.misc", | ||||
| 				false, | ||||
| 				true, | ||||
| 				true); | ||||
|  | @ -47,8 +46,9 @@ public class BindingManager extends ModuleBase { | |||
| 		List<PModuleConfigEntry> entries = new ArrayList<>(); | ||||
| 
 | ||||
| 		Map<KeybindOption, ModuleBase> mapped = new HashMap<>(); | ||||
| 		if (ConfigManager.getConfig().isPresent()) { | ||||
| 			Map<KeyBinding, ModuleBase> binds = ConfigManager.getConfig().get().globalConfig.bindings; | ||||
| 		Optional<ConfigHolder> config = ConfigManager.getConfig(this.getParent()); | ||||
| 		if (config.isPresent()) { | ||||
| 			Map<KeyBinding, ModuleBase> binds = config.get().globalConfig.bindings; | ||||
| 
 | ||||
| 			binds.forEach((key, func) -> { | ||||
| 				KeybindOption option = new KeybindOption(func.getModuleName() + " " + func.getCategory(), func.getModuleName() + " " + func.getCategory(), func); | ||||
|  | @ -67,11 +67,12 @@ public class BindingManager extends ModuleBase { | |||
| 	 * Register bindings. | ||||
| 	 */ | ||||
| 	private void registerBindings() { | ||||
| 		if (!ConfigManager.getConfig().isPresent()) { | ||||
| 		Optional<ConfigHolder> config = ConfigManager.getConfig(this.getParent()); | ||||
| 		if (!config.isPresent()) { | ||||
| 			return; | ||||
| 		} | ||||
| 		GlobalConfig c = ConfigManager.getConfig().get().globalConfig; | ||||
| 		Optional<ModuleBase> mod = PetroleumMod.getMod("petroleum.modmenu"); | ||||
| 		GlobalConfig c = config.get().globalConfig; | ||||
| 		Optional<ModuleBase> mod = KeroseneMod.getMod("petroleum.modmenu"); | ||||
| 		if (mod.isPresent() && !c.isBound(mod.get())) { | ||||
| 			//TODO | ||||
| 			// the only explicit keybinding (for now.) | ||||
|  | @ -83,7 +84,7 @@ public class BindingManager extends ModuleBase { | |||
| 					GLFW.GLFW_KEY_RIGHT_CONTROL, | ||||
| 					"category.petroleum" | ||||
| 			); | ||||
| 			ConfigManager.getConfig().get().globalConfig.setBinding(binding, mod.get()); | ||||
| 			config.get().globalConfig.setBinding(binding, mod.get()); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | @ -1,9 +1,9 @@ | |||
| package pm.j4.petroleum.util.config; | ||||
| package pm.j4.kerosene.util.config; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import pm.j4.petroleum.PetroleumMod; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.KeroseneMod; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Config. | ||||
|  | @ -31,8 +31,8 @@ public abstract class Config { | |||
| 	 * @param mod the mod | ||||
| 	 */ | ||||
| 	public void disableModule(String mod) { | ||||
| 		if (isEnabled(mod) && PetroleumMod.isActive(mod) && PetroleumMod.getMod(mod).isPresent()) { | ||||
| 			ModuleBase moduleInfo = PetroleumMod.getMod(mod).get(); | ||||
| 		if (isEnabled(mod) && KeroseneMod.isActive(mod) && KeroseneMod.getMod(mod).isPresent()) { | ||||
| 			ModuleBase moduleInfo = KeroseneMod.getMod(mod).get(); | ||||
| 			if (moduleInfo.isActivatable()) { | ||||
| 				enabledModules.remove(mod); | ||||
| 			} | ||||
|  | @ -45,8 +45,8 @@ public abstract class Config { | |||
| 	 * @param mod the mod | ||||
| 	 */ | ||||
| 	public void toggleModule(String mod) { | ||||
| 		if (PetroleumMod.isActive(mod) && PetroleumMod.getMod(mod).isPresent()) { | ||||
| 			ModuleBase moduleInfo = PetroleumMod.getMod(mod).get(); | ||||
| 		if (KeroseneMod.isActive(mod) && KeroseneMod.getMod(mod).isPresent()) { | ||||
| 			ModuleBase moduleInfo = KeroseneMod.getMod(mod).get(); | ||||
| 			if (moduleInfo.isActivatable()) { | ||||
| 				if (isEnabled(mod)) { | ||||
| 					enabledModules.remove(mod); | ||||
|  | @ -1,10 +1,10 @@ | |||
| package pm.j4.petroleum.util.config; | ||||
| package pm.j4.kerosene.util.config; | ||||
| 
 | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.stream.Collectors; | ||||
| import pm.j4.petroleum.PetroleumMod; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.KeroseneMod; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Config holder. | ||||
|  | @ -27,7 +27,7 @@ public class ConfigHolder { | |||
| 	 */ | ||||
| 	public boolean isModuleEnabled(String module) { | ||||
| 
 | ||||
| 		if (!PetroleumMod.isActive(module)) { | ||||
| 		if (!KeroseneMod.isActive(module)) { | ||||
| 			return false; | ||||
| 		} | ||||
| 		if (globalConfig.isEnabled(module)) { | ||||
|  | @ -46,7 +46,7 @@ public class ConfigHolder { | |||
| 	 * @return the enabled modules | ||||
| 	 */ | ||||
| 	public List<ModuleBase> getEnabledModules() { | ||||
| 		List<ModuleBase> modules = PetroleumMod.getActiveMods(); | ||||
| 		List<ModuleBase> modules = KeroseneMod.getRegisteredMods(); | ||||
| 		return modules.stream().filter(module -> | ||||
| 				isModuleEnabled(module.getModuleName()) | ||||
| 		).collect(Collectors.toList()); | ||||
|  | @ -58,7 +58,7 @@ public class ConfigHolder { | |||
| 	 * @return the server | ||||
| 	 */ | ||||
| 	public String getServer() { | ||||
| 		return PetroleumMod.getServerAddress(); | ||||
| 		return KeroseneMod.getServerAddress(); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.util.config; | ||||
| package pm.j4.kerosene.util.config; | ||||
| 
 | ||||
| import com.google.common.reflect.TypeToken; | ||||
| import com.google.gson.*; | ||||
|  | @ -6,13 +6,11 @@ import java.io.*; | |||
| import java.lang.reflect.Type; | ||||
| import java.util.*; | ||||
| import net.fabricmc.loader.api.FabricLoader; | ||||
| import pm.j4.petroleum.PetroleumMod; | ||||
| import pm.j4.petroleum.modules.bindings.BindingInfo; | ||||
| import pm.j4.petroleum.modules.menu.ModMenu; | ||||
| import pm.j4.petroleum.util.data.ButtonInformation; | ||||
| import pm.j4.petroleum.util.data.ModuleConfig; | ||||
| import pm.j4.petroleum.util.data.OptionSerializiable; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.KeroseneMod; | ||||
| import pm.j4.kerosene.modules.bindings.BindingInfo; | ||||
| import pm.j4.kerosene.util.data.ModuleConfig; | ||||
| import pm.j4.kerosene.util.data.OptionSerializiable; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Config manager. | ||||
|  | @ -28,7 +26,7 @@ public class ConfigManager { | |||
| 	/** | ||||
| 	 * The constant config. | ||||
| 	 */ | ||||
| 	private static ConfigHolder config; | ||||
| 	private static Map<String, ConfigHolder> configs = new HashMap<>(); | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Prepare config file. | ||||
|  | @ -48,25 +46,25 @@ public class ConfigManager { | |||
| 	/** | ||||
| 	 * Init config. | ||||
| 	 */ | ||||
| 	public static void initConfig() { | ||||
| 		if (config != null) { | ||||
| 	public static void initConfig(String moduleName) { | ||||
| 		if (configs.containsKey(moduleName)) { | ||||
| 			return; | ||||
| 		} | ||||
| 
 | ||||
| 		config = new ConfigHolder(); | ||||
| 		ConfigHolder config = new ConfigHolder(); | ||||
| 		config.globalConfig = new DefaultConfig(); | ||||
| 		config.serverConfigs = new HashMap<>(); | ||||
| 
 | ||||
| 		config = load("petroleum/", "petroleum.json", ConfigHolder.class); | ||||
| 		initModules(); | ||||
| 		config = load(moduleName + "/", moduleName +".json", ConfigHolder.class); | ||||
| 		initModules(moduleName); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Init modules. | ||||
| 	 */ | ||||
| 	public static void initModules() { | ||||
| 		PetroleumMod.getActiveMods().forEach(module -> { | ||||
| 			ModuleConfig options = load("petroleum/modules/", module.getModuleName() + ".json", ModuleConfig.class); | ||||
| 	public static void initModules(String moduleName) { | ||||
| 		KeroseneMod.getRegisteredMods().forEach(module -> { | ||||
| 			ModuleConfig options = load(moduleName + "/modules/", module.getModuleName() + ".json", ModuleConfig.class); | ||||
| 			if (options != null && options.options != null) { | ||||
| 				options.options.forEach((key, option) -> { | ||||
| 					if (module.hasOption(option.key)) { | ||||
|  | @ -150,25 +148,29 @@ public class ConfigManager { | |||
| 	 * | ||||
| 	 * @param b the b | ||||
| 	 */ | ||||
| 	public static void saveModule(ModuleBase b) { | ||||
| 	public static void saveModule(String modName, ModuleBase b) { | ||||
| 		ModuleConfig c = new ModuleConfig(); | ||||
| 		c.options = GlobalConfig.serializeModuleConfiguration(b); | ||||
| 		save("petroleum/modules/", b.getModuleName() + ".json", c); | ||||
| 		save(modName + "/modules/", b.getModuleName() + ".json", c); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Save all modules. | ||||
| 	 */ | ||||
| 	public static void saveAllModules() { | ||||
| 		List<ModuleBase> mods = PetroleumMod.getActiveMods(); | ||||
| 		mods.forEach(ConfigManager::saveModule); | ||||
| 		List<ModuleBase> mods = KeroseneMod.getRegisteredMods(); | ||||
| 		mods.forEach((module) -> { | ||||
| 			ConfigManager.saveModule(module.getParent(), module); | ||||
| 		}); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Save global config. | ||||
| 	 */ | ||||
| 	public static void saveGlobalConfig() { | ||||
| 		save("petroleum/", "petroleum.json", config); | ||||
| 	public static void saveGlobalConfig(String modName) { | ||||
| 		if(configs.containsKey(modName)) { | ||||
| 			save(modName + "/", modName + ".json", configs.get(modName)); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
|  | @ -176,11 +178,11 @@ public class ConfigManager { | |||
| 	 * | ||||
| 	 * @return the config | ||||
| 	 */ | ||||
| 	public static Optional<ConfigHolder> getConfig() { | ||||
| 		if (config == null) { | ||||
| 			return Optional.empty(); | ||||
| 	public static Optional<ConfigHolder> getConfig(String modName) { | ||||
| 		if (configs.containsKey(modName)) { | ||||
| 			return Optional.of(configs.get(modName)); | ||||
| 		} | ||||
| 		return Optional.of(config); | ||||
| 		return Optional.empty(); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | @ -201,12 +203,6 @@ class SerializationHelper { | |||
| 		JsonArray modules = ctx.serialize(src.enabledModules).getAsJsonArray(); | ||||
| 		jsonConfig.add("enabled_modules", modules); | ||||
| 
 | ||||
| 		JsonObject tabCoordinates = new JsonObject(); | ||||
| 		ModMenu.getButtons().forEach((category, coordinates) -> { | ||||
| 			tabCoordinates.add(category, ctx.serialize(coordinates)); | ||||
| 		}); | ||||
| 		jsonConfig.add("button_coordinates", tabCoordinates); | ||||
| 
 | ||||
| 		return jsonConfig; | ||||
| 	}; | ||||
| 
 | ||||
|  | @ -233,14 +229,7 @@ class SerializationHelper { | |||
| 		} else { | ||||
| 			options = new HashMap<>(); | ||||
| 		} | ||||
| 		if (obj.has("button_coordinates")) { | ||||
| 			obj.get("button_coordinates").getAsJsonObject().entrySet().forEach( | ||||
| 					value -> { | ||||
| 						cfg.setButton(value.getKey(), ctx.deserialize(value.getValue(), ButtonInformation.class)); | ||||
| 					} | ||||
| 			); | ||||
| 		} | ||||
| 		PetroleumMod.getActiveMods().forEach(module -> { | ||||
| 		KeroseneMod.getRegisteredMods().forEach(module -> { | ||||
| 			if (options.containsKey(module.getModuleName())) { | ||||
| 				cfg.deserializeModuleConfiguration(options.get(module.getModuleName()), module); | ||||
| 			} | ||||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.util.config; | ||||
| package pm.j4.kerosene.util.config; | ||||
| 
 | ||||
| import java.util.Collections; | ||||
| 
 | ||||
|  | @ -1,16 +1,15 @@ | |||
| package pm.j4.petroleum.util.config; | ||||
| package pm.j4.kerosene.util.config; | ||||
| 
 | ||||
| import java.util.*; | ||||
| import java.util.concurrent.atomic.AtomicBoolean; | ||||
| import java.util.concurrent.atomic.AtomicReference; | ||||
| import net.minecraft.client.options.KeyBinding; | ||||
| import net.minecraft.client.util.InputUtil; | ||||
| import pm.j4.petroleum.PetroleumMod; | ||||
| import pm.j4.petroleum.modules.bindings.BindingInfo; | ||||
| import pm.j4.petroleum.util.data.ButtonInformation; | ||||
| import pm.j4.petroleum.util.data.OptionSerializiable; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.petroleum.util.module.option.ConfigurationOption; | ||||
| import pm.j4.kerosene.KeroseneMod; | ||||
| import pm.j4.kerosene.modules.bindings.BindingInfo; | ||||
| import pm.j4.kerosene.util.data.OptionSerializiable; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.util.module.option.ConfigurationOption; | ||||
| 
 | ||||
| /** | ||||
|  * The type Global config. | ||||
|  | @ -48,7 +47,7 @@ public class GlobalConfig extends Config { | |||
| 		if (bindings.containsValue(func)) { | ||||
| 			bindings.forEach((key, binding) -> { | ||||
| 				if (binding.equals(func)) { | ||||
| 					PetroleumMod.removeBind(key); | ||||
| 					KeroseneMod.removeBind(key); | ||||
| 					match.set(key); | ||||
| 				} | ||||
| 			}); | ||||
|  | @ -58,8 +57,8 @@ public class GlobalConfig extends Config { | |||
| 			bindings.remove(match.get()); | ||||
| 		} | ||||
| 
 | ||||
| 		if (PetroleumMod.isActive(func.getModuleName())) { | ||||
| 			PetroleumMod.addBind(bind); | ||||
| 		if (KeroseneMod.isActive(func.getModuleName())) { | ||||
| 			KeroseneMod.addBind(bind); | ||||
| 			bindings.put(bind, func); | ||||
| 		} | ||||
| 	} | ||||
|  | @ -70,7 +69,7 @@ public class GlobalConfig extends Config { | |||
| 	 * @param info the info | ||||
| 	 */ | ||||
| 	private void convertBinding(BindingInfo info) { | ||||
| 		Optional<ModuleBase> match = PetroleumMod.getMod(info.attachedModuleName); | ||||
| 		Optional<ModuleBase> match = KeroseneMod.getMod(info.attachedModuleName); | ||||
| 		match.ifPresent(moduleBase -> setBinding(reconstructBinding(info), | ||||
| 				moduleBase)); | ||||
| 	} | ||||
|  | @ -158,38 +157,5 @@ public class GlobalConfig extends Config { | |||
| 			} | ||||
| 		}); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * The Button locations. | ||||
| 	 */ | ||||
| 	private final Map<String, ButtonInformation> buttonLocations = new HashMap<>(); | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Sets button. | ||||
| 	 * | ||||
| 	 * @param category          the category | ||||
| 	 * @param buttonInformation the button information | ||||
| 	 */ | ||||
| 	public void setButton(String category, ButtonInformation buttonInformation) { | ||||
| 		if (buttonLocations.containsKey(category)) { | ||||
| 			buttonLocations.replace(category, buttonInformation); | ||||
| 		} else { | ||||
| 			buttonLocations.put(category, buttonInformation); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Gets button. | ||||
| 	 * | ||||
| 	 * @param category the category | ||||
| 	 * @return the button | ||||
| 	 */ | ||||
| 	public ButtonInformation getButton(String category) { | ||||
| 		if (buttonLocations.containsKey(category)) { | ||||
| 			return buttonLocations.get(category); | ||||
| 		} | ||||
| 		System.out.println("Could not find button of category " + category); | ||||
| 		return null; | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.util.config; | ||||
| package pm.j4.kerosene.util.config; | ||||
| 
 | ||||
| /** | ||||
|  * The type Server config. | ||||
|  | @ -1,11 +1,11 @@ | |||
| package pm.j4.petroleum.util.data; | ||||
| package pm.j4.kerosene.util.data; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import pm.j4.petroleum.PetroleumMod; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.KeroseneMod; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Category. | ||||
|  | @ -17,7 +17,7 @@ public class Category { | |||
| 	 * @return the category map | ||||
| 	 */ | ||||
| 	public static Map<String, List<ModuleBase>> getCategoryMap() { | ||||
| 		List<ModuleBase> modules = PetroleumMod.getActiveMods(); | ||||
| 		List<ModuleBase> modules = KeroseneMod.getRegisteredMods(); | ||||
| 		Map<String, List<ModuleBase>> categoryMap = new HashMap<>(); | ||||
| 		modules.forEach(module -> { | ||||
| 			if (!categoryMap.containsKey(module.getCategory())) { | ||||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.util.data; | ||||
| package pm.j4.kerosene.util.data; | ||||
| 
 | ||||
| import java.util.Map; | ||||
| 
 | ||||
|  | @ -1,4 +1,4 @@ | |||
| package pm.j4.petroleum.util.data; | ||||
| package pm.j4.kerosene.util.data; | ||||
| 
 | ||||
| import com.google.gson.JsonElement; | ||||
| 
 | ||||
|  | @ -1,14 +1,14 @@ | |||
| package pm.j4.petroleum.util.module; | ||||
| package pm.j4.kerosene.util.module; | ||||
| 
 | ||||
| import com.google.gson.JsonElement; | ||||
| import java.util.*; | ||||
| import net.minecraft.client.MinecraftClient; | ||||
| import net.minecraft.text.TranslatableText; | ||||
| import pm.j4.petroleum.gui.PModuleConfigEntry; | ||||
| import pm.j4.petroleum.gui.PModuleConfigPane; | ||||
| import pm.j4.petroleum.util.config.ConfigHolder; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.module.option.ConfigurationOption; | ||||
| import pm.j4.kerosene.gui.PModuleConfigEntry; | ||||
| import pm.j4.kerosene.gui.PModuleConfigPane; | ||||
| import pm.j4.kerosene.util.config.ConfigHolder; | ||||
| import pm.j4.kerosene.util.config.ConfigManager; | ||||
| import pm.j4.kerosene.util.module.option.ConfigurationOption; | ||||
| 
 | ||||
| /** | ||||
|  * The Basis for all mods, used so that modules all have a common activation point and settings. | ||||
|  | @ -25,7 +25,8 @@ public abstract class ModuleBase { | |||
| 	 * @param hidden        Whether the module will show up in @link pm.j4.petroleum.modules.menu.ModMenu or the active module list | ||||
| 	 * @param hasConfigMenu whether a button in the configuration menu will show | ||||
| 	 */ | ||||
| 	public ModuleBase(String name, String category, boolean activatable, boolean hidden, boolean hasConfigMenu) { | ||||
| 	public ModuleBase(String parent, String name, String category, boolean activatable, boolean hidden, boolean hasConfigMenu) { | ||||
| 		this.parent = parent; | ||||
| 		this.moduleName = name; | ||||
| 		this.category = category; | ||||
| 		this.readableName = new TranslatableText(name); | ||||
|  | @ -55,10 +56,15 @@ public abstract class ModuleBase { | |||
| 	 * Toggle mod. | ||||
| 	 */ | ||||
| 	public void toggle() { | ||||
| 		Optional<ConfigHolder> config = ConfigManager.getConfig(); | ||||
| 		Optional<ConfigHolder> config = ConfigManager.getConfig(this.getParent()); | ||||
| 		config.ifPresent(configHolder -> configHolder.toggleModule(this.moduleName)); | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	private final String parent; | ||||
| 	public String getParent() { | ||||
| 		return this.parent; | ||||
| 	} | ||||
| 	/** | ||||
| 	 * The Module's name. | ||||
| 	 */ | ||||
|  | @ -1,8 +1,8 @@ | |||
| package pm.j4.petroleum.util.module.option; | ||||
| package pm.j4.kerosene.util.module.option; | ||||
| 
 | ||||
| import com.google.gson.JsonElement; | ||||
| import com.google.gson.JsonPrimitive; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Boolean value. | ||||
|  | @ -1,7 +1,7 @@ | |||
| package pm.j4.petroleum.util.module.option; | ||||
| package pm.j4.kerosene.util.module.option; | ||||
| 
 | ||||
| import com.google.gson.JsonElement; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Configuration option. | ||||
|  | @ -1,8 +1,8 @@ | |||
| package pm.j4.petroleum.util.module.option; | ||||
| package pm.j4.kerosene.util.module.option; | ||||
| 
 | ||||
| import com.google.gson.JsonElement; | ||||
| import com.google.gson.JsonPrimitive; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Integer value. | ||||
|  | @ -1,11 +1,11 @@ | |||
| package pm.j4.petroleum.util.module.option; | ||||
| package pm.j4.kerosene.util.module.option; | ||||
| 
 | ||||
| import com.google.gson.JsonElement; | ||||
| import net.minecraft.client.options.KeyBinding; | ||||
| import pm.j4.petroleum.modules.bindings.BindingInfo; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.config.GlobalConfig; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.modules.bindings.BindingInfo; | ||||
| import pm.j4.kerosene.util.config.ConfigManager; | ||||
| import pm.j4.kerosene.util.config.GlobalConfig; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Keybind value. | ||||
|  | @ -1,7 +1,7 @@ | |||
| package pm.j4.petroleum.util.module.option; | ||||
| package pm.j4.kerosene.util.module.option; | ||||
| 
 | ||||
| import com.google.gson.JsonElement; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type List option. | ||||
|  | @ -1,8 +1,8 @@ | |||
| package pm.j4.petroleum.util.module.option; | ||||
| package pm.j4.kerosene.util.module.option; | ||||
| 
 | ||||
| import com.google.gson.JsonElement; | ||||
| import com.google.gson.JsonPrimitive; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.kerosene.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type String value. | ||||
|  | @ -1,69 +0,0 @@ | |||
| package pm.j4.petroleum.gui; | ||||
| 
 | ||||
| import com.mojang.blaze3d.systems.RenderSystem; | ||||
| import java.util.Map; | ||||
| import net.minecraft.client.gui.screen.Screen; | ||||
| import net.minecraft.client.render.BufferBuilder; | ||||
| import net.minecraft.client.render.Tessellator; | ||||
| import net.minecraft.client.render.VertexFormats; | ||||
| import net.minecraft.client.util.math.MatrixStack; | ||||
| import net.minecraft.text.TranslatableText; | ||||
| import pm.j4.petroleum.modules.menu.ModMenu; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.data.ButtonInformation; | ||||
| import pm.j4.petroleum.util.data.Category; | ||||
| 
 | ||||
| /** | ||||
|  * The type P mod menu screen. | ||||
|  */ | ||||
| public class PModMenuScreen extends Screen { | ||||
| 	/** | ||||
| 	 * Instantiates a new P mod menu screen. | ||||
| 	 */ | ||||
| 	public PModMenuScreen() { | ||||
| 		super(new TranslatableText("petroleum.modmenu")); | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { | ||||
| 		this.renderBackground(matrices); | ||||
| 		super.render(matrices, mouseX, mouseY, delta); | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	protected void init() { | ||||
| 		Map<String, ButtonInformation> coordinateMap = ModMenu.getButtons(); | ||||
| 		coordinateMap.forEach((category, coord) -> { | ||||
| 			this.addButton(new PMovableButton((int) (coord.x * this.width), | ||||
| 					(int) (coord.y * this.height), | ||||
| 					category, | ||||
| 					Category.getByCategory(category), | ||||
| 					coord.open, | ||||
| 					this)); | ||||
| 		}); | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public void onClose() { | ||||
| 		if (ConfigManager.getConfig().isPresent()) { | ||||
| 			ConfigManager.getConfig().get().disableModule("petroleum.modmenu"); | ||||
| 			this.buttons.forEach(button -> ((PMovableButton) button).updateCoordinate()); | ||||
| 			ConfigManager.saveGlobalConfig(); | ||||
| 		} | ||||
| 		super.onClose(); | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public void renderBackground(MatrixStack matrices) { | ||||
| 		Tessellator t_1 = Tessellator.getInstance(); | ||||
| 		BufferBuilder buffer = t_1.getBuffer(); | ||||
| 		RenderSystem.enableBlend(); | ||||
| 		buffer.begin(7, VertexFormats.POSITION_COLOR); | ||||
| 		buffer.vertex(0, this.height, 0.0D).color(0.1F, 0.1F, 0.1F, 0.3F).next(); | ||||
| 		buffer.vertex(this.width, this.height, 0.0D).color(0.1F, 0.1F, 0.1F, 0.3F).next(); | ||||
| 		buffer.vertex(this.width, 0, 0.0D).color(0.1F, 0.1F, 0.1F, 0.3F).next(); | ||||
| 		buffer.vertex(0, 0, 0.0D).color(0.1F, 0.1F, 0.1F, 0.3F).next(); | ||||
| 		t_1.draw(); | ||||
| 		RenderSystem.disableBlend(); | ||||
| 	} | ||||
| } | ||||
|  | @ -1,388 +0,0 @@ | |||
| package pm.j4.petroleum.gui; | ||||
| 
 | ||||
| import com.mojang.blaze3d.systems.RenderSystem; | ||||
| import java.util.List; | ||||
| import net.minecraft.client.MinecraftClient; | ||||
| import net.minecraft.client.font.TextRenderer; | ||||
| import net.minecraft.client.gui.widget.AbstractButtonWidget; | ||||
| import net.minecraft.client.render.BufferBuilder; | ||||
| import net.minecraft.client.render.Tessellator; | ||||
| import net.minecraft.client.render.VertexFormats; | ||||
| import net.minecraft.client.util.math.MatrixStack; | ||||
| import net.minecraft.text.LiteralText; | ||||
| import net.minecraft.text.TranslatableText; | ||||
| import net.minecraft.util.math.MathHelper; | ||||
| import net.minecraft.util.math.Matrix4f; | ||||
| import pm.j4.petroleum.modules.menu.ModMenu; | ||||
| import pm.j4.petroleum.util.data.ButtonInformation; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type P movable button. | ||||
|  */ | ||||
| public class PMovableButton extends AbstractButtonWidget { | ||||
| 	/** | ||||
| 	 * The Expanded. | ||||
| 	 */ | ||||
| 	private boolean expanded; | ||||
| 	/** | ||||
| 	 * The Collapsed width. | ||||
| 	 */ | ||||
| 	private final int collapsedWidth; | ||||
| 	/** | ||||
| 	 * The Expanded width. | ||||
| 	 */ | ||||
| 	private int expandedWidth; | ||||
| 	/** | ||||
| 	 * The Collapsed height. | ||||
| 	 */ | ||||
| 	private final int collapsedHeight; | ||||
| 	/** | ||||
| 	 * The Expanded height. | ||||
| 	 */ | ||||
| 	private int expandedHeight; | ||||
| 	/** | ||||
| 	 * The Module height. | ||||
| 	 */ | ||||
| 	private final int moduleHeight; | ||||
| 	/** | ||||
| 	 * The Modules. | ||||
| 	 */ | ||||
| 	private final List<ModuleBase> modules; | ||||
| 
 | ||||
| 	/** | ||||
| 	 * The Stored x. | ||||
| 	 */ | ||||
| 	private int storedX; | ||||
| 	/** | ||||
| 	 * The Stored y. | ||||
| 	 */ | ||||
| 	private int storedY; | ||||
| 
 | ||||
| 	/** | ||||
| 	 * The Spin. | ||||
| 	 */ | ||||
| 	private double spin; | ||||
| 
 | ||||
| 	/** | ||||
| 	 * The Arrow size. | ||||
| 	 */ | ||||
| 	private final int arrowSize = 10; | ||||
| 
 | ||||
| 
 | ||||
| 	/** | ||||
| 	 * The Category. | ||||
| 	 */ | ||||
| 	private final String category; | ||||
| 
 | ||||
| 	/** | ||||
| 	 * The Parent. | ||||
| 	 */ | ||||
| 	private final PModMenuScreen parent; | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Instantiates a new P movable button. | ||||
| 	 * | ||||
| 	 * @param x            the x | ||||
| 	 * @param y            the y | ||||
| 	 * @param categoryName the category name | ||||
| 	 * @param modules      the modules | ||||
| 	 * @param open         the open | ||||
| 	 * @param parent       the parent | ||||
| 	 */ | ||||
| 	public PMovableButton(int x, int y, String categoryName, List<ModuleBase> modules, boolean open, PModMenuScreen parent) { | ||||
| 		super(x, y, 0, 0, new TranslatableText(categoryName)); | ||||
| 		this.category = categoryName; | ||||
| 		int w = MinecraftClient.getInstance().textRenderer.getWidth(new TranslatableText(categoryName)) + 8; | ||||
| 		int h = MinecraftClient.getInstance().textRenderer.fontHeight + 8; | ||||
| 		this.width = w; | ||||
| 		this.collapsedWidth = w; | ||||
| 		this.expandedWidth = 0; | ||||
| 		this.height = h; | ||||
| 		this.collapsedHeight = h; | ||||
| 		this.expandedHeight = 0; | ||||
| 		this.moduleHeight = h; | ||||
| 		this.expanded = open; | ||||
| 		this.modules = modules; | ||||
| 		this.parent = parent; | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public void onClick(double mouseX, double mouseY) { | ||||
| 		this.storedX = (int) mouseX; | ||||
| 		this.storedY = (int) mouseY; | ||||
| 		super.onClick(mouseX, mouseY); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * On extra click. | ||||
| 	 * | ||||
| 	 * @param mouseX the mouse x | ||||
| 	 * @param mouseY the mouse y | ||||
| 	 */ | ||||
| 	private void onExtraClick(double mouseX, double mouseY) { | ||||
| 		System.out.println("extra click"); | ||||
| 		int increment = this.moduleHeight + 4; | ||||
| 		int location = (int)mouseY - (this.y + this.collapsedHeight); | ||||
| 		int index = location / increment; | ||||
| 		System.out.println("index: " + index); | ||||
| 		if(modules.size() >= index) { | ||||
| 			ModuleBase affectedModule = modules.get(index); | ||||
| 			System.out.println("module: " + affectedModule); | ||||
| 			if(affectedModule.isActivatable()) { | ||||
| 				System.out.println("toggling"); | ||||
| 				affectedModule.toggle(); | ||||
| 			} | ||||
| 		} | ||||
| 		else { | ||||
| 			System.out.println("index too great"); | ||||
| 		} | ||||
| 		//TODO module things | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public void onRelease(double mouseX, double mouseY) { | ||||
| 		int mx = (int) mouseX; | ||||
| 		int my = (int) mouseY; | ||||
| 		/** | ||||
| 		 * The Padding. | ||||
| 		 */ | ||||
| 		int padding = 5; | ||||
| 		if (storedX + padding > mx && storedX - padding < mx && | ||||
| 				storedY + padding > my && storedY - padding < my) { | ||||
| 			this.expanded = !this.expanded; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	protected void onDrag(double mouseX, double mouseY, double deltaX, double deltaY) { | ||||
| 		this.x += (int) deltaX; | ||||
| 		this.y += (int) deltaY; | ||||
| 
 | ||||
| 		// i really hate to do it but nowhere else will it properly save | ||||
| 		this.updateCoordinate(); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Update coordinate. | ||||
| 	 */ | ||||
| 	public void updateCoordinate() { | ||||
| 		ModMenu.updateCoord(this.category, new ButtonInformation((this.x / (double) parent.width), (this.y / (double) parent.height), this.expanded)); | ||||
| 	} | ||||
| 
 | ||||
| 	// fuck click sounds | ||||
| 	@Override | ||||
| 	public boolean mouseClicked(double mouseX, double mouseY, int button) { | ||||
| 		if (this.active && this.visible) { | ||||
| 			if (this.isValidClickButton(button)) { | ||||
| 				boolean bl = this.clicked(mouseX, mouseY); | ||||
| 				if (bl && mouseY > this.y + this.collapsedHeight && mouseY < this.y + this.expandedHeight) { | ||||
| 					this.onExtraClick(mouseX, mouseY); | ||||
| 					return true; | ||||
| 				} else if (bl) { | ||||
| 					this.onClick(mouseX, mouseY); | ||||
| 					return true; | ||||
| 				} | ||||
| 			} | ||||
| 
 | ||||
| 		} | ||||
| 		return false; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Transition max width. | ||||
| 	 * | ||||
| 	 * @param width the width | ||||
| 	 */ | ||||
| 	private void transitionMaxWidth(int width) { | ||||
| 		double increment = ((width - this.width) / 20.0); | ||||
| 		int sign = (width > this.width) ? 1 : -1; | ||||
| 		if (increment == 0) { | ||||
| 			this.width = width; | ||||
| 		} else if (increment < 1 && increment > -1) { | ||||
| 			this.width += sign; | ||||
| 		} else { | ||||
| 			this.width += (int) increment; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Transition max height. | ||||
| 	 * | ||||
| 	 * @param height the height | ||||
| 	 */ | ||||
| 	private void transitionMaxHeight(int height) { | ||||
| 		double increment = ((height - this.height) / 20.0); | ||||
| 		int sign = (height > this.height) ? 1 : -1; | ||||
| 		if (increment == 0) { | ||||
| 			this.height = height; | ||||
| 		} else if (increment < 1 && increment > -1) { | ||||
| 			this.height += sign; | ||||
| 		} else { | ||||
| 			this.height += (int) increment; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) { | ||||
| 
 | ||||
| 		if (this.expandedWidth == 0 || this.expandedHeight == 0) { | ||||
| 			this.expandedHeight = this.collapsedHeight + ((this.moduleHeight + 4) * modules.size()); | ||||
| 			modules.forEach(module -> { | ||||
| 				this.expandedWidth = this.width; | ||||
| 				int w = MinecraftClient.getInstance().textRenderer.getWidth(module.getReadableName()) + arrowSize + 8; | ||||
| 				if (w > this.expandedWidth) { | ||||
| 					this.expandedWidth = w; | ||||
| 				} | ||||
| 			}); | ||||
| 			// this should only run when opening the screen for the first time | ||||
| 			if (this.expanded) { | ||||
| 				this.height = expandedHeight; | ||||
| 				this.width = expandedWidth; | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		MinecraftClient minecraftClient = MinecraftClient.getInstance(); | ||||
| 		TextRenderer textRenderer = minecraftClient.textRenderer; | ||||
| 		minecraftClient.getTextureManager().bindTexture(WIDGETS_LOCATION); | ||||
| 		RenderSystem.color4f(1.0F, 1.0F, 1.0F, this.alpha); | ||||
| 
 | ||||
| 		RenderSystem.disableTexture(); | ||||
| 		RenderSystem.defaultBlendFunc(); | ||||
| 		float brightness = this.isFocused() ? 1.0F : 0.5F; | ||||
| 		RenderSystem.color4f(brightness, brightness, brightness, 1.0F); | ||||
| 		Matrix4f matrix = matrices.peek().getModel(); | ||||
| 
 | ||||
| 		int buttonLeft = this.x; | ||||
| 		int buttonRight = this.x + width + 2; | ||||
| 		int buttonTop = this.y; | ||||
| 		int buttonBottom = this.y + this.collapsedHeight; | ||||
| 		int buttonExpandedBottom = this.y + this.height; | ||||
| 		Tessellator t_1 = Tessellator.getInstance(); | ||||
| 		BufferBuilder buffer = t_1.getBuffer(); | ||||
| 
 | ||||
| 		RenderSystem.color4f(0.5F, 0.5F, 0.5F, 0.5F); | ||||
| 		drawBox(t_1, buffer, matrix, buttonLeft, buttonRight, buttonTop - 2, buttonBottom + 2); | ||||
| 
 | ||||
| 		RenderSystem.color4f(0.0F, 0.0F, 0.0F, 0.3F); | ||||
| 		drawBox(t_1, buffer, matrix, buttonLeft + 1, buttonRight - 1, buttonTop - 1, buttonBottom + 1); | ||||
| 
 | ||||
| 		RenderSystem.color4f(1.0F, 1.0F, 1.0F, 0.9F); | ||||
| 		drawEquilateralTriangle(t_1, buffer, matrix, 40, 40, 180, arrowSize); | ||||
| 		drawEquilateralTriangle(t_1, buffer, matrix, 60, 60, 0, arrowSize); | ||||
| 		drawEquilateralTriangle(t_1, buffer, matrix, 40, 60, 90, arrowSize); | ||||
| 		drawEquilateralTriangle(t_1, buffer, matrix, 60, 40, 360, arrowSize); | ||||
| 		drawEquilateralTriangle(t_1, buffer, matrix, 80, 40, 270, arrowSize); | ||||
| 		drawEquilateralTriangle(t_1, buffer, matrix, 80, 60, 120, arrowSize); | ||||
| 
 | ||||
| 		int j = this.active ? 16777215 : 10526880; | ||||
| 		if (this.expanded) { | ||||
| 			if (this.width != this.expandedWidth || this.height != this.expandedHeight) { | ||||
| 				transitionMaxWidth(this.expandedWidth); | ||||
| 				transitionMaxHeight(this.expandedHeight); | ||||
| 				RenderSystem.color4f(0.5F, 0.5F, 0.5F, 0.5F); | ||||
| 				drawBox(t_1, buffer, matrix, buttonLeft, buttonRight, buttonBottom + 1, buttonExpandedBottom + 2); | ||||
| 
 | ||||
| 				RenderSystem.color4f(0.0F, 0.0F, 0.0F, 0.3F); | ||||
| 				drawBox(t_1, buffer, matrix, buttonLeft + 1, buttonRight - 1, buttonBottom + 2, buttonExpandedBottom + 1); | ||||
| 				if ((this.height - 8) / 2 > (this.collapsedHeight)) { | ||||
| 					drawCenteredText(matrices, textRenderer, new LiteralText("..."), this.x + this.width / 2, this.y + (this.height - 8) / 2, j | MathHelper.ceil(this.alpha * 255.0F) << 24); | ||||
| 				} | ||||
| 			} else { | ||||
| 				for (int i = 0; i < modules.size(); i++) { | ||||
| 					int adjustedIndex = i + 1; | ||||
| 					int previousBottom = buttonBottom + (i * (this.moduleHeight + 4)); | ||||
| 					int currentBottom = buttonBottom + ((i + 1) * (this.moduleHeight + 4)); | ||||
| 
 | ||||
| 					RenderSystem.defaultBlendFunc(); | ||||
| 					RenderSystem.color4f(0.5F, 0.5F, 0.5F, 0.5F); | ||||
| 					drawBox(t_1, buffer, matrix, buttonLeft, buttonRight, previousBottom + 1, currentBottom + 2); | ||||
| 
 | ||||
| 					RenderSystem.color4f(0.0F, 0.0F, 0.0F, 0.3F); | ||||
| 					drawBox(t_1, buffer, matrix, buttonLeft + 1, buttonRight - 1, previousBottom + 2, currentBottom + 1); | ||||
| 
 | ||||
| 					drawCenteredText(matrices, | ||||
| 							textRenderer, | ||||
| 							modules.get(i).getReadableName(), | ||||
| 							this.x + this.width / 2, | ||||
| 							this.y + ((this.collapsedHeight - 8) / 2 + ((moduleHeight + 4) * adjustedIndex)), | ||||
| 							j | MathHelper.ceil(this.alpha * 255.0F) << 24); | ||||
| 				} | ||||
| 			} | ||||
| 		} else { | ||||
| 			if (this.width != this.collapsedWidth || this.height != this.collapsedHeight) { | ||||
| 				transitionMaxWidth(this.collapsedWidth); | ||||
| 				transitionMaxHeight(this.collapsedHeight); | ||||
| 				RenderSystem.color4f(0.5F, 0.5F, 0.5F, 0.5F); | ||||
| 				drawBox(t_1, buffer, matrix, buttonLeft, buttonRight, buttonBottom + 1, buttonExpandedBottom + 2); | ||||
| 
 | ||||
| 				RenderSystem.color4f(0.0F, 0.0F, 0.0F, 0.3F); | ||||
| 				drawBox(t_1, buffer, matrix, buttonLeft + 1, buttonRight - 1, buttonBottom + 2, buttonExpandedBottom + 1); | ||||
| 				if ((this.height - 8) / 2 > (this.collapsedHeight)) { | ||||
| 					drawCenteredText(matrices, textRenderer, new LiteralText("..."), this.x + this.width / 2, this.y + (this.height - 8) / 2, j | MathHelper.ceil(this.alpha * 255.0F) << 24); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		RenderSystem.enableTexture(); | ||||
| 		drawCenteredText(matrices, textRenderer, this.getMessage(), this.x + this.width / 2, this.y + (this.collapsedHeight - 8) / 2, j | MathHelper.ceil(this.alpha * 255.0F) << 24); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Draw equilateral triangle. | ||||
| 	 * | ||||
| 	 * @param t_1      the t 1 | ||||
| 	 * @param buffer   the buffer | ||||
| 	 * @param matrix   the matrix | ||||
| 	 * @param centerX  the center x | ||||
| 	 * @param centerY  the center y | ||||
| 	 * @param rotation the rotation | ||||
| 	 * @param distance the distance | ||||
| 	 */ | ||||
| 	private void drawEquilateralTriangle(Tessellator t_1, BufferBuilder buffer, Matrix4f matrix, int centerX, int centerY, double rotation, int distance) { | ||||
| 		double rotation2 = rotation + 120; | ||||
| 		double rotation3 = rotation + 240; | ||||
| 		int point1X = (int)(distance * Math.cos(Math.toRadians(rotation))) + centerX; | ||||
| 		int point1Y = (int)(distance * Math.sin(Math.toRadians(rotation))) + centerY; | ||||
| 		int point2X = (int)(distance * Math.cos(Math.toRadians(rotation2))) + centerX; | ||||
| 		int point2Y = (int)(distance * Math.sin(Math.toRadians(rotation2))) + centerY; | ||||
| 		int point3X = (int)(distance * Math.cos(Math.toRadians(rotation3))) + centerX; | ||||
| 		int point3Y = (int)(distance * Math.sin(Math.toRadians(rotation3))) + centerY; | ||||
| 
 | ||||
| 		//RenderSystem.enableBlend(); | ||||
| 		RenderSystem.disableBlend(); | ||||
| 		buffer.begin(7, VertexFormats.POSITION_COLOR); | ||||
| 		buffer.vertex(matrix, centerX, centerY, 0.0F).color(0.0F, 1.0F, 1.0F, 1.0F).next(); | ||||
| 		buffer.vertex(matrix, centerX, point1Y, 0.0F).color(0.0F, 1.0F, 1.0F, 1.0F).next(); | ||||
| 		buffer.vertex(matrix, point1X, point1Y, 0.0F).color(0.0F, 1.0F, 1.0F, 1.0F).next(); | ||||
| 
 | ||||
| 		buffer.vertex(matrix, centerX, centerY, 0.0F).color(0.5F, 1.0F, 1.0F, 1.0F).next(); | ||||
| 		buffer.vertex(matrix, centerX, point2Y, 0.0F).color(0.5F, 1.0F, 1.0F, 1.0F).next(); | ||||
| 		buffer.vertex(matrix, point2X, point2Y, 0.0F).color(0.5F, 1.0F, 1.0F, 1.0F).next(); | ||||
| 
 | ||||
| 		buffer.vertex(matrix, centerX, centerY, 0.0F).color(1.0F, 0.0F, 1.0F, 1.0F).next(); | ||||
| 		buffer.vertex(matrix, centerX, point3Y, 0.0F).color(1.0F, 0.0F, 1.0F, 1.0F).next(); | ||||
| 		buffer.vertex(matrix, point3X, point3Y, 0.0F).color(1.0F, 0.0F, 1.0F, 1.0F).next(); | ||||
| 		t_1.draw(); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Draw box. | ||||
| 	 * | ||||
| 	 * @param t_1          the t 1 | ||||
| 	 * @param buffer       the buffer | ||||
| 	 * @param matrix       the matrix | ||||
| 	 * @param buttonLeft   the button left | ||||
| 	 * @param buttonRight  the button right | ||||
| 	 * @param buttonTop    the button top | ||||
| 	 * @param buttonBottom the button bottom | ||||
| 	 */ | ||||
| 	private void drawBox(Tessellator t_1, BufferBuilder buffer, Matrix4f matrix, int buttonLeft, int buttonRight, int buttonTop, int buttonBottom) { | ||||
| 		RenderSystem.enableBlend(); | ||||
| 		buffer.begin(7, VertexFormats.POSITION); | ||||
| 		buffer.vertex(matrix, buttonLeft, buttonBottom, 0.0F).next(); | ||||
| 		buffer.vertex(matrix, buttonRight, buttonBottom, 0.0F).next(); | ||||
| 		buffer.vertex(matrix, buttonRight, buttonTop, 0.0F).next(); | ||||
| 		buffer.vertex(matrix, buttonLeft, buttonTop, 0.0F).next(); | ||||
| 		t_1.draw(); | ||||
| 	} | ||||
| } | ||||
|  | @ -1,38 +0,0 @@ | |||
| package pm.j4.petroleum.mixin; | ||||
| 
 | ||||
| import java.util.List; | ||||
| import java.util.Optional; | ||||
| import net.minecraft.client.gui.hud.DebugHud; | ||||
| import net.minecraft.client.util.math.MatrixStack; | ||||
| import org.spongepowered.asm.mixin.Mixin; | ||||
| import org.spongepowered.asm.mixin.injection.At; | ||||
| import org.spongepowered.asm.mixin.injection.Inject; | ||||
| import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||||
| import org.spongepowered.asm.mixin.injection.callback.LocalCapture; | ||||
| import pm.j4.petroleum.modules.splash.SplashText; | ||||
| import pm.j4.petroleum.util.config.ConfigHolder; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| 
 | ||||
| /** | ||||
|  * The type Debug hud mixin. | ||||
|  */ | ||||
| @Mixin(DebugHud.class) | ||||
| public class DebugHudMixin { | ||||
| 	/** | ||||
| 	 * Render text right. | ||||
| 	 * | ||||
| 	 * @param matrices the matrices | ||||
| 	 * @param ci       the ci | ||||
| 	 * @param list     the list | ||||
| 	 */ | ||||
| 	@Inject(method = "renderLeftText", | ||||
| 			at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/client/gui/hud/DebugHud;getLeftText()Ljava/util/List;"), | ||||
| 			locals = LocalCapture.CAPTURE_FAILSOFT) | ||||
| 	protected void renderTextRight(MatrixStack matrices, CallbackInfo ci, List<String> list) { | ||||
| 		Optional<ConfigHolder> config = ConfigManager.getConfig(); | ||||
| 		if (config.isPresent() && config.get().isModuleEnabled("petroleum.splashtext")) { | ||||
| 			list.add("[Petroleum] " + SplashText.get() + " loaded"); | ||||
| 		} | ||||
| 
 | ||||
| 	} | ||||
| } | ||||
|  | @ -1,89 +0,0 @@ | |||
| package pm.j4.petroleum.mixin; | ||||
| 
 | ||||
| 
 | ||||
| import java.util.List; | ||||
| import java.util.Optional; | ||||
| import java.util.stream.Collectors; | ||||
| import net.minecraft.client.MinecraftClient; | ||||
| import net.minecraft.client.font.TextRenderer; | ||||
| import net.minecraft.client.gui.DrawableHelper; | ||||
| import net.minecraft.client.gui.hud.InGameHud; | ||||
| import net.minecraft.client.util.math.MatrixStack; | ||||
| import net.minecraft.text.TranslatableText; | ||||
| import org.spongepowered.asm.mixin.Mixin; | ||||
| import org.spongepowered.asm.mixin.Shadow; | ||||
| import org.spongepowered.asm.mixin.injection.At; | ||||
| import org.spongepowered.asm.mixin.injection.Inject; | ||||
| import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||||
| import pm.j4.petroleum.modules.list.ModList; | ||||
| import pm.j4.petroleum.util.config.ConfigHolder; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Mod list mixin. | ||||
|  */ | ||||
| @Mixin(InGameHud.class) | ||||
| public abstract class ModListMixin extends DrawableHelper { | ||||
| 	/** | ||||
| 	 * The Scaled height. | ||||
| 	 */ | ||||
| 	@Shadow | ||||
| 	private int scaledHeight; | ||||
| 	/** | ||||
| 	 * The Client. | ||||
| 	 */ | ||||
| 	private final MinecraftClient client; | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Gets font renderer. | ||||
| 	 * | ||||
| 	 * @return the font renderer | ||||
| 	 */ | ||||
| 	@Shadow | ||||
| 	public abstract TextRenderer getFontRenderer(); | ||||
| 
 | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Instantiates a new Mod list mixin. | ||||
| 	 * | ||||
| 	 * @param client the client | ||||
| 	 */ | ||||
| 	public ModListMixin(MinecraftClient client) { | ||||
| 		this.client = client; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Render. | ||||
| 	 * | ||||
| 	 * @param matrices  the matrices | ||||
| 	 * @param tickDelta the tick delta | ||||
| 	 * @param ci        the ci | ||||
| 	 */ | ||||
| 	@Inject(method = "render(Lnet/minecraft/client/util/math/MatrixStack;F)V", | ||||
| 			at = @At("HEAD")) | ||||
| 	public void render(MatrixStack matrices, float tickDelta, CallbackInfo ci) { | ||||
| 		Optional<ConfigHolder> config = ConfigManager.getConfig(); | ||||
| 		if (config.isPresent() && | ||||
| 				config.get().isModuleEnabled("petroleum.modlist") && | ||||
| 				!this.client.options.hudHidden && | ||||
| 				!this.client.options.debugEnabled) { | ||||
| 			renderModuleList(matrices); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Render module list. | ||||
| 	 * | ||||
| 	 * @param matrices the matrices | ||||
| 	 */ | ||||
| 	private void renderModuleList(MatrixStack matrices) { | ||||
| 		List<ModuleBase> modules = ModList.getActive(); | ||||
| 		List<TranslatableText> activeModuleList = modules.stream().map(module -> module.getReadableName()).collect(Collectors.toList()); | ||||
| 		int fontHeight = this.getFontRenderer().fontHeight; | ||||
| 		int startHeight = this.scaledHeight - (activeModuleList.size() * (fontHeight + 4)); | ||||
| 		for (int i = 0; i < activeModuleList.size(); i++) { | ||||
| 			this.getFontRenderer().drawWithShadow(matrices, activeModuleList.get(i), 10, 10 + (i * (fontHeight + 4)), -1); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | @ -1,141 +0,0 @@ | |||
| package pm.j4.petroleum.mixin; | ||||
| 
 | ||||
| import java.util.Optional; | ||||
| import net.minecraft.client.gui.screen.Screen; | ||||
| import net.minecraft.client.gui.screen.TitleScreen; | ||||
| import net.minecraft.client.util.math.MatrixStack; | ||||
| import net.minecraft.text.Text; | ||||
| import org.spongepowered.asm.mixin.Mixin; | ||||
| import org.spongepowered.asm.mixin.injection.At; | ||||
| import org.spongepowered.asm.mixin.injection.Inject; | ||||
| import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||||
| import org.spongepowered.asm.mixin.injection.callback.LocalCapture; | ||||
| import pm.j4.petroleum.PetroleumMod; | ||||
| import pm.j4.petroleum.modules.splash.SplashText; | ||||
| import pm.j4.petroleum.util.config.ConfigHolder; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.petroleum.util.module.option.BooleanOption; | ||||
| import pm.j4.petroleum.util.module.option.ConfigurationOption; | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * Mixin attached to the TitleScreen. | ||||
|  * Currently, it is only used to display a string of text with the mod's version. | ||||
|  * Any other modules will likely extend the options screen or pause screen, | ||||
|  * so the module is unlikely to be used elsewhere. | ||||
|  */ | ||||
| @Mixin(TitleScreen.class) | ||||
| public class TitleScreenMixin extends Screen { | ||||
| 	/** | ||||
| 	 * The Opacity. | ||||
| 	 */ | ||||
| 	private double opacity = 0; | ||||
| 	/** | ||||
| 	 * The Ascending. | ||||
| 	 */ | ||||
| 	private boolean ascending = false; | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Stub method. | ||||
| 	 * Since the mixin injects itself into the *actual* TitleScreen used by the game, | ||||
| 	 * this should never run. | ||||
| 	 * | ||||
| 	 * @param title the title | ||||
| 	 */ | ||||
| 	protected TitleScreenMixin(Text title) { | ||||
| 		super(title); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Mixin injection into the render method. | ||||
| 	 * It captures locals so that the text can be rendered alongside the | ||||
| 	 * screen fade-in. | ||||
| 	 * It injects before the call to @link com.mojang.bridge.game.GameVersion#getName() using INVOKE_ASSIGN, | ||||
| 	 * because attempting to use a regular invoke statement on @link net.minecraft.client.gui.DrawHelper#drawStringWithShadow() | ||||
| 	 * repeatedly failed. | ||||
| 	 * <p> | ||||
| 	 * | ||||
| 	 * @param matrices the matrices | ||||
| 	 * @param mouseX   the mouse x | ||||
| 	 * @param mouseY   the mouse y | ||||
| 	 * @param delta    the delta | ||||
| 	 * @param ci       the ci | ||||
| 	 * @param f        the f | ||||
| 	 * @param i        the | ||||
| 	 * @param j        the j | ||||
| 	 * @param g        the g | ||||
| 	 * @param l        the l | ||||
| 	 */ | ||||
| 	@Inject(method = "render", | ||||
| 			at = @At( | ||||
| 					value = "INVOKE_ASSIGN", | ||||
| 					target = "Lcom/mojang/bridge/game/GameVersion;getName()Ljava/lang/String;", | ||||
| 					ordinal = 0), | ||||
| 			locals = LocalCapture.CAPTURE_FAILSOFT) | ||||
| 	private void render(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci, float f, int i, int j, float g, int l) { | ||||
| 		Optional<ConfigHolder> config = ConfigManager.getConfig(); | ||||
| 		Optional<ModuleBase> splashText = PetroleumMod.getMod("petroleum.splashtext"); | ||||
| 		if (config.isPresent() && config.get().isModuleEnabled("petroleum.splashtext") | ||||
| 		&& splashText.isPresent()) { | ||||
| 			Optional<ConfigurationOption> isActive = splashText.get().getConfigOption("petroleum.splashtext.active"); | ||||
| 			if(isActive.isPresent() && ((BooleanOption)isActive.get()).getValue()) { | ||||
| 				drawStringWithShadow(matrices, this.textRenderer, SplashText.get(), 2, this.height - 20, blink(13108374) | l); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * fades an integer color based on the values declared at the top of the class. | ||||
| 	 * | ||||
| 	 * @param color the integer representation of the color to fade. this should generally remain constant. | ||||
| 	 * @return the color, adjusted for "opacity". It's RGB and not RGBA, so it just lowers all color values. | ||||
| 	 */ | ||||
| 	@SuppressWarnings("SameParameterValue") | ||||
| 	private int blink(int color) { | ||||
| 		/* | ||||
| 		  The Speed. | ||||
| 		 */ | ||||
| 		int speed = 3; | ||||
| 		/* | ||||
| 		  The Opacity max. | ||||
| 		 */ | ||||
| 		double opacity_max = 1000; | ||||
| 		if (ascending) { | ||||
| 			opacity += speed; | ||||
| 			if (opacity > opacity_max) { | ||||
| 				opacity = opacity_max; | ||||
| 				ascending = false; | ||||
| 			} | ||||
| 		} else { | ||||
| 			opacity -= speed; | ||||
| 			/* | ||||
| 			  The Opacity min. | ||||
| 			 */ | ||||
| 			double opacity_min = 500; | ||||
| 			if (opacity < opacity_min) { | ||||
| 				opacity = opacity_min; | ||||
| 				ascending = true; | ||||
| 			} | ||||
| 		} | ||||
| 		double opacityD = (opacity / opacity_max); | ||||
| 		/* | ||||
| 		  The R mask. | ||||
| 		 */ | ||||
| 		int r_mask = 16711680; | ||||
| 		int r = ((color & r_mask) / Integer.parseInt("010000", 16)); | ||||
| 		/* | ||||
| 		  The G mask. | ||||
| 		 */ | ||||
| 		int g_mask = 65280; | ||||
| 		int g = ((color & g_mask) / Integer.parseInt("000100", 16)); | ||||
| 		/* | ||||
| 		  The B mask. | ||||
| 		 */ | ||||
| 		int b_mask = 255; | ||||
| 		int b = ((color & b_mask)); | ||||
| 		return ((int) (r * opacityD) * Integer.parseInt("010000", 16)) | | ||||
| 				((int) (g * opacityD) * Integer.parseInt("000100", 16)) | | ||||
| 				((int) (b * opacityD)); | ||||
| 	} | ||||
| } | ||||
|  | @ -1,42 +0,0 @@ | |||
| package pm.j4.petroleum.modules; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import net.minecraft.client.MinecraftClient; | ||||
| import net.minecraft.text.LiteralText; | ||||
| import pm.j4.petroleum.gui.PModuleConfigEntry; | ||||
| import pm.j4.petroleum.gui.PModuleConfigPane; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.petroleum.util.module.option.BooleanOption; | ||||
| import pm.j4.petroleum.util.module.option.ConfigurationOption; | ||||
| 
 | ||||
| /** | ||||
|  * The type Example module. | ||||
|  */ | ||||
| public class ExampleModule extends ModuleBase { | ||||
| 	/** | ||||
| 	 * example mod | ||||
| 	 */ | ||||
| 	public ExampleModule() { | ||||
| 		super("petroleum.example", | ||||
| 				"petroleum.misc", | ||||
| 				true, | ||||
| 				false, | ||||
| 				true); | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public List<ConfigurationOption> getDefaultConfig() { | ||||
| 		List<ConfigurationOption> options = new ArrayList<>(); | ||||
| 		options.add(new BooleanOption("petroleum.example.b_one","example", this)); | ||||
| 		options.add(new BooleanOption("petroleum.example.b_two","example", this)); | ||||
| 		return options; | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public void activate(MinecraftClient client) { | ||||
| 		System.out.println("Example Mod Keybind Activate"); | ||||
| 	} | ||||
| } | ||||
|  | @ -1,40 +0,0 @@ | |||
| package pm.j4.petroleum.modules.list; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import java.util.Optional; | ||||
| import pm.j4.petroleum.util.config.ConfigHolder; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Mod list. | ||||
|  */ | ||||
| public class ModList extends ModuleBase { | ||||
| 	/** | ||||
| 	 * Instantiates a new Mod list. | ||||
| 	 */ | ||||
| 	public ModList() { | ||||
| 		super("petroleum.modlist", | ||||
| 				"petroleum.misc", | ||||
| 				true, | ||||
| 				true, | ||||
| 				true); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Gets active. | ||||
| 	 * | ||||
| 	 * @return the active | ||||
| 	 */ | ||||
| 	public static List<ModuleBase> getActive() { | ||||
| 		List<ModuleBase> result = new ArrayList<>(); | ||||
| 		Optional<ConfigHolder> config = ConfigManager.getConfig(); | ||||
| 		config.ifPresent(configHolder -> configHolder.getEnabledModules().forEach((mod) -> { | ||||
| 			if (!mod.isHidden()) { | ||||
| 				result.add(mod); | ||||
| 			} | ||||
| 		})); | ||||
| 		return result; | ||||
| 	} | ||||
| } | ||||
|  | @ -1,98 +0,0 @@ | |||
| package pm.j4.petroleum.modules.menu; | ||||
| 
 | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import net.minecraft.client.MinecraftClient; | ||||
| import pm.j4.petroleum.gui.PModMenuScreen; | ||||
| import pm.j4.petroleum.util.config.ConfigManager; | ||||
| import pm.j4.petroleum.util.data.ButtonInformation; | ||||
| import pm.j4.petroleum.util.data.Category; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Mod menu. | ||||
|  */ | ||||
| public class ModMenu extends ModuleBase { | ||||
| 
 | ||||
| 	/** | ||||
| 	 * The constant coordinates. | ||||
| 	 */ | ||||
| 	private static final Map<String, ButtonInformation> coordinates = new HashMap<>(); | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Instantiates a new Mod menu. | ||||
| 	 */ | ||||
| 	public ModMenu() { | ||||
| 		super("petroleum.modmenu", | ||||
| 				"petroleum.misc", | ||||
| 				true, | ||||
| 				true, | ||||
| 				true); | ||||
| 	} | ||||
| 
 | ||||
| 	// TODO figure out resizing | ||||
| 	//  the number itself changes, so it should just be probably like some onResize bullshit in PModMenuScreen | ||||
| 	@Override | ||||
| 	public void init() { | ||||
| 		Map<String, List<ModuleBase>> categories = Category.getCategoryMap(); | ||||
| 		final double[] h = {.1}; | ||||
| 		categories.forEach((category, moduleList) -> { | ||||
| 			ButtonInformation conf = ConfigManager.getConfig().isPresent() ? | ||||
| 					ConfigManager.getConfig().get().globalConfig.getButton(category) : | ||||
| 					null; | ||||
| 			ButtonInformation coord = conf != null ? conf : new ButtonInformation(.1, h[0], false); | ||||
| 			h[0] += .01; | ||||
| 			coordinates.put(category, coord); | ||||
| 			if (ConfigManager.getConfig().isPresent()) { | ||||
| 				ConfigManager.getConfig().get().globalConfig.setButton(category, coord); | ||||
| 			} | ||||
| 		}); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Update coord. | ||||
| 	 * | ||||
| 	 * @param b the b | ||||
| 	 * @param c the c | ||||
| 	 */ | ||||
| 	public static void updateCoord(String b, ButtonInformation c) { | ||||
| 		if (c.x < 0.05) { | ||||
| 			c.x = 0.05; | ||||
| 		} | ||||
| 		if (c.x > .95) { | ||||
| 			c.x = .95; | ||||
| 		} | ||||
| 		if (c.y < 0.05) { | ||||
| 			c.y = 0.05; | ||||
| 		} | ||||
| 		if (c.y > .95) { | ||||
| 			c.y = .95; | ||||
| 		} | ||||
| 		if (coordinates.containsKey(b)) { | ||||
| 			coordinates.replace(b, c); | ||||
| 			if (ConfigManager.getConfig().isPresent()) { | ||||
| 				ConfigManager.getConfig().get().globalConfig.setButton(b, c); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public void activate(MinecraftClient client) { | ||||
| 		this.toggle(); | ||||
| 		if (ConfigManager.getConfig().get().isModuleEnabled(this.getModuleName())) { | ||||
| 			client.openScreen(new PModMenuScreen()); | ||||
| 		} else { | ||||
| 			client.openScreen(null); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Gets buttons. | ||||
| 	 * | ||||
| 	 * @return the buttons | ||||
| 	 */ | ||||
| 	public static Map<String, ButtonInformation> getButtons() { | ||||
| 		return coordinates; | ||||
| 	} | ||||
| } | ||||
|  | @ -1,46 +0,0 @@ | |||
| package pm.j4.petroleum.modules.splash; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import net.minecraft.text.LiteralText; | ||||
| import pm.j4.petroleum.PetroleumMod; | ||||
| import pm.j4.petroleum.gui.PModuleConfigEntry; | ||||
| import pm.j4.petroleum.gui.PModuleConfigPane; | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| import pm.j4.petroleum.util.module.option.BooleanOption; | ||||
| import pm.j4.petroleum.util.module.option.ConfigurationOption; | ||||
| 
 | ||||
| /** | ||||
|  * The type Splash text. | ||||
|  */ | ||||
| public class SplashText extends ModuleBase { | ||||
| 	/** | ||||
| 	 * Instantiates a new Splash text. | ||||
| 	 */ | ||||
| 	public SplashText() { | ||||
| 		super("petroleum.splashtext", | ||||
| 				"petroleum.misc", | ||||
| 				false, | ||||
| 				true, | ||||
| 				true); | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public List<ConfigurationOption> getDefaultConfig() { | ||||
| 		List<ConfigurationOption> options = new ArrayList<>(); | ||||
| 		options.add(new BooleanOption("petroleum.splashtext.active", "Show the main menu version text.", this)); | ||||
| 		return options; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Get string. | ||||
| 	 * | ||||
| 	 * @return the string | ||||
| 	 */ | ||||
| 	public static String get() { | ||||
| 		if (PetroleumMod.modData != null) { | ||||
| 			return "Petroleum v" + PetroleumMod.modData.getVersion().getFriendlyString(); | ||||
| 		} | ||||
| 		return "Petroleum vUnknown"; | ||||
| 	} | ||||
| } | ||||
|  | @ -1,19 +0,0 @@ | |||
| package pm.j4.petroleum.modules.xray; | ||||
| 
 | ||||
| import pm.j4.petroleum.util.module.ModuleBase; | ||||
| 
 | ||||
| /** | ||||
|  * The type Xray. | ||||
|  */ | ||||
| public class Xray extends ModuleBase { | ||||
| 	/** | ||||
| 	 * Instantiates a new Xray. | ||||
| 	 */ | ||||
| 	public Xray() { | ||||
| 		super("petroleum.xray", | ||||
| 				"petroleum.render", | ||||
| 				true, | ||||
| 				false, | ||||
| 				true); | ||||
| 	} | ||||
| } | ||||
|  | @ -1,32 +0,0 @@ | |||
| package pm.j4.petroleum.util.data; | ||||
| 
 | ||||
| /** | ||||
|  * The type Button information. | ||||
|  */ | ||||
| public class ButtonInformation { | ||||
| 	/** | ||||
| 	 * The X. | ||||
| 	 */ | ||||
| 	public double x; | ||||
| 	/** | ||||
| 	 * The Y. | ||||
| 	 */ | ||||
| 	public double y; | ||||
| 	/** | ||||
| 	 * The Open. | ||||
| 	 */ | ||||
| 	public final boolean open; | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Instantiates a new Button information. | ||||
| 	 * | ||||
| 	 * @param x    the x | ||||
| 	 * @param y    the y | ||||
| 	 * @param open the open | ||||
| 	 */ | ||||
| 	public ButtonInformation(double x, double y, boolean open) { | ||||
| 		this.x = x; | ||||
| 		this.y = y; | ||||
| 		this.open = open; | ||||
| 	} | ||||
| } | ||||
| Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB | 
							
								
								
									
										4
									
								
								src/main/resources/assets/kerosene/lang/en_us.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								src/main/resources/assets/kerosene/lang/en_us.json
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | |||
| { | ||||
|   "kerosene.bindings": "Binding Manager", | ||||
|   "kerosene.options": "Kerosene Options" | ||||
| } | ||||
| Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 145 B | 
|  | @ -1,13 +0,0 @@ | |||
| { | ||||
|   "petroleum.bindings": "Binding Manager", | ||||
|   "petroleum.example": "Test Module", | ||||
|   "petroleum.splashtext": "Splash Text", | ||||
|   "petroleum.modlist": "Module List", | ||||
|   "petroleum.modmenu": "Mod Menu", | ||||
| 
 | ||||
|   "petroleum.xray": "X-ray", | ||||
| 
 | ||||
|   "petroleum.misc": "Miscellaneous", | ||||
|   "petroleum.render": "Render", | ||||
|   "petroleum.options": "Petroleum Options" | ||||
| } | ||||
|  | @ -1,27 +1,27 @@ | |||
| { | ||||
|   "schemaVersion": 1, | ||||
|   "id": "petroleum", | ||||
|   "id": "kerosene", | ||||
|   "version": "${version}", | ||||
| 
 | ||||
|   "name": "Petroleum", | ||||
|   "description": "Burn it down.", | ||||
|   "name": "Kerosene", | ||||
|   "description": "Shared library", | ||||
|   "authors": [ | ||||
|     "janeptrv" | ||||
|   ], | ||||
|   "contact": { | ||||
|     "homepage": "https://j4.pm/", | ||||
|     "sources": "https://gitdab.com/jane/petroleum" | ||||
|     "sources": "https://gitdab.com/jane/kerosene" | ||||
|   }, | ||||
|   "license": "WTFPL", | ||||
|   "icon": "assets/petroleum/icon.png", | ||||
|   "icon": "assets/kerosene/icon.png", | ||||
|   "environment": "*", | ||||
|   "entrypoints": { | ||||
|     "main": [ | ||||
|       "pm.j4.petroleum.PetroleumMod" | ||||
|       "pm.j4.kerosene.KeroseneMod" | ||||
|     ] | ||||
|   }, | ||||
|   "mixins": [ | ||||
|     "petroleum.mixins.json" | ||||
|     "kerosene.mixins.json" | ||||
|   ], | ||||
|   "depends": { | ||||
|     "fabricloader": ">=0.7.4", | ||||
|  |  | |||
|  | @ -1,16 +1,13 @@ | |||
| { | ||||
|   "required": true, | ||||
|   "minVersion": "0.8", | ||||
|   "package": "pm.j4.petroleum.mixin", | ||||
|   "package": "pm.j4.kerosene.mixin", | ||||
|   "compatibilityLevel": "JAVA_8", | ||||
|   "mixins": [ | ||||
|   ], | ||||
|   "client": [ | ||||
|     "DebugHudMixin", | ||||
|     "EntryListWidgetAccessor", | ||||
|     "ModListMixin", | ||||
|     "OptionsMenuMixin", | ||||
|     "TitleScreenMixin" | ||||
|     "OptionsMenuMixin" | ||||
|   ], | ||||
|   "injectors": { | ||||
|     "defaultRequire": 1 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue