generated from BocchiKessokuTeam/ForgeTemplateMod-ArchLoom
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sync from
sakura-ryoko/malilib
1.21-0.21.5-sakura.4
- Loading branch information
Showing
65 changed files
with
5,825 additions
and
1,689 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,25 @@ | ||
## Change | ||
- sync from `sakura-ryoko/malilib` 1.21-0.21.5-sakura.3 | ||
- fix Visibility of renderInventoryBackgroundSlots | ||
- fix: Missing Textures from Horse Armor, etc | ||
- fix: add support for other Generic Entity Types, such as Armor Stands using Inventory Overlay | ||
- add printTranslationKeys Debug from Post Rewrite | ||
- Adds Korean & Mod Menu 'Config Switcher' for MaLiLib config screens | ||
- fix: when prettyName, comment, or translatedName entries are outdated, or not being applied with apply(), such as if the mod wasn't updated to use apply(). | ||
- sync from `sakura-ryoko/malilib` 1.21-0.21.5-sakura.4 | ||
|
||
details: | ||
|
||
**Lots of changes, please read carefully, especially for Downstream mods.** | ||
|
||
Merged a handful of useful utility functions from Post-Rewrite MaLiLib 1.12.2-ornithe including: | ||
|
||
* BlockUtils (Deprecated things, and split between util/game/BlockUtils and util/nbt/NbtBlockUtils) | ||
* util/game/BlockUtils has been also merged with Post-ReWrite. | ||
* EntityUtils (Deprecated things, and moved most functions to util/nbt/NbtEntityUtils) | ||
* NbtKeys (Deprecated, and moved to util/nbt/NbtKeys) | ||
* Added FileNameUtils, and Merged FileUtils from Post-Rewrite. | ||
* Added as a WIP JsonUtils from Post-ReWrite under util/data/json, which will have JSON Deserializers for every Config Type (Coming soon) | ||
* Deprecated util/NBTUtils for a merged Post-ReWrite copy under util/nbt/NbtUtils with added functionality | ||
* Deprecated PayloadUtils | ||
* Added a handful of other items under util/data, util/game, util/nbt, and util/position from Post-ReWrite. | ||
* Added Config Menu Registry from Post-Re-Write. Your Mods should Register with MaLiLib for each of your `GuiConfigBase` screens as follows using the new `ModInfo` class During your Mod Init(): | ||
``` | ||
Registry.CONFIG_SCREEN.registerConfigScreenFactory( | ||
new ModInfo(MaLiLibReference.MOD_ID, MaLiLibReference.MOD_NAME, MaLiLibConfigGui::new) | ||
); | ||
``` | ||
MaFgLib will attempt to automatically Register any non-compliant Downstream mods; and this feature can be disabled using `enableConfigSwitcher` under MaFgLib's config menu. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/main/java/fi/dy/masa/malilib/config/value/BaseOptionListConfigValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package fi.dy.masa.malilib.config.value; | ||
|
||
import java.util.List; | ||
import javax.annotation.Nullable; | ||
|
||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
import fi.dy.masa.malilib.util.StringUtils; | ||
|
||
/** | ||
* Post-ReWrite code | ||
*/ | ||
@ApiStatus.Experimental | ||
public class BaseOptionListConfigValue implements OptionListConfigValue | ||
{ | ||
protected final String name; | ||
protected final String translationKey; | ||
|
||
public BaseOptionListConfigValue(String name, String translationKey) | ||
{ | ||
this.name = name; | ||
this.translationKey = translationKey; | ||
} | ||
|
||
@Override | ||
public String getName() | ||
{ | ||
return this.name; | ||
} | ||
|
||
@Override | ||
public String getDisplayName() | ||
{ | ||
return StringUtils.translate(this.translationKey); | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return this.name; | ||
} | ||
|
||
/** | ||
* Finds the value by the given name from the provided list. | ||
* If none of the entries match, then the first entry is returned as a fallback. | ||
*/ | ||
public static <T extends OptionListConfigValue> T findValueByName(String name, List<T> values) | ||
{ | ||
return findValueByName(name, values, values.get(0)); | ||
} | ||
|
||
/** | ||
* Finds the value by the given name from the provided list. | ||
* If none of the entries match, then the fallback value is returned. | ||
*/ | ||
public static <T extends OptionListConfigValue> T findValueByName(String name, List<T> values, @Nullable T fallback) | ||
{ | ||
for (T val : values) | ||
{ | ||
if (val.getName().equalsIgnoreCase(name)) | ||
{ | ||
return val; | ||
} | ||
} | ||
|
||
return fallback; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/fi/dy/masa/malilib/config/value/FileWriteType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package fi.dy.masa.malilib.config.value; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
/** | ||
* Post-ReWrite code | ||
*/ | ||
@ApiStatus.Experimental | ||
public class FileWriteType extends BaseOptionListConfigValue | ||
{ | ||
public static final FileWriteType NORMAL_WRITE = new FileWriteType("normal_write", "malilib.name.file_write_type.normal_write"); | ||
public static final FileWriteType TEMP_AND_RENAME = new FileWriteType("temp_and_rename", "malilib.name.file_write_type.temp_and_rename"); | ||
|
||
public static final ImmutableList<FileWriteType> VALUES = ImmutableList.of(NORMAL_WRITE, TEMP_AND_RENAME); | ||
|
||
private FileWriteType(String name, String translationKey) | ||
{ | ||
super(name, translationKey); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/fi/dy/masa/malilib/config/value/OptionListConfigValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package fi.dy.masa.malilib.config.value; | ||
|
||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
/** | ||
* Post-ReWrite code | ||
*/ | ||
@ApiStatus.Experimental | ||
public interface OptionListConfigValue | ||
{ | ||
String getName(); | ||
|
||
String getDisplayName(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/java/fi/dy/masa/malilib/gui/config/registry/ConfigScreenRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package fi.dy.masa.malilib.gui.config.registry; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Comparator; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.function.Supplier; | ||
import javax.annotation.Nullable; | ||
import com.google.common.collect.ImmutableList; | ||
|
||
import fi.dy.masa.malilib.gui.GuiBase; | ||
import fi.dy.masa.malilib.util.data.ModInfo; | ||
|
||
/** | ||
* Post-ReWrite code | ||
*/ | ||
public class ConfigScreenRegistry | ||
{ | ||
protected final Map<String, ModInfo> modsMap = new HashMap<>(); | ||
protected ImmutableList<ModInfo> mods = ImmutableList.of(); | ||
|
||
public ConfigScreenRegistry() | ||
{ | ||
} | ||
|
||
public void registerConfigScreenFactory(ModInfo modInfo) | ||
{ | ||
this.modsMap.put(modInfo.getModId(), modInfo); | ||
ArrayList<ModInfo> list = new ArrayList<>(this.modsMap.values()); | ||
list.sort(Comparator.comparing(ModInfo::getModName)); | ||
this.mods = ImmutableList.copyOf(list); | ||
} | ||
|
||
@Nullable | ||
public Supplier<GuiBase> getConfigScreenFactoryFor(ModInfo modInfo) | ||
{ | ||
return this.modsMap.get(modInfo.getModId()).getConfigScreenSupplier(); | ||
} | ||
|
||
public ImmutableList<ModInfo> getAllModsWithConfigScreens() | ||
{ | ||
return this.mods; | ||
} | ||
|
||
public @Nullable ModInfo getModInfoFromConfigScreen(Class<? extends GuiBase> clazz) | ||
{ | ||
return this.modsMap.values().stream() | ||
.filter(mod -> mod.getConfigScreenSupplier() != null) | ||
.filter(mod -> mod.getConfigScreenSupplier().get().getClass() == clazz) | ||
.findFirst() | ||
.orElse(null); | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
package fi.dy.masa.malilib.registry; | ||
|
||
import org.apache.http.annotation.Experimental; | ||
|
||
import fi.dy.masa.malilib.gui.config.registry.ConfigScreenRegistry; | ||
import fi.dy.masa.malilib.interoperation.BlockPlacementPositionHandler; | ||
|
||
/** | ||
* Post-ReWrite code | ||
*/ | ||
@Experimental | ||
public class Registry | ||
{ | ||
// Registries | ||
//public static final ConfigTabRegistry CONFIG_TAB = new ConfigTabRegistryImpl(); | ||
//public static final ConfigTabExtensionRegistry CONFIG_TAB_EXTENSION = new ConfigTabExtensionRegistry(); | ||
|
||
// Event dispatchers and handlers | ||
public static final BlockPlacementPositionHandler BLOCK_PLACEMENT_POSITION_HANDLER = new BlockPlacementPositionHandler(); | ||
public static final ConfigScreenRegistry CONFIG_SCREEN = new ConfigScreenRegistry(); | ||
} |
Oops, something went wrong.