├── jitpack.yml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── src └── main │ ├── resources │ ├── assets │ │ └── malilib │ │ │ ├── icon.png │ │ │ ├── textures │ │ │ ├── gui │ │ │ │ ├── gui_widgets.png │ │ │ │ └── test_gui_widgets.png │ │ │ └── xcf │ │ │ │ └── gui_widgets.xcf │ │ │ └── shaders │ │ │ ├── position_color_lines.fsh │ │ │ ├── position_color_lines.vsh │ │ │ ├── sv_selector.frag │ │ │ └── legacy_terrain.vsh │ ├── malilib.accesswidener │ └── fabric.mod.json │ └── java │ └── fi │ └── dy │ └── masa │ └── malilib │ ├── util │ ├── data │ │ ├── tag │ │ │ ├── NumberData.java │ │ │ ├── util │ │ │ │ └── SizeTracker.java │ │ │ ├── EmptyData.java │ │ │ ├── ArrayData.java │ │ │ ├── IntData.java │ │ │ ├── ByteData.java │ │ │ ├── LongData.java │ │ │ ├── FloatData.java │ │ │ ├── ShortData.java │ │ │ ├── DoubleData.java │ │ │ └── StringData.java │ │ ├── Constants.java │ │ ├── IEnumCodecProvider.java │ │ └── ModInfo.java │ ├── game │ │ ├── IGameHud.java │ │ ├── IEntityOwnedInventory.java │ │ └── PlacementUtils.java │ ├── IF3KeyStateSetter.java │ ├── nbt │ │ └── INbtEntityInvoker.java │ ├── log │ │ └── IAnsiLogger.java │ ├── time │ │ ├── formatter │ │ │ ├── DurationFmtRegular.java │ │ │ ├── DurationFmt.java │ │ │ ├── DurationFmtPretty.java │ │ │ ├── TimeFmt.java │ │ │ ├── DurationFmtFormatted.java │ │ │ ├── DurationFmtISOExtended.java │ │ │ ├── TimeFmtISOLocal.java │ │ │ ├── TimeFmtISOOffset.java │ │ │ ├── TimeFmtRFC1123.java │ │ │ ├── TimeFmtTimeAmPm.java │ │ │ ├── TimeFmtTimeOnly.java │ │ │ ├── TimeFmtDateOnly.java │ │ │ ├── TimeFmtDayAmPm.java │ │ │ ├── TimeFmtRegular.java │ │ │ └── TimeFmtDateAmPm.java │ │ └── TimeTestExample.java │ └── restrictions │ │ ├── ItemRestriction.java │ │ └── BlockRestriction.java │ ├── interfaces │ ├── IStringConsumer.java │ ├── ICommandDispatcher.java │ ├── IStringListProvider.java │ ├── IConfirmationListener.java │ ├── IClientTickHandler.java │ ├── IRangeChangeListener.java │ ├── IStringConsumerFeedback.java │ ├── IValueChangeCallback.java │ ├── IStringRetriever.java │ ├── IStringValue.java │ ├── IGuiRendererInvoker.java │ ├── ICompletionListener.java │ ├── IInitializationDispatcher.java │ ├── IClientCommandListener.java │ ├── ICoordinateValueModifier.java │ ├── IInitializationHandler.java │ ├── IWorldLoadListener.java │ └── IServerListener.java │ ├── config │ ├── IConfigValue.java │ ├── IHotkeyTogglable.java │ ├── options │ │ └── table │ │ │ ├── type │ │ │ ├── EntryTypes.java │ │ │ ├── Entry.java │ │ │ └── StringEntry.java │ │ │ └── Label.java │ ├── IConfigSlider.java │ ├── IConfigOptionList.java │ ├── IConfigNotifiable.java │ ├── value │ │ ├── OptionListConfigValue.java │ │ └── FileWriteType.java │ ├── IConfigFloat.java │ ├── IConfigInteger.java │ ├── IConfigDouble.java │ ├── IConfigResettable.java │ ├── IConfigLockedListEntry.java │ ├── IConfigStringList.java │ ├── IConfigBoolean.java │ ├── IConfigColor.java │ ├── IConfigColorList.java │ ├── IConfigManager.java │ ├── IConfigLockedListType.java │ ├── IConfigOptionListEntry.java │ ├── IConfigHandler.java │ ├── gui │ │ ├── ButtonPressDirtyListenerSimple.java │ │ ├── ConfigOptionChangeListenerTextField.java │ │ ├── GuiModConfigs.java │ │ ├── ConfigOptionChangeListenerButton.java │ │ ├── SliderCallbackFloat.java │ │ ├── ConfigOptionChangeListenerKeybind.java │ │ ├── SliderCallbackInteger.java │ │ └── SliderCallbackDouble.java │ ├── IStringRepresentable.java │ ├── IConfigLockedList.java │ ├── IConfigTable.java │ └── ConfigManager.java │ ├── gui │ ├── button │ │ ├── IButtonActionListener.java │ │ ├── ConfigButtonBoolean.java │ │ ├── ConfigButtonOptionList.java │ │ └── ButtonOnOff.java │ ├── interfaces │ │ ├── IStringListConsumer.java │ │ ├── ISelectionListener.java │ │ ├── IDirectoryNavigator.java │ │ ├── IDirectoryCache.java │ │ ├── IMessageConsumer.java │ │ ├── ITextFieldListener.java │ │ ├── IConfigInfoProvider.java │ │ ├── IDialogHandler.java │ │ ├── IGuiIcon.java │ │ ├── IFileBrowserIconProvider.java │ │ ├── ISliderCallback.java │ │ ├── IKeybindConfigGui.java │ │ └── IConfigGui.java │ ├── BaseScreen.java │ ├── LeftRight.java │ ├── ConfigInfoProviderSimple.java │ ├── widgets │ │ ├── WidgetListEntryBase.java │ │ ├── WidgetInfoIcon.java │ │ ├── WidgetIcon.java │ │ ├── WidgetListStringSelection.java │ │ └── WidgetStringListEntry.java │ ├── GuiDialogBase.java │ ├── GuiTextInputFeedback.java │ ├── GuiTextFieldInteger.java │ └── config │ │ └── registry │ │ └── ConfigScreenRegistry.java │ ├── event │ ├── IServerManager.java │ ├── IWorldLoadManager.java │ ├── TickHandler.java │ └── InitializationHandler.java │ ├── render │ ├── InventoryOverlayRefresher.java │ ├── InventoryOverlayType.java │ ├── InventoryOverlayContext.java │ └── special │ │ └── MaLiLibBlockStateModelGuiElement.java │ ├── hotkeys │ ├── IHotkeyCallback.java │ ├── IKeyboardInputHandler.java │ ├── KeyCallbackToggleBoolean.java │ ├── KeyCallbackToggleBooleanConfigWithMessage.java │ ├── IKeybindProvider.java │ ├── IInputManager.java │ ├── IMouseInputHandler.java │ ├── KeyCallbackAdjustable.java │ └── IKeybindManager.java │ ├── mixin │ ├── network │ │ ├── IMixinDataQueryHandler.java │ │ └── MixinClientConfigurationNetworkHandler.java │ ├── server │ │ ├── IMixinServerTickManager.java │ │ └── MixinIntegratedServer.java │ ├── entity │ │ ├── IMixinPiglinEntity.java │ │ ├── IMixinAbstractHorseEntity.java │ │ ├── IMixinMerchantEntity.java │ │ ├── IMixinAbstractNautilus.java │ │ ├── IMixinPlayerEntity.java │ │ ├── MixinSimpleInventory.java │ │ ├── MixinAbstractNautilus.java │ │ ├── MixinAbstractHorseEntity.java │ │ └── MixinPiglinEntity.java │ ├── recipe │ │ ├── IMixinIngredient.java │ │ └── IMixinClientRecipeBook.java │ ├── screen │ │ ├── IMixinHandledScreen.java │ │ ├── MixinChatScreen.java │ │ ├── MixinInventoryScreen.java │ │ └── MixinHandledScreen.java │ ├── render │ │ ├── IMixinBufferBuilder.java │ │ ├── IMixinAbstractTexture.java │ │ ├── IMixinGuiRenderer.java │ │ ├── MixinGlBackend.java │ │ ├── IMixinGameRenderer.java │ │ ├── MixinDebugRenderer.java │ │ ├── MixinDrawContext.java │ │ ├── MixinGuiRenderer.java │ │ ├── IMixinDrawContext.java │ │ └── MixinGameRenderer.java │ ├── nbt │ │ ├── IMixinNbtWriteView.java │ │ └── IMixinNbtReadView.java │ ├── item │ │ └── IMixinContainerComponent.java │ ├── input │ │ ├── IMixinKeyBinding.java │ │ └── MixinKeyboard.java │ ├── hud │ │ ├── IMixinDebugHudProfile.java │ │ └── MixinInGameHud.java │ └── test │ │ ├── MixinSharedConstants.java │ │ ├── MixinBundleItem.java │ │ ├── MixinClientPlayInteractionManager_testSelector.java │ │ └── MixinMinecraftClient_testSelector.java │ ├── network │ ├── IClientPlayHandler.java │ └── IClientPayloadData.java │ ├── MaLiLibCallbacks.java │ ├── compat │ ├── modmenu │ │ └── ModMenuImpl.java │ └── lwgl │ │ └── GpuCompat.java │ ├── test │ ├── TestDataSyncer.java │ ├── TestDirectoryCache.java │ ├── TestCommand.java │ ├── gui │ │ └── widgets │ │ │ └── WidgetTestBrowser.java │ └── ConfigTestOptList.java │ ├── data │ └── CachedTagKey.java │ ├── registry │ └── Registry.java │ ├── interoperation │ ├── IBlockPlacementPositionProvider.java │ └── BlockPlacementPositionHandler.java │ ├── MaLiLibReference.java │ ├── MaLiLib.java │ └── MaLiLibInputHandler.java ├── settings.gradle ├── .gitignore ├── README.md ├── .gitattributes ├── gradle.properties └── .github └── workflows └── build.yml /jitpack.yml: -------------------------------------------------------------------------------- 1 | before_install: 2 | - sdk install java 21.0.9-tem 3 | - sdk use java 21.0.9-tem 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sakura-ryoko/malilib/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/assets/malilib/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sakura-ryoko/malilib/HEAD/src/main/resources/assets/malilib/icon.png -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/util/data/tag/NumberData.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.util.data.tag; 2 | 3 | public interface NumberData 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/main/resources/assets/malilib/textures/gui/gui_widgets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sakura-ryoko/malilib/HEAD/src/main/resources/assets/malilib/textures/gui/gui_widgets.png -------------------------------------------------------------------------------- /src/main/resources/assets/malilib/textures/xcf/gui_widgets.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sakura-ryoko/malilib/HEAD/src/main/resources/assets/malilib/textures/xcf/gui_widgets.xcf -------------------------------------------------------------------------------- /src/main/resources/assets/malilib/textures/gui/test_gui_widgets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sakura-ryoko/malilib/HEAD/src/main/resources/assets/malilib/textures/gui/test_gui_widgets.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | maven { 4 | name = 'Fabric' 5 | url = 'https://maven.fabricmc.net/' 6 | } 7 | gradlePluginPortal() 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/interfaces/IStringConsumer.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.interfaces; 2 | 3 | public interface IStringConsumer 4 | { 5 | void setString(String string); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/util/game/IGameHud.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.util.game; 2 | 3 | public interface IGameHud 4 | { 5 | void malilib$setOverlayRemaining(int ticks); 6 | } 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | .settings 3 | bin/ 4 | build/ 5 | eclipse/ 6 | logs/ 7 | .classpath 8 | .project 9 | build.number 10 | Task 11 | .idea/ 12 | run/ 13 | libs/ 14 | /src/main/generated/.cache/ 15 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigValue.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | public interface IConfigValue extends IConfigBase, IConfigResettable, IStringRepresentable 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/util/IF3KeyStateSetter.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.util; 2 | 3 | public interface IF3KeyStateSetter 4 | { 5 | void malilib$setF3KeyState(boolean value); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/interfaces/ICommandDispatcher.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.interfaces; 2 | 3 | public interface ICommandDispatcher 4 | { 5 | void registerCommand(IClientCommandListener command); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IHotkeyTogglable.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | import fi.dy.masa.malilib.hotkeys.IHotkey; 4 | 5 | public interface IHotkeyTogglable extends IConfigBoolean, IHotkey 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/button/IButtonActionListener.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui.button; 2 | 3 | public interface IButtonActionListener 4 | { 5 | void actionPerformedWithButton(ButtonBase button, int mouseButton); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/interfaces/IStringListProvider.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.interfaces; 2 | 3 | import java.util.Collection; 4 | 5 | public interface IStringListProvider 6 | { 7 | Collection getStrings(); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/interfaces/IConfirmationListener.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.interfaces; 2 | 3 | public interface IConfirmationListener 4 | { 5 | boolean onActionConfirmed(); 6 | 7 | boolean onActionCancelled(); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/interfaces/IClientTickHandler.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.interfaces; 2 | 3 | import net.minecraft.client.Minecraft; 4 | 5 | public interface IClientTickHandler 6 | { 7 | void onClientTick(Minecraft mc); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/interfaces/IStringListConsumer.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui.interfaces; 2 | 3 | import java.util.Collection; 4 | 5 | public interface IStringListConsumer 6 | { 7 | boolean consume(Collection strings); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/interfaces/ISelectionListener.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui.interfaces; 2 | 3 | import javax.annotation.Nullable; 4 | 5 | public interface ISelectionListener 6 | { 7 | void onSelectionChange(@Nullable T entry); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/options/table/type/EntryTypes.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config.options.table.type; 2 | 3 | public enum EntryTypes 4 | { 5 | STRING, 6 | INTEGER, 7 | // KEYBIND, 8 | BOOLEAN, 9 | DOUBLE, 10 | LABEL 11 | } 12 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/util/game/IEntityOwnedInventory.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.util.game; 2 | 3 | import net.minecraft.world.entity.Entity; 4 | 5 | public interface IEntityOwnedInventory 6 | { 7 | Entity malilib$getEntityOwner(); 8 | void malilib$setEntityOwner(Entity entity); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigSlider.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | public interface IConfigSlider extends IConfigValue 4 | { 5 | default boolean shouldUseSlider() 6 | { 7 | return false; 8 | } 9 | 10 | default void toggleUseSlider() 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/event/IServerManager.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.event; 2 | 3 | import fi.dy.masa.malilib.interfaces.IServerListener; 4 | 5 | public interface IServerManager 6 | { 7 | void registerServerHandler(IServerListener handler); 8 | void unregisterServerHandler(IServerListener handler); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigOptionList.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | public interface IConfigOptionList 4 | { 5 | IConfigOptionListEntry getOptionListValue(); 6 | 7 | IConfigOptionListEntry getDefaultOptionListValue(); 8 | 9 | void setOptionListValue(IConfigOptionListEntry value); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigNotifiable.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | import fi.dy.masa.malilib.interfaces.IValueChangeCallback; 4 | 5 | public interface IConfigNotifiable 6 | { 7 | void onValueChanged(); 8 | 9 | void setValueChangeCallback(IValueChangeCallback callback); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/resources/assets/malilib/shaders/position_color_lines.fsh: -------------------------------------------------------------------------------- 1 | #version 330 2 | 3 | #moj_import 4 | 5 | in vec4 vertexColor; 6 | 7 | out vec4 fragColor; 8 | 9 | void main() { 10 | vec4 color = vertexColor; 11 | if (color.a == 0.0) { 12 | discard; 13 | } 14 | fragColor = color * ColorModulator; 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/interfaces/IRangeChangeListener.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.interfaces; 2 | 3 | public interface IRangeChangeListener 4 | { 5 | void updateAll(); 6 | 7 | void updateBetweenX(int minX, int maxX); 8 | 9 | void updateBetweenY(int minY, int maxY); 10 | 11 | void updateBetweenZ(int minZ, int maxZ); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/value/OptionListConfigValue.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config.value; 2 | 3 | import org.jetbrains.annotations.ApiStatus; 4 | 5 | /** 6 | * Post-ReWrite code 7 | */ 8 | @ApiStatus.Experimental 9 | public interface OptionListConfigValue 10 | { 11 | String getName(); 12 | 13 | String getDisplayName(); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/render/InventoryOverlayRefresher.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.render; 2 | 3 | import net.minecraft.world.level.Level; 4 | 5 | /** 6 | * Replaces the old / ugly method. 7 | */ 8 | public interface InventoryOverlayRefresher 9 | { 10 | InventoryOverlayContext onContextRefresh(InventoryOverlayContext data, Level world); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/interfaces/IStringConsumerFeedback.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.interfaces; 2 | 3 | public interface IStringConsumerFeedback 4 | { 5 | /** 6 | * 7 | * @param string () 8 | * @return true if the operation succeeded, false if there was some kind of an error 9 | */ 10 | boolean setString(String string); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigFloat.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | public interface IConfigFloat extends IConfigValue, IConfigSlider 4 | { 5 | float getFloatValue(); 6 | 7 | float getDefaultFloatValue(); 8 | 9 | void setFloatValue(float value); 10 | 11 | float getMinFloatValue(); 12 | 13 | float getMaxFloatValue(); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/interfaces/IDirectoryNavigator.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui.interfaces; 2 | 3 | import java.nio.file.Path; 4 | 5 | public interface IDirectoryNavigator 6 | { 7 | Path getCurrentDirectory(); 8 | 9 | void switchToDirectory(Path dir); 10 | 11 | void switchToParentDirectory(); 12 | 13 | void switchToRootDirectory(); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigInteger.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | public interface IConfigInteger extends IConfigValue, IConfigSlider 4 | { 5 | int getIntegerValue(); 6 | 7 | int getDefaultIntegerValue(); 8 | 9 | void setIntegerValue(int value); 10 | 11 | int getMinIntegerValue(); 12 | 13 | int getMaxIntegerValue(); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigDouble.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | public interface IConfigDouble extends IConfigValue, IConfigSlider 4 | { 5 | double getDoubleValue(); 6 | 7 | double getDefaultDoubleValue(); 8 | 9 | void setDoubleValue(double value); 10 | 11 | double getMinDoubleValue(); 12 | 13 | double getMaxDoubleValue(); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/interfaces/IDirectoryCache.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui.interfaces; 2 | 3 | import java.nio.file.Path; 4 | import javax.annotation.Nullable; 5 | 6 | public interface IDirectoryCache 7 | { 8 | @Nullable 9 | Path getCurrentDirectoryForContext(String context); 10 | 11 | void setCurrentDirectoryForContext(String context, Path dir); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/interfaces/IMessageConsumer.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui.interfaces; 2 | 3 | import fi.dy.masa.malilib.gui.Message.MessageType; 4 | 5 | public interface IMessageConsumer 6 | { 7 | void addMessage(MessageType type, String messageKey, Object... args); 8 | 9 | void addMessage(MessageType type, int lifeTime, String messageKey, Object... args); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/interfaces/ITextFieldListener.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui.interfaces; 2 | 3 | import net.minecraft.client.gui.components.EditBox; 4 | 5 | public interface ITextFieldListener 6 | { 7 | default boolean onGuiClosed(T textField) 8 | { 9 | return false; 10 | } 11 | 12 | boolean onTextChange(T textField); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/interfaces/IValueChangeCallback.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.interfaces; 2 | 3 | import fi.dy.masa.malilib.config.IConfigBase; 4 | 5 | public interface IValueChangeCallback 6 | { 7 | /** 8 | * Called when (= after) the config's value is changed 9 | * @param config () 10 | */ 11 | void onValueChanged(T config); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/interfaces/IStringRetriever.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.interfaces; 2 | 3 | public interface IStringRetriever 4 | { 5 | /** 6 | * Returns a string representation of the given value. 7 | * This may be different than just calling toString(). 8 | * @param entry () 9 | * @return () 10 | */ 11 | String getStringValue(T entry); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/interfaces/IStringValue.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.interfaces; 2 | 3 | public interface IStringValue 4 | { 5 | /** 6 | * Returns the String representation of the value of this config. Used in the config GUI to 7 | * fill in the text field contents. 8 | * @return the String representation of the current value 9 | */ 10 | String getStringValue(); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigResettable.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | public interface IConfigResettable 4 | { 5 | /** 6 | * Returns true if the value has been changed from the default value 7 | * @return 8 | */ 9 | boolean isModified(); 10 | 11 | /** 12 | * Resets the value back to the default value 13 | */ 14 | void resetToDefault(); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/interfaces/IConfigInfoProvider.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui.interfaces; 2 | 3 | import fi.dy.masa.malilib.config.IConfigBase; 4 | 5 | public interface IConfigInfoProvider 6 | { 7 | /** 8 | * Get the mouse-over hover info tooltip for the given config 9 | * @param config () 10 | * @return () 11 | */ 12 | String getHoverInfo(IConfigBase config); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigLockedListEntry.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | public interface IConfigLockedListEntry 4 | { 5 | // @ApiStatus.Experimental 6 | // default Codec codec() { return null; } 7 | 8 | static IConfigLockedListEntry empty() { return null; } 9 | 10 | String getStringValue(); 11 | 12 | String getDisplayName(); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/hotkeys/IHotkeyCallback.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.hotkeys; 2 | 3 | public interface IHotkeyCallback 4 | { 5 | /** 6 | * Called when a hotkey action happens. 7 | * @param action () 8 | * @param key () 9 | * @return true if further processing of the just pressed key should be cancelled 10 | */ 11 | boolean onKeyAction(KeyAction action, IKeybind key); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/resources/assets/malilib/shaders/position_color_lines.vsh: -------------------------------------------------------------------------------- 1 | #version 330 2 | 3 | #moj_import 4 | #moj_import 5 | 6 | in vec3 Position; 7 | in vec4 Color; 8 | in float LineWidth; 9 | 10 | out vec4 vertexColor; 11 | 12 | void main() { 13 | gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0); 14 | vertexColor = Color; 15 | gl_PointSize = LineWidth; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigStringList.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | import java.util.List; 4 | import com.google.common.collect.ImmutableList; 5 | 6 | public interface IConfigStringList extends IConfigBase 7 | { 8 | List getStrings(); 9 | 10 | ImmutableList getDefaultStrings(); 11 | 12 | void setStrings(List strings); 13 | 14 | void setModified(); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/network/IMixinDataQueryHandler.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.network; 2 | 3 | import net.minecraft.client.DebugQueryHandler; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(DebugQueryHandler.class) 8 | public interface IMixinDataQueryHandler 9 | { 10 | @Accessor("transactionId") 11 | int malilib_currentTransactionId(); 12 | } -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/util/nbt/INbtEntityInvoker.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.util.nbt; 2 | 3 | import java.util.Optional; 4 | import net.minecraft.nbt.CompoundTag; 5 | import fi.dy.masa.malilib.util.data.tag.CompoundData; 6 | 7 | public interface INbtEntityInvoker 8 | { 9 | Optional malilib$getNbtDataWithId(final int expectedId); 10 | Optional malilib$getDataTagWithId(final int expectedId); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/network/IClientPlayHandler.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.network; 2 | 3 | import net.minecraft.network.protocol.common.custom.CustomPacketPayload; 4 | 5 | public interface IClientPlayHandler 6 | { 7 |

void registerClientPlayHandler(IPluginClientPlayHandler

handler); 8 |

void unregisterClientPlayHandler(IPluginClientPlayHandler

handler); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/server/IMixinServerTickManager.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.server; 2 | 3 | import net.minecraft.server.ServerTickRateManager; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(ServerTickRateManager.class) 8 | public interface IMixinServerTickManager 9 | { 10 | @Accessor("remainingSprintTicks") 11 | long malilib_getSprintTicks(); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigBoolean.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | public interface IConfigBoolean extends IConfigValue 4 | { 5 | boolean getBooleanValue(); 6 | 7 | boolean getDefaultBooleanValue(); 8 | 9 | void setBooleanValue(boolean value); 10 | 11 | default void toggleBooleanValue() 12 | { 13 | this.setBooleanValue(! this.getBooleanValue()); 14 | this.checkIfClean(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/interfaces/IDialogHandler.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui.interfaces; 2 | 3 | import fi.dy.masa.malilib.gui.GuiBase; 4 | 5 | public interface IDialogHandler 6 | { 7 | /** 8 | * Open the provided GUI as a "dialog window" 9 | * @param gui () 10 | */ 11 | void openDialog(GuiBase gui); 12 | 13 | /** 14 | * Close the previously opened "dialog window" 15 | */ 16 | void closeDialog(); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/interfaces/IGuiRendererInvoker.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.interfaces; 2 | 3 | import java.util.Map; 4 | import net.minecraft.client.gui.render.pip.PictureInPictureRenderer; 5 | import net.minecraft.client.gui.render.state.pip.PictureInPictureRenderState; 6 | 7 | public interface IGuiRendererInvoker 8 | { 9 | void malilib$replaceSpecialGuiRenderers(Map, PictureInPictureRenderer> map); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/interfaces/ICompletionListener.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.interfaces; 2 | 3 | public interface ICompletionListener 4 | { 5 | /** 6 | * Called when a task wants to inform a listener about the task being completed 7 | */ 8 | void onTaskCompleted(); 9 | 10 | /** 11 | * Called when a task wants to inform a listener about the task being aborted before completion 12 | */ 13 | default void onTaskAborted() {} 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/entity/IMixinPiglinEntity.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.entity; 2 | 3 | import net.minecraft.world.SimpleContainer; 4 | import net.minecraft.world.entity.monster.piglin.Piglin; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(Piglin.class) 9 | public interface IMixinPiglinEntity 10 | { 11 | @Accessor("inventory") 12 | SimpleContainer malilib_getInventory(); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigColor.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | import fi.dy.masa.malilib.util.data.Color4f; 4 | 5 | public interface IConfigColor extends IConfigValue 6 | //, IConfigSlider 7 | { 8 | Color4f getColor(); 9 | 10 | int getIntegerValue(); 11 | 12 | int getDefaultIntegerValue(); 13 | 14 | void setIntegerValue(int value); 15 | 16 | int getMinIntegerValue(); 17 | 18 | int getMaxIntegerValue(); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigColorList.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | import com.google.common.collect.ImmutableList; 4 | import fi.dy.masa.malilib.util.data.Color4f; 5 | 6 | import java.util.List; 7 | 8 | public interface IConfigColorList extends IConfigBase 9 | { 10 | List getColors(); 11 | 12 | ImmutableList getDefaultColors(); 13 | 14 | void setColors(List colors); 15 | 16 | void setModified(); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/interfaces/IInitializationDispatcher.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.interfaces; 2 | 3 | public interface IInitializationDispatcher 4 | { 5 | /** 6 | * Register an initialization handler, which will get called once the game has been initialized 7 | * and set up, and things are ready to be accessed and initialized by mods. 8 | * @param handler 9 | */ 10 | void registerInitializationHandler(IInitializationHandler handler); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/entity/IMixinAbstractHorseEntity.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.entity; 2 | 3 | import net.minecraft.world.SimpleContainer; 4 | import net.minecraft.world.entity.animal.equine.AbstractHorse; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(AbstractHorse.class) 9 | public interface IMixinAbstractHorseEntity 10 | { 11 | @Accessor("inventory") 12 | SimpleContainer malilib_getHorseInventory(); 13 | } -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/entity/IMixinMerchantEntity.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.entity; 2 | 3 | import net.minecraft.world.entity.npc.villager.AbstractVillager; 4 | import net.minecraft.world.item.trading.MerchantOffers; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(AbstractVillager.class) 9 | public interface IMixinMerchantEntity 10 | { 11 | @Accessor("offers") 12 | MerchantOffers malilib_offers(); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/recipe/IMixinIngredient.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.recipe; 2 | 3 | import net.minecraft.core.HolderSet; 4 | import net.minecraft.world.item.Item; 5 | import net.minecraft.world.item.crafting.Ingredient; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | 9 | @Mixin(Ingredient.class) 10 | public interface IMixinIngredient 11 | { 12 | @Accessor("values") 13 | HolderSet malilib_getEntries(); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigManager.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | public interface IConfigManager 4 | { 5 | /** 6 | * Registers a config handler 7 | * @param modId 8 | * @param handler 9 | */ 10 | void registerConfigHandler(String modId, IConfigHandler handler); 11 | 12 | /** 13 | * Can be called to save and reload the configs for the given mod. 14 | * @param modId 15 | */ 16 | void onConfigsChanged(String modId); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/interfaces/IGuiIcon.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui.interfaces; 2 | 3 | import fi.dy.masa.malilib.render.GuiContext; 4 | import net.minecraft.resources.Identifier; 5 | 6 | public interface IGuiIcon 7 | { 8 | int getWidth(); 9 | 10 | int getHeight(); 11 | 12 | int getU(); 13 | 14 | int getV(); 15 | 16 | void renderAt(GuiContext ctx, int x, int y, float zLevel, boolean enabled, boolean selected); 17 | 18 | Identifier getTexture(); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/entity/IMixinAbstractNautilus.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.entity; 2 | 3 | import net.minecraft.world.SimpleContainer; 4 | import net.minecraft.world.entity.animal.nautilus.AbstractNautilus; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(AbstractNautilus.class) 9 | public interface IMixinAbstractNautilus 10 | { 11 | @Accessor("inventory") 12 | SimpleContainer malilib_getNautilusInventory(); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/entity/IMixinPlayerEntity.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.entity; 2 | 3 | import net.minecraft.world.entity.player.Player; 4 | import net.minecraft.world.inventory.PlayerEnderChestContainer; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(Player.class) 9 | public interface IMixinPlayerEntity 10 | { 11 | @Accessor("enderChestInventory") 12 | PlayerEnderChestContainer malilib_getEnderItems(); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/screen/IMixinHandledScreen.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.screen; 2 | 3 | import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; 4 | import net.minecraft.world.inventory.Slot; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(AbstractContainerScreen.class) 9 | public interface IMixinHandledScreen 10 | { 11 | @Accessor("hoveredSlot") 12 | Slot malilib_getFocusedSlot(); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigLockedListType.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | import javax.annotation.Nullable; 4 | import com.google.common.collect.ImmutableList; 5 | 6 | public interface IConfigLockedListType 7 | { 8 | // @ApiStatus.Experimental 9 | // default Codec codec() { return null; } 10 | 11 | ImmutableList getDefaultEntries(); 12 | 13 | @Nullable IConfigLockedListEntry fromString(String string); 14 | } 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![](https://jitpack.io/v/sakura-ryoko/malilib.svg)](https://jitpack.io/#sakura-ryoko/malilib) 2 | 3 | malilib 4 | ============== 5 | malilib is a library mod used by masa's LiteLoader mods. It contains some common code previously 6 | duplicated in most of the mods, such as multi-key capable keybinds, configuration GUIs etc. 7 | 8 | Compiling 9 | ========= 10 | * Clone the repository 11 | * Open a command prompt/terminal to the repository directory 12 | * run 'gradlew build' 13 | * The built jar file will be in build/libs/ 14 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigOptionListEntry.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | public interface IConfigOptionListEntry 4 | { 5 | // @ApiStatus.Experimental 6 | // Codec codec(); 7 | 8 | String getStringValue(); 9 | 10 | String getDisplayName(); 11 | 12 | IConfigOptionListEntry cycle(boolean forward); 13 | 14 | IConfigOptionListEntry fromString(String value); 15 | 16 | static IConfigOptionListEntry empty() { return null; } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/options/table/Label.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config.options.table; 2 | 3 | public record Label(String label, String comment) 4 | { 5 | public static Label of(String label, String comment) 6 | { 7 | return new Label(label, comment); 8 | } 9 | 10 | public static Label of(String label) 11 | { 12 | return new Label(label, ""); 13 | } 14 | 15 | public static Label of() 16 | { 17 | return new Label("", ""); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/interfaces/IFileBrowserIconProvider.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui.interfaces; 2 | 3 | import java.nio.file.Path; 4 | import javax.annotation.Nullable; 5 | 6 | public interface IFileBrowserIconProvider 7 | { 8 | IGuiIcon getIconRoot(); 9 | 10 | IGuiIcon getIconUp(); 11 | 12 | IGuiIcon getIconCreateDirectory(); 13 | 14 | IGuiIcon getIconSearch(); 15 | 16 | IGuiIcon getIconDirectory(); 17 | 18 | @Nullable 19 | IGuiIcon getIconForFile(Path file); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/hotkeys/IKeyboardInputHandler.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.hotkeys; 2 | 3 | import net.minecraft.client.input.KeyEvent; 4 | 5 | public interface IKeyboardInputHandler 6 | { 7 | /** 8 | * Called on keyboard events with the keyCode and scanCode and modifiers, and whether the key was pressed or released. 9 | * 10 | * @param input () 11 | * @param eventKeyState () 12 | * @return () 13 | */ 14 | default boolean onKeyInput(KeyEvent input, boolean eventKeyState) 15 | { 16 | return false; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/render/IMixinBufferBuilder.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.render; 2 | 3 | import com.mojang.blaze3d.vertex.BufferBuilder; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.gen.Accessor; 6 | 7 | @Mixin(BufferBuilder.class) 8 | public interface IMixinBufferBuilder 9 | { 10 | @Accessor("building") 11 | boolean malilib_isBuilding(); 12 | 13 | @Accessor("vertices") 14 | int malilib_getVertexCount(); 15 | 16 | @Accessor("vertexPointer") 17 | long malilib_getVertexPointer(); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/nbt/IMixinNbtWriteView.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.nbt; 2 | 3 | import com.mojang.serialization.DynamicOps; 4 | import net.minecraft.nbt.CompoundTag; 5 | import net.minecraft.world.level.storage.TagValueOutput; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | 9 | @Mixin(TagValueOutput.class) 10 | public interface IMixinNbtWriteView 11 | { 12 | @Accessor("ops") 13 | DynamicOps malilib_getOps(); 14 | 15 | @Accessor("output") 16 | CompoundTag malilib_getNbt(); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/render/InventoryOverlayType.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.render; 2 | 3 | /** 4 | * Replaces the old / ugly method. 5 | */ 6 | public enum InventoryOverlayType 7 | { 8 | BREWING_STAND, 9 | CRAFTER, 10 | DISPENSER, 11 | FURNACE, 12 | HOPPER, 13 | HORSE, 14 | LLAMA, 15 | NAUTILUS, 16 | WOLF, 17 | HAPPY_GHAST, 18 | COPPER_GOLEM, 19 | FIXED_27, 20 | FIXED_54, 21 | VILLAGER, 22 | PLAYER, 23 | ENDER_CHEST, 24 | BOOKSHELF, 25 | WALL_SHELF, 26 | SINGLE_ITEM, 27 | BUNDLE, 28 | ARMOR_STAND, 29 | LIVING_ENTITY, 30 | GENERIC 31 | } 32 | -------------------------------------------------------------------------------- /src/main/resources/assets/malilib/shaders/sv_selector.frag: -------------------------------------------------------------------------------- 1 | #version 120 2 | 3 | // Made by skyrising 4 | 5 | uniform float hue_value; 6 | 7 | vec3 hue2rgb(float h) 8 | { 9 | float r = abs(h * 6.0 - 3.0) - 1.0; 10 | float g = 2.0 - abs(h * 6.0 - 2.0); 11 | float b = 2.0 - abs(h * 6.0 - 4.0); 12 | return clamp(vec3(r, g, b), 0.0, 1.0); 13 | } 14 | 15 | vec3 hsv2rgb(vec3 hsv) 16 | { 17 | vec3 rgb = hue2rgb(hsv.x); 18 | return ((rgb - 1.0) * hsv.y + 1.0) * hsv.z; 19 | } 20 | 21 | void main() 22 | { 23 | gl_FragColor = vec4(hsv2rgb(vec3(mod(hue_value, 1.0), gl_TexCoord[0].xy)), 1.0); 24 | } -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/BaseScreen.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui; 2 | 3 | import net.minecraft.client.gui.screens.Screen; 4 | import org.jetbrains.annotations.ApiStatus; 5 | 6 | /** 7 | * Wrapper class for Post-Rewrite Compatibility 8 | */ 9 | @ApiStatus.Experimental 10 | public abstract class BaseScreen extends GuiBase 11 | { 12 | public BaseScreen() {} 13 | 14 | public void initGui() 15 | { 16 | super.initGui(); 17 | } 18 | 19 | public static void openScreen(Screen screen) 20 | { 21 | GuiBase.openGui(screen); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/hotkeys/KeyCallbackToggleBoolean.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.hotkeys; 2 | 3 | import fi.dy.masa.malilib.config.IConfigBoolean; 4 | 5 | public class KeyCallbackToggleBoolean implements IHotkeyCallback 6 | { 7 | protected final IConfigBoolean config; 8 | 9 | public KeyCallbackToggleBoolean(IConfigBoolean config) 10 | { 11 | this.config = config; 12 | } 13 | 14 | @Override 15 | public boolean onKeyAction(KeyAction action, IKeybind key) 16 | { 17 | this.config.toggleBooleanValue(); 18 | return true; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/MaLiLibCallbacks.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib; 2 | 3 | import net.minecraft.client.Minecraft; 4 | 5 | import fi.dy.masa.malilib.config.IConfigBoolean; 6 | 7 | public class MaLiLibCallbacks 8 | { 9 | public static void init() 10 | { 11 | MaLiLibConfigs.Generic.RENDER_TRANSPARENCY_FIX.setValueChangeCallback(MaLiLibCallbacks::RenderFixCallback); 12 | } 13 | 14 | public static void RenderFixCallback(IConfigBoolean config) 15 | { 16 | if (config.getBooleanValue()) 17 | { 18 | Minecraft.getInstance().options.improvedTransparency().set(false); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/item/IMixinContainerComponent.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.item; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import net.minecraft.core.NonNullList; 6 | import net.minecraft.world.item.ItemStack; 7 | import net.minecraft.world.item.component.ItemContainerContents; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.gen.Accessor; 10 | 11 | @Mixin(ItemContainerContents.class) 12 | public interface IMixinContainerComponent 13 | { 14 | @Accessor("items") 15 | NonNullList<@NotNull ItemStack> malilib_getStacks(); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigHandler.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | public interface IConfigHandler 4 | { 5 | /** 6 | * Called when some settings have (potentially) been changed via some of the config GUIs 7 | */ 8 | default void onConfigsChanged() 9 | { 10 | this.save(); 11 | this.load(); 12 | } 13 | 14 | /** 15 | * Called after game launch to load the configs from file 16 | */ 17 | void load(); 18 | 19 | /** 20 | * Called to save any potential config changes to a file 21 | */ 22 | void save(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/nbt/IMixinNbtReadView.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.nbt; 2 | 3 | import net.minecraft.nbt.CompoundTag; 4 | import net.minecraft.world.level.storage.TagValueInput; 5 | import net.minecraft.world.level.storage.ValueInputContextHelper; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | 9 | @Mixin(TagValueInput.class) 10 | public interface IMixinNbtReadView 11 | { 12 | @Accessor("context") 13 | ValueInputContextHelper malilib_getContext(); 14 | 15 | @Accessor("input") 16 | CompoundTag malilib_getNbt(); 17 | } 18 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # text stuff 2 | * text=auto 3 | *.bat text eol=crlf 4 | *.groovy text eol=lf 5 | *.java text eol=crlf 6 | *.md text 7 | *.properties text eol=lf 8 | *.scala text eol=lf 9 | *.sh text eol=lf 10 | .gitattributes text eol=lf 11 | .gitignore text eol=lf 12 | build.gradle text eol=lf 13 | gradlew text eol=lf 14 | gradle/wrapper/gradle-wrapper.properties text eol=crlf 15 | COPYING.txt text eol=lf 16 | COPYING.LESSER.txt text eol=lf 17 | README.md text eol=lf 18 | 19 | #binary 20 | *.dat binary 21 | *.bin binary 22 | *.png binary 23 | *.exe binary 24 | *.dll binary 25 | *.zip binary 26 | *.jar binary 27 | *.7z binary 28 | *.db binary 29 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/compat/modmenu/ModMenuImpl.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.compat.modmenu; 2 | 3 | import com.terraformersmc.modmenu.api.ConfigScreenFactory; 4 | import com.terraformersmc.modmenu.api.ModMenuApi; 5 | import fi.dy.masa.malilib.MaLiLibConfigGui; 6 | 7 | public class ModMenuImpl implements ModMenuApi 8 | { 9 | @Override 10 | public ConfigScreenFactory getModConfigScreenFactory() 11 | { 12 | return (screen) -> { 13 | MaLiLibConfigGui gui = new MaLiLibConfigGui(); 14 | gui.setParent(screen); 15 | return gui; 16 | }; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/input/IMixinKeyBinding.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.input; 2 | 3 | import com.mojang.blaze3d.platform.InputConstants; 4 | import net.minecraft.client.KeyMapping; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(KeyMapping.class) 9 | public interface IMixinKeyBinding 10 | { 11 | @Accessor("defaultKey") 12 | InputConstants.Key malilib$getDefaultKey(); 13 | 14 | @Accessor("key") 15 | InputConstants.Key malilib$getBoundKey(); 16 | 17 | @Accessor("category") 18 | KeyMapping.Category malilib$getCategory(); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/recipe/IMixinClientRecipeBook.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.recipe; 2 | 3 | import java.util.Map; 4 | import net.minecraft.client.ClientRecipeBook; 5 | import net.minecraft.world.item.crafting.display.RecipeDisplayEntry; 6 | import net.minecraft.world.item.crafting.display.RecipeDisplayId; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.gen.Accessor; 9 | 10 | @Mixin(ClientRecipeBook.class) 11 | public interface IMixinClientRecipeBook 12 | { 13 | @Accessor("known") 14 | Map malilib_getRecipeMap(); 15 | } 16 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs = -Xmx3G 2 | org.gradle.daemon = false 3 | org.gradle.cache.cleanup = false 4 | 5 | group = fi.dy.masa 6 | mod_id = malilib 7 | mod_name = MaLiLib 8 | author = masa 9 | mod_file_name = malilib-fabric 10 | 11 | # Current mod version 12 | mod_version = 0.27.2 13 | 14 | # Minecraft, Fabric Loader and API and mappings versions 15 | minecraft_version_out = 1.21.11 16 | minecraft_version = 1.21.11 17 | mappings_version = 1.21.11+build.3 18 | 19 | fabric_loader_version = 0.18.2 20 | mod_menu_version = 17.0.0-alpha.1 21 | fabric_api_version = 0.139.5+1.21.11 22 | 23 | iris_version = 1.10.2 24 | iris_mc_version = 1.21.11 25 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/render/IMixinAbstractTexture.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.render; 2 | 3 | import com.mojang.blaze3d.textures.GpuTexture; 4 | import com.mojang.blaze3d.textures.GpuTextureView; 5 | import net.minecraft.client.renderer.texture.AbstractTexture; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.gen.Accessor; 8 | 9 | @Mixin(AbstractTexture.class) 10 | public interface IMixinAbstractTexture 11 | { 12 | @Accessor("texture") 13 | GpuTexture malilib_getGlTexture(); 14 | 15 | @Accessor("textureView") 16 | GpuTextureView malilib_getGlTextureView(); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/render/InventoryOverlayContext.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.render; 2 | 3 | import javax.annotation.Nullable; 4 | import net.minecraft.world.Container; 5 | import net.minecraft.world.entity.LivingEntity; 6 | import net.minecraft.world.level.block.entity.BlockEntity; 7 | import fi.dy.masa.malilib.util.data.tag.CompoundData; 8 | 9 | /** 10 | * Replaces the old / ugly method. 11 | */ 12 | public record InventoryOverlayContext(InventoryOverlayType type, @Nullable Container inv, @Nullable BlockEntity be, @Nullable LivingEntity entity, @Nullable CompoundData data, InventoryOverlayRefresher refresher) 13 | { 14 | } 15 | -------------------------------------------------------------------------------- /src/main/resources/malilib.accesswidener: -------------------------------------------------------------------------------- 1 | accessWidener v2 named 2 | extendable class net/minecraft/client/gui/GuiGraphics 3 | transitive-accessible class net/minecraft/client/gui/GuiGraphics$ScissorStack 4 | transitive-accessible field net/minecraft/client/gui/GuiGraphics scissorStack Lnet/minecraft/client/gui/GuiGraphics$ScissorStack; 5 | transitive-accessible field net/minecraft/client/gui/components/debug/DebugScreenEntries ENTRIES_BY_ID Ljava/util/Map; 6 | transitive-accessible method net/minecraft/client/gui/components/debug/DebugScreenEntries register (Lnet/minecraft/resources/Identifier;Lnet/minecraft/client/gui/components/debug/DebugScreenEntry;)Lnet/minecraft/resources/Identifier; 7 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/LeftRight.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui; 2 | 3 | public enum LeftRight 4 | { 5 | LEFT 6 | { 7 | @Override 8 | public int choose(int left, int right) {return left;} 9 | }, 10 | RIGHT 11 | { 12 | @Override 13 | public int choose(int left, int right) {return right;} 14 | }, 15 | CENTER 16 | { 17 | @Override 18 | public int choose(int left, int right) {return (left + right) >> 1;} 19 | }; 20 | 21 | public abstract int choose(int left, int right); 22 | 23 | public int getLeft(int left, int right, int width, int reserved) 24 | { 25 | return choose(left + reserved, right - reserved - width); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/render/IMixinGuiRenderer.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.render; 2 | 3 | import java.util.Map; 4 | 5 | import net.minecraft.client.gui.render.GuiRenderer; 6 | import net.minecraft.client.gui.render.pip.PictureInPictureRenderer; 7 | import net.minecraft.client.gui.render.state.pip.PictureInPictureRenderState; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.gen.Accessor; 10 | 11 | @Mixin(GuiRenderer.class) 12 | public interface IMixinGuiRenderer 13 | { 14 | @Accessor("pictureInPictureRenderers") 15 | Map, PictureInPictureRenderer> malilib_getSpecialGuiRenderers(); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/gui/ButtonPressDirtyListenerSimple.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config.gui; 2 | 3 | import fi.dy.masa.malilib.gui.button.ButtonBase; 4 | import fi.dy.masa.malilib.gui.button.IButtonActionListener; 5 | 6 | public class ButtonPressDirtyListenerSimple implements IButtonActionListener 7 | { 8 | private boolean dirty; 9 | 10 | @Override 11 | public void actionPerformedWithButton(ButtonBase button, int mouseButton) 12 | { 13 | this.dirty = true; 14 | } 15 | 16 | public boolean isDirty() 17 | { 18 | return this.dirty; 19 | } 20 | 21 | public void resetDirty() 22 | { 23 | this.dirty = false; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/ConfigInfoProviderSimple.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui; 2 | 3 | import fi.dy.masa.malilib.config.IConfigBase; 4 | import fi.dy.masa.malilib.gui.interfaces.IConfigInfoProvider; 5 | 6 | public class ConfigInfoProviderSimple implements IConfigInfoProvider 7 | { 8 | protected final String prefix; 9 | protected final String suffix; 10 | 11 | public ConfigInfoProviderSimple(String prefix, String suffix) 12 | { 13 | this.prefix = prefix; 14 | this.suffix = suffix; 15 | } 16 | 17 | @Override 18 | public String getHoverInfo(IConfigBase config) 19 | { 20 | return this.prefix + config.getPrettyName() + this.suffix; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IStringRepresentable.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | import fi.dy.masa.malilib.interfaces.IStringValue; 4 | 5 | public interface IStringRepresentable extends IStringValue 6 | { 7 | String getDefaultStringValue(); 8 | 9 | /** 10 | * Parses the value of this config from a String. Used for example to get the new value from 11 | * the config GUI textfield. 12 | * @param value 13 | */ 14 | void setValueFromString(String value); 15 | 16 | /** 17 | * Checks whether or not the given value would be modified from the default value. 18 | * @param newValue 19 | * @return 20 | */ 21 | boolean isModified(String newValue); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/util/data/tag/util/SizeTracker.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.util.data.tag.util; 2 | 3 | import java.io.IOException; 4 | 5 | public class SizeTracker 6 | { 7 | private final long maxBytes; 8 | private long currentBytes; 9 | 10 | public SizeTracker(long maxBytes) 11 | { 12 | this.maxBytes = maxBytes; 13 | } 14 | 15 | public void increment(int numBytes) throws IOException 16 | { 17 | this.currentBytes += numBytes; 18 | 19 | if (this.maxBytes > 0 && this.currentBytes > this.maxBytes) 20 | { 21 | throw new IOException("SizeTracker limit exceeded, limit = " + this.maxBytes + ", current = " + this.currentBytes); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/interfaces/IClientCommandListener.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.interfaces; 2 | 3 | import java.util.List; 4 | import net.minecraft.client.Minecraft; 5 | 6 | public interface IClientCommandListener 7 | { 8 | /** 9 | * Return the value of the command; such as the `/' or '#' 10 | * --> NOTE: That if you are using `/` Vanilla may still throw an invalid command error. 11 | * @return (string of command) 12 | */ 13 | String getCommand(); 14 | 15 | /** 16 | * Execute the command with args as a callback; 17 | * return if it should cancel further processing. 18 | * @return (True|False) 19 | */ 20 | boolean execute(List args, Minecraft mc); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/hud/IMixinDebugHudProfile.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.hud; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | import net.minecraft.client.gui.components.debug.DebugScreenEntryList; 6 | import net.minecraft.client.gui.components.debug.DebugScreenEntryStatus; 7 | import net.minecraft.resources.Identifier; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.gen.Accessor; 10 | 11 | @Mixin(DebugScreenEntryList.class) 12 | public interface IMixinDebugHudProfile 13 | { 14 | @Accessor("allStatuses") 15 | Map malilib$getVisibilityMap(); 16 | 17 | @Accessor("currentlyEnabled") 18 | List malilib$getVisibleEntries(); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/hotkeys/KeyCallbackToggleBooleanConfigWithMessage.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.hotkeys; 2 | 3 | import fi.dy.masa.malilib.config.IConfigBoolean; 4 | import fi.dy.masa.malilib.util.InfoUtils; 5 | 6 | public class KeyCallbackToggleBooleanConfigWithMessage extends KeyCallbackToggleBoolean 7 | { 8 | public KeyCallbackToggleBooleanConfigWithMessage(IConfigBoolean config) 9 | { 10 | super(config); 11 | } 12 | 13 | @Override 14 | public boolean onKeyAction(KeyAction action, IKeybind key) 15 | { 16 | super.onKeyAction(action, key); 17 | 18 | InfoUtils.printBooleanConfigToggleMessage(this.config.getPrettyName(), this.config.getBooleanValue()); 19 | 20 | return true; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigLockedList.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | import java.util.List; 4 | import javax.annotation.Nullable; 5 | import com.google.common.collect.ImmutableList; 6 | 7 | public interface IConfigLockedList extends IConfigBase 8 | { 9 | ImmutableList getDefaultEntries(); 10 | 11 | List getEntries(); 12 | 13 | List getConfigKeys(); 14 | 15 | void setEntries(List entries); 16 | 17 | @Nullable 18 | IConfigLockedListEntry getEmpty(); 19 | 20 | @Nullable 21 | IConfigLockedListEntry getEntry(String key); 22 | 23 | int getEntryIndex(IConfigLockedListEntry entry); 24 | 25 | void setModified(); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/test/TestDataSyncer.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.test; 2 | 3 | import org.jetbrains.annotations.ApiStatus; 4 | import fi.dy.masa.malilib.interfaces.IDataSyncer; 5 | import fi.dy.masa.malilib.util.WorldUtils; 6 | import net.minecraft.client.Minecraft; 7 | import net.minecraft.world.level.Level; 8 | 9 | @ApiStatus.Experimental 10 | public class TestDataSyncer implements IDataSyncer 11 | { 12 | private static final TestDataSyncer INSTANCE = new TestDataSyncer(); 13 | 14 | public TestDataSyncer() { } 15 | 16 | public static TestDataSyncer getInstance() { return INSTANCE; } 17 | 18 | @Override 19 | public Level getWorld() 20 | { 21 | return WorldUtils.getBestWorld(Minecraft.getInstance()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/widgets/WidgetListEntryBase.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui.widgets; 2 | 3 | import javax.annotation.Nullable; 4 | 5 | public class WidgetListEntryBase extends WidgetContainer 6 | { 7 | @Nullable protected final TYPE entry; 8 | protected final int listIndex; 9 | 10 | public WidgetListEntryBase(int x, int y, int width, int height, @Nullable TYPE entry, int listIndex) 11 | { 12 | super(x, y, width, height); 13 | 14 | this.entry = entry; 15 | this.listIndex = listIndex; 16 | } 17 | 18 | @Nullable 19 | public TYPE getEntry() 20 | { 21 | return this.entry; 22 | } 23 | 24 | public int getListIndex() 25 | { 26 | return this.listIndex; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/interfaces/ICoordinateValueModifier.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.interfaces; 2 | 3 | import fi.dy.masa.malilib.util.position.PositionUtils.CoordinateType; 4 | 5 | public interface ICoordinateValueModifier 6 | { 7 | /** 8 | * Modifies the existing value by the given amount 9 | * @param type () 10 | * @param amount () 11 | * @return (True|False) 12 | */ 13 | boolean modifyValue(CoordinateType type, int amount); 14 | 15 | /** 16 | * Sets the coordinate indicated by type to the value parsed from the string newValue 17 | * @param type () 18 | * @param newValue () 19 | * @return (True|False) 20 | */ 21 | boolean setValueFromString(CoordinateType type, String newValue); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/data/CachedTagKey.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.data; 2 | 3 | import fi.dy.masa.malilib.MaLiLibReference; 4 | import net.minecraft.resources.Identifier; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | public record CachedTagKey(String modId, String tag) 8 | { 9 | public static CachedTagKey fromString(String str) 10 | { 11 | Identifier id = Identifier.tryParse(str); 12 | 13 | if (id != null) 14 | { 15 | return new CachedTagKey(id.getNamespace(), id.getPath()); 16 | } 17 | 18 | return new CachedTagKey(MaLiLibReference.MOD_ID, str); 19 | } 20 | 21 | @Override 22 | public @NotNull String toString() 23 | { 24 | return this.modId() + ":" + this.tag(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/widgets/WidgetInfoIcon.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui.widgets; 2 | 3 | import fi.dy.masa.malilib.gui.interfaces.IGuiIcon; 4 | import fi.dy.masa.malilib.render.GuiContext; 5 | 6 | public class WidgetInfoIcon extends WidgetHoverInfo 7 | { 8 | protected final IGuiIcon icon; 9 | 10 | public WidgetInfoIcon(int x, int y, IGuiIcon icon, String key, Object... args) 11 | { 12 | super(x, y, icon.getWidth(), icon.getHeight(), key, args); 13 | 14 | this.icon = icon; 15 | } 16 | 17 | @Override 18 | public void render(GuiContext ctx, int mouseX, int mouseY, boolean selected) 19 | { 20 | super.render(ctx, mouseX, mouseY, selected); 21 | this.icon.renderAt(ctx, this.x, this.y, this.zLevel, false, selected); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/registry/Registry.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.registry; 2 | 3 | import fi.dy.masa.malilib.gui.config.registry.ConfigScreenRegistry; 4 | import fi.dy.masa.malilib.interoperation.BlockPlacementPositionHandler; 5 | 6 | /** 7 | * Post-ReWrite code 8 | */ 9 | public class Registry 10 | { 11 | // Registries 12 | //public static final ConfigTabRegistry CONFIG_TAB = new ConfigTabRegistryImpl(); 13 | //public static final ConfigTabExtensionRegistry CONFIG_TAB_EXTENSION = new ConfigTabExtensionRegistry(); 14 | 15 | // Event dispatchers and handlers 16 | public static final BlockPlacementPositionHandler BLOCK_PLACEMENT_POSITION_HANDLER = new BlockPlacementPositionHandler(); 17 | public static final ConfigScreenRegistry CONFIG_SCREEN = new ConfigScreenRegistry(); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/value/FileWriteType.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config.value; 2 | 3 | import com.google.common.collect.ImmutableList; 4 | 5 | /** 6 | * Post-ReWrite code 7 | */ 8 | public class FileWriteType extends BaseOptionListConfigValue 9 | { 10 | public static final FileWriteType NORMAL_WRITE = new FileWriteType("normal_write", "malilib.name.file_write_type.normal_write"); 11 | public static final FileWriteType TEMP_AND_RENAME = new FileWriteType("temp_and_rename", "malilib.name.file_write_type.temp_and_rename"); 12 | 13 | public static final ImmutableList VALUES = ImmutableList.of(NORMAL_WRITE, TEMP_AND_RENAME); 14 | 15 | private FileWriteType(String name, String translationKey) 16 | { 17 | super(name, translationKey); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/util/log/IAnsiLogger.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Cloned from CoreLib by Sakura Ryoko; Originally written under CSVTool by Sakura. 3 | */ 4 | package fi.dy.masa.malilib.util.log; 5 | 6 | public interface IAnsiLogger 7 | { 8 | default String format(final String format, final Object... args) 9 | { 10 | String result = format; 11 | 12 | for (Object arg : args) 13 | { 14 | result = result.replaceFirst("\\{\\}", arg.toString()); 15 | } 16 | 17 | return result; 18 | } 19 | 20 | void info(String fmt, Object... args); 21 | 22 | void debug(String fmt, Object... args); 23 | 24 | void warn(String fmt, Object... args); 25 | 26 | void error(String fmt, Object... args); 27 | 28 | void fatal(String fmt, Object... args); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/util/time/formatter/DurationFmtRegular.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.util.time.formatter; 2 | 3 | import javax.annotation.Nullable; 4 | import org.apache.commons.lang3.time.DurationFormatUtils; 5 | import org.jetbrains.annotations.ApiStatus; 6 | 7 | import fi.dy.masa.malilib.util.time.DurationFormat; 8 | 9 | /** 10 | * Ported from CoreLib by Sakura Ryoko 11 | */ 12 | @ApiStatus.Internal 13 | public class DurationFmtRegular extends DurationFmt 14 | { 15 | public DurationFmtRegular(DurationFormat fmt) 16 | { 17 | super(fmt); 18 | this.formatString = "HH:mm:ss.SSS"; 19 | } 20 | 21 | @Override 22 | public String format(long duration, @Nullable String fmt) 23 | { 24 | return DurationFormatUtils.formatDurationHMS(duration); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/test/MixinSharedConstants.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.test; 2 | 3 | import net.minecraft.SharedConstants; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.Shadow; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | import fi.dy.masa.malilib.MaLiLibReference; 11 | 12 | @Mixin(SharedConstants.class) 13 | public class MixinSharedConstants 14 | { 15 | @Shadow public static boolean IS_RUNNING_IN_IDE; 16 | 17 | @Inject(method = "", at = @At("TAIL")) 18 | private static void malilib_sharedConstants(CallbackInfo ci) 19 | { 20 | IS_RUNNING_IN_IDE = MaLiLibReference.DEBUG_MODE; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/entity/MixinSimpleInventory.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.entity; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Unique; 5 | 6 | import fi.dy.masa.malilib.util.game.IEntityOwnedInventory; 7 | import net.minecraft.world.Container; 8 | import net.minecraft.world.SimpleContainer; 9 | import net.minecraft.world.entity.Entity; 10 | 11 | @Mixin(SimpleContainer.class) 12 | public abstract class MixinSimpleInventory implements IEntityOwnedInventory, Container 13 | { 14 | @Unique Entity entityOwner; 15 | 16 | @Override 17 | public Entity malilib$getEntityOwner() 18 | { 19 | return entityOwner; 20 | } 21 | 22 | @Override 23 | public void malilib$setEntityOwner(Entity entityOwner) 24 | { 25 | this.entityOwner = entityOwner; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/interfaces/ISliderCallback.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui.interfaces; 2 | 3 | public interface ISliderCallback 4 | { 5 | /** 6 | * Maximum number of values/steps the underlying data can have. 7 | * Return Integer.MAX_VALUE for unlimited/non-specified, like double data type ranges. 8 | * @return () 9 | */ 10 | int getMaxSteps(); 11 | 12 | /** 13 | * Returns the relative value (within the min - max range) 14 | * @return () 15 | */ 16 | double getValueRelative(); 17 | 18 | /** 19 | * Sets the value 20 | * @param relativeValue) 21 | */ 22 | void setValueRelative(double relativeValue); 23 | 24 | /** 25 | * Returns the formatted display string for the current value 26 | * @return () 27 | */ 28 | String getFormattedDisplayValue(); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/widgets/WidgetIcon.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui.widgets; 2 | 3 | import fi.dy.masa.malilib.gui.interfaces.IGuiIcon; 4 | import fi.dy.masa.malilib.render.GuiContext; 5 | import fi.dy.masa.malilib.render.RenderUtils; 6 | 7 | public class WidgetIcon extends WidgetBase 8 | { 9 | protected final IGuiIcon icon; 10 | 11 | public WidgetIcon(int x, int y, IGuiIcon icon) 12 | { 13 | super(x, y, icon.getWidth(), icon.getHeight()); 14 | 15 | this.icon = icon; 16 | } 17 | 18 | public void render(GuiContext ctx, boolean enabled, boolean selected) 19 | { 20 | this.icon.renderAt(ctx, this.x, this.y, this.zLevel, enabled, selected); 21 | 22 | if (selected) 23 | { 24 | RenderUtils.drawOutlinedBox(ctx, this.x, this.y, this.width, this.height, 0x20C0C0C0, 0xE0FFFFFF); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/render/MixinGlBackend.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.render; 2 | 3 | import com.mojang.blaze3d.opengl.GlDevice; 4 | import com.mojang.blaze3d.shaders.ShaderSource; 5 | import com.mojang.blaze3d.systems.GpuDevice; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 10 | 11 | import fi.dy.masa.malilib.compat.lwgl.GpuCompat; 12 | 13 | @Mixin(GlDevice.class) 14 | public class MixinGlBackend 15 | { 16 | @Inject(method = "", at = @At("TAIL")) 17 | private void malilib_onGlBackendInit(long contextId, int debugVerbosity, boolean sync, ShaderSource defaultShaderSourceGetter, boolean renderDebugLabels, CallbackInfo ci) 18 | { 19 | GpuCompat.init((GpuDevice) this); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/render/IMixinGameRenderer.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.render; 2 | 3 | import net.minecraft.client.gui.render.GuiRenderer; 4 | import net.minecraft.client.gui.render.state.GuiRenderState; 5 | import net.minecraft.client.renderer.GameRenderer; 6 | import net.minecraft.client.renderer.GlobalSettingsUniform; 7 | import net.minecraft.client.renderer.fog.FogRenderer; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.gen.Accessor; 10 | 11 | @Mixin(GameRenderer.class) 12 | public interface IMixinGameRenderer 13 | { 14 | @Accessor("globalSettingsUniform") 15 | GlobalSettingsUniform malilib_getGlobalSettings(); 16 | 17 | @Accessor("fogRenderer") 18 | FogRenderer malilib_getFogRenderer(); 19 | 20 | @Accessor("guiRenderer") 21 | GuiRenderer malilib_getGuiRenderer(); 22 | 23 | @Accessor("guiRenderState") 24 | GuiRenderState malilib_getGuiRenderState(); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/hotkeys/IKeybindProvider.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.hotkeys; 2 | 3 | public interface IKeybindProvider 4 | { 5 | /** 6 | * Called when the keybind map is refreshed/recreated. 7 | * Classes implementing this interface should add all of their keybinds 8 | * using the {@link IKeybindManager#addKeybindToMap(IKeybind)} method when this method is called. 9 | * Assume any previously added keybinds have been cleared just before this method is called. 10 | * @param manager () 11 | */ 12 | void addKeysToMap(IKeybindManager manager); 13 | 14 | /** 15 | * Called when the event handler is registered. 16 | * Any mod that wants all their keybinds to appear in the master/combined list of all 17 | * keybinds, should add them here using the {@link IKeybindManager#addHotkeysForCategory(String, String, java.util.List)} method). 18 | * @param manager () 19 | */ 20 | void addHotkeys(IKeybindManager manager); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/gui/interfaces/IKeybindConfigGui.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.gui.interfaces; 2 | 3 | import javax.annotation.Nullable; 4 | import fi.dy.masa.malilib.gui.button.ConfigButtonKeybind; 5 | 6 | public interface IKeybindConfigGui extends IConfigGui 7 | { 8 | /** 9 | * Adds a hotkey keybind change listener. These will be used for updating the used 10 | * keys in the keybind handler after the hotkeys were changed, and also 11 | * for updating the hotkey config buttons in the GUI. 12 | * @param listener () 13 | */ 14 | void addKeybindChangeListener(Runnable listener); 15 | 16 | /** 17 | * Sets or clears the currently active/selected hotkey config button. 18 | * The active button reference is used for capturing the new hotkey combination, 19 | * and for updating the button appearance when gaining or losing the focus. 20 | * @param button () 21 | */ 22 | void setActiveKeybindButton(@Nullable ConfigButtonKeybind button); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/util/time/formatter/DurationFmt.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.util.time.formatter; 2 | 3 | import javax.annotation.Nullable; 4 | import org.jetbrains.annotations.ApiStatus; 5 | 6 | import fi.dy.masa.malilib.util.time.DurationFormat; 7 | 8 | /** 9 | * Ported from CoreLib by Sakura Ryoko 10 | */ 11 | @ApiStatus.Internal 12 | public abstract class DurationFmt 13 | { 14 | protected DurationFormat type; 15 | protected String formatString; 16 | 17 | public DurationFmt(DurationFormat fmt) 18 | { 19 | this.formatString = ""; 20 | this.type = fmt; 21 | } 22 | 23 | public DurationFormat getType() 24 | { 25 | return this.type; 26 | } 27 | 28 | public String format(long duration) { return this.format(duration, null); } 29 | 30 | public String format(long duration, @Nullable String fmt) { return ""; } 31 | 32 | public String getFormatString() 33 | { 34 | return this.formatString; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/resources/assets/malilib/shaders/legacy_terrain.vsh: -------------------------------------------------------------------------------- 1 | #version 330 2 | 3 | #moj_import 4 | #moj_import 5 | #moj_import 6 | 7 | in vec3 Position; 8 | in vec4 Color; 9 | in vec2 UV0; 10 | in ivec2 UV2; 11 | in vec3 Normal; 12 | 13 | uniform sampler2D Sampler2; 14 | 15 | out float sphericalVertexDistance; 16 | out float cylindricalVertexDistance; 17 | out vec4 vertexColor; 18 | out vec2 texCoord0; 19 | 20 | vec4 minecraft_sample_lightmap(sampler2D lightMap, ivec2 uv) { 21 | return texture(lightMap, clamp((uv / 256.0) + 0.5 / 16.0, vec2(0.5 / 16.0), vec2(15.5 / 16.0))); 22 | } 23 | 24 | void main() { 25 | vec3 pos = Position + ModelOffset; 26 | gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0); 27 | 28 | sphericalVertexDistance = fog_spherical_distance(pos); 29 | cylindricalVertexDistance = fog_cylindrical_distance(pos); 30 | vertexColor = Color * minecraft_sample_lightmap(Sampler2, UV2); 31 | texCoord0 = UV0; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/interoperation/IBlockPlacementPositionProvider.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.interoperation; 2 | 3 | import javax.annotation.Nullable; 4 | import net.minecraft.core.BlockPos; 5 | import org.jetbrains.annotations.ApiStatus; 6 | 7 | /** 8 | * Post-ReWrite code 9 | */ 10 | @ApiStatus.Experimental 11 | public interface IBlockPlacementPositionProvider 12 | { 13 | /** 14 | * Returns the block placement position that should be used 15 | * for the current situation. 16 | * This allows mods that want to modify the normal vanilla block placement 17 | * position to indicate that change to other mods that want to do something 18 | * with the placement position. 19 | * If the implementer does not currently want to modify the normal placement 20 | * position, then it should return null. 21 | * @return The overridden block placement position, or null if no changes should occur at the moment 22 | */ 23 | @Nullable 24 | BlockPos getPlacementPosition(); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/util/data/tag/EmptyData.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.util.data.tag; 2 | 3 | import java.io.DataInput; 4 | import java.io.DataOutput; 5 | import java.io.IOException; 6 | 7 | import fi.dy.masa.malilib.util.data.Constants; 8 | import fi.dy.masa.malilib.util.data.tag.util.SizeTracker; 9 | 10 | public class EmptyData extends BaseData 11 | { 12 | public static final String TAG_NAME = "TAG_End"; 13 | public static final EmptyData INSTANCE = new EmptyData(); 14 | 15 | protected EmptyData() 16 | { 17 | super(Constants.NBT.TAG_END, TAG_NAME); 18 | } 19 | 20 | @Override 21 | public EmptyData copy() 22 | { 23 | return this; 24 | } 25 | 26 | @Override 27 | public String toString() 28 | { 29 | return ""; 30 | } 31 | 32 | @Override 33 | public void write(DataOutput output) throws IOException 34 | { 35 | } 36 | 37 | public static EmptyData read(DataInput input, int depth, SizeTracker sizeTracker) throws IOException 38 | { 39 | return new EmptyData(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/event/IWorldLoadManager.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.event; 2 | 3 | import fi.dy.masa.malilib.interfaces.IWorldLoadListener; 4 | 5 | public interface IWorldLoadManager 6 | { 7 | /** 8 | * Registers a handler for listening to client world changes. 9 | * @param listener () 10 | */ 11 | void registerWorldLoadPreHandler(IWorldLoadListener listener); 12 | 13 | /** 14 | * Un-registers a previously registered client world change handler. 15 | * @param listener () 16 | */ 17 | void unregisterWorldLoadPreHandler(IWorldLoadListener listener); 18 | 19 | /** 20 | * Registers a handler for listening to client world changes. 21 | * @param listener () 22 | */ 23 | void registerWorldLoadPostHandler(IWorldLoadListener listener); 24 | 25 | /** 26 | * Un-registers a previously registered client world change handler. 27 | * @param listener () 28 | */ 29 | void unregisterWorldLoadPostHandler(IWorldLoadListener listener); 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/MaLiLibReference.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib; 2 | 3 | import java.nio.file.Path; 4 | 5 | import fi.dy.masa.malilib.util.StringUtils; 6 | import net.minecraft.SharedConstants; 7 | import net.fabricmc.loader.api.FabricLoader; 8 | 9 | public class MaLiLibReference 10 | { 11 | public static final String MOD_ID = "malilib"; 12 | public static final String MOD_NAME = "MaLiLib"; 13 | public static final String MOD_VERSION = StringUtils.getModVersionString(MOD_ID); 14 | public static final String MC_VERSION = SharedConstants.getCurrentVersion().id(); 15 | public static final int MC_DATA_VERSION = SharedConstants.getCurrentVersion().dataVersion().version(); 16 | public static final Path GAME_DIR = FabricLoader.getInstance().getGameDir(); 17 | public static final Path CONFIG_DIR = FabricLoader.getInstance().getConfigDir(); 18 | public static final boolean DEBUG_MODE = false; 19 | public static final boolean ANSI_MODE = DEBUG_MODE; 20 | public static final boolean EXPERIMENTAL_MODE = false; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/render/MixinDebugRenderer.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.render; 2 | 3 | import fi.dy.masa.malilib.event.RenderEventHandler; 4 | import net.minecraft.client.renderer.debug.DebugRenderer; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(DebugRenderer.class) 11 | public class MixinDebugRenderer 12 | { 13 | // // This injection draws on the same layer as all the other debug rendering, during the Main Phase; at the proper rendering order. 14 | // @Inject(method = "render", at = @At("TAIL")) 15 | // private void malilib_onDebugRender(Frustum frustum, double cameraX, double cameraY, double cameraZ, float tickProgress, CallbackInfo ci) 16 | // { 17 | // ((RenderEventHandler) RenderEventHandler.getInstance()).runRenderWorldPostDebug(frustum, new Vec3d(cameraX, cameraY, cameraZ), tickProgress); 18 | // } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/hotkeys/IInputManager.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.hotkeys; 2 | 3 | public interface IInputManager 4 | { 5 | /** 6 | * Registers a keyboard input handler, which will receive 7 | * the raw key presses. 8 | * @param handler () 9 | */ 10 | void registerKeyboardInputHandler(IKeyboardInputHandler handler); 11 | 12 | /** 13 | * Un-registers a previously registered keyboard input handler 14 | * @param handler () 15 | */ 16 | void unregisterKeyboardInputHandler(IKeyboardInputHandler handler); 17 | 18 | /** 19 | * Registers a mouse input handler, which will receive 20 | * the raw mouse key presses and mouse wheel changes, as 21 | * well as mouse move notifications. 22 | * @param handler () 23 | */ 24 | void registerMouseInputHandler(IMouseInputHandler handler); 25 | 26 | /** 27 | * Un-registers a previously registered mouse input handler 28 | * @param handler () 29 | */ 30 | void unregisterMouseInputHandler(IMouseInputHandler handler); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/test/TestDirectoryCache.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.test; 2 | 3 | import java.nio.file.Path; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | import fi.dy.masa.malilib.gui.interfaces.IDirectoryCache; 9 | 10 | public class TestDirectoryCache implements IDirectoryCache 11 | { 12 | private static final TestDirectoryCache INSTANCE = new TestDirectoryCache(); 13 | public static TestDirectoryCache getInstance() { return INSTANCE; } 14 | private final Map LAST_DIRECTORIES; 15 | 16 | private TestDirectoryCache() 17 | { 18 | this.LAST_DIRECTORIES = new HashMap<>(); 19 | } 20 | 21 | @Override 22 | public @Nullable Path getCurrentDirectoryForContext(String context) 23 | { 24 | return this.LAST_DIRECTORIES.get(context); 25 | } 26 | 27 | @Override 28 | public void setCurrentDirectoryForContext(String context, Path dir) 29 | { 30 | this.LAST_DIRECTORIES.put(context, dir); 31 | } 32 | 33 | public void clear() 34 | { 35 | this.LAST_DIRECTORIES.clear(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/render/MixinDrawContext.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.render; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.injection.At; 5 | import org.spongepowered.asm.mixin.injection.Inject; 6 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 7 | 8 | import fi.dy.masa.malilib.event.RenderEventHandler; 9 | import fi.dy.masa.malilib.render.GuiContext; 10 | import net.minecraft.client.gui.Font; 11 | import net.minecraft.client.gui.GuiGraphics; 12 | import net.minecraft.world.item.ItemStack; 13 | 14 | @Mixin(GuiGraphics.class) 15 | public abstract class MixinDrawContext 16 | { 17 | @Inject(method = "setTooltipForNextFrame(Lnet/minecraft/client/gui/Font;Lnet/minecraft/world/item/ItemStack;II)V", at = @At(value = "TAIL")) 18 | private void malilib_onRenderTooltip(Font textRenderer, ItemStack stack, int x, int y, CallbackInfo ci) 19 | { 20 | ((RenderEventHandler) RenderEventHandler.getInstance()).onRenderTooltipLast(GuiContext.fromGuiGraphics((GuiGraphics) (Object) this), stack, x, y); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/mixin/screen/MixinChatScreen.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.mixin.screen; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.injection.At; 5 | import org.spongepowered.asm.mixin.injection.Inject; 6 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 7 | 8 | import fi.dy.masa.malilib.command.ClientCommandHandler; 9 | import net.minecraft.client.gui.screens.ChatScreen; 10 | import net.minecraft.client.gui.screens.Screen; 11 | import net.minecraft.network.chat.Component; 12 | 13 | @Mixin(ChatScreen.class) 14 | public abstract class MixinChatScreen extends Screen 15 | { 16 | private MixinChatScreen(Component title) 17 | { 18 | super(title); 19 | } 20 | 21 | @Inject(method = "handleChatInput", at = @At("HEAD"), cancellable = true) 22 | private void malilib_onSendChatMessage(String msg, boolean addToHistory, CallbackInfo ci) 23 | { 24 | if (!msg.isEmpty() && ClientCommandHandler.INSTANCE.onSendClientMessage(msg, this.minecraft)) 25 | { 26 | ci.cancel(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/gui/ConfigOptionChangeListenerTextField.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config.gui; 2 | 3 | import fi.dy.masa.malilib.config.IStringRepresentable; 4 | import fi.dy.masa.malilib.gui.GuiTextFieldGeneric; 5 | import fi.dy.masa.malilib.gui.button.ButtonBase; 6 | import fi.dy.masa.malilib.gui.interfaces.ITextFieldListener; 7 | 8 | public class ConfigOptionChangeListenerTextField implements ITextFieldListener 9 | { 10 | protected final IStringRepresentable config; 11 | protected final GuiTextFieldGeneric textField; 12 | protected final ButtonBase buttonReset; 13 | 14 | public ConfigOptionChangeListenerTextField(IStringRepresentable config, GuiTextFieldGeneric textField, ButtonBase buttonReset) 15 | { 16 | this.config = config; 17 | this.textField = textField; 18 | this.buttonReset = buttonReset; 19 | } 20 | 21 | @Override 22 | public boolean onTextChange(GuiTextFieldGeneric textField) 23 | { 24 | this.buttonReset.setEnabled(this.config.isModified(this.textField.getValue())); 25 | return false; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/fi/dy/masa/malilib/config/IConfigTable.java: -------------------------------------------------------------------------------- 1 | package fi.dy.masa.malilib.config; 2 | 3 | import com.google.common.collect.ImmutableList; 4 | import fi.dy.masa.malilib.config.options.table.Label; 5 | import fi.dy.masa.malilib.config.options.table.TableRow; 6 | import fi.dy.masa.malilib.config.options.table.type.EntryTypes; 7 | 8 | import org.jetbrains.annotations.ApiStatus; 9 | import org.jetbrains.annotations.Nullable; 10 | 11 | import java.util.List; 12 | 13 | @ApiStatus.Experimental 14 | public interface IConfigTable extends IConfigBase 15 | { 16 | List getTable(); 17 | List> getRawTable(); 18 | 19 | // whats this 'Warning:(20, 19) Non-null type argument is expected' mean? it wasnt here before 20 | ImmutableList getDefaultTable(); 21 | ImmutableList> getDefaultRawTable(); 22 | 23 | void setTable(List newTable); 24 | 25 | void setModified(); 26 | 27 | @Nullable String getDisplayString(); 28 | 29 | List getTypes(); 30 | List